From ed99f72403ef6aacba6ffe81ab14f65ee74a91ee Mon Sep 17 00:00:00 2001 From: Craig Bruce Date: Fri, 23 Mar 2018 14:15:59 +1100 Subject: [PATCH 01/62] Initial commit of cast types --- .../cast.framework.breaks.d.ts | 110 + .../cast.framework.d.ts | 773 +++++++ .../cast.framework.events.d.ts | 421 ++++ .../cast.framework.messages.d.ts | 1777 +++++++++++++++++ .../cast.framework.system.d.ts | 177 ++ .../cast.framework.ui.d.ts | 194 ++ .../chromecast-caf-receiver-tests.ts | 66 + types/chromecast-caf-receiver/index.d.ts | 25 + types/chromecast-caf-receiver/tsconfig.json | 22 + types/chromecast-caf-receiver/tslint.json | 1 + 10 files changed, 3566 insertions(+) create mode 100644 types/chromecast-caf-receiver/cast.framework.breaks.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.events.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.messages.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.system.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.ui.d.ts create mode 100644 types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts create mode 100644 types/chromecast-caf-receiver/index.d.ts create mode 100644 types/chromecast-caf-receiver/tsconfig.json create mode 100644 types/chromecast-caf-receiver/tslint.json diff --git a/types/chromecast-caf-receiver/cast.framework.breaks.d.ts b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts new file mode 100644 index 0000000000..4fed094a12 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts @@ -0,0 +1,110 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { Break, BreakClip } from './cast.framework.messages'; + +export = cast.framework.breaks; + +declare namespace cast.framework.breaks { + export class BreakSeekData { + constructor(seekFrom: number, seekTo: number, breaks: Break[]); + + /** + * List of breaks + */ + breaks: Break[]; + + /** + * Current playback time + */ + seekFrom: number; + + /** + * The time to seek to + */ + seekTo: number; + } + + /** Provide context information for break clip load interceptor. */ + export class BreakClipLoadInterceptorContext { + constructor(brk: Break); + + /** + * The container break for the break clip + */ + break: Break; + } + + /** Interface to manage breaks */ + export interface BreakManager { + /** + * Get current media break by id. + * @param {*} id + */ + getBreakById(id: string): Break; + + /** + * Get current media break clip by id + * @param {*} id + */ + getBreakClipById(id: string): BreakClip; + + /** Get current media break clips. */ + getBreakClips(): BreakClip[]; + + /** Get current media breaks. */ + getBreaks(): Break[]; + + /** Returns true if watched breaks should be played. */ + getPlayWatchedBreak(): boolean; + + /** + * Provide an interceptor to allow developer to insert more break clips or modify current break clip before a break is started. + * If interceptor is null it will reset the interceptor to default one. + * By default VAST fetching and parsing logic in default interceptor. + * So if customized interceptor is set by developer; + * the VAST logic will be overridden and developers should implement their own VAST fetching and parsing logic in the provided interceptor. + * @param {*} interceptor + */ + setBreakClipLoadInterceptor( + interceptor: ( + breakClip: BreakClip, + breakClipLoaderContext?: BreakClipLoadInterceptorContext + ) => void + ): void; + + /** + * Provide an interceptor for developer to specify what breaks they want to play after seek. + * @param {*} seekInterceptor + */ + setBreakSeekInterceptor( + seekInterceptor: (breakSeekData: BreakSeekData) => void + ): void; + + /** + * Set a flag to control if the watched client stitching break should be played. + * @param {*} playWatchedBreak + */ + setPlayWatchedBreak(playWatchedBreak: boolean): void; + + /** + * Provide an interceptor to modify VAST tracking URL before it is being sent to server. + * The input of the interceptor is a string of the tracking URL. + * The interceptor can either return a modified string of URL or a Promise of modified string of URL. + * The interceptor can also return null if you want to send the tracking URL by your own code instead of by CAF. + * @param {*} interceptor + */ + setVastTrackingInterceptor( + interceptor?: (trackingUrl: string) => void + ): void; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.d.ts b/types/chromecast-caf-receiver/cast.framework.d.ts new file mode 100644 index 0000000000..a22e9a24b9 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.d.ts @@ -0,0 +1,773 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { EventType } from './cast.framework.events'; +import { + PlayerState, + PlayStringId, + ErrorType, + ErrorReason, + IdleReason, + MessageType, + Track, + TextTrackStyle, + QueueItem, + LoadRequestData, + QueueData, + Break, + LiveSeekableRange, + MediaInformation, + ErrorData, + RequestData, +} from './cast.framework.messages'; +import { BreakManager } from './cast.framework.breaks'; +import { EventHandler, RequestHandler, BinaryHandler } from './cast'; +import { + ApplicationData, + Sender, + StandbyState, + SystemState, +} from './cast.framework.system'; + +export = cast.framework; + +declare namespace cast.framework { + export type LoggerLevel = + | 'DEBUG' + | 'VERBOSE' + | 'INFO' + | 'WARNING' + | 'ERROR' + | 'NONE'; + + export type ContentProtection = + | 'NONE' + | 'CLEARKEY' + | 'PLAYREADY' + | 'WIDEVINE'; + + /** + * Manages text tracks. + */ + export class TextTracksManager { + constructor(params: any); + + /** + * Adds text tracks to the list. + */ + addTracks(tracks: Track[]): void; + + /** + * Creates a text track. + */ + createTrack(): Track; + + /** + * Gets all active text ids. + */ + getActiveIds(): number[]; + + /** + * Gets all active text tracks. + */ + getActiveTracks(): Track[]; + + /** + * Returns the current text track style. + */ + getTextTracksStyle(): TextTrackStyle; + + /** + * Gets text track by id. + */ + getTrackById(id: number): Track; + + /** + * Returns all text tracks. + */ + getTracks(): Track[]; + + /** + * Gets text tracks by language. + */ + getTracksByLanguage(language: string): Track[]; + + /** + * Sets text tracks to be active by id. + */ + setActiveByIds(newIds: number[]): void; + + /** + * Sets text tracks to be active by language. + */ + setActiveByLanguage(language: string): void; + + /** + * Sets text track style. + */ + setTextTrackStyle(style: TextTrackStyle): void; + } + + /** + * QueueManager exposes several queue manipulation APIs to developers. + */ + export class QueueManager { + constructor(params: any); + + /** + * Returns the current queue item. + */ + getCurrentItem(): QueueItem; + + /** + * Returns the index of the current queue item. + */ + getCurrentItemIndex(): number; + + /** + * Returns the queue items. + */ + getItems(): QueueItem[]; + + /** + * Inserts items into the queue. + */ + insertItems(items: QueueItem[], insertBefore?: number): void; + + /** + * Removes items from the queue. + */ + removeItems(itemIds: number[]): void; + + /** + * Sets whether to limit the number of queue items to be reported in Media Status (default is true). + */ + setQueueStatusLimit(limitQueueItemsInStatus: boolean): void; + + /** + * Updates existing queue items by matching itemId. + */ + updateItems(items: QueueItem[]): void; + } + + /** + * Base implementation of a queue. + */ + export class QueueBase { + /** + * Fetches a window of items using the specified item id as reference; called by the receiver MediaManager when it needs more queue items; often as a request from senders. If only one of nextCount and prevCount is non-zero; fetchItems should only return items after or before the reference item; if both nextCount and prevCount are non-zero; a window of items including the reference item should be returned. + */ + fetchItems( + itemId: number, + nextCount: number, + prevCount: number + ): QueueItem[] | Promise; + + /** + * Initializes the queue with the requestData. This is called when a new LOAD request comes in to the receiver. If this returns or resolves to null; our default queueing implementation will create a queue based on queueData.items or the single media in the load request data. + */ + initialize(requestData: LoadRequestData): QueueData | Promise; + + /** + * Returns next items after the reference item; often the end of the current queue; called by the receiver MediaManager. + */ + nextItems(itemId?: number): QueueItem[] | Promise; + + /** + * Sets the current item with the itemId; called by the receiver MediaManager when it changes the current playing item. + */ + onCurrentItemIdChanged(itemId: number): void; + + /** + * A callback for informing the following items have been inserted into the receiver queue in this session. A cloud based implementation can optionally choose to update its queue based on the new information. + */ + onItemsInserted(items: QueueItem[], insertBefore?: number): void; + + /** + * A callback for informing the following items have been removed from the receiver queue in this session. A cloud based implementation can optionally choose to update its queue based on the new information. + */ + onItemsRemoved(itemIds: number[]): void; + + /** + * Returns previous items before the reference item; often at the beginning of the queue; called by the receiver MediaManager. + */ + prevItems(itemId?: number): QueueItem[] | Promise; + + /** + * Shuffles the queue and returns new queue items. Returns null if the operation is not supported. + */ + shuffle(): QueueItem[] | Promise; + } + + /** + * Controls and monitors media playback. + */ + export class PlayerManager { + constructor(params: any); + + /** + * Adds an event listener for player event. + */ + addEventListener: ( + eventType: EventType | EventType[], + eventListener: EventHandler + ) => void; + + /** + * Sends a media status message to all senders (broadcast). Applications use this to send a custom state change. + */ + broadcastStatus( + includeMedia?: boolean, + requestId?: number, + customData?: any, + includeQueueItems?: boolean + ): void; + + /** + * + */ + getAudioTracksManager(): AudioTracksManager; + + /** + * Returns current time in sec in currently-playing break clip. + */ + getBreakClipCurrentTimeSec(): number; + + /** + * Returns duration in sec of currently-playing break clip. + */ + getBreakClipDurationSec(): number; + + /** + * Obtain the breaks (Ads) manager. + */ + getBreakManager(): BreakManager; + + /** + * Returns list of breaks. + */ + getBreaks(): Break[]; + + /** + * Gets current time in sec of current media. + */ + getCurrentTimeSec(): number; + + /** + * Gets duration in sec of currently playing media. + */ + getDurationSec(): number; + + /** + * Returns live seekable range with start and end time in seconds. The values are media time based. + */ + getLiveSeekableRange(): LiveSeekableRange; + + /** + * Gets media information of current media. + */ + getMediaInformation(): MediaInformation; + + /** + * Returns playback configuration. + */ + getPlaybackConfig(): PlaybackConfig; + + /** + * Returns current playback rate. + */ + getPlaybackRate(): number; + + /** + * Gets player state. + */ + getPlayerState(): PlayerState; + + /** + * Get the preferred playback rate. (Can be used on shutdown event to save latest preferred playback rate to a persistent storage; so it can be used in next session in the cast options). + */ + getPreferredPlaybackRate(): number; + + /** + * Get the preferred text track language. + */ + getPreferredTextLanguage(): string; + + /** + * Obtain QueueManager API. + */ + getQueueManager(): QueueManager; + + /** + * + */ + getTextTracksManager(): TextTracksManager; + + /** + * Loads media. + */ + load(loadRequest: LoadRequestData): Promise; + + /** + * Pauses currently playing media. + */ + pause(): void; + + /** + * Plays currently paused media. + */ + play(): void; + + /** + * Requests a text string to be played back locally on the receiver device. + */ + playString(stringId: PlayStringId, args?: string[]): Promise; + + /** + * Request Google Assistant to refresh the credentials. Only works if the original credentials came from the assistant. + */ + refreshCredentials(): Promise; + + /** + * Removes the event listener added for given player event. If event listener is not added; it will be ignored. + */ + removeEventListener( + eventType: EventType | EventType[], + eventListener: EventHandler + ): void; + + /** + * Seeks in current media. + */ + seek(seekTime: number): void; + + /** + * Sends an error to a specific sender + */ + sendError( + senderId: string, + requestId: number, + type: ErrorType, + reason?: ErrorReason, + customData?: any + ): void; + + /** + * Send local media request. + */ + sendLocalMediaRequest(request: RequestData): void; + + /** + * Sends a media status message to a specific sender. + */ + sendStatus( + senderId: string, + requestId: number, + includeMedia?: boolean, + customData?: any, + includeQueueItems?: boolean + ): void; + + /** + * Sets the IDLE reason. This allows applications that want to force the IDLE state to indicate the reason that made the player going to IDLE state (a custom error; for example). The idle reason will be sent in the next status message. NOTE: Most applications do not need to set this value; it is only needed if they want to make the player go to IDLE in special circumstances and the default idleReason does not reflect their intended behavior. + */ + setIdleReason(idleReason: IdleReason): void; + + /** + * Sets MediaElement to use. If Promise of MediaElement is set; media begins playback after Promise is resolved. + */ + setMediaElement(mediaElement: HTMLMediaElement): void; + + /** + * Sets media information. + */ + setMediaInformation( + mediaInformation: MediaInformation, + opt_broadcast?: boolean + ): void; + + /** + * Sets a handler to return or modify PlaybackConfig; for a specific load request. The handler paramaters are the load request data and default playback config for the receiver (provided in the context options). The handler should returns a modified playback config; or null to prevent the media from playing. The return value can be a promise to allow waiting for data from the server. + */ + setMediaPlaybackInfoHandler( + handler: ( + loadRequestData: LoadRequestData, + playbackConfig: PlaybackConfig + ) => void + ): void; + + /** + * Sets a handler to return the media url for a load request. This handler can be used to avoid having the media content url published as part of the media status. By default the media contentId is used as the content url. + */ + setMediaUrlResolver( + resolver: (loadRequestData: LoadRequestData) => void + ): void; + + /** + * Provide an interceptor of incoming and outgoing messages. The interceptor can update the request data; and return updated data; a promise of updated data if need to get more data from the server; or null if the request should not be handled. Note that if load message interceptor is provided; and no interceptor is provided for preload - the load interceptor will be called for preload messages. + */ + setMessageInterceptor( + type: MessageType, + interceptor: (requestData: RequestData) => Promise + ): void; + + /** + * Sets playback configuration on the PlayerManager. + */ + setPlaybackConfig(playbackConfig: PlaybackConfig): void; + + /** + * Set the preferred playback rate for follow up load or media items. The preferred playback rate will be updated automatically to the latest playback rate that was provided by a load request or explicit set of playback rate. + */ + setPreferredPlaybackRate(preferredPlaybackRate: number): void; + + /** + * Set the preferred text track language. The preferred text track language will be updated automatically to the latest enabled language by a load request or explicit change to text tracks. (Should be called only in idle state; and Will only apply to next loaded media). + */ + setPreferredTextLanguage(preferredTextLanguage: string): void; + + /** + * Stops currently playing media. + */ + stop(): void; + } + + /** + * Configuration to customize playback behavior. + */ + export class PlaybackConfig { + /** + * Duration of buffered media in seconds to start buffering. + */ + autoPauseDuration?: number; + + /** + * Duration of buffered media in seconds to start/resume playback after auto-paused due to buffering. + */ + autoResumeDuration?: number; + + /** + * Minimum number of buffered segments to start/resume playback. + */ + autoResumeNumberOfSegments?: number; + + /** + * A function to customize request to get a caption segment. + */ + captionsRequestHandler?: RequestHandler; + + /** + * Initial bandwidth in bits in per second. + */ + initialBandwidth?: number; + + /** + * Custom license data. + */ + licenseCustomData?: string; + + /** + * Handler to process license data. The handler is passed the license data; and returns the modified license data. + */ + licenseHandler?: BinaryHandler; + + /** + * A function to customize request to get a license. + */ + licenseRequestHandler?: RequestHandler; + + /** + * Url for acquiring the license. + */ + licenseUrl?: string; + + /** + * Handler to process manifest data. The handler is passed the manifest; and returns the modified manifest. + */ + manifestHandler?: (manifest: string) => string; + + /** + * A function to customize request to get a manifest. + */ + manifestRequestHandler?: RequestHandler; + + /** + * Preferred protection system to use for decrypting content. + */ + protectionSystem: ContentProtection; + + /** + * Handler to process segment data. The handler is passed the segment data; and returns the modified segment data. + */ + segmentHandler?: BinaryHandler; + + /** + * A function to customize request information to get a media segment. + */ + segmentRequestHandler?: RequestHandler; + + /** + * Maximum number of times to retry a network request for a segment. + */ + segmentRequestRetryLimit?: number; + } + /** + * HTTP(s) Request/Response information. + */ + export class NetworkRequestInfo { + /** + * The content of the request. Can be used to modify license request body. + */ + content: Uint8Array; + + /** + * An object containing properties that you would like to send in the header. + */ + headers: any; + + /** + * The URL requested. + */ + url: string; + + /** + * Indicates whether CORS Access-Control requests should be made using credentials such as cookies or authorization headers. + */ + withCredentials: boolean; + } + /** Cast receiver context options. All options are optionals. */ + export class CastReceiverOptions { + /** + * Optional map of custom messages namespaces to initialize and their types. + * Custom messages namespaces need to be initiated before the application started; + * so it is best to provide the namespaces in the receiver options. + * (The default type of a message bus is JSON; if not provided here). + */ + customNamespaces?: any; + + /** + * Sender id used for local requests. Default value is 'local'. + */ + localSenderId?: string; + + /** + * Maximum time in seconds before closing an idle sender connection. + * Setting this value enables a heartbeat message to keep the connection alive. + * Used to detect unresponsive senders faster than typical TCP timeouts. + * The minimum value is 5 seconds; there is no upper bound enforced but practically it's minutes before platform TCP timeouts come into play. + * Default value is 10 seconds. + */ + maxInactivity?: number; + + /** + * Optional media element to play content with. Default behavior is to use the first found media element in the page. + */ + mediaElement?: HTMLMediaElement; + + /** + * Optional playback configuration. + */ + playbackConfig?: PlaybackConfig; + + /** + * If this is true; the watched client stitching break will also be played. + */ + playWatchedBreak?: boolean; + + /** + * Preferred value for player playback rate. It is used if playback rate value is not provided in the load request. + */ + preferredPlaybackRate?: number; + + /** + * Preferred text track language. It is used if no active track is provided in the load request. + */ + preferredTextLanguage?: string; + + /** + * Optional queue implementation. + */ + queue?: QueueBase; + + /** + * Text that represents the application status. + * It should meet internationalization rules as may be displayed by the sender application. + */ + statusText?: string; + + /** + * A bitmask of media commands supported by the application. + * LOAD; PLAY; STOP; GET_STATUS must always be supported. + * If this value is not provided; then PAUSE; SEEK; STREAM_VOLUME; STREAM_MUTE are assumed to be supported too. + */ + supportedCommands?: number; + + /** + * Indicate that MPL should be used for DASH content. + */ + useLegacyDashSupport?: boolean; + + /** + * An integer used as an internal version number. + * This number is used only to distinguish between receiver releases and higher numbers do not necessarily have to represent newer releases. + */ + versionCode?: number; + } + + /** Manages loading of underlying libraries and initializes underlying cast receiver SDK. */ + export class CastReceiverContext { + /** Returns the CastReceiverContext singleton instance. */ + static getInstance(): CastReceiverContext; + + constructor(params: any); + + /** + * Sets message listener on custom message channel. + */ + addCustomMessageListener(namespace: string, listener: EventHandler): void; + + /** + * Add listener to cast system events. + */ + addEventListener(type: EventType, handler: EventHandler): void; + + /** + * Checks if the given media params of video or audio streams are supported by the platform. + */ + canDisplayType( + mimeType: string, + codecs?: string, + width?: number, + height?: number, + framerate?: number + ): boolean; + + /** + * Provides application information once the system is ready; otherwise it will be null. + */ + getApplicationData(): ApplicationData; + + /** + * Provides device capabilities information once the system is ready; otherwise it will be null. + * If an empty object is returned; the device does not expose any capabilities information. + */ + getDeviceCapabilities(): any; + + /** + * Get Player instance that can control and monitor media playback. + */ + getPlayerManager(): PlayerManager; + + /** + * Get a sender by sender id + */ + getSender(senderId: string): Sender; + + /** + * Gets a list of currently-connected senders. + */ + getSenders(): Sender[]; + + /** + * Reports if the cast application's HDMI input is in standby. + */ + getStandbyState(): StandbyState; + + /** + * Provides application information about the system state. + */ + getSystemState(): SystemState; + + /** + * Reports if the cast application is the HDMI active input. + */ + getVisibilityState(): VisibilityState; + + /** + * When the application calls start; the system will send the ready event to indicate + * that the application information is ready and the application can send messages as soon as there is one sender connected. + */ + isSystemReady(): boolean; + + /** + * Start loading player js. This can be used to start loading the players js code in early stage of starting the receiver before calling start. + * This function is a no-op if players were already loaded (start was called). + */ + loadPlayerLibraries(useLegacyDashSupport?: boolean): void; + + /** + * Remove a message listener on custom message channel. + */ + removeCustomMessageListener( + namespace: string, + listener: EventHandler + ): void; + + /** + * Remove listener to cast system events. + */ + removeEventListener(type: EventType, handler: EventHandler): void; + + /** + * Sends a message to a specific sender. + */ + sendCustomMessage(namespace: string, senderId: string, message: any): void; + + /** + * This function should be called in response to the feedbackstarted event if the application + * add debug state information to log in the feedback report. + * It takes in a parameter ‘message’ that is a string that represents the debug information that the application wants to log. + */ + sendFeedbackMessage(feedbackMessage: string): void; + + /** + * Sets the application state. The application should call this when its state changes. + * If undefined or set to an empty string; the value of the Application Name established during application + * registration is used for the application state by default. + */ + setApplicationState(statusText: string): void; + + /** + * Sets the receiver inactivity timeout. + * It is recommended to set the maximum inactivity value when calling Start and not changing it. + * This API is just provided for development/debugging purposes. + */ + setInactivityTimeout(maxInactivity: number): void; + + /** + * Sets the log verbosity level. + */ + setLoggerLevel(level: LoggerLevel): void; + + /** + * Initializes system manager and media manager; so that receiver app can receive requests from senders. + */ + start(options?: CastReceiverOptions): CastReceiverContext; + + /** + * Shutdown receiver application. + */ + stop(): void; + } + + /** Manages audio tracks. */ + export class AudioTracksManager { + constructor(params: any); + getActiveId(): number; + getActiveTrack(): Track; + getTrackById(id: number): Track; + getTracks(): Track[]; + getTracksByLanguage(language: string): Track[]; + setActiveById(id: number): void; + setActiveByLanguage(language: string): void; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.events.d.ts b/types/chromecast-caf-receiver/cast.framework.events.d.ts new file mode 100644 index 0000000000..c5e2e71771 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.events.d.ts @@ -0,0 +1,421 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { + RequestData, + MediaInformation, + Track, + MediaStatus, +} from './cast.framework.messages'; +export = cast.framework.events; + +declare namespace cast.framework.events { + export type EventType = + | 'ALL' + | 'ABORT' + | 'CAN_PLAY' + | 'CAN_PLAY_THROUGH' + | 'DURATION_CHANGE' + | 'EMPTIED' + | 'ENDED' + | 'LOADED_DATA' + | 'LOADED_METADATA' + | 'LOAD_START' + | 'PAUSE' + | 'PLAY' + | 'PLAYING' + | 'PROGRESS' + | 'RATE_CHANGE' + | 'SEEKED' + | 'SEEKING' + | 'STALLED' + | 'TIME_UPDATE' + | 'SUSPEND' + | 'WAITING' + | 'BITRATE_CHANGED' + | 'BREAK_STARTED' + | 'BREAK_ENDED' + | 'BREAK_CLIP_LOADING' + | 'BREAK_CLIP_STARTED' + | 'BREAK_CLIP_ENDED' + | 'BUFFERING' + | 'CACHE_LOADED' + | 'CACHE_HIT' + | 'CACHE_INSERTED' + | 'CLIP_STARTED' + | 'CLIP_ENDED' + | 'EMSG' + | 'ERROR' + | 'ID3' + | 'MEDIA_STATUS' + | 'MEDIA_FINISHED' + | 'PLAYER_PRELOADING' + | 'PLAYER_PRELOADING_CANCELLED' + | 'PLAYER_LOAD_COMPLETE' + | 'PLAYER_LOADING' + | 'SEGMENT_DOWNLOADED' + | 'REQUEST_SEEK' + | 'REQUEST_LOAD' + | 'REQUEST_STOP' + | 'REQUEST_PAUSE' + | 'REQUEST_PLAY' + | 'REQUEST_PLAY_AGAIN' + | 'REQUEST_PLAYBACK_RATE_CHANGE' + | 'REQUEST_SKIP_AD' + | 'REQUEST_VOLUME_CHANGE' + | 'REQUEST_EDIT_TRACKS_INFO' + | 'REQUEST_EDIT_AUDIO_TRACKS' + | 'REQUEST_SET_CREDENTIALS' + | 'REQUEST_LOAD_BY_ENTITY' + | 'REQUEST_USER_ACTION' + | 'REQUEST_DISPLAY_STATUS' + | 'REQUEST_CUSTOM_COMMAND' + | 'REQUEST_FOCUS_STATE' + | 'REQUEST_QUEUE_LOAD' + | 'REQUEST_QUEUE_INSERT' + | 'REQUEST_QUEUE_UPDATE' + | 'REQUEST_QUEUE_REMOVE' + | 'REQUEST_QUEUE_REORDER' + | 'REQUEST_QUEUE_GET_ITEM_RANGE' + | 'REQUEST_QUEUE_GET_ITEMS' + | 'REQUEST_QUEUE_GET_ITEM_IDS' + | 'REQUEST_PRECACHE'; + + export type DetailedErrorCode = + | 'MEDIA_UNKNOWN' + | 'MEDIA_ABORTED' + | 'MEDIA_DECODE' + | 'MEDIA_NETWORK' + | 'MEDIA_SRC_NOT_SUPPORTED' + | 'SOURCE_BUFFER_FAILURE' + | 'MEDIAKEYS_UNKNOWN' + | 'MEDIAKEYS_NETWORK' + | 'MEDIAKEYS_UNSUPPORTED' + | 'MEDIAKEYS_WEBCRYPTO' + | 'NETWORK_UNKNOWN' + | 'SEGMENT_NETWORK' + | 'HLS_NETWORK_MASTER_PLAYLIST' + | 'HLS_NETWORK_PLAYLIST' + | 'HLS_NETWORK_NO_KEY_RESPONSE' + | 'HLS_NETWORK_KEY_LOAD' + | 'HLS_NETWORK_INVALID_SEGMENT' + | 'HLS_SEGMENT_PARSING' + | 'DASH_NETWORK' + | 'DASH_NO_INIT' + | 'SMOOTH_NETWORK' + | 'SMOOTH_NO_MEDIA_DATA' + | 'MANIFEST_UNKNOWN' + | 'HLS_MANIFEST_MASTER' + | 'HLS_MANIFEST_PLAYLIST' + | 'DASH_MANIFEST_UNKNOWN' + | 'DASH_MANIFEST_NO_PERIODS' + | 'DASH_MANIFEST_NO_MIMETYPE' + | 'DASH_INVALID_SEGMENT_INFO' + | 'SMOOTH_MANIFEST' + | 'SEGMENT_UNKNOWN' + | 'TEXT_UNKNOWN' + | 'APP' + | 'BREAK_CLIP_LOADING_ERROR' + | 'BREAK_SEEK_INTERCEPTOR_ERROR' + | 'IMAGE_ERROR' + | 'LOAD_INTERRUPTED' + | 'GENERIC'; + + export type EndedReason = + | 'END_OF_STREAM' + | 'ERROR' + | 'STOPPED' + | 'INTERRUPTED' + | 'SKIPPED' + | 'BREAK_SWITCH'; + + /** + * Event data for @see{@link EventType.SEGMENT_DOWNLOADED} event. + */ + export class SegmentDownloadedEvent { + constructor(downloadTime?: number, size?: number); + + /** + * The time it took to download the segment; in milliseconds. + */ + downloadTime?: number; + + /** + * The number of bytes in the segment. + */ + size?: number; + } + + /** + * Event data for all events that represent requests made to the receiver. + */ + export class RequestEvent { + constructor(type: EventType, requestData?: RequestData, senderId?: string); + + /** + * The data that was sent with the request. + */ + requestData?: RequestData; + + /** + * The sender id the request came from. + */ + senderId?: string; + } + + /** + * Event data for @see{@link EventType.MEDIA_STATUS} event. + */ + export class MediaStatusEvent { + constructor(mediaStatus?: MediaStatus); + + /** + * The media status that was sent. + */ + mediaStatus?: MediaStatus; + } + /** + * Event data for pause events forwarded from the MediaElement. + */ + export class MediaPauseEvent { + constructor(currentMediaTime?: number, ended?: boolean); + + /** + * Indicate if the media ended (indicates the pause was fired due to stream reached the end). + */ + ended?: boolean; + } + /** + * Event data for @see{@link EventType.MEDIA_FINISHED} event. + */ + export class MediaFinishedEvent { + constructor(currentMediaTime?: number, endedReason?: EndedReason); + + /** + * The time when the media finished (in seconds). For an item in a queue; this value represents the time in the currently playing queue item ( where 0 means the queue item has just started). + */ + currentTime?: number; + + /** + * The reason the media finished. + */ + endedReason?: EndedReason; + } + /** + * Event data for all events forwarded from the MediaElement. + */ + export class MediaElementEvent { + constructor(type: EventType, currentMediaTime?: number); + + /** + * The time in the currently playing clip when the event was fired (in seconds). Undefined if playback has not started yet. + */ + currentMediaTime?: number; + } + /** + * Event data for all events pertaining to processing a load / preload request. made to the player. + */ + export class LoadEvent { + constructor(type: EventType, media?: MediaInformation); + + /** + * Information about the media being loaded. + */ + media: MediaInformation; + } + /** + * Event data for @see{@link EventType.INBAND_TRACK_ADDED} event. + */ + export class InbandTrackAddedEvent { + constructor(track: Track); + + /** + * Added track. + */ + track: Track; + } + + /** Event data for @see{@link EventType.ID3} event. */ + export class Id3Event { + constructor(segmentData: Uint8Array); + + /** + * The segment data. + */ + segmentData: Uint8Array; + } + /** + * Event data superclass for all events dispatched by @see{@link PlayerManager} + */ + export class Event { + constructor(type: EventType); + + /** + * Type of the event. + */ + type: EventType; + } + /** + * Event data for @see{@link EventType.EMSG} event. + */ + export class EmsgEvent { + constructor(emsgData: any); + + /** + * The time that the event ends (in presentation time). Undefined if using legacy Dash support. + */ + endTime: any; + + /** + * The duration of the event (in units of timescale). Undefined if using legacy Dash support. + */ + eventDuration: any; + + /** + * A field identifying this instance of the message. Undefined if using legacy Dash support. + */ + id: any; + + /** + * Body of the message. Undefined if using legacy Dash support. + */ + messageData: any; + + /** + * The offset that the event starts; relative to the start of the segment this is contained in (in units of timescale). Undefined if using legacy Dash support. + */ + presentationTimeDelta: any; + + /** + * Identifies the message scheme. Undefined if using legacy Dash support. + */ + schemeIdUri: any; + + /** + * The segment data. This is only defined if using legacy Dash support. + */ + segmentData: any; + + /** + * The time that the event starts (in presentation time). Undefined if using legacy Dash support. + */ + startTime: any; + + /** + * Provides the timescale; in ticks per second. Undefined if using legacy Dash support. + */ + timescale: any; + + /** + * Specifies the value for the event. Undefined if using legacy Dash support. + */ + value: any; + } + /** + * Event data for @see{@link EventType.CLIP_ENDED} event. + */ + export class ClipEndedEvent { + constructor(currentMediaTime: number, endedReason?: EndedReason); + + /** + * The time in media (in seconds) when clip ended. + */ + currentMediaTime: number; + + /** + * The reason the clip ended. + */ + endedReason?: EndedReason; + } + + /** + * Event data for @see{@link EventType.CACHE_LOADED} event. + */ + export class CacheLoadedEvent { + constructor(media?: MediaInformation); + + /** + * Information about the media being cached. + */ + media: MediaInformation; + } + + export class CacheItemEvent { + constructor(type: EventType, url: string); + + /** + * The URL of data fetched from cache + */ + url: string; + } + + export class BufferingEvent { + constructor(isBuffering: boolean); + + /** + * True if the player is entering a buffering state. + */ + isBuffering: boolean; + } + + export class BreaksEvent { + constructor( + type: EventType, + currentMediaTime?: number, + index?: number, + total?: number, + whenSkippable?: number, + endedReason?: EndedReason, + breakClipId?: string + ); + + /** + * The break clip's id. Refer to BreakClip.id + */ + breakClipId: string; + + /** + * The time in the currently playing media when the break event occurred. + */ + currentMediaTime: string; + + /** + * The reason the break clip ended. + */ + endedReason: EndedReason; + + /** + * Index of break clip; which starts from 1. + */ + index: number; + + /** + * Total number of break clips. + */ + total: number; + + /** + * When to skip current break clip in sec; after break clip begins to play. + */ + whenSkippable: number; + } + + /** + * Event data for @see {@link EventType.BITRATE_CHANGED} event. + */ + export class BitrateChangedEvent { + constructor(totalBitrate?: number); + + /** The bitrate of the media (audio and video) in bits per second. */ + totalBitrate: number; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.messages.d.ts b/types/chromecast-caf-receiver/cast.framework.messages.d.ts new file mode 100644 index 0000000000..dc5c1ac07b --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.messages.d.ts @@ -0,0 +1,1777 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { DetailedErrorCode } from './cast.framework.events'; +export = cast.framework.messages; + +declare namespace cast.framework.messages { + export type UserAction = + | 'LIKE' + | 'DISLIKE' + | 'FOLLOW' + | 'UNFOLLOW' + | 'FLAG' + | 'SKIP_AD'; + + export type UserActionContext = + | 'UNKNOWN_CONTEXT' + | 'ALBUM' + | 'ARTIST' + | 'PLAYLIST' + | 'EPISODE' + | 'SERIES' + | 'MOVIE' + | 'CHANNEL' + | 'TEAM' + | 'PLAYER' + | 'COACH'; + + export type TextTrackType = + | 'SUBTITLES' + | 'CAPTIONS' + | 'DESCRIPTIONS' + | 'CHAPTERS' + | 'METADATA'; + + export type TextTrackWindowType = 'NONE' | 'NORMAL' | 'ROUNDED_CORNERS'; + + export type TrackType = 'TEXT' | 'AUDIO' | 'VIDEO'; + + export type TextTrackFontGenericFamily = + | 'SANS_SERIF' + | 'MONOSPACED_SANS_SERIF' + | 'SERIF' + | 'MONOSPACED_SERIF' + | 'CASUAL' + | 'CURSIVE' + | 'SMALL_CAPITALS'; + + export type TextTrackFontStyle = 'NORMAL' | 'BOLD' | 'BOLD_ITALIC' | 'ITALIC'; + + export type TextTrackEdgeType = + | 'NONE' + | 'OUTLINE' + | 'DROP_SHADOW' + | 'RAISED' + | 'DEPRESSED'; + + export type Command = + | 'PAUSE' + | 'SEEK' + | 'STREAM_VOLUME' + | 'STREAM_MUTE' + | 'ALL_BASIC_MEDIA' + | 'QUEUE_NEXT' + | 'QUEUE_PREV' + | 'QUEUE_SHUFFLE' + | 'SKIP_AD'; + + export type SeekResumeState = 'PLAYBACK_START' | 'PLAYBACK_PAUSE'; + + export type StreamingProtocolType = + | 'UNKNOWN' + | 'MPEG_DASH' + | 'HLS' + | 'SMOOTH_STREAMING'; + + export type StreamType = 'BUFFERED' | 'LIVE' | 'NONE'; + + export type FocusState = 'IN_FOCUS' | 'NOT_IN_FOCUS'; + + export type ExtendedPlayerState = 'LOADING'; + + export type ErrorType = + | 'INVALID_PLAYER_STATE' + | 'LOAD_FAILED' + | 'LOAD_CANCELLED' + | 'INVALID_REQUEST' + | 'ERROR'; + + export type ErrorReason = + | 'INVALID_COMMAND' + | 'INVALID_PARAMS' + | 'INVALID_MEDIA_SESSION_ID' + | 'SKIP_LIMIT_REACHED' + | 'NOT_SUPPORTED' + | 'LANGUAGE_NOT_SUPPORTED' + | 'END_OF_QUEUE' + | 'APP_ERROR' + | 'AUTHENTICATION_EXPIRED' + | 'PREMIUM_ACCOUNT_REQUIRED' + | 'CONCURRENT_STREAM_LIMIT' + | 'PARENTAL_CONTROL_RESTRICTED' + | 'NOT_AVAILABLE_IN_REGION' + | 'CONTENT_ALREADY_PLAYING' + | 'INVALID_REQUEST' + | 'GENERIC_LOAD_ERROR'; + + export type RepeatMode = + | 'REPEAT_OFF' + | 'REPEAT_ALL' + | 'REPEAT_SINGLE' + | 'REPEAT_ALL_AND_SHUFFLE'; + + export type IdleReason = 'CANCELLED' | 'INTERRUPTED' | 'FINISHED' | 'ERROR'; + + export type HlsSegmentFormat = 'AAC' | 'AC3' | 'MP3' | 'TS' | 'TS_AAC'; + + export type HdrType = 'SDR' | 'HDR' | 'DV'; + + export type PlayStringId = + | 'FREE_TRIAL_ABOUT_TO_EXPIRE' + | 'SUBSCRIPTION_ABOUT_TO_EXPIRE' + | 'STREAM_HIJACKED'; + + export type GetStatusOptions = 'NO_METADATA' | 'NO_QUEUE_ITEMS'; + + export type MessageType = + | 'MEDIA_STATUS' + | 'CLOUD_STATUS' + | 'QUEUE_CHANGE' + | 'QUEUE_ITEMS' + | 'QUEUE_ITEM_IDS' + | 'GET_STATUS' + | 'LOAD' + | 'PAUSE' + | 'STOP' + | 'PLAY' + | 'SKIP_AD' + | 'PLAY_AGAIN' + | 'SEEK' + | 'SET_PLAYBACK_RATE' + | 'SET_VOLUME' + | 'EDIT_TRACKS_INFO' + | 'EDIT_AUDIO_TRACKS' + | 'PRECACHE' + | 'PRELOAD' + | 'QUEUE_LOAD' + | 'QUEUE_INSERT' + | 'QUEUE_UPDATE' + | 'QUEUE_REMOVE' + | 'QUEUE_REORDER' + | 'QUEUE_NEXT' + | 'QUEUE_PREV' + | 'QUEUE_GET_ITEM_RANGE' + | 'QUEUE_GET_ITEMS' + | 'QUEUE_GET_ITEM_IDS' + | 'QUEUE_SHUFFLE' + | 'SET_CREDENTIALS' + | 'LOAD_BY_ENTITY' + | 'USER_ACTION' + | 'DISPLAY_STATUS' + | 'FOCUS_STATE' + | 'CUSTOM_COMMAND'; + + export type PlayerState = 'IDLE' | 'PLAYING' | 'PAUSED' | 'BUFFERING'; + + export type QueueChangeType = + | 'INSERT' + | 'REMOVE' + | 'ITEMS_CHANGE' + | 'UPDATE' + | 'NO_CHANGE'; + + export type QueueType = + | 'ALBUM' + | 'PLAYLIST' + | 'AUDIOBOOK' + | 'RADIO_STATION' + | 'PODCAST_SERIES' + | 'TV_SERIES' + | 'VIDEO_PLAYLIST' + | 'LIVE_TV' + | 'MOVIE'; + + export type MetadataType = + | 'GENERIC' + | 'MOVIE' + | 'TV_SHOW' + | 'MUSIC_TRACK' + | 'PHOTO'; + + /** + * RefreshCredentials request data. + */ + export interface RefreshCredentialsRequestData { } + + /** + * Media event SET_VOLUME request data. + */ + export interface VolumeRequestData extends RequestData { + /** + * The media stream volume + */ + volume?: Volume; + } + + /** + * Represents the volume of a media session stream. + */ + export interface Volume { + /** + * Value from 0 to 1 that represents the current stream volume level. + */ + level?: number; + + /** + * Whether the stream is muted. + */ + muted?: boolean; + } + + /** + * Video information such as video resolution and High Dynamic Range (HDR). + */ + export class VideoInformation { + constructor(width: number, height: number, hdrType: HdrType); + + /** + * + */ + width: number; + + /** + * + */ + height: number; + + /** + * + */ + hdrType: HdrType; + } + + /** + * VAST ad request configuration. + */ + export interface VastAdsRequest { + /** + * Specifies a VAST document to be used as the ads response instead of making a request via an ad tag url. This can be useful for debugging and other situations where a VAST response is already available. + */ + adsResponse?: string; + + /** + * URL for VAST file. + */ + adTagUrl?: string; + } + + /** + * UserAction request data. + */ + export interface UserActionRequestData { + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source?: string; + + /** + * User action to be handled by the application. + */ + userAction?: UserAction; + + /** + * Optional context information for the user action. + */ + userActionContext?: UserActionContext; + } + + /** + * A TV episode media description. + */ + export interface TvShowMediaMetadata { + /** + * TV episode number. A positive integer. + */ + episode?: number; + + /** + * @deprecated use episode instead + */ + episodeNumber?: number; + + /** + * @deprecated use episode instead + */ + episodeTitle?: string; + + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images?: Image[]; + + /** + * ISO 8601 date when the episode originally aired; e.g. 2014-02-10. + */ + originalAirdate?: string; + + /** + * @deprecated use originalAirdate instead. + */ + releaseYear?: number; + + /** + * TV episode season. A positive integer. + */ + season?: number; + + /** + * @deprecated use season instead. + */ + seasonNumber?: number; + + /** + * TV series title. + */ + seriesTitle?: string; + + /** + * TV episode title. + */ + title?: string; + } + /** + * Describes track metadata information. + */ + export class Track { + constructor(trackId: number, trackType: TrackType); + + /** + * Custom data set by the receiver application. + */ + customData?: string; + + /** + * Language tag as per RFC 5646 (If subtype is “SUBTITLES” it is mandatory). + */ + language?: string; + + /** + * A descriptive; human readable name for the track. For example "Spanish". + */ + name?: string; + + /** + * For text tracks; the type of text track. + */ + subtype?: string; + + /** + * It can be the url of the track or any other identifier that allows the receiver to find the content (when the track is not inband or included in the manifest). For example it can be the url of a vtt file. + */ + trackContentId?: string; + + /** + * It represents the MIME type of the track content. For example if the track is a vtt file it will be ‘text/vtt’. This field is needed for out of band tracks; so it is usually provided if a trackContentId has also been provided. It is not mandatory if the receiver has a way to identify the content from the trackContentId; but recommended. The track content type; if provided; must be consistent with the track type. + */ + trackContentType?: string; + + /** + * Unique identifier of the track within the context of a MediaInformation object. + */ + trackId?: number; + + /** + * The type of track. + */ + type: TrackType; + } + /** + * Describes style information for a text track. + */ + export interface TextTrackStyle { + /** + * The background 32 bit RGBA color. The alpha channel should be used for transparent backgrounds. + */ + backgroundColor?: string; + + /** + * Custom data set by the receiver application. + */ + customData?: any; + + /** + * RGBA color for the edge; this value will be ignored if edgeType is NONE. + */ + edgeColor?: string; + + /** + * + */ + edgeType?: TextTrackEdgeType; + + /** + * If the font is not available in the receiver the fontGenericFamily will be used. + */ + fontFamily?: string; + + /** + * The text track generic family. + */ + fontGenericFamily?: TextTrackFontGenericFamily; + + /** + * The font scaling factor for the text track (the default is 1). + */ + fontScale?: number; + + /** + * The text track font style. + */ + fontStyle?: TextTrackFontStyle; + + /** + * The foreground 32 bit RGBA color. + */ + foregroundColor?: string; + + /** + * 32 bit RGBA color for the window. This value will be ignored if windowType is NONE. + */ + windowColor?: string; + + /** + * Rounded corner radius absolute value in pixels (px). This value will be ignored if windowType is not ROUNDED_CORNERS. + */ + windowRoundedCornerRadius?: number; + + /** + * The window concept is defined in CEA-608 and CEA-708. In WebVTT is called a region. + */ + windowType?: TextTrackWindowType; + } + + /** + * Media event playback rate request data. + */ + export interface SetPlaybackRateRequestData extends RequestData { + /** + * New playback rate (>0). + */ + playbackRate?: number; + + /** + * New playback rate relative to current playback rate. New rate will be the result of multiplying the current rate with the value. For example a value of 1.1 will increase rate by 10%. (Only used if the playbackRate value is not provided). + */ + relativePlaybackRate?: number; + } + + /** + * SetCredentials request data. + */ + export interface SetCredentialsRequestData { + /** + * Credentials to use by receiver. + */ + credentials?: string; + + /** + * If it is a response for refresh credentials; it will indicate the request id of the refresh credentials request. + */ + forRequestId?: number; + + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source?: string; + } + + /** + * Media event SEEK request data. + */ + export interface SeekRequestData extends RequestData { + /** + * Seconds since beginning of content. + */ + currentTime?: number; + + /** + * Seconds relative to the current playback position. If this field is defined; the currentTime field will be ignored. + */ + relativeTime?: number; + + /** + * The playback state after a SEEK request. + */ + resumeState?: SeekResumeState; + } + + /** + * Provides seekable range in seconds. + */ + export class SeekableRange { + constructor(start?: number, end?: number); + + /** + * End of the seekable range in seconds. + */ + end?: number; + + /** + * Start of the seekable range in seconds. + */ + start?: number; + } + + /** + * Media event request data. + */ + export class RequestData { + constructor(type: MessageType); + + /** + * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + + /** + * Id of the media session that the request applies to. + */ + mediaSessionId?: number; + + /** + * Id of the request; used to correlate request/response. + */ + requestId: number; + } + + /** + * Media event UPDATE queue request data. + */ + export interface QueueUpdateRequestData { + /** + * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + */ + currentItemId?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * List of queue items to be updated. No reordering will happen; the items will retain the existing order. + */ + items?: QueueItem[]; + + /** + * Skip/Go back number of items with respect to the position of currentItem (it can be negative). If it is out of boundaries; the currentItem will be the next logical item in the queue wrapping around the boundaries. The new currentItem position will follow the rules of the queue repeat behavior. + */ + jump?: number; + + /** + * Behavior of the queue when all items have been played. + */ + repeatMode?: RepeatMode; + + /** + * Shuffle the queue items when the update is processed. After the queue items are shuffled; the item at the currentItem position will be loaded. + */ + shuffle?: boolean; + } + + /** + * Media event queue REORDER request data. + */ + export class QueueReorderRequestData extends RequestData { + constructor(itemIds: number[]); + + /** + * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + */ + currentItemId?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * ID of the item that will be located immediately after the reordered list. If the ID is not found or it is not provided; the reordered list will be appended at the end of the existing list. + */ + insertBefore?: number; + + /** + * IDs of the items to be reordered; in the new order. Items not provided will keep their existing order. The provided list will be inserted at the position determined by insertBefore. For example: + + If insertBefore is not specified Existing queue: “A”;”D”;”G”;”H”;”B”;”E” itemIds: “D”;”H”;”B” New Order: “A”;”G”;”E”;“D”;”H”;”B” + + If insertBefore is “A” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “D”;”H”;”B”;“A”;”G”;”E” + + If insertBefore is “G” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “A”;“D”;”H”;”B”;”G”;”E” + */ + itemIds: number[]; + } + + /** + * Media event queue REMOVE request data. + */ + export class QueueRemoveRequestData extends RequestData { + constructor(itemIds: number[]); + + /** + * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + */ + currentItemId?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * IDs of queue items to be deleted. + */ + itemIds?: number[]; + } + /** + * Media event queue LOAD request data. + */ + export interface QueueLoadRequestData extends RequestData { + constructor(items: QueueItem[]): QueueLoadRequestData; + + /** + * Seconds (since the beginning of content) to start playback of the first item to be played. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user casts the item that was playing locally so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * Behavior of the queue when all items have been played. + */ + items: QueueItem[]; + + /** + * Id of the request; used to correlate request/response. + */ + repeatMode?: RepeatMode; + + /** + * The index of the item in the items array that must be the first currentItem (the item that will be played first). Note this is the index of the array (starts at 0) and not the itemId (as it is not known until the queue is created). If repeatMode is REPEAT_OFF playback will end when the last item in the array is played (elements before the startIndex will not be played). This may be useful for continuation scenarios where the user was already using the sender app and in the middle decides to cast. In this way the sender app does not need to map between the local and remote queue positions or saves one extra QUEUE_UPDATE request. + */ + startIndex?: number; + } + + /** + * Queue item information. Application developers may need to create a QueueItem to insert a queue element using InsertQueueItems. In this case they should not provide an itemId (as the actual itemId will be assigned when the item is inserted in the queue). This prevents ID collisions with items added from a sender app. + */ + export class QueueItem { + constructor(opt_itemId?: number); + + /** + * Array of Track trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds?: number[]; + + /** + * If the autoplay parameter is not specified or is true; the media player will begin playing the element in the queue when the item becomes the currentItem. + */ + autoplay?: boolean; + + /** + * The application can define any extra queue item information needed. + */ + customData?: any; + + /** + * Unique identifier of the item in the queue. The attribute is optional because for LOAD or INSERT should not be provided (as it will be assigned by the receiver when an item is first created/inserted). + */ + itemId?: number; + + /** + * Metadata (including contentId) of the playlist element. + */ + media?: MediaInformation; + + /** + * Playback duration of the item; if it is larger than the actual duration - startTime it will be ignored (default behavior). It can be negative; in such case the duration will be the actual asset duration minus the duration provided. It can be used for photo slideshows to control the duration the item should be presented or for live events to control the duration that the program should be played. It may be useful for autoplay scenarios to avoid displaying all the credits after an episode has ended. + */ + playbackDuration?: number; + + /** + * This parameter is a hint for the receiver to preload this media item before it is played. It allows for a smooth transition between items played from the queue. The time is expressed in seconds; relative to the beginning of this item playback (usually the end of the previous item playback). Only positive values are valid. For example; if the value is 10 seconds; this item will be preloaded 10 seconds before the previous item has finished. The receiver will try to honor this value but will not guarantee it; for example if the value is larger than the previous item duration the receiver may just preload this item shortly after the previous item has started playing (there will never be two items being preloaded in parallel). Also; if an item is inserted in the queue just after the currentItem and the time to preload is higher than the time left on the currentItem; the preload will just happen as soon as possible. + */ + preloadTime?: number; + + /** + * Seconds since beginning of content. If the content is live content; and startTime is not specified; the stream will start at the live position. + */ + startTime?: number; + } + + /** + * Media event queue INSERT request data. + */ + export class QueueInsertRequestData extends RequestData { + constructor(items: QueueItem[]); + + /** + * ID of the current media Item after the insertion (if not provided; the currentItem value will be the same as before the insertion). + */ + currentItemId?: number; + + /** + * Index (relative to the items array; starting with 0) of the new current media Item. For inserted items we use the index (similar to startIndex in QUEUE_LOAD) and not currentItemId; because the itemId is unknown until the items are inserted. If not provided; the currentItem value will be the same as before the insertion (unless currentItemId is provided). This param allows to make atomic the common use case of insert and play an item. + */ + currentItemIndex?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * ID of the item that will be located immediately after the inserted list. If the ID is not found or it is not provided; the list will be appended at the end of the existing list. + */ + insertBefore?: number; + + /** + * List of queue items. The itemId field of the items should be empty. It is sorted (first element will be played first). + */ + items: QueueItem[]; + } + + /** + * Represents a data message containing the full list of queue ids. + */ + export interface QueueIds { + /** + * List of queue item ids. + */ + itemIds?: number[]; + + /** + * The corresponding request id. + */ + requestId?: number; + + /** + * + */ + type: MessageType; + } + + /** + * Queue data as part of the LOAD request. + */ + export class QueueData { + constructor( + id?: string, + name?: string, + description?: string, + repeatMode?: RepeatMode, + items?: QueueItem[], + startIndex?: number, + startTime?: number + ); + + /** + * Description of the queue. + */ + description?: string; + + /** + * Optional Queue entity id; provide Google Assistant deep link. + */ + entity?: string; + + /** + * Id of the queue. + */ + id?: string; + + /** + * Array of queue items. It is sorted (first element will be played first). + */ + items?: QueueItem[]; + + /** + * Name of the queue. + */ + name?: string; + + /** + * Queue type; e.g. album; playlist; radio station; tv series; etc. + */ + queueType?: QueueType; + + /** + * Continuous playback behavior of the queue. + */ + repeatMode?: RepeatMode; + + /** + * The index of the item in the queue that should be used to start playback first. + */ + startIndex?: number; + + /** + * Seconds (since the beginning of content) to start playback of the first item. + */ + startTime?: number; + } + + /** + * Represents a queue change message; such as insert; remove; and update. + */ + export interface QueueChange { + /** + * The actual queue change type. + */ + changeType?: QueueChangeType; + + /** + * The id to insert the list of itemIds before. + */ + insertBefore?: number; + + /** + * List of changed itemIds. + */ + itemIds?: number[]; + + /** + * The corresponding request id. + */ + requestId?: number; + + /** + * The queue change sequence ID. Used to coordinate state sync between various senders and the receiver. + */ + sequenceNumber?: number; + + /** + * + */ + type: MessageType; + } + + /** + * Media event PRELOAD request data. + */ + export class PreloadRequestData implements LoadRequestData { + /** + * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds: number[]; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + */ + autoplay?: boolean; + /** + * Optional user credentials. + */ + credentials?: string; + /** + * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + */ + credentialsType?: string; + /** + * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + */ + currentTime?: number; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + */ + media: MediaInformation; + /** + * The media playback rate. + */ + playbackRate?: number; + /** + * Queue data. + */ + queueData: QueueData; + /** + * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + /** + * Id of the media session that the request applies to. + */ + mediaSessionId?: number; + /** + * Id of the request; used to correlate request/response. + */ + requestId: number; + constructor(itemId: number); + + /** + * The ID of the queue item. + */ + itemId: number; + } + + /** + * Media event PRECACHE request data. (Some fields of the load request; like autoplay and queueData; are ignored). + */ + export class PrecacheRequestData implements LoadRequestData { + /** + * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds: number[]; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + */ + autoplay?: boolean; + /** + * Optional user credentials. + */ + credentials?: string; + /** + * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + */ + credentialsType?: string; + /** + * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + */ + currentTime?: number; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + */ + media: MediaInformation; + /** + * The media playback rate. + */ + playbackRate?: number; + /** + * Queue data. + */ + queueData: QueueData; + /** + * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + /** + * Id of the media session that the request applies to. + */ + mediaSessionId?: number; + /** + * Id of the request; used to correlate request/response. + */ + requestId: number; + constructor(data?: string); + + /** + * Application precache data. + */ + precacheData?: string; + } + + /** + * PlayString request data. + */ + export class PlayStringRequestData { + constructor(stringId: PlayStringId, opt_arguments?: string[]); + + /** + * An optional array of string values to be filled into the text. + */ + arguments?: string[]; + + /** + * An identifier for the text to be played back. + */ + stringId: PlayStringId; + } + + /** + * A photo media description. + */ + export interface PhotoMediaMetadata { + /** + * Name of the photographer. + */ + artist?: string; + + /** + * ISO 8601 date and time the photo was taken; e.g. 2014-02-10T15:47:00Z. + */ + creationDateTime?: string; + + /** + * Photo height; in pixels. + */ + height?: number; + + /** + * Images associated with the content. Examples would include a photo thumbnail. + */ + images: Image[]; + + /** + * Latitude. + */ + latitude?: number; + + /** + * Location where the photo was taken. For example; "Seattle; Washington; USA". + */ + location?: string; + + /** + * Longitude. + */ + longitude?: number; + + /** + * Photo title. + */ + title?: string; + + /** + * Photo width; in pixels. + */ + width?: number; + } + + /** + * A music track media description. + */ + export interface MusicTrackMediaMetadata { + /** + * Album artist name. + */ + albumArtist?: string; + + /** + * Album name. + */ + albumName?: string; + + /** + * Track artist name. + */ + artist?: string; + + /** + * @deprecated: use @see{@link artist} instead + */ + artistName: string; + + /** + * Track composer name. + */ + composer?: string; + + /** + * Disc number. A positive integer. + */ + discNumber?: number; + + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images: Image[]; + + /** + * ISO 8601 date when the track was released; e.g. 2014-02-10. + */ + releaseDate?: string; + + /** + * @deprecated: Use @see{@link releaseDate} instead + */ + releaseYear?: string; + + /** + * Track name. + */ + songName?: string; + + /** + * Track title. + */ + title?: string; + + /** + * Track number in album. A positive integer. + */ + trackNumber?: number; + } + + /** + * A movie media description. + */ + export interface MovieMediaMetadata { + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images: Image[]; + + /** + * ISO 8601 date when the movie was released; e.g. 2014-02-10. + */ + releaseDate?: string; + + /** + * @deprecated: use @see{@link releaseDate} instead + */ + releaseYear?: number; + + /** + * Movie studio. + */ + studio?: string; + + /** + * Movie subtitle. + */ + subtitle?: string; + + /** + * Movie title. + */ + title?: string; + } + /** + * Represents the status of a media session. + */ + export interface MediaStatus { + /** + * List of IDs corresponding to the active tracks. + */ + activeTrackIds: number[]; + + /** + * Status of break; if receiver is playing break. This field will be defined only when receiver is playing break. + */ + breakStatus: BreakStatus; + + /** + * ID of this media item (the item that originated the status change). + */ + currentItemId?: number; + + /** + * The current playback position. + */ + currentTime: number; + + /** + * Application-specific media status. + */ + customData?: any; + + /** + * Extended media status information. + */ + extendedStatus: ExtendedMediaStatus; + + /** + * If the state is IDLE; the reason the player went to IDLE state. + */ + idleReason: IdleReason; + + /** + * List of media queue items. + */ + items: QueueItem[]; + + /** + * Seekable range of a live or event stream. It uses relative media time in seconds. It will be undefined for VOD streams. + */ + liveSeekableRange: LiveSeekableRange; + + /** + * ID of the media Item currently loading. If there is no item being loaded; it will be undefined. + */ + loadingItemId?: number; + + /** + * The media information. + */ + media: MediaInformation; + + /** + * Unique id for the session. + */ + mediaSessionId: number; + + /** + * The playback rate. + */ + playbackRate: number; + + /** + * The playback state. + */ + playerState: PlayerState; + + /** + * ID of the next Item; only available if it has been preloaded. Media items can be preloaded and cached temporarily in memory; so when they are loaded later on; the process is faster (as the media does not have to be fetched from the network). + */ + preloadedItemId?: number; + + /** + * Queue data. + */ + queueData: QueueData; + + /** + * The behavior of the queue when all items have been played. + */ + repeatMode: RepeatMode; + + /** + * The commands supported by this player. + */ + supportedMediaCommands: number; + + /** + * + */ + type: MessageType; + + /** + * The video information. + */ + videoInfo: VideoInformation; + + /** + * The current stream volume. + */ + volume: Volume; + } + /** + * Common media metadata used as part of MediaInformation + */ + export class MediaMetadata { + constructor(type: MetadataType); + + /** + * The type of metadata + */ + metadataType: MetadataType; + } + + /** + * Represents the media information. + */ + export interface MediaInformation { + /** + * Partial list of break clips that includes current break clip that receiver is playing or ones that receiver will play shortly after; instead of sending whole list of clips. This is to avoid overflow of MediaStatus message. + */ + breakClips: BreakClip[]; + + /** + * List of breaks. + */ + breaks: Break[]; + + /** + * Typically the url of the media. + */ + contentId: string; + + /** + * The content MIME type. + */ + contentType: string; + + /** + * Optional media url; to allow using contentId for real id. If contentUrl is provided; it will be used as media url; otherwise the contentId will be used as the media url. + */ + contentUrl?: string; + + /** + * Application-specific media information. + */ + customData?: any; + + /** + * The media duration. + */ + duration?: number; + + /** + * Optional Media entity; provide Google Assistant deep link. + */ + entity?: string; + + /** + * The format of the HLS media segment. + */ + hlsSegmentFormat: HlsSegmentFormat; + + /** + * The media metadata. + */ + metadata: MediaMetadata; + + /** + * The stream type. + */ + streamType: StreamType; + + /** + * The style of text track. + */ + textTrackStyle: TextTrackStyle; + + /** + * The media tracks. + */ + tracks: Track[]; + } + + /** + * Media event LOAD request data. + */ + export interface LoadRequestData extends RequestData { + /** + * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds: number[]; + + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + */ + autoplay?: boolean; + + /** + * Optional user credentials. + */ + credentials?: string; + + /** + * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + */ + credentialsType?: string; + + /** + * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + */ + currentTime?: number; + + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + */ + media: MediaInformation; + + /** + * The media playback rate. + */ + playbackRate?: number; + + /** + * Queue data. + */ + queueData: QueueData; + } + + /** + * LoadByEntity request data. + */ + export interface LoadByEntityRequestData { + /** + * Content entity information; typically represented by a stringified JSON object + */ + entity: string; + + /** + * Shuffle the items to play. + */ + shuffle?: boolean; + + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source?: string; + } + + /** + * Provides live seekable range with start and end time in seconds and two more attributes. + */ + export class LiveSeekableRange { + constructor( + start?: number, + end?: number, + isMovingWindow?: boolean, + isLiveDone?: boolean + ); + + /** + * A boolean value indicates whether a live stream is ended. If it is done; the end of live seekable range should stop updating. + */ + isLiveDone?: boolean; + + /** + * A boolean value indicates whether the live seekable range is a moving window. If false; it will be either a expanding range or a fixed range meaning live has ended. + */ + isMovingWindow?: boolean; + } + + /** + * Represents a data message containing item information for each requested ids. + */ + export interface ItemsInfo { + /** + * List of changed itemIds. + */ + items: QueueItem[]; + + /** + * The corresponding request id. + */ + requestId?: number; + + /** + * + */ + type: MessageType; + } + + /** + * An image that describes a receiver application or media item. + * This could be an application icon; cover art; or a thumbnail. + */ + export class Image { + constructor(url: string); + + /** + * The height of the image. + */ + height?: number; + + /** + * the URL to the image + */ + url: string; + + /** + * The width of the image + */ + width?: number; + } + /** Media event GET_STATUS request data. */ + export interface GetStatusRequestData extends RequestData { + /** + * The options of a GET_STATUS request. + */ + options: GetStatusOptions; + } + + /** + * Get items info request data. + */ + export interface GetItemsInfoRequestData extends RequestData { + constructor(itemIds: number[]): GetItemsInfoRequestData; + + /** + * List of item ids to be requested. + */ + itemIds: number[]; + } + /** + * A generic media description. + */ + export interface GenericMediaMetadata { + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images: Image[]; + + /** + * ISO 8601 date and/or time when the content was released; e.g. 2014-02-10. + */ + releaseDate?: string; + + /** + *@deprecated - use @see{@link releaseDate} instead + */ + releaseYear?: number; + + /** + * Content subtitle. + */ + subtitle?: string; + + /** + * Content title. + */ + title?: string; + } + + /** + * Focus state change message. + */ + export interface FocusStateRequestData { + /** + * The focus state of the app. + */ + state: FocusState; + } + + /** Fetch items request data. */ + export class FetchItemsRequestData extends RequestData { + constructor(itemId: number, nextCount: number, prevCount: number); + + /** + * ID of the reference media item for fetching more items. + */ + itemId: number; + + /** + * Number of items after the reference item to be fetched. + */ + nextCount: number; + + /** + * Number of items before the reference item to be fetched. + */ + prevCount: number; + } + + /** + * Extended media status information + */ + export class ExtendedMediaStatus { + constructor(playerState: MediaInformation, opt_media?: MediaInformation); + + /** + * + */ + media: MediaInformation; + + /** + * + */ + playerState: ExtendedPlayerState; + } + + /** Event data for @see{@link EventType.ERROR} event. */ + export class ErrorEvent { + constructor(detailedErrorCode?: DetailedErrorCode, error?: any); + /** + * An error code representing the cause of the error. + */ + detailedErrorCode?: DetailedErrorCode; + + /** + * The error object. + * This could be an Error object (e.g.; if an Error was thrown in an event handler) + * or an object with error information (e.g.; if the receiver received an invalid command). + */ + error?: any; + } + + export class ErrorData { + constructor(type: ErrorType); + + /** + * Application-specific data for this request. + * It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + + /** + Id of the request; used to correlate request/response. + */ + requestId?: number; + } + + /** Media event EDIT_TRACKS_INFO request data. */ + export interface EditTracksInfoRequestData extends RequestData { + /** + * Array of the Track trackIds that should be active. + * If it is not provided; the active tracks will not change. + * If the array is empty; no track will be active. + */ + activeTrackIds?: number[]; + + /** + * Flag to enable or disable text tracks. + * If false it will disable all text tracks; + * if true it will enable the first text track; or the previous active text tracks. + * This flag is ignored if activeTrackIds or language is provided. + */ + enableTextTracks?: boolean; + + /** + * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. + * It allows receiver apps to use user saved preference instead of spoken language. + */ + isSuggestedLanguage?: boolean; + + /** + * Language for the tracks that should be active. The language field will take precedence over activeTrackIds if both are specified. + */ + language?: string; + + /** + * + */ + textTrackStyle?: TextTrackStyle; + } + + /** + * Media event EDIT_AUDIO_TRACKS request data. If language is not provided; the default audio track for the media will be enabled. + */ + export interface EditAudioTracksRequestData extends RequestData { + /** + * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. + * It allows receiver apps to use user saved preference instead of spoken language. + */ + isSuggestedLanguage?: boolean; + + /** + * + */ + language?: string; + } + + /** DisplayStatus request data. */ + export interface DisplayStatusRequestData { + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source: string; + } + + /** CustomCommand request data. */ + export interface CustomCommandRequestData { + /** + * Custom Data; typically represented by a stringified JSON object. + */ + data: string; + + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source: string; + } + /** Cloud media status. Media status that is only sent to the cloud sender. */ + export class CloudMediaStatus { + constructor(); + } + + export class BreakStatus { + constructor(currentBreakTime: number, currentBreakClipTime: number); + + /** + * Id of current break clip. + */ + breakClipId: string; + + /** + * Id of current break. + */ + breakId: string; + + /** + * Time in sec elapsed after current break clip starts. + */ + currentBreakClipTime: number; + + /** + * Time in sec elapsed after current break starts. + */ + currentBreakTime: number; + + /** + * The time in sec when this break clip becomes skippable. + * 5 means that end user can skip this break clip after 5 seconds. + * If this field is not defined; it means that current break clip is not skippable. + */ + whenSkippable: number; + } + + /** + * Represents break clip (e.g. a clip of ad during ad break) + */ + export class BreakClip { + constructor(id: string); + + /** + * Url of page that sender will display; when end user clicks link on sender UI; while receiver is playing this clip. + */ + clickThroughUrl?: string; + /** + * Typically the url of the break media (playing on the receiver). + */ + contentId?: string; + /** + * The content MIME type. + */ + contentType?: string; + /** + * Optional break media url; to allow using contentId for real id. + * If contentUrl is provided; it will be used as media url; otherwise the contentId will be used as the media url. + */ + contentUrl?: string; + /** + * Application-specific break clip data. + */ + customData?: any; + /** + * Duration of break clip in sec. + */ + duration?: number; + /** + * The format of the HLS media segment. + */ + hlsSegmentFormat: HlsSegmentFormat; + /** + * Unique id of break clip. + */ + id: string; + /** + * Url of content that sender will display while receiver is playing this clip. + */ + posterUrl?: string; + /** + * Title of break clip. Sender might display this on its screen; if provided. + */ + title?: string; + /** + * VAST ad request configuration. Used if contentId or contentUrl is not provided. + */ + vastAdsRequest: VastAdsRequest; + /** + * The time in sec when this break clip becomes skippable. + * 5 means that end user can skip this break clip after 5 seconds. + * If this field is not defined; it means that current break clip is not skippable. + */ + whenSkippable?: number; + } + + /** Represents break (e.g. ad break) included in main video. */ + export class Break { + constructor(id: string, breakClipIds: string[], position: number); + /** + * List of ids of break clip that this break includes. + */ + breakClipIds: string[]; + /** + * Duration of break in sec. + */ + duration?: number; + /** + * Unique id of break. + */ + id: string; + /** + * If true; indicates this is embedded break in main stream. + */ + isEmbedded?: boolean; + /** + * Whether break is watched. + * Sender can change color of progress bar marker corresponding to this break once this field changes from false to true; + * denoting that the end-user already watched this break. + */ + isWatched: boolean; + /** + * Where the break is located inside main video. -1 represents the end of main video. + */ + position: number; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.system.d.ts b/types/chromecast-caf-receiver/cast.framework.system.d.ts new file mode 100644 index 0000000000..1f465761b0 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.system.d.ts @@ -0,0 +1,177 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { EventType } from './cast.framework.events'; +export = cast.framework.system; + +declare namespace cast.framework.system { + export type SystemState = + | 'NOT_STARTED' + | 'STARTING_IN_BACKGROUND' + | 'STARTING' + | 'READY' + | 'STOPPING_IN_BACKGROUND' + | 'STOPPING'; + + export type StandbyState = 'STANDBY' | 'NOT_STANDBY' | 'UNKNOWN'; + + export type DisconnectReason = 'REQUESTED_BY_SENDER' | 'ERROR' | 'UNKNOWN'; + + /** + * Event dispatched by @see{@link CastReceiverManager} when the visibility of the application changes (HDMI input change; TV is turned off). + */ + export class VisibilityChangedEvent { + constructor(isVisible: boolean); + + /** + * Whether the Cast device is the active input or not. + */ + isVisible: boolean; + } + + /** + * Represents the system volume data. + */ + export interface SystemVolumeData { + /** + * The level (from 0.0 to 1.0) of the system volume. + */ + level: number; + + /** + * Whether the system volume is muted or not. + */ + muted: boolean; + } + /** + * Event dispatched by @see{CastReceiverManager} when the system volume changes. + */ + export class SystemVolumeChangedEvent extends Event { + constructor(volume: SystemVolumeData); + + /** + * The system volume data + */ + data: SystemVolumeData; + } + /** + * Event dispatched by @see{@link CastReceiverManager} when the TV enters/leaves the standby state. + */ + export class StandbyChangedEvent { + constructor(isStandby: boolean); + + /** + * + */ + isStandby: boolean; + } + /** + * Whether the TV is in standby or not. + */ + export interface ShutdownEvent extends Event {} + + /** + * Event dispatched by @see{@link CastReceiverManager} when a sender is disconnected. + */ + export class SenderDisconnectedEvent extends Event { + constructor(senderId: string, userAgent: string); + /** + * The ID of the sender connected. + */ + senderId: string; + + /** + * The user agent of the sender. + */ + userAgent: string; + + /** + * The reason the sender was disconnected. + */ + reason?: DisconnectReason; + } + + /** + * Event dispatched by @see{@link CastReceiverManager} when a sender is connected. + */ + export class SenderConnectedEvent extends Event { + constructor(senderId: string, userAgent: string); + /** + * The ID of the sender connected. + */ + senderId: string; + + /** + * The user agent of the sender. + */ + userAgent: string; + } + + /** + * Represents the data of a connected sender device. + */ + export interface Sender { + /** + * The sender Id. + */ + id: string; + + /** + * Indicate the sender supports large messages (>64KB). + */ + largeMessageSupported?: boolean; + + /** + * The userAgent of the sender. + */ + userAgent?: string; + } + + /** + * Event dispatched by CastReceiverManager when the system is ready. + */ + export class ReadyEvent { + constructor(applicationData: ApplicationData); + + /** + * The application data + */ + data: ApplicationData; + } + + /** + * Event dispatched by @see{@link CastReceiverManager} when the system needs to update the restriction on maximum video resolution. + */ + export class MaxVideoResolutionChangedEvent extends Event { + constructor(height: number); + + /** + * Maximum video resolution requested by the system. The value of 0 means there is no restriction. + */ + height: number; + } + /** Event dispatched by @see{@link CastReceiverManager} when the systems starts to create feedback report. */ + export interface FeedbackStartedEvent extends Event {} + /** Event dispatched by @see{@link CastReceiverContext} which contains system information. */ + export class Event { + constructor(type: EventType, data?: any); + } + + /** Represents the data of the launched application. */ + export interface ApplicationData { + id(): string; + launchingSenderId(): string; + name(): string; + namespaces(): string[]; + sessionId(): number; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.ui.d.ts b/types/chromecast-caf-receiver/cast.framework.ui.d.ts new file mode 100644 index 0000000000..fbc61f56d0 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.ui.d.ts @@ -0,0 +1,194 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { PlayerDataEventType } from './cast.framework.ui'; +import { MediaMetadata } from './cast.framework.messages'; + +export = cast.framework.ui; + +declare namespace cast.framework.ui { + export type ContentType = 'VIDEO' | 'AUDIO' | 'IMAGE'; + + export type State = + | 'LAUNCHING' + | 'IDLE' + | 'LOADING' + | 'BUFFERING' + | 'PAUSED' + | 'PLAYING'; + + export type PlayerDataEventType = + | 'ANY_CHANGE' + | 'STATE_CHANGED' + | 'IS_SEEKING_CHANGED' + | 'DURATION_CHANGED' + | 'CURRENT_TIME_CHANGED' + | 'METADATA_CHANGED' + | 'TITLE_CHANGED' + | 'SUBTITLE_CHANGED' + | 'THUMBNAIL_URL_CHANGED' + | 'NEXT_TITLE_CHANGED' + | 'NEXT_SUBTITLE_CHANGED' + | 'NEXT_THUMBNAIL_URL_CHANGED' + | 'PRELOADING_NEXT_CHANGED' + | 'CONTENT_TYPE_CHANGED' + | 'IS_LIVE_CHANGED' + | 'BREAK_PERCENTAGE_POSITIONS_CHANGED' + | 'IS_PLAYING_BREAK_CHANGED' + | 'IS_BREAK_SKIPPABLE_CHANGED' + | 'WHEN_SKIPPABLE_CHANGED' + | 'NUMBER_BREAK_CLIPS_CHANGED' + | 'CURRENT_BREAK_CLIP_NUMBER_CHANGED' + | 'DISPLAY_STATUS_CHANGED'; + + /** + * Player data changed event. Provides the changed field (type); and new value. + */ + export class PlayerDataChangedEvent { + constructor(type: PlayerDataEventType, field: string, value: any); + + /** + * The field name that was changed. + */ + field: string; + + /** + * + */ + type: PlayerDataEventType; + + /** + * The new field value. + */ + value: any; + } + /** + * Player data binder. Bind a player data object to the player state. The player data will be updated to reflect correctly the current player state without firing any change event. + */ + export class PlayerDataBinder { + constructor(playerData: PlayerData | any); + + /** + * Add listener to player data changes. + */ + // addEventListener: (type: PlayerDataEventType; listener: PlayerDataChangedEventHandler); + + /** + * Remove listener to player data changes. + */ + // removeEventListener: (type: PlayerDataEventType; listener: PlayerDataChangedEventHandler); + } + /** + * Player data. Provide the player media and break state. + */ + export interface PlayerData { + /** + * Array of breaks positions in percentage. + */ + breakPercentagePositions: number[]; + + /** + * Content Type. + */ + contentType: ContentType; + + /** + * The number of the current playing break clip in the break. + */ + currentBreakClipNumber: number; + + /** + * Media current position in seconds; or break current position if playing break. + */ + currentTime: number; + + /** + * Whether the player metadata (ie: title; currentTime) should be displayed. This will be true if at least one field in the metadata should be displayed. In some cases; displayStatus will be true; but parts of the metadata should be hidden (ie: the media title while media is seeking). In these cases; additional css can be applied to hide those elements. For cases where the media is audio-only; this will almost always be true. In cases where the media is video; this will be true when: (1) the video is loading; buffering; or seeking (2) a play request was made in the last five seconds while media is already playing; (3) there is a request made to show the status in the last five seconds; or (4) the media was paused in the last five seconds. + */ + displayStatus: boolean; + + /** + * Media duration in seconds; Or break duration if playing break. + */ + duration: number; + + /** + * Indicate break clip can be skipped. + */ + isBreakSkippable: boolean; + + /** + * Indicate if the content is a live stream. + */ + isLive: boolean; + + /** + * Indicate that the receiver is playing a break. + */ + isPlayingBreak: boolean; + + /** + * Indicate the player is seeking (can be either during playing or pausing). + */ + isSeeking: boolean; + + /** + * Media metadata. + */ + metadata: MediaMetadata | any; + + /** + * Next Item subtitle. + */ + nextSubtitle: string; + + /** + * Next Item thumbnail url. + */ + nextThumbnailUrl: string; + + /** + * Next Item title. + */ + nextTitle: string; + + /** + * Number of break clips in current break. + */ + numberBreakClips: number; + + /** + * Flag to show/hide next item metadata. + */ + preloadingNext: boolean; + + /** + * Current player state. + */ + state: State; + + /** + * Content thumbnail url. + */ + thumbnailUrl: string; + + /** + * Content title. + */ + title: string; + + /** + * Provide the time a break is skipable - relative to current playback time. Undefined if not skippable. + */ + whenSkippable?: number; + } +} diff --git a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts new file mode 100644 index 0000000000..a4f59bd985 --- /dev/null +++ b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts @@ -0,0 +1,66 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// +/// + +import { TextTracksManager } from "cast.framework"; +import { StandbyChangedEvent } from "cast.framework.system"; +import { PlayerData, ContentType } from "cast.framework.ui"; +import { BreakManager } from "cast.framework.breaks"; +import { MediaStatusEvent } from "cast.framework.events"; +import { Track, Break, MediaStatus, QueueData } from "cast.framework.messages"; + +const ct = ContentType.VIDEO; +// framework tests +const track = new Track(123, {}); +const ttm = new TextTracksManager({}); +ttm.addTracks(track); + +// $ExpectError +ttm.addTracks("should fail"); + +// system tests +const sce = new StandbyChangedEvent(true); +// $ExpectError +const wrongSce = new StandbyChangedEvent("error"); + +const result: boolean = sce.isStandby; +// $ExpectError +const failure: string = sce.isStandby; + +// ui tests +const pd = new PlayerData(); + +const cn: number = pd.currentBreakClipNumber; +// $ExpectError +const wrongCn: boolean = pd.currentBreakClipNumber; + +// breaks tests +const bm: BreakManager = new BreakManager(); +const brk1: Break = bm.getBreakById("123"); +// $ExpectError +const brk2: string = bm.getBreakById("123"); +// $ExpectError +const brk3: Break = bm.getBreakById(123); +// events tests + +const evt: MediaStatusEvent = new MediaStatusEvent(); +const ms: MediaStatus = evt.mediaStatus; +// $ExpectError +const ms: string = evt.mediaStatus; + +// messages tests +const qd = new QueueData("id", "name", "description", "mode"); +// $ExpectError +const wrongQd = new QueueData({}); +const name: string = qd.name; +// $ExpectError +const wrongName: number = qd.name; diff --git a/types/chromecast-caf-receiver/index.d.ts b/types/chromecast-caf-receiver/index.d.ts new file mode 100644 index 0000000000..5dc89456e6 --- /dev/null +++ b/types/chromecast-caf-receiver/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { PlayerDataChangedEvent } from './cast.framework.ui'; +import { NetworkRequestInfo } from './cast.framework'; +import { Event } from './cast.framework.events'; + +export = cast; +declare namespace cast { + export type EventHandler = (event: Event) => void; + export type PlayerDataChangedEventHandler = ( + event: PlayerDataChangedEvent + ) => void; + export type RequestHandler = (request: NetworkRequestInfo) => void; + export type BinaryHandler = (data: Uint8Array) => Uint8Array; +} diff --git a/types/chromecast-caf-receiver/tsconfig.json b/types/chromecast-caf-receiver/tsconfig.json new file mode 100644 index 0000000000..5c13aa8765 --- /dev/null +++ b/types/chromecast-caf-receiver/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chromecast-caf-receiver-tests.ts" + ] +} diff --git a/types/chromecast-caf-receiver/tslint.json b/types/chromecast-caf-receiver/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chromecast-caf-receiver/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From fde76994561dd7151f8b002fd646690c176e85a3 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Thu, 19 Apr 2018 23:42:02 -0400 Subject: [PATCH 02/62] Fix up next/router types * add name to index.ts * update tests --- types/next/index.d.ts | 1 + types/next/router.d.ts | 8 +++-- types/next/test/next-router-tests.tsx | 46 +++++++++++++-------------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 036e9f58ce..e0ec456724 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zeit/next.js // Definitions by: Drew Hays // Brice BERNARD +// Scott Jones // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 181208518f..a5cfb42c90 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -9,7 +9,7 @@ export interface EventChangeOptions { } export type RouterCallback = () => void; -export interface SingletonRouter { +export interface RouterProps { readyCallbacks: RouterCallback[]; ready(cb: RouterCallback): void; @@ -53,8 +53,12 @@ export interface SingletonRouter { onRouteChangeError?(error: any, url: string): void; } +export interface SingletonRouter { + router: RouterProps; +} + export function withRouter( - Component: React.ComponentType, + Component: React.ComponentType, ): React.ComponentType; export const Singleton: SingletonRouter; diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index fe82d6f0b2..7957f5e8a2 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -2,10 +2,10 @@ import Router, * as r from "next/router"; import * as React from "react"; import * as qs from "querystring"; -Router.readyCallbacks.push(() => { +Router.router.readyCallbacks.push(() => { console.log("I'll get called when the router initializes."); }); -Router.ready(() => { +Router.router.ready(() => { console.log( "I'll get called immediately if the router initializes, or when it eventually does.", ); @@ -13,8 +13,8 @@ Router.ready(() => { // Access readonly properties of the router. -Object.keys(Router.components).forEach(key => { - const c = Router.components[key]; +Object.keys(Router.router.components).forEach(key => { + const c = Router.router.components[key]; c.err.isAnAny; return ; @@ -26,51 +26,51 @@ function split(routeLike: string) { }); } -if (Router.asPath) { - split(Router.asPath); - split(Router.asPath); +if (Router.router.asPath) { + split(Router.router.asPath); + split(Router.router.asPath); } -split(Router.pathname); +split(Router.router.pathname); -const query = `?${qs.stringify(Router.query)}`; +const query = `?${qs.stringify(Router.router.query)}`; // Assign some callback methods. -Router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); -Router.onRouteChangeStart = (url: string) => +Router.router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); +Router.router.onRouteChangeStart = (url: string) => console.log("Route is starting to change.", url); -Router.onBeforeHistoryChange = (as: string) => +Router.router.onBeforeHistoryChange = (as: string) => console.log("History hasn't changed yet.", as); -Router.onRouteChangeComplete = (url: string) => +Router.router.onRouteChangeComplete = (url: string) => console.log("Route chaneg is complete.", url); -Router.onRouteChangeError = (err: any, url: string) => +Router.router.onRouteChangeError = (err: any, url: string) => console.log("Route is starting to change.", url, err); // Call methods on the router itself. -Router.reload("/route").then(() => console.log("route was reloaded")); -Router.back(); +Router.router.reload("/route").then(() => console.log("route was reloaded")); +Router.router.back(); -Router.push("/route").then((success: boolean) => +Router.router.push("/route").then((success: boolean) => console.log("route push success: ", success), ); -Router.push("/route", "/asRoute").then((success: boolean) => +Router.router.push("/route", "/asRoute").then((success: boolean) => console.log("route push success: ", success), ); -Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => +Router.router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => console.log("route push success: ", success), ); -Router.replace("/route").then((success: boolean) => +Router.router.replace("/route").then((success: boolean) => console.log("route replace success: ", success), ); -Router.replace("/route", "/asRoute").then((success: boolean) => +Router.router.replace("/route", "/asRoute").then((success: boolean) => console.log("route replace success: ", success), ); -Router.replace("/route", "/asRoute", { +Router.router.replace("/route", "/asRoute", { shallow: false, }).then((success: boolean) => console.log("route replace success: ", success)); -Router.prefetch("/route").then(Component => { +Router.router.prefetch("/route").then(Component => { const element = ; }); From 107dce1caeeab4524dbe53e049f692dbd858eb5a Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Fri, 20 Apr 2018 19:19:50 -0400 Subject: [PATCH 03/62] Update SingletonRouter type to include ready and readyCallback funcs --- types/next/router.d.ts | 5 ++--- types/next/test/next-router-tests.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/types/next/router.d.ts b/types/next/router.d.ts index a5cfb42c90..5a17bd2a53 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -10,9 +10,6 @@ export interface EventChangeOptions { export type RouterCallback = () => void; export interface RouterProps { - readyCallbacks: RouterCallback[]; - ready(cb: RouterCallback): void; - // router properties readonly components: { [key: string]: { Component: React.ComponentType; err: any }; @@ -55,6 +52,8 @@ export interface RouterProps { export interface SingletonRouter { router: RouterProps; + readyCallbacks: RouterCallback[]; + ready(cb: RouterCallback): void; } export function withRouter( diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 7957f5e8a2..822b9b8e6f 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -2,10 +2,10 @@ import Router, * as r from "next/router"; import * as React from "react"; import * as qs from "querystring"; -Router.router.readyCallbacks.push(() => { +Router.readyCallbacks.push(() => { console.log("I'll get called when the router initializes."); }); -Router.router.ready(() => { +Router.ready(() => { console.log( "I'll get called immediately if the router initializes, or when it eventually does.", ); From 9bf9e4c95bbf8db44d08ce6a9aa01e726573758c Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 9 May 2018 15:11:26 +1000 Subject: [PATCH 04/62] Updated type definitions to 0.15.12 --- types/react-calendar-timeline/index.d.ts | 139 +++++++++++++---------- 1 file changed, 77 insertions(+), 62 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 69e5d037dc..649a301bb3 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -1,71 +1,86 @@ -// Type definitions for react-calendar-timeline v0.8.1 +// Type definitions for react-calendar-timeline v0.15.12 // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov +// Alex Maclean // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 /// declare module "react-calendar-timeline" { - interface ReactCalendarTimeline { - groups: { - id: number; - title: any; // string | Element (React.ClassicComponentClass); - }[]; - items:{ - id: number; - group: number; - title?: any; // string | Element (React.ClassicComponentClass); - start_time: any; - end_time: any; - canMove?: boolean; - canResize?: boolean; - canChangeGroup?: boolean; - className?: string; - }[]; - keys?:{ - groupIdKey: string; - groupTitleKey: string; - itemIdKey: string; - itemTitleKey: string; - itemGroupKey: string; - itemTimeStartKey: string; - itemTimeEndKey: string; - }; - sidebarWidth?: number; - dragSnap?: number; - minResizeWidth?: number; - fixedHeader?: "fixed" | "none"; - zIndexStart?: number; - lineHeight?: number; - headerLabelGroupHeight?: number; - headerLabelHeight?: number; - itemHeightRatio?: number; - minZoom?: number; - maxZoom?: number; - canMove?: boolean; - canChangeGroup?: boolean; - canResize?: boolean; - useResizeHandle?: boolean; - stackItems?: boolean; - traditionalZoom?: boolean; - itemTouchSendsClick?: boolean; - onItemMove?(itemId:any, dragTime:any, newGroupOrder:any): any; - onItemResize?(itemId:any, newResizeEnd:any): any; - onItemSelect?(itemId:any): any; - onItemClick?(itemId:any): any; - onCanvasClick?(groupId:any, time:any, e:any): any; - onItemDoubleClick?(itemId:any): any; - moveResizeValidator?(action:any, itemId:any, time:any): any; - defaultTimeStart?: any; - defaultTimeEnd?: any; - visibleTimeStart?: number; - visibleTimeEnd?: number; - onTimeChange?(visibleTimeStart:any, visibleTimeEnd:any): any; - onTimeInit?(visibleTimeStart:any, visibleTimeEnd:any): any; - onBoundsChange?(canvasTimeStart:any, canvasTimeEnd:any): any; - children?: any; - } - let ReactCalendarTimeline : React.ClassicComponentClass; - export default ReactCalendarTimeline; + + export interface TimelineGroup { + id: number; + title: string | JSX.Element; + } + + export interface TimelineItem { + id: number; + group: number; + title?: string | JSX.Element; + start_time: any; + end_time: any; + canMove?: boolean; + canResize?: boolean; + canChangeGroup?: boolean; + className?: string; + } + + export interface TimelineContext { + visibletimeStart: number, + visibleTimeEnd: number, + timelineWidth: number + } + + export interface ReactCalendarTimelineProps { + groups: TimelineGroup[]; + items: TimelineItem[]; + keys?:{ + groupIdKey: string; + groupTitleKey: string; + itemIdKey: string; + itemTitleKey: string; + itemGroupKey: string; + itemTimeStartKey: string; + itemTimeEndKey: string; + }; + sidebarWidth?: number; + dragSnap?: number; + minResizeWidth?: number; + fixedHeader?: "fixed" | "none"; + zIndexStart?: number; + lineHeight?: number; + headerLabelGroupHeight?: number; + headerLabelHeight?: number; + itemHeightRatio?: number; + minZoom?: number; + maxZoom?: number; + canMove?: boolean; + canChangeGroup?: boolean; + canResize?: boolean; + useResizeHandle?: boolean; + stackItems?: boolean; + traditionalZoom?: boolean; + itemTouchSendsClick?: boolean; + onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; + onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; + onItemSelect?(itemId:number, e: any, time: number): any; + onItemClick?(itemId:number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onItemDoubleClick?(itemId:number, e: any, time: number): any; + moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; + defaultTimeStart?: any; + defaultTimeEnd?: any; + visibleTimeStart?: number; + visibleTimeEnd?: number; + onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; + onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; + onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + children?: any; + fullUpdate?: boolean; + itemRenderer?: (item: TimelineItem, context: TimelineContext) => JSX.Element; + groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => JSX.Element; + } + let ReactCalendarTimeline : React.ClassicComponentClass; + export default ReactCalendarTimeline; } From 449a5e2d87e20f1dc33944eee4debb473a15045d Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 9 May 2018 15:20:01 +0200 Subject: [PATCH 05/62] Add rolling rate limiter --- types/rolling-rate-limiter/index.d.ts | 38 +++++++++++++++++++ .../rolling-rate-limiter-tests.ts | 36 ++++++++++++++++++ types/rolling-rate-limiter/tsconfig.json | 23 +++++++++++ types/rolling-rate-limiter/tslint.json | 1 + 4 files changed, 98 insertions(+) create mode 100644 types/rolling-rate-limiter/index.d.ts create mode 100644 types/rolling-rate-limiter/rolling-rate-limiter-tests.ts create mode 100644 types/rolling-rate-limiter/tsconfig.json create mode 100644 types/rolling-rate-limiter/tslint.json diff --git a/types/rolling-rate-limiter/index.d.ts b/types/rolling-rate-limiter/index.d.ts new file mode 100644 index 0000000000..0de8235fc2 --- /dev/null +++ b/types/rolling-rate-limiter/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for rolling-rate-limiter 0.1 +// Project: https://github.com/peterkhayes/rolling-rate-limiter +// Definitions by: Jonas Lochmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = RollingRateLimiter; + +declare function RollingRateLimiter(options: RollingRateLimiter.InMemoryOptions): RollingRateLimiter.SyncOrAsyncLimiter; +declare function RollingRateLimiter(options: RollingRateLimiter.WithRedisOptions): RollingRateLimiter.AsyncLimiter; + +declare namespace RollingRateLimiter { + interface GeneralOptions { + interval: number; + maxInInterval: number; + minDifference?: number; + } + + interface RedisOptions { + redis: CompatibleRedisClient; + namespace?: string; + } + + interface CompatibleRedisClient { + multi: () => any; + } + + type InMemoryOptions = GeneralOptions; + type WithRedisOptions = GeneralOptions & RedisOptions; + + type AsyncLimiterWithToken = (token: string, callback: AsyncLimiterCallback) => void; + type AsyncLimiterWithoutToken = (callback: AsyncLimiterCallback) => void; + type AsyncLimiterCallback = (err: any, timeLeft: number, actionsLeft: number) => void; + type AsyncLimiter = AsyncLimiterWithToken & AsyncLimiterWithToken; + + type SyncLimiter = (token?: string) => number; + + type SyncOrAsyncLimiter = SyncLimiter & AsyncLimiter; +} diff --git a/types/rolling-rate-limiter/rolling-rate-limiter-tests.ts b/types/rolling-rate-limiter/rolling-rate-limiter-tests.ts new file mode 100644 index 0000000000..1318b8d425 --- /dev/null +++ b/types/rolling-rate-limiter/rolling-rate-limiter-tests.ts @@ -0,0 +1,36 @@ +import * as RateLimiter from 'rolling-rate-limiter'; + +/* + Setup: +*/ + +const limiter = RateLimiter({ + // in miliseconds + interval: 1000, + maxInInterval: 10, + // optional: the minimum time (in miliseconds) between any two actions + minDifference: 100 +}); + +/* + Action: +*/ + +function attemptAction(userId: string) { + // Argument should be a unique identifier for a user if one exists. + // If none is provided, the limiter will not differentiate between users. + const timeLeft = limiter(userId); + + if (timeLeft > 0) { + // limit was exceeded, action should not be allowed + // timeLeft is the number of ms until the next action will be allowed + // note that this can be treated as a boolean, since 0 is falsy + } else { + // limit was not exceeded, action should be allowed + } +} + +/* + Note that the in-memory version can also operate asynchronously. + The syntax is identical to the redis implementation below. +*/ diff --git a/types/rolling-rate-limiter/tsconfig.json b/types/rolling-rate-limiter/tsconfig.json new file mode 100644 index 0000000000..0b526f946e --- /dev/null +++ b/types/rolling-rate-limiter/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rolling-rate-limiter-tests.ts" + ] +} diff --git a/types/rolling-rate-limiter/tslint.json b/types/rolling-rate-limiter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rolling-rate-limiter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 173f530f62d5c5b3059db900a0a33cf504b447b8 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Thu, 10 May 2018 14:04:08 +1000 Subject: [PATCH 06/62] Added missing api --- types/react-calendar-timeline/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 649a301bb3..013e652760 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -44,7 +44,11 @@ declare module "react-calendar-timeline" { itemTimeStartKey: string; itemTimeEndKey: string; }; + selected?: number[]; sidebarWidth?: number; + sidebarContent?: any; + rightSidebarWidth?: number; + rightSidebarContent?: any; dragSnap?: number; minResizeWidth?: number; fixedHeader?: "fixed" | "none"; From 5ba41a77899f4e665056ae17b2f8903e8af83a02 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Thu, 10 May 2018 06:05:11 +0200 Subject: [PATCH 07/62] rolling-rate-limiter: replace intersection by extending interface --- types/rolling-rate-limiter/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/rolling-rate-limiter/index.d.ts b/types/rolling-rate-limiter/index.d.ts index 0de8235fc2..c81c8304d7 100644 --- a/types/rolling-rate-limiter/index.d.ts +++ b/types/rolling-rate-limiter/index.d.ts @@ -15,7 +15,7 @@ declare namespace RollingRateLimiter { minDifference?: number; } - interface RedisOptions { + interface WithRedisOptions extends GeneralOptions { redis: CompatibleRedisClient; namespace?: string; } @@ -25,7 +25,6 @@ declare namespace RollingRateLimiter { } type InMemoryOptions = GeneralOptions; - type WithRedisOptions = GeneralOptions & RedisOptions; type AsyncLimiterWithToken = (token: string, callback: AsyncLimiterCallback) => void; type AsyncLimiterWithoutToken = (callback: AsyncLimiterCallback) => void; From 9f85c6e169398dea19dae58ca0702906ebef5bba Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Thu, 10 May 2018 14:07:43 +1000 Subject: [PATCH 08/62] relaxed type safety --- types/react-calendar-timeline/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 013e652760..5726e08365 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -11,13 +11,13 @@ declare module "react-calendar-timeline" { export interface TimelineGroup { id: number; - title: string | JSX.Element; + title: any; } export interface TimelineItem { id: number; group: number; - title?: string | JSX.Element; + title?: any; start_time: any; end_time: any; canMove?: boolean; @@ -82,8 +82,8 @@ declare module "react-calendar-timeline" { onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (item: TimelineItem, context: TimelineContext) => JSX.Element; - groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => JSX.Element; + itemRenderer?: (item: TimelineItem, context: TimelineContext) => any; + groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => any; } let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; From 1b2c3539da5e40fd5aa720909074139ad0e07ca1 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Thu, 10 May 2018 15:34:43 +1000 Subject: [PATCH 09/62] Added missing API. Fixed incorrect. --- types/react-calendar-timeline/index.d.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 5726e08365..86c79ca7ae 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -8,16 +8,16 @@ /// declare module "react-calendar-timeline" { - - export interface TimelineGroup { + + export interface TimelineGroup { id: number; - title: any; + title: React.ReactNode; } export interface TimelineItem { id: number; group: number; - title?: any; + title?: React.ReactNode; start_time: any; end_time: any; canMove?: boolean; @@ -51,18 +51,21 @@ declare module "react-calendar-timeline" { rightSidebarContent?: any; dragSnap?: number; minResizeWidth?: number; - fixedHeader?: "fixed" | "none"; - zIndexStart?: number; + stickyOffset?: number; + stickyHeader?: boolean; + headerRef?: any; lineHeight?: number; headerLabelGroupHeight?: number; headerLabelHeight?: number; itemHeightRatio?: number; minZoom?: number; maxZoom?: number; + clickTolerance?: number; canMove?: boolean; canChangeGroup?: boolean; canResize?: boolean; useResizeHandle?: boolean; + showCursorLine?: boolean; stackItems?: boolean; traditionalZoom?: boolean; itemTouchSendsClick?: boolean; @@ -70,8 +73,9 @@ declare module "react-calendar-timeline" { onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; onItemSelect?(itemId:number, e: any, time: number): any; onItemClick?(itemId:number, e: any, time: number): any; - onCanvasClick?(groupId:number, time:number, e:any): any; onItemDoubleClick?(itemId:number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onCanvasDoubleClick?(groupId:number, time:number, e:any): any; moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; defaultTimeStart?: any; defaultTimeEnd?: any; @@ -80,10 +84,12 @@ declare module "react-calendar-timeline" { onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + onZoom?(timelineContext: TimelineContext): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (item: TimelineItem, context: TimelineContext) => any; - groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => any; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; + minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; From c5ac0628883e7dfbd78960289543df5831e10ec3 Mon Sep 17 00:00:00 2001 From: "skubarenko.andrey" Date: Tue, 8 May 2018 12:42:15 +0300 Subject: [PATCH 10/62] Add type definitions for the DevExpress Bootstrap ASP.NET Core Controls --- .../devexpress-aspnetcore-bootstrap-tests.ts | 13 + .../index.d.ts | 2495 +++++++++++++++++ .../tsconfig.json | 24 + .../tslint.json | 3 + 4 files changed, 2535 insertions(+) create mode 100644 types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts create mode 100644 types/devexpress-aspnetcore-bootstrap/index.d.ts create mode 100644 types/devexpress-aspnetcore-bootstrap/tsconfig.json create mode 100644 types/devexpress-aspnetcore-bootstrap/tslint.json diff --git a/types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts b/types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts new file mode 100644 index 0000000000..55eae3c27f --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts @@ -0,0 +1,13 @@ +declare let button: DevExpress.AspNetCore.BootstrapButton; +button.on('click', e => {}); +button.doClick(); +button.once('click', e => {}); + +declare let accordion: DevExpress.AspNetCore.BootstrapAccordion; +accordion.on('init', e => {}); +const firstGroup = accordion.getGroup(0); +if (firstGroup) { + const groupText = firstGroup.getText(); + const item = firstGroup.getItemByName('item10'); + item && item.getEnabled(); +} diff --git a/types/devexpress-aspnetcore-bootstrap/index.d.ts b/types/devexpress-aspnetcore-bootstrap/index.d.ts new file mode 100644 index 0000000000..9422ccd2f7 --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/index.d.ts @@ -0,0 +1,2495 @@ +// Type definitions for DevExpress ASP.NET 181.3 +// Project: http://devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +declare namespace DevExpress.AspNetCore { + enum BootstrapSchedulerGroupType { + Date = "Date", + None = "None", + Resource = "Resource", + } + enum BootstrapSchedulerViewType { + Day = "Day", + WorkWeek = "WorkWeek", + Week = "Week", + Month = "Month", + Timeline = "Timeline", + FullWeek = "FullWeek", + Agenda = "Agenda", + } + enum BootstrapSchedulerAppointmentType { + Normal = "Normal", + Pattern = "Pattern", + Occurrence = "Occurrence", + ChangedOccurrence = "ChangedOccurrence", + DeletedOccurrence = "DeletedOccurrence", + } + enum BootstrapSchedulerRecurrenceRange { + NoEndDate = "NoEndDate", + OccurrenceCount = "OccurrenceCount", + EndByDate = "EndByDate", + } + enum BootstrapSchedulerRecurrenceType { + Daily = "Daily", + Weekly = "Weekly", + Monthly = "Monthly", + Yearly = "Yearly", + Hourly = "Hourly", + } + enum WeekDays { + Sunday = 1, + Monday = 2, + Tuesday = 4, + Wednesday = 8, + Thursday = 16, + Friday = 32, + Saturday = 64, + WeekendDays = 65, + WorkDays = 62, + EveryDay = 127, + } + enum WeekOfMonth { + None = 0, + First = 1, + Second = 2, + Third = 3, + Fourth = 4, + Last = 5, + } + enum BootstrapPopupControlCloseReason { + API = "API", + CloseButton = "CloseButton", + OuterMouseClick = "OuterMouseClick", + MouseOut = "MouseOut", + Escape = "Escape", + } + + const Utils: { + getControls: () => Control[]; + getSerializedEditorValuesInContainer: (containerOrId: string | HTMLElement, processInvisibleEditors?: boolean) => any; + getEditorValuesInContainer: (containerOrId: string | HTMLElement, processInvisibleEditors?: boolean) => any; + }; + + interface EventArgs { + readonly sender: Control; + } + + interface CancelEventArgs extends EventArgs { + cancel: boolean; + } + + interface BeginCallbackEventArgs extends EventArgs { + readonly command: string; + } + + interface ProcessingModeEventArgs extends EventArgs { + processOnServer: boolean; + } + + interface ProcessingModeCancelEventArgs extends ProcessingModeEventArgs { + cancel: boolean; + } + + interface GlobalBeginCallbackEventArgs extends BeginCallbackEventArgs { + readonly control: Control; + } + + interface EndCallbackEventArgs extends EventArgs { // tslint:disable-line:no-empty-interface + } + + interface GlobalEndCallbackEventArgs extends EndCallbackEventArgs { + readonly control: Control; + } + + interface CustomDataCallbackEventArgs extends EventArgs { + result: string; + } + + interface CallbackErrorEventArgs extends EventArgs { + handled: boolean; + message: string; + } + + interface GlobalCallbackErrorEventArgs extends CallbackErrorEventArgs { + readonly control: Control; + } + + interface EditValidationEventArgs extends EventArgs { + errorText: string; + isValid: boolean; + value: string; + } + + interface ValidationCompletedEventArgs extends EventArgs { + readonly container: any; + readonly firstInvalidControl: Control; + readonly firstVisibleInvalidControl: Control; + readonly invisibleControlsValidated: boolean; + isValid: boolean; + readonly validationGroup: string; + } + + interface EditClickEventArgs extends EventArgs { + readonly htmlElement: any; + readonly htmlEvent: any; + } + + interface EditKeyEventArgs extends EventArgs { + readonly htmlEvent: any; + } + + class Control { + protected readonly instance: any; + protected constructor(instance: any); + readonly name: string; + adjustControl(): void; + getHeight(): number; + getMainElement(): any; + getParentControl(): any; + getVisible(): boolean; + getWidth(): number; + inCallback(): boolean; + sendMessageToAssistiveTechnology(message: string): void; + setHeight(height: number): void; + setVisible(visible: boolean): void; + setWidth(width: number): void; + on(eventName: K, callback: (this: Control, args?: ControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: Control, args?: ControlEventMap[K]) => void): this; + off(): this; // tslint:disable-line:no-unnecessary-generics + off(eventName: K): this; // tslint:disable-line:unified-signatures no-unnecessary-generics + off(eventName: K, callback: (this: Control, args?: ControlEventMap[K]) => void): this; // tslint:disable-line:unified-signatures + } + interface ControlEventMap { + "init": EventArgs; + } + + class BootstrapClientEdit extends Control { + focus(): void; + getCaption(): string; + getEnabled(): boolean; + getErrorText(): string; + getInputElement(): any; + getIsValid(): boolean; + getReadOnly(): boolean; + getValue(): any; + setCaption(caption: string): void; + setEnabled(value: boolean): void; + setErrorText(errorText: string): void; + setIsValid(isValid: boolean): void; + setReadOnly(readOnly: boolean): void; + setValue(value: any): void; + validate(): void; + on(eventName: K, callback: (this: BootstrapClientEdit, args?: BootstrapClientEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapClientEdit, args?: BootstrapClientEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapClientEdit, args?: BootstrapClientEditEventMap[K]) => void): this; + } + interface BootstrapClientEditEventMap extends ControlEventMap { + "gotFocus": EventArgs; + "lostFocus": EventArgs; + "validation": EditValidationEventArgs; + "valueChanged": ProcessingModeEventArgs; + } + + interface AccordionItemEventArgs extends ProcessingModeEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + readonly item: BootstrapAccordionItem; + } + + interface AccordionGroupEventArgs extends EventArgs { + readonly group: BootstrapAccordionGroup; + } + + interface AccordionGroupCancelEventArgs extends ProcessingModeCancelEventArgs { + readonly group: BootstrapAccordionGroup; + } + + interface AccordionGroupClickEventArgs extends AccordionGroupCancelEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + } + + class BootstrapAccordion extends Control { + collapseAll(): void; + expandAll(): void; + getActiveGroup(): BootstrapAccordionGroup | null; + getGroup(index: number): BootstrapAccordionGroup | null; + getGroupByName(name: string): BootstrapAccordionGroup | null; + getGroupCount(): number; + getItemByName(name: string): BootstrapAccordionItem | null; + getSelectedItem(): BootstrapAccordionItem | null; + setActiveGroup(group: BootstrapAccordionGroup): void; + setSelectedItem(item: BootstrapAccordionItem): void; + on(eventName: K, callback: (this: BootstrapAccordion, args?: BootstrapAccordionEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapAccordion, args?: BootstrapAccordionEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapAccordion, args?: BootstrapAccordionEventMap[K]) => void): this; + } + interface BootstrapAccordionEventMap extends ControlEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "endCallback": EndCallbackEventArgs; + "expandedChanged": AccordionGroupEventArgs; + "expandedChanging": AccordionGroupCancelEventArgs; + "headerClick": AccordionGroupClickEventArgs; + "itemClick": AccordionItemEventArgs; + } + + class BootstrapAccordionGroup { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly name: string; + readonly navBar: BootstrapAccordion | null; + getEnabled(): boolean; + getExpanded(): boolean; + getHeaderBadgeIconCssClass(): string; + getHeaderBadgeText(): string; + getItem(index: number): BootstrapAccordionItem | null; + getItemByName(name: string): BootstrapAccordionItem | null; + getItemCount(): number; + getText(): string; + getVisible(): boolean; + setExpanded(value: boolean): void; + setHeaderBadgeIconCssClass(cssClass: string): void; + setHeaderBadgeText(text: string): void; + setText(text: string): void; + setVisible(value: boolean): void; + } + + class BootstrapAccordionItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly group: BootstrapAccordionGroup | null; + readonly index: number; + readonly name: string; + readonly navBar: BootstrapAccordion | null; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getEnabled(): boolean; + getIconCssClass(): string; + getImageUrl(): string; + getNavigateUrl(): string; + getText(): string; + getVisible(): boolean; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setEnabled(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + } + + class BootstrapBinaryImage extends BootstrapClientEdit { + clear(): void; + getUploadedFileName(): string; + getValue(): any; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + setSize(width: number, height: number): void; + setValue(value: any): void; + on(eventName: K, callback: (this: BootstrapBinaryImage, args?: BootstrapBinaryImageEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapBinaryImage, args?: BootstrapBinaryImageEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapBinaryImage, args?: BootstrapBinaryImageEventMap[K]) => void): this; + } + interface BootstrapBinaryImageEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "click": EditClickEventArgs; + "endCallback": EndCallbackEventArgs; + } + + interface ButtonClickEventArgs extends ProcessingModeEventArgs { + readonly cancelEventAndBubble: boolean; + } + + class BootstrapButton extends Control { + doClick(): void; + focus(): void; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getChecked(): boolean; + getEnabled(): boolean; + getImageUrl(): string; + getText(): string; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setChecked(value: boolean): void; + setEnabled(value: boolean): void; + setImageUrl(value: string): void; + setText(value: string): void; + on(eventName: K, callback: (this: BootstrapButton, args?: BootstrapButtonEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapButton, args?: BootstrapButtonEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapButton, args?: BootstrapButtonEventMap[K]) => void): this; + } + interface BootstrapButtonEventMap extends ControlEventMap { + "checkedChanged": ProcessingModeEventArgs; + "click": ButtonClickEventArgs; + "gotFocus": EventArgs; + "lostFocus": EventArgs; + } + + interface CalendarCustomDisabledDateEventArgs extends EventArgs { + readonly date: Date; + isDisabled: boolean; + } + + class BootstrapCalendar extends BootstrapClientEdit { + clearSelection(): void; + deselectDate(date: Date): void; + deselectRange(start: Date, end: Date): void; + getEnabled(): boolean; + getMaxDate(): Date; + getMinDate(): Date; + getSelectedDate(): Date; + getSelectedDates(): Date[]; + getVisibleDate(): Date; + isDateSelected(date: Date): boolean; + selectDate(date: Date): void; + selectRange(start: Date, end: Date): void; + setEnabled(enabled: boolean): void; + setMaxDate(date: Date): void; + setMinDate(date: Date): void; + setSelectedDate(date: Date): void; + setVisibleDate(date: Date): void; + on(eventName: K, callback: (this: BootstrapCalendar, args?: BootstrapCalendarEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCalendar, args?: BootstrapCalendarEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCalendar, args?: BootstrapCalendarEventMap[K]) => void): this; + } + interface BootstrapCalendarEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "customDisabledDate": CalendarCustomDisabledDateEventArgs; + "endCallback": EndCallbackEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "selectionChanged": ProcessingModeEventArgs; + "visibleMonthChanged": ProcessingModeEventArgs; + } + + interface GridToolbarItemClickEventArgs extends ProcessingModeEventArgs { + readonly item: BootstrapMenuItem; + readonly toolbarIndex: number; + readonly toolbarName: string; + usePostBack: boolean; + } + + class BootstrapGridBase extends Control { + getToolbar(index: number): BootstrapMenu | null; + getToolbarByName(name: string): BootstrapMenu | null; + on(eventName: K, callback: (this: BootstrapGridBase, args?: BootstrapGridBaseEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapGridBase, args?: BootstrapGridBaseEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapGridBase, args?: BootstrapGridBaseEventMap[K]) => void): this; + } + interface BootstrapGridBaseEventMap extends ControlEventMap { + "toolbarItemClick": GridToolbarItemClickEventArgs; + } + + interface CardViewColumnCancelEventArgs extends CancelEventArgs { + readonly column: BootstrapCardViewColumn; + } + + interface CardViewCardFocusingEventArgs extends CancelEventArgs { + readonly htmlEvent: any; + readonly visibleIndex: number; + } + + interface CardViewCardClickEventArgs extends CancelEventArgs { + readonly htmlEvent: any; + readonly visibleIndex: number; + } + + interface CardViewCustomButtonEventArgs extends ProcessingModeEventArgs { + readonly buttonID: string; + readonly visibleIndex: number; + } + + interface CardViewSelectionEventArgs extends ProcessingModeEventArgs { + readonly isAllRecordsOnPage: boolean; + readonly isChangedOnServer: boolean; + readonly isSelected: boolean; + readonly visibleIndex: number; + } + + interface CardViewFocusEventArgs extends ProcessingModeEventArgs { + readonly isChangedOnServer: boolean; + } + + interface CardViewBatchEditStartEditingEventArgs extends CancelEventArgs { + readonly cardValues: any; + focusedColumn: BootstrapCardViewColumn; + readonly visibleIndex: number; + } + + interface CardViewBatchEditEndEditingEventArgs extends CancelEventArgs { + readonly cardValues: any; + readonly visibleIndex: number; + } + + interface CardViewBatchEditCardValidatingEventArgs extends EventArgs { + readonly validationInfo: any; + readonly visibleIndex: number; + } + + interface CardViewBatchEditConfirmShowingEventArgs extends CancelEventArgs { + readonly requestTriggerID: string; + } + + interface CardViewBatchEditTemplateCellFocusedEventArgs extends EventArgs { + readonly column: BootstrapCardViewColumn; + handled: boolean; + } + + interface CardViewBatchEditChangesSavingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface CardViewBatchEditChangesCancelingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface CardViewBatchEditCardInsertingEventArgs extends CancelEventArgs { + readonly visibleIndex: number; + } + + interface CardViewBatchEditCardDeletingEventArgs extends CancelEventArgs { + readonly cardValues: any; + readonly visibleIndex: number; + } + + interface CardViewFocusedCellChangingEventArgs extends CancelEventArgs { + readonly cellInfo: BootstrapCardViewCellInfo; + } + + class BootstrapCardView extends BootstrapGridBase { + readonly batchEditApi: BootstrapCardViewBatchEditApi | null; + addNewCard(): void; + applyFilter(filterExpression: string): void; + applySearchPanelFilter(value: string): void; + cancelEdit(): void; + clearFilter(): void; + closeFilterControl(): void; + deleteCard(visibleIndex: number): void; + deleteCardByKey(key: any): void; + focus(): void; + focusEditor(column: BootstrapCardViewColumn): void; + focusEditor(columnIndex: number): void; // tslint:disable-line:unified-signatures + focusEditor(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + getCardKey(visibleIndex: number): string; + getColumn(columnIndex: number): BootstrapCardViewColumn | null; + getColumnByField(columnFieldName: string): BootstrapCardViewColumn | null; + getColumnById(columnId: string): BootstrapCardViewColumn | null; + getColumnCount(): number; + getEditValue(column: BootstrapCardViewColumn): string; + getEditValue(columnIndex: number): string; // tslint:disable-line:unified-signatures + getEditValue(columnFieldNameOrId: string): string; // tslint:disable-line:unified-signatures unified-signatures + getEditor(column: BootstrapCardViewColumn): BootstrapClientEdit; + getEditor(columnIndex: number): BootstrapClientEdit; // tslint:disable-line:unified-signatures + getEditor(columnFieldNameOrId: string): BootstrapClientEdit; // tslint:disable-line:unified-signatures unified-signatures + getFocusedCardIndex(): number; + getFocusedCell(): BootstrapCardViewCellInfo | null; + getPageCount(): number; + getPageIndex(): number; + getPopupEditForm(): BootstrapPopupControl | null; + getSelectedCardCount(): number; + getSelectedKeysOnPage(): any[]; + getTopVisibleIndex(): number; + getVerticalScrollPosition(): number; + getVisibleCardsOnPage(): number; + gotoPage(pageIndex: number): void; + hideCustomizationWindow(): void; + isCardSelectedOnPage(visibleIndex: number): boolean; + isCustomizationWindowVisible(): boolean; + isEditing(): boolean; + isNewCardEditing(): boolean; + moveColumn(column: BootstrapCardViewColumn): void; + moveColumn(columnIndex: number): void; // tslint:disable-line:unified-signatures + moveColumn(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + moveColumn(column: BootstrapCardViewColumn, moveToColumnVisibleIndex: number): void; // tslint:disable-line:unified-signatures + moveColumn(columnIndex: number, moveToColumnVisibleIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + moveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + moveColumn(column: BootstrapCardViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean): void; // tslint:disable-line:unified-signatures + moveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + moveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + nextPage(): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + prevPage(): void; + refresh(): void; + selectAllCardsOnPage(): void; + selectCardOnPage(visibleIndex: number): void; + selectCardOnPage(visibleIndex: number, selected: boolean): void; // tslint:disable-line:unified-signatures + selectCards(): void; + selectCardsByKey(keys: any[]): void; + selectCardsByKey(key: any): void; // tslint:disable-line:unified-signatures + selectCardsByKey(keys: any[], selected: boolean): void; // tslint:disable-line:unified-signatures + selectCardsByKey(key: any, selected: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + setEditValue(column: BootstrapCardViewColumn, value: string): void; + setEditValue(columnIndex: number, value: string): void; // tslint:disable-line:unified-signatures + setEditValue(columnFieldNameOrId: string, value: string): void; // tslint:disable-line:unified-signatures unified-signatures + setFilterEnabled(isFilterEnabled: boolean): void; + setFocusedCardIndex(visibleIndex: number): void; + setFocusedCell(cardVisibleIndex: number, columnIndex: number): void; + setSearchPanelCustomEditor(editor: BootstrapClientEdit): void; + setVerticalScrollPosition(position: number): void; + showCustomizationWindow(): void; + showFilterControl(): void; + sortBy(column: BootstrapCardViewColumn): void; + sortBy(columnIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(column: BootstrapCardViewColumn, sortOrder: string): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapCardViewColumn, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapCardViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + startEditCard(visibleIndex: number): void; + startEditCardByKey(key: any): void; + unselectAllCardsOnPage(): void; + unselectCardOnPage(visibleIndex: number): void; + unselectCards(): void; + unselectCardsByKey(keys: any[]): void; + unselectCardsByKey(key: any): void; // tslint:disable-line:unified-signatures + unselectFilteredCards(): void; + updateEdit(): void; + on(eventName: K, callback: (this: BootstrapCardView, args?: BootstrapCardViewEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCardView, args?: BootstrapCardViewEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCardView, args?: BootstrapCardViewEventMap[K]) => void): this; + } + interface BootstrapCardViewEventMap extends BootstrapGridBaseEventMap { + "batchEditCardDeleting": CardViewBatchEditCardDeletingEventArgs; + "batchEditCardInserting": CardViewBatchEditCardInsertingEventArgs; + "batchEditCardValidating": CardViewBatchEditCardValidatingEventArgs; + "batchEditChangesCanceling": CardViewBatchEditChangesCancelingEventArgs; + "batchEditChangesSaving": CardViewBatchEditChangesSavingEventArgs; + "batchEditConfirmShowing": CardViewBatchEditConfirmShowingEventArgs; + "batchEditEndEditing": CardViewBatchEditEndEditingEventArgs; + "batchEditStartEditing": CardViewBatchEditStartEditingEventArgs; + "batchEditTemplateCellFocused": CardViewBatchEditTemplateCellFocusedEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "cardClick": CardViewCardClickEventArgs; + "cardDblClick": CardViewCardClickEventArgs; + "cardFocusing": CardViewCardFocusingEventArgs; + "columnSorting": CardViewColumnCancelEventArgs; + "customButtonClick": CardViewCustomButtonEventArgs; + "customizationWindowCloseUp": EventArgs; + "endCallback": EndCallbackEventArgs; + "focusedCardChanged": CardViewFocusEventArgs; + "focusedCellChanging": CardViewFocusedCellChangingEventArgs; + "selectionChanged": CardViewSelectionEventArgs; + } + + class BootstrapCardViewBatchEditApi { + protected readonly instance: any; + protected constructor(instance: any); + addNewCard(): void; + deleteCard(visibleIndex: number): void; + deleteCardByKey(key: any): void; + getCardVisibleIndices(includeDeleted: boolean): number[]; + getDeletedCardIndices(): number[]; + getInsertedCardIndices(): number[]; + isDeletedCard(visibleIndex: number): boolean; + isNewCard(visibleIndex: number): boolean; + recoverCard(visibleIndex: number): void; + recoverCardByKey(key: any): void; + validateCard(visibleIndex: number): boolean; + validateCards(validateOnlyModified: boolean): boolean; + } + + class BootstrapCardViewColumn { + protected readonly instance: any; + protected constructor(instance: any); + } + + class BootstrapCardViewCellInfo { + protected readonly instance: any; + protected constructor(instance: any); + readonly cardVisibleIndex: number; + endEdit(): void; + getCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): any; + getCellValue(visibleIndex: number, columnFieldNameOrId: string, initial: boolean): any; + getColumnDisplayText(columnFieldNameOrId: string, value: any): string; + getEditCellInfo(): BootstrapCardViewCellInfo | null; + hasChanges(): boolean; + moveFocusBackward(): boolean; + moveFocusForward(): boolean; + resetChanges(visibleIndex: number): void; + resetChanges(visibleIndex: number, columnIndex: number): void; // tslint:disable-line:unified-signatures + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any): void; + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any, displayText: string, cancelCellHighlighting: boolean): void; + startEdit(visibleIndex: number, columnIndex: number): void; + } + + interface BootstrapChartEventArgsBase extends EventArgs { + readonly component: any; + readonly element: any; + } + + interface BootstrapChartErrorEventArgs extends BootstrapChartEventArgsBase { + readonly target: any; + } + + interface BootstrapChartElementActionEventArgs extends BootstrapChartEventArgsBase { + readonly target: any; + } + + interface BootstrapChartElementClickEventArgs extends BootstrapChartElementActionEventArgs { + readonly jQueryEvent: any; + } + + interface BootstrapChartExportEventArgs extends BootstrapChartEventArgsBase { + cancel: boolean; + readonly data: any; + readonly fileName: string; + readonly format: string; + } + + interface BootstrapChartOptionChangedEventArgs extends BootstrapChartEventArgsBase { + readonly fullName: string; + readonly name: string; + readonly previousValue: any; + readonly value: any; + } + + interface BootstrapChartZoomEndEventArgs extends BootstrapChartEventArgsBase { + readonly rangeEnd: any; + readonly rangeStart: any; + } + + class BootstrapChart extends Control { + exportTo(format: string, fileName: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapChart, args?: BootstrapChartEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapChart, args?: BootstrapChartEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapChart, args?: BootstrapChartEventMap[K]) => void): this; + } + interface BootstrapChartEventMap extends ControlEventMap { + "argumentAxisClick": BootstrapChartElementClickEventArgs; + "disposing": BootstrapChartEventArgsBase; + "done": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "legendClick": BootstrapChartElementClickEventArgs; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "pointClick": BootstrapChartElementClickEventArgs; + "pointHoverChanged": BootstrapChartElementActionEventArgs; + "pointSelectionChanged": BootstrapChartElementActionEventArgs; + "seriesClick": BootstrapChartElementClickEventArgs; + "seriesHoverChanged": BootstrapChartElementActionEventArgs; + "seriesSelectionChanged": BootstrapChartElementActionEventArgs; + "tooltipHidden": BootstrapChartElementActionEventArgs; + "tooltipShown": BootstrapChartElementActionEventArgs; + "zoomEnd": BootstrapChartZoomEndEventArgs; + "zoomStart": BootstrapChartEventArgsBase; + } + + class BootstrapPolarChart extends Control { + exportTo(format: string, fileName: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapPolarChart, args?: BootstrapPolarChartEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPolarChart, args?: BootstrapPolarChartEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPolarChart, args?: BootstrapPolarChartEventMap[K]) => void): this; + } + interface BootstrapPolarChartEventMap extends ControlEventMap { + "argumentAxisClick": BootstrapChartElementClickEventArgs; + "disposing": BootstrapChartEventArgsBase; + "done": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "legendClick": BootstrapChartElementClickEventArgs; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "pointClick": BootstrapChartElementClickEventArgs; + "pointHoverChanged": BootstrapChartElementActionEventArgs; + "pointSelectionChanged": BootstrapChartElementActionEventArgs; + "seriesClick": BootstrapChartElementClickEventArgs; + "seriesHoverChanged": BootstrapChartElementActionEventArgs; + "seriesSelectionChanged": BootstrapChartElementActionEventArgs; + "tooltipHidden": BootstrapChartElementActionEventArgs; + "tooltipShown": BootstrapChartElementActionEventArgs; + } + + class BootstrapPieChart extends Control { + exportTo(format: string, fileName: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapPieChart, args?: BootstrapPieChartEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPieChart, args?: BootstrapPieChartEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPieChart, args?: BootstrapPieChartEventMap[K]) => void): this; + } + interface BootstrapPieChartEventMap extends ControlEventMap { + "disposing": BootstrapChartEventArgsBase; + "done": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "legendClick": BootstrapChartElementClickEventArgs; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "pointClick": BootstrapChartElementClickEventArgs; + "pointHoverChanged": BootstrapChartElementActionEventArgs; + "pointSelectionChanged": BootstrapChartElementActionEventArgs; + "tooltipHidden": BootstrapChartElementActionEventArgs; + "tooltipShown": BootstrapChartElementActionEventArgs; + } + + class BootstrapCheckBox extends BootstrapClientEdit { + getCheckState(): string; + getChecked(): boolean; + getText(): string; + setCheckState(checkState: string): void; + setChecked(isChecked: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapCheckBox, args?: BootstrapCheckBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCheckBox, args?: BootstrapCheckBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCheckBox, args?: BootstrapCheckBoxEventMap[K]) => void): this; + } + interface BootstrapCheckBoxEventMap extends BootstrapClientEditEventMap { + "checkedChanged": ProcessingModeEventArgs; + } + + class BootstrapRadioButton extends BootstrapClientEdit { + getCheckState(): string; + getChecked(): boolean; + getText(): string; + setCheckState(checkState: string): void; + setChecked(isChecked: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapRadioButton, args?: BootstrapRadioButtonEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapRadioButton, args?: BootstrapRadioButtonEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapRadioButton, args?: BootstrapRadioButtonEventMap[K]) => void): this; + } + interface BootstrapRadioButtonEventMap extends BootstrapClientEditEventMap { + "checkedChanged": ProcessingModeEventArgs; + } + + class BootstrapComboBox extends BootstrapClientEdit { + addItem(texts: string[]): number; + addItem(text: string): number; // tslint:disable-line:unified-signatures + addItem(texts: string[], value: any): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any): number; // tslint:disable-line:unified-signatures unified-signatures + addItem(texts: string[], value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures unified-signatures + addItemCssClass(index: number, className: string): void; + addItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + adjustDropDownWindow(): void; + beginUpdate(): void; + clearItems(): void; + endUpdate(): void; + ensureDropDownLoaded(callbackFunction: any): void; + findItemByText(text: string): BootstrapListBoxItem | null; + findItemByValue(value: any): BootstrapListBoxItem | null; + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getItem(index: number): BootstrapListBoxItem | null; + getItemBadgeIconCssClass(index: number): string; + getItemBadgeText(index: number): string; + getItemCount(): number; + getSelectedIndex(): number; + getSelectedItem(): BootstrapListBoxItem | null; + getText(): string; + hideDropDown(): void; + insertItem(index: number, texts: string[]): void; + insertItem(index: number, text: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, texts: string[], value: any): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any): void; // tslint:disable-line:unified-signatures unified-signatures + insertItem(index: number, texts: string[], value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures unified-signatures + makeItemVisible(index: number): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + removeItem(index: number): void; + removeItemCssClass(index: number, className: string): void; + removeItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setItemBadgeIconCssClass(index: number, cssClass: string): void; + setItemBadgeText(index: number, text: string): void; + setItemHtml(index: number, html: string): void; + setItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + setItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + setItemTooltip(index: number, tooltip: string): void; + setSelectedIndex(index: number): void; + setSelectedItem(item: BootstrapListBoxItem): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string, applyFilter: boolean): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapComboBox, args?: BootstrapComboBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapComboBox, args?: BootstrapComboBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapComboBox, args?: BootstrapComboBoxEventMap[K]) => void): this; + } + interface BootstrapComboBoxEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "buttonClick": ButtonEditClickEventArgs; + "callbackError": CallbackErrorEventArgs; + "closeUp": EventArgs; + "customHighlighting": ListEditCustomHighlightingEventArgs; + "dropDown": EventArgs; + "endCallback": EndCallbackEventArgs; + "itemFiltering": ListEditItemFilteringEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "queryCloseUp": CancelEventArgs; + "selectedIndexChanged": ProcessingModeEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + interface ParseDateEventArgs extends EventArgs { + readonly date: Date; + readonly handled: boolean; + readonly value: string; + } + + class BootstrapDateEdit extends BootstrapClientEdit { + adjustDropDownWindow(): void; + getButtonVisible(number: number): boolean; + getCalendar(): BootstrapCalendar | null; + getCaretPosition(): number; + getDate(): Date; + getMaxDate(): Date; + getMinDate(): Date; + getRangeDayCount(): number; + getText(): string; + getTimeEdit(): BootstrapTimeEdit | null; + hideDropDown(): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setDate(date: Date): void; + setMaxDate(date: Date): void; + setMinDate(date: Date): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapDateEdit, args?: BootstrapDateEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapDateEdit, args?: BootstrapDateEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapDateEdit, args?: BootstrapDateEditEventMap[K]) => void): this; + } + interface BootstrapDateEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "calendarCustomDisabledDate": CalendarCustomDisabledDateEventArgs; + "closeUp": EventArgs; + "dateChanged": ProcessingModeEventArgs; + "dropDown": EventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "parseDate": ParseDateEventArgs; + "queryCloseUp": CancelEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapDropDownEdit extends BootstrapClientEdit { + adjustDropDownWindow(): void; + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getKeyValue(): string; + getText(): string; + hideDropDown(): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setKeyValue(keyValue: string): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapDropDownEdit, args?: BootstrapDropDownEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapDropDownEdit, args?: BootstrapDropDownEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapDropDownEdit, args?: BootstrapDropDownEditEventMap[K]) => void): this; + } + interface BootstrapDropDownEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "closeUp": EventArgs; + "dropDown": EventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "queryCloseUp": CancelEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapFormLayout extends Control { + getItemByName(name: string): BootstrapFormLayoutItem | null; + on(eventName: K, callback: (this: BootstrapFormLayout, args?: BootstrapFormLayoutEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapFormLayout, args?: BootstrapFormLayoutEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapFormLayout, args?: BootstrapFormLayoutEventMap[K]) => void): this; + } + interface BootstrapFormLayoutEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapFormLayoutItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly formLayout: BootstrapFormLayout | null; + readonly name: string; + readonly parent: BootstrapFormLayoutItem | null; + getCaption(): string; + getItemByName(name: string): BootstrapFormLayoutItem | null; + getVisible(): boolean; + setCaption(caption: string): void; + setVisible(value: boolean): void; + } + + interface GridViewColumnCancelEventArgs extends CancelEventArgs { + readonly column: BootstrapGridViewColumn; + } + + interface GridViewColumnProcessingModeEventArgs extends ProcessingModeEventArgs { + readonly column: BootstrapGridViewColumn; + } + + interface GridViewRowCancelEventArgs extends CancelEventArgs { + readonly visibleIndex: number; + } + + interface GridViewSelectionEventArgs extends ProcessingModeEventArgs { + readonly isAllRecordsOnPage: boolean; + readonly isChangedOnServer: boolean; + readonly isSelected: boolean; + readonly visibleIndex: number; + } + + interface GridViewFocusEventArgs extends ProcessingModeEventArgs { + readonly isChangedOnServer: boolean; + } + + interface GridViewRowFocusingEventArgs extends GridViewRowCancelEventArgs { + readonly htmlEvent: any; + } + + interface GridViewRowClickEventArgs extends GridViewRowCancelEventArgs { + readonly htmlEvent: any; + } + + interface GridViewContextMenuEventArgs extends EventArgs { + readonly htmlEvent: any; + readonly index: number; + readonly menu: any; + readonly objectType: string; + showBrowserMenu: boolean; + } + + interface GridViewContextMenuItemClickEventArgs extends ProcessingModeEventArgs { + readonly elementIndex: number; + handled: boolean; + readonly item: BootstrapMenuItem; + readonly objectType: string; + usePostBack: boolean; + } + + interface GridViewCustomButtonEventArgs extends ProcessingModeEventArgs { + readonly buttonID: string; + readonly visibleIndex: number; + } + + interface GridViewColumnMovingEventArgs extends EventArgs { + allow: boolean; + readonly destinationColumn: BootstrapGridViewColumn; + readonly isDropBefore: boolean; + readonly isGroupPanel: boolean; + readonly sourceColumn: BootstrapGridViewColumn; + } + + interface GridViewBatchEditConfirmShowingEventArgs extends CancelEventArgs { + readonly requestTriggerID: string; + } + + interface GridViewBatchEditStartEditingEventArgs extends CancelEventArgs { + focusedColumn: BootstrapGridViewColumn; + readonly rowValues: any; + readonly visibleIndex: number; + } + + interface GridViewBatchEditEndEditingEventArgs extends CancelEventArgs { + readonly rowValues: any; + readonly visibleIndex: number; + } + + interface GridViewBatchEditRowValidatingEventArgs extends EventArgs { + readonly validationInfo: any; + readonly visibleIndex: number; + } + + interface GridViewBatchEditTemplateCellFocusedEventArgs extends EventArgs { + readonly column: BootstrapGridViewColumn; + handled: boolean; + } + + interface GridViewBatchEditChangesSavingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface GridViewBatchEditChangesCancelingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface GridViewBatchEditRowInsertingEventArgs extends CancelEventArgs { + readonly visibleIndex: number; + } + + interface GridViewBatchEditRowDeletingEventArgs extends CancelEventArgs { + readonly rowValues: any; + readonly visibleIndex: number; + } + + interface GridViewFocusedCellChangingEventArgs extends CancelEventArgs { + readonly cellInfo: BootstrapGridViewCellInfo; + } + + class BootstrapGridView extends BootstrapGridBase { + readonly batchEditApi: BootstrapGridViewBatchEditApi | null; + addNewRow(): void; + applyFilter(filterExpression: string): void; + applyOnClickRowFilter(): void; + applySearchPanelFilter(value: string): void; + autoFilterByColumn(column: BootstrapGridViewColumn, val: string): void; + autoFilterByColumn(columnIndex: number, val: string): void; // tslint:disable-line:unified-signatures + autoFilterByColumn(columnFieldNameOrId: string, val: string): void; // tslint:disable-line:unified-signatures unified-signatures + cancelEdit(): void; + clearFilter(): void; + closeFilterControl(): void; + collapseAll(): void; + collapseAllDetailRows(): void; + collapseDetailRow(visibleIndex: number): void; + collapseRow(visibleIndex: number): void; + collapseRow(visibleIndex: number, recursive: boolean): void; // tslint:disable-line:unified-signatures + deleteRow(visibleIndex: number): void; + deleteRowByKey(key: any): void; + expandAll(): void; + expandAllDetailRows(): void; + expandDetailRow(visibleIndex: number): void; + expandRow(visibleIndex: number): void; + expandRow(visibleIndex: number, recursive: boolean): void; // tslint:disable-line:unified-signatures + focus(): void; + focusEditor(column: BootstrapGridViewColumn): void; + focusEditor(columnIndex: number): void; // tslint:disable-line:unified-signatures + focusEditor(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + getAutoFilterEditor(column: BootstrapGridViewColumn): any; + getAutoFilterEditor(columnIndex: number): any; // tslint:disable-line:unified-signatures + getAutoFilterEditor(columnFieldNameOrId: string): any; // tslint:disable-line:unified-signatures unified-signatures + getColumn(columnIndex: number): BootstrapGridViewColumn | null; + getColumnByField(columnFieldName: string): BootstrapGridViewColumn | null; + getColumnById(columnId: string): BootstrapGridViewColumn | null; + getColumnCount(): number; + getColumnLayout(): any; + getEditValue(column: BootstrapGridViewColumn): string; + getEditValue(columnIndex: number): string; // tslint:disable-line:unified-signatures + getEditValue(columnFieldNameOrId: string): string; // tslint:disable-line:unified-signatures unified-signatures + getEditor(column: BootstrapGridViewColumn): BootstrapClientEdit; + getEditor(columnIndex: number): BootstrapClientEdit; // tslint:disable-line:unified-signatures + getEditor(columnFieldNameOrId: string): BootstrapClientEdit; // tslint:disable-line:unified-signatures unified-signatures + getFocusedCell(): BootstrapGridViewCellInfo | null; + getFocusedRowIndex(): number; + getHorizontalScrollPosition(): number; + getPageCount(): number; + getPageIndex(): number; + getPopupEditForm(): BootstrapPopupControl | null; + getRowIndicesVisibleInViewPort(includePartiallyVisible: boolean): number[]; + getRowKey(visibleIndex: number): string; + getSelectedKeysOnPage(): any[]; + getSelectedRowCount(): number; + getTopVisibleIndex(): number; + getVerticalScrollPosition(): number; + getVisibleRowsOnPage(): number; + gotoPage(pageIndex: number): void; + groupBy(column: BootstrapGridViewColumn): void; + groupBy(columnIndex: number): void; // tslint:disable-line:unified-signatures + groupBy(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + groupBy(column: BootstrapGridViewColumn, groupIndex: number): void; // tslint:disable-line:unified-signatures + groupBy(columnIndex: number, groupIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + groupBy(columnFieldNameOrId: string, groupIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + groupBy(column: BootstrapGridViewColumn, groupIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures + groupBy(columnIndex: number, groupIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures + groupBy(columnFieldNameOrId: string, groupIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + hideCustomizationWindow(): void; + isCustomizationWindowVisible(): boolean; + isDataRow(visibleIndex: number): boolean; + isEditing(): boolean; + isGroupRow(visibleIndex: number): boolean; + isGroupRowExpanded(visibleIndex: number): boolean; + isNewRowEditing(): boolean; + isRowSelectedOnPage(visibleIndex: number): boolean; + makeRowVisible(visibleIndex: number): void; + nextPage(): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + prevPage(): void; + refresh(): void; + selectAllRowsOnPage(): void; + selectRowOnPage(visibleIndex: number): void; + selectRowOnPage(visibleIndex: number, selected: boolean): void; // tslint:disable-line:unified-signatures + selectRows(): void; + selectRowsByKey(keys: any[]): void; + selectRowsByKey(key: any): void; // tslint:disable-line:unified-signatures + selectRowsByKey(keys: any[], selected: boolean): void; // tslint:disable-line:unified-signatures + selectRowsByKey(key: any, selected: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + setColumnLayout(columnLayout: any): void; + setEditValue(column: BootstrapGridViewColumn, value: string): void; + setEditValue(columnIndex: number, value: string): void; // tslint:disable-line:unified-signatures + setEditValue(columnFieldNameOrId: string, value: string): void; // tslint:disable-line:unified-signatures unified-signatures + setFilterEnabled(isFilterEnabled: boolean): void; + setFixedColumnScrollableRows(scrollableRowSettings: any): void; + setFocusedCell(rowVisibleIndex: number, columnIndex: number): void; + setFocusedRowIndex(visibleIndex: number): void; + setHorizontalScrollPosition(position: number): void; + setSearchPanelCustomEditor(editor: BootstrapClientEdit): void; + setVerticalScrollPosition(position: number): void; + showCustomizationDialog(): void; + showCustomizationWindow(): void; + showFilterControl(): void; + sortBy(column: BootstrapGridViewColumn): void; + sortBy(columnIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(column: BootstrapGridViewColumn, sortOrder: string): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapGridViewColumn, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapGridViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + startEditRow(visibleIndex: number): void; + startEditRowByKey(key: any): void; + ungroup(column: BootstrapGridViewColumn): void; + ungroup(columnIndex: number): void; // tslint:disable-line:unified-signatures + ungroup(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + unselectAllRowsOnPage(): void; + unselectFilteredRows(): void; + unselectRowOnPage(visibleIndex: number): void; + unselectRows(): void; + unselectRowsByKey(keys: any[]): void; + unselectRowsByKey(key: any): void; // tslint:disable-line:unified-signatures + updateEdit(): void; + on(eventName: K, callback: (this: BootstrapGridView, args?: BootstrapGridViewEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapGridView, args?: BootstrapGridViewEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapGridView, args?: BootstrapGridViewEventMap[K]) => void): this; + } + interface BootstrapGridViewEventMap extends BootstrapGridBaseEventMap { + "batchEditChangesCanceling": GridViewBatchEditChangesCancelingEventArgs; + "batchEditChangesSaving": GridViewBatchEditChangesSavingEventArgs; + "batchEditConfirmShowing": GridViewBatchEditConfirmShowingEventArgs; + "batchEditEndEditing": GridViewBatchEditEndEditingEventArgs; + "batchEditRowDeleting": GridViewBatchEditRowDeletingEventArgs; + "batchEditRowInserting": GridViewBatchEditRowInsertingEventArgs; + "batchEditRowValidating": GridViewBatchEditRowValidatingEventArgs; + "batchEditStartEditing": GridViewBatchEditStartEditingEventArgs; + "batchEditTemplateCellFocused": GridViewBatchEditTemplateCellFocusedEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "columnGrouping": GridViewColumnCancelEventArgs; + "columnMoving": GridViewColumnMovingEventArgs; + "columnResized": GridViewColumnProcessingModeEventArgs; + "columnResizing": GridViewColumnCancelEventArgs; + "columnSorting": GridViewColumnCancelEventArgs; + "columnStartDragging": GridViewColumnCancelEventArgs; + "contextMenu": GridViewContextMenuEventArgs; + "contextMenuItemClick": GridViewContextMenuItemClickEventArgs; + "customButtonClick": GridViewCustomButtonEventArgs; + "customizationWindowCloseUp": EventArgs; + "detailRowCollapsing": GridViewRowCancelEventArgs; + "detailRowExpanding": GridViewRowCancelEventArgs; + "endCallback": EndCallbackEventArgs; + "focusedCellChanging": GridViewFocusedCellChangingEventArgs; + "focusedRowChanged": GridViewFocusEventArgs; + "rowClick": GridViewRowClickEventArgs; + "rowCollapsing": GridViewRowCancelEventArgs; + "rowDblClick": GridViewRowClickEventArgs; + "rowExpanding": GridViewRowCancelEventArgs; + "rowFocusing": GridViewRowFocusingEventArgs; + "selectionChanged": GridViewSelectionEventArgs; + } + + class BootstrapGridViewBatchEditApi { + protected readonly instance: any; + protected constructor(instance: any); + addNewRow(): void; + deleteRow(visibleIndex: number): void; + deleteRowByKey(key: any): void; + endEdit(): void; + getCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): any; + getCellValue(visibleIndex: number, columnFieldNameOrId: string, initial: boolean): any; + getColumnDisplayText(columnFieldNameOrId: string, value: any): string; + getDeletedRowIndices(): number[]; + getEditCellInfo(): BootstrapGridViewCellInfo | null; + getInsertedRowIndices(): number[]; + getRowVisibleIndices(includeDeleted: boolean): number[]; + hasChanges(): boolean; + isDeletedRow(visibleIndex: number): boolean; + isNewRow(visibleIndex: number): boolean; + moveFocusBackward(): boolean; + moveFocusForward(): boolean; + recoverRow(visibleIndex: number): void; + recoverRowByKey(key: any): void; + resetChanges(visibleIndex: number): void; + resetChanges(visibleIndex: number, columnIndex: number): void; // tslint:disable-line:unified-signatures + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any): void; + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any, displayText: string, cancelCellHighlighting: boolean): void; + startEdit(visibleIndex: number, columnIndex: number): void; + validateRow(visibleIndex: number): boolean; + validateRows(validateOnlyModified: boolean): boolean; + } + + class BootstrapGridViewColumn { + protected readonly instance: any; + protected constructor(instance: any); + readonly fieldName: string; + readonly index: number; + readonly name: string; + readonly visible: boolean; + } + + class BootstrapGridViewCellInfo { + protected readonly instance: any; + protected constructor(instance: any); + readonly rowVisibleIndex: number; + } + + class BootstrapHyperLink extends Control { + getBadgeIconCssClass(): string; + getBadgeText(): string; + getCaption(): string; + getEnabled(): boolean; + getNavigateUrl(): string; + getText(): string; + getValue(): any; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setCaption(caption: string): void; + setEnabled(value: boolean): void; + setNavigateUrl(url: string): void; + setText(text: string): void; + setValue(value: any): void; + on(eventName: K, callback: (this: BootstrapHyperLink, args?: BootstrapHyperLinkEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapHyperLink, args?: BootstrapHyperLinkEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapHyperLink, args?: BootstrapHyperLinkEventMap[K]) => void): this; + } + interface BootstrapHyperLinkEventMap extends ControlEventMap { + "click": EditClickEventArgs; + } + + interface ListEditItemSelectedChangedEventArgs extends ProcessingModeEventArgs { + readonly index: number; + readonly isSelected: boolean; + } + + interface ListEditCustomHighlightingEventArgs extends EventArgs { + readonly filter: string; + highlighting: any; + } + + interface ListEditItemFilteringEventArgs extends EventArgs { + readonly filter: string; + isFit: boolean; + readonly item: BootstrapListBoxItem; + } + + class BootstrapListBox extends BootstrapClientEdit { + addItem(texts: string[]): number; + addItem(text: string): number; // tslint:disable-line:unified-signatures + addItem(texts: string[], value: any): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any): number; // tslint:disable-line:unified-signatures unified-signatures + addItem(texts: string[], value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures unified-signatures + addItemCssClass(index: number, className: string): void; + addItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + beginUpdate(): void; + clearItems(): void; + endUpdate(): void; + findItemByText(text: string): BootstrapListBoxItem | null; + findItemByValue(value: any): BootstrapListBoxItem | null; + getItem(index: number): BootstrapListBoxItem | null; + getItemBadgeIconCssClass(index: number): string; + getItemBadgeText(index: number): string; + getItemCount(): number; + getSelectedIndex(): number; + getSelectedIndices(): number[]; + getSelectedItem(): BootstrapListBoxItem | null; + getSelectedItems(): BootstrapListBoxItem[]; + getSelectedValues(): any[]; + insertItem(index: number, texts: string[]): void; + insertItem(index: number, text: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, texts: string[], value: any): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any): void; // tslint:disable-line:unified-signatures unified-signatures + insertItem(index: number, texts: string[], value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures unified-signatures + makeItemVisible(index: number): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + removeItem(index: number): void; + removeItemCssClass(index: number, className: string): void; + removeItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + selectAll(): void; + selectIndices(indices: number[]): void; + selectItems(items: BootstrapListBoxItem[]): void; + selectValues(values: any[]): void; + setItemBadgeIconCssClass(index: number, cssClass: string): void; + setItemBadgeText(index: number, text: string): void; + setItemHtml(index: number, html: string): void; + setItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + setItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + setItemTooltip(index: number, tooltip: string): void; + setSelectedIndex(index: number): void; + setSelectedItem(item: BootstrapListBoxItem): void; + unselectAll(): void; + unselectIndices(indices: number[]): void; + unselectItems(items: BootstrapListBoxItem[]): void; + unselectValues(values: any[]): void; + on(eventName: K, callback: (this: BootstrapListBox, args?: BootstrapListBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapListBox, args?: BootstrapListBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapListBox, args?: BootstrapListBoxEventMap[K]) => void): this; + } + interface BootstrapListBoxEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "customHighlighting": ListEditCustomHighlightingEventArgs; + "endCallback": EndCallbackEventArgs; + "itemDoubleClick": EventArgs; + "itemFiltering": ListEditItemFilteringEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "selectedIndexChanged": ProcessingModeEventArgs; + } + + class BootstrapListBoxItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly iconCssClass: string; + readonly imageUrl: string; + readonly index: number; + readonly listEditBase: BootstrapListBox | null; + readonly text: string; + readonly value: any; + getColumnText(columnIndex: number): string; + getColumnText(columnName: string): string; // tslint:disable-line:unified-signatures + getFieldText(fieldIndex: number): string; + getFieldText(fieldName: string): string; // tslint:disable-line:unified-signatures + } + + class BootstrapCheckBoxList extends BootstrapListBox { + getItem(index: number): BootstrapListBoxItem | null; + getItemCount(): number; + getSelectedIndices(): number[]; + getSelectedItems(): BootstrapListBoxItem[]; + getSelectedValues(): any[]; + selectAll(): void; + selectIndices(indices: number[]): void; + selectItems(items: BootstrapListBoxItem[]): void; + selectValues(values: any[]): void; + unselectAll(): void; + unselectIndices(indices: number[]): void; + unselectItems(items: BootstrapListBoxItem[]): void; + unselectValues(values: any[]): void; + on(eventName: K, callback: (this: BootstrapCheckBoxList, args?: BootstrapCheckBoxListEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCheckBoxList, args?: BootstrapCheckBoxListEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCheckBoxList, args?: BootstrapCheckBoxListEventMap[K]) => void): this; + } + interface BootstrapCheckBoxListEventMap extends BootstrapListBoxEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapRadioButtonList extends BootstrapListBox { + getItem(index: number): BootstrapListBoxItem | null; + getItemCount(): number; + on(eventName: K, callback: (this: BootstrapRadioButtonList, args?: BootstrapRadioButtonListEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapRadioButtonList, args?: BootstrapRadioButtonListEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapRadioButtonList, args?: BootstrapRadioButtonListEventMap[K]) => void): this; + } + interface BootstrapRadioButtonListEventMap extends BootstrapListBoxEventMap { // tslint:disable-line:no-empty-interface + } + + interface MenuItemEventArgs extends EventArgs { + readonly item: BootstrapMenuItem; + } + + interface MenuItemMouseEventArgs extends MenuItemEventArgs { // tslint:disable-line:no-empty-interface + } + + interface MenuItemClickEventArgs extends ProcessingModeEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + readonly item: BootstrapMenuItem; + } + + class BootstrapMenu extends Control { + getItem(index: number): BootstrapMenuItem | null; + getItemByName(name: string): BootstrapMenuItem | null; + getItemCount(): number; + getOrientation(): string; + getRootItem(): BootstrapMenuItem | null; + getSelectedItem(): BootstrapMenuItem | null; + setOrientation(orientation: string): void; + setSelectedItem(item: BootstrapMenuItem): void; + on(eventName: K, callback: (this: BootstrapMenu, args?: BootstrapMenuEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapMenu, args?: BootstrapMenuEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapMenu, args?: BootstrapMenuEventMap[K]) => void): this; + } + interface BootstrapMenuEventMap extends ControlEventMap { + "closeUp": MenuItemEventArgs; + "itemClick": MenuItemClickEventArgs; + "itemMouseOut": MenuItemMouseEventArgs; + "itemMouseOver": MenuItemMouseEventArgs; + "popUp": MenuItemEventArgs; + } + + class BootstrapMenuItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly indexPath: string; + readonly menu: BootstrapMenu | null; + readonly name: string; + readonly parent: BootstrapMenuItem | null; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getChecked(): boolean; + getEnabled(): boolean; + getIconCssClass(): string; + getImageUrl(): string; + getItem(index: number): BootstrapMenuItem | null; + getItemByName(name: string): BootstrapMenuItem | null; + getItemCount(): number; + getNavigateUrl(): string; + getText(): string; + getVisible(): boolean; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setChecked(value: boolean): void; + setEnabled(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + } + + interface PopupWindowEventArgs extends EventArgs { + readonly window: BootstrapPopupWindow; + } + + interface PopupWindowCloseUpEventArgs extends PopupWindowEventArgs { + readonly closeReason: BootstrapPopupControlCloseReason; + } + + interface PopupWindowCancelEventArgs extends CancelEventArgs { + readonly closeReason: BootstrapPopupControlCloseReason; + readonly window: BootstrapPopupWindow; + } + + interface PopupWindowPinnedChangedEventArgs extends PopupWindowEventArgs { + readonly pinned: boolean; + } + + interface PopupWindowResizeEventArgs extends PopupWindowEventArgs { + readonly resizeState: number; + } + + class BootstrapPopupControl extends Control { + adjustSize(): void; + bringToFront(): void; + bringWindowToFront(window: BootstrapPopupWindow): void; + getCollapsed(): boolean; + getContentHeight(): number; + getContentHtml(): string; + getContentIFrame(): any; + getContentIFrameWindow(): any; + getContentUrl(): string; + getContentWidth(): number; + getCurrentPopupElement(): any; + getCurrentPopupElementIndex(): number; + getFooterImageUrl(): string; + getFooterNavigateUrl(): string; + getFooterText(): string; + getHeaderImageUrl(): string; + getHeaderNavigateUrl(): string; + getHeaderText(): string; + getMainElement(): any; + getMaximized(): boolean; + getPinned(): boolean; + getPopUpReasonMouseEvent(): any; + getWindow(index: number): BootstrapPopupWindow | null; + getWindowByName(name: string): BootstrapPopupWindow | null; + getWindowCollapsed(window: BootstrapPopupWindow): boolean; + getWindowContentHeight(window: BootstrapPopupWindow): number; + getWindowContentHtml(window: BootstrapPopupWindow): string; + getWindowContentIFrame(window: BootstrapPopupWindow): any; + getWindowContentUrl(window: BootstrapPopupWindow): string; + getWindowContentWidth(window: BootstrapPopupWindow): number; + getWindowCount(): number; + getWindowCurrentPopupElement(window: BootstrapPopupWindow): any; + getWindowCurrentPopupElementIndex(window: BootstrapPopupWindow): number; + getWindowHeight(window: BootstrapPopupWindow): number; + getWindowMaximized(window: BootstrapPopupWindow): boolean; + getWindowPinned(window: BootstrapPopupWindow): boolean; + getWindowPopUpReasonMouseEvent(window: BootstrapPopupWindow): any; + getWindowWidth(window: BootstrapPopupWindow): number; + hide(): void; + hideWindow(window: BootstrapPopupWindow): void; + isVisible(): boolean; + isWindowVisible(window: BootstrapPopupWindow): boolean; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + refreshContentUrl(): void; + refreshPopupElementConnection(): void; + refreshWindowContentUrl(window: BootstrapPopupWindow): void; + setAdaptiveMaxHeight(maxHeight: number): void; + setAdaptiveMaxHeight(maxHeight: string): void; // tslint:disable-line:unified-signatures + setAdaptiveMaxWidth(maxWidth: number): void; + setAdaptiveMaxWidth(maxWidth: string): void; // tslint:disable-line:unified-signatures + setAdaptiveMinHeight(minHeight: number): void; + setAdaptiveMinHeight(minHeight: string): void; // tslint:disable-line:unified-signatures + setAdaptiveMinWidth(minWidth: number): void; + setAdaptiveMinWidth(minWidth: string): void; // tslint:disable-line:unified-signatures + setCollapsed(value: boolean): void; + setContentHtml(html: string): void; + setContentUrl(url: string): void; + setFooterImageUrl(value: string): void; + setFooterNavigateUrl(value: string): void; + setFooterText(value: string): void; + setHeaderImageUrl(value: string): void; + setHeaderNavigateUrl(value: string): void; + setHeaderText(value: string): void; + setMaximized(value: boolean): void; + setPinned(value: boolean): void; + setPopupElementCssSelector(selector: string): void; + setPopupElementID(popupElementId: string): void; + setSize(width: number, height: number): void; + setWindowAdaptiveMaxHeight(window: BootstrapPopupWindow, maxHeight: number): void; + setWindowAdaptiveMaxHeight(window: BootstrapPopupWindow, maxHeight: string): void; // tslint:disable-line:unified-signatures + setWindowAdaptiveMaxWidth(window: BootstrapPopupWindow, maxWidth: number): void; + setWindowAdaptiveMaxWidth(window: BootstrapPopupWindow, maxWidth: string): void; // tslint:disable-line:unified-signatures + setWindowAdaptiveMinHeight(window: BootstrapPopupWindow, minHeight: number): void; + setWindowAdaptiveMinHeight(window: BootstrapPopupWindow, minHeight: string): void; // tslint:disable-line:unified-signatures + setWindowAdaptiveMinWidth(window: BootstrapPopupWindow, minWidth: number): void; + setWindowAdaptiveMinWidth(window: BootstrapPopupWindow, minWidth: string): void; // tslint:disable-line:unified-signatures + setWindowCollapsed(window: BootstrapPopupWindow, value: boolean): void; + setWindowContentHtml(window: BootstrapPopupWindow, html: string): void; + setWindowContentUrl(window: BootstrapPopupWindow, url: string): void; + setWindowMaximized(window: BootstrapPopupWindow, value: boolean): void; + setWindowPinned(window: BootstrapPopupWindow, value: boolean): void; + setWindowPopupElementID(window: BootstrapPopupWindow, popupElementId: string): void; + setWindowSize(window: BootstrapPopupWindow, width: number, height: number): void; + show(): void; + showAtElement(htmlElement: any): void; + showAtElementByID(id: string): void; + showAtPos(x: number, y: number): void; + showWindow(window: BootstrapPopupWindow): void; + showWindow(window: BootstrapPopupWindow, popupElementIndex: number): void; // tslint:disable-line:unified-signatures + showWindowAtElement(window: BootstrapPopupWindow, htmlElement: any): void; + showWindowAtElementByID(window: BootstrapPopupWindow, id: string): void; + showWindowAtPos(window: BootstrapPopupWindow, x: number, y: number): void; + stretchVertically(): void; + updatePosition(): void; + updatePositionAtElement(htmlElement: any): void; + updateWindowPosition(window: BootstrapPopupWindow): void; + updateWindowPositionAtElement(window: BootstrapPopupWindow, htmlElement: any): void; + windowStretchVertically(window: BootstrapPopupWindow): void; + on(eventName: K, callback: (this: BootstrapPopupControl, args?: BootstrapPopupControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPopupControl, args?: BootstrapPopupControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPopupControl, args?: BootstrapPopupControlEventMap[K]) => void): this; + } + interface BootstrapPopupControlEventMap extends ControlEventMap { + "afterResizing": PopupWindowEventArgs; + "beforeResizing": PopupWindowEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "closeUp": PopupWindowCloseUpEventArgs; + "closing": PopupWindowCancelEventArgs; + "endCallback": EndCallbackEventArgs; + "pinnedChanged": PopupWindowPinnedChangedEventArgs; + "popUp": PopupWindowEventArgs; + "resize": PopupWindowResizeEventArgs; + "shown": PopupWindowEventArgs; + } + + class BootstrapPopupWindow { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly name: string; + readonly popupControl: BootstrapPopupControl | null; + getFooterImageUrl(): string; + getFooterNavigateUrl(): string; + getFooterText(): string; + getHeaderImageUrl(): string; + getHeaderNavigateUrl(): string; + getHeaderText(): string; + setFooterImageUrl(value: string): void; + setFooterNavigateUrl(value: string): void; + setFooterText(value: string): void; + setHeaderImageUrl(value: string): void; + setHeaderNavigateUrl(value: string): void; + setHeaderText(value: string): void; + } + + class BootstrapPopupMenu extends BootstrapMenu { + getCurrentPopupElement(): any; + getCurrentPopupElementIndex(): number; + getItem(index: number): BootstrapMenuItem | null; + getItemByName(name: string): BootstrapMenuItem | null; + getRootItem(): BootstrapMenuItem | null; + getSelectedItem(): BootstrapMenuItem | null; + hide(): void; + refreshPopupElementConnection(): void; + setPopupElementCssSelector(selector: string): void; + setPopupElementID(popupElementId: string): void; + setSelectedItem(item: BootstrapMenuItem): void; + show(): void; + showAtElement(htmlElement: any): void; + showAtElementByID(id: string): void; + showAtPos(x: number, y: number): void; + on(eventName: K, callback: (this: BootstrapPopupMenu, args?: BootstrapPopupMenuEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPopupMenu, args?: BootstrapPopupMenuEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPopupMenu, args?: BootstrapPopupMenuEventMap[K]) => void): this; + } + interface BootstrapPopupMenuEventMap extends BootstrapMenuEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapProgressBar extends Control { + getCaption(): string; + getDisplayText(): string; + getEnabled(): boolean; + getMaximum(): number; + getMinimum(): number; + getPercent(): number; + getPosition(): number; + getValue(): any; + setCaption(caption: string): void; + setCustomDisplayFormat(text: string): void; + setEnabled(value: boolean): void; + setMaximum(max: number): void; + setMinMaxValues(minValue: number, maxValue: number): void; + setMinimum(min: number): void; + setPosition(position: number): void; + setValue(value: any): void; + on(eventName: K, callback: (this: BootstrapProgressBar, args?: BootstrapProgressBarEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapProgressBar, args?: BootstrapProgressBarEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapProgressBar, args?: BootstrapProgressBarEventMap[K]) => void): this; + } + interface BootstrapProgressBarEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + interface ActiveViewChangingEventArgs extends EventArgs { + cancel: boolean; + readonly newView: BootstrapSchedulerViewType; + readonly oldView: BootstrapSchedulerViewType; + } + + interface AppointmentClickEventArgs extends EventArgs { + readonly appointmentId: string; + readonly handled: boolean; + readonly htmlElement: object; + } + + interface AppointmentDeletingEventArgs extends CancelEventArgs { + readonly appointmentIds: object[]; + } + + interface AppointmentDragEventArgs extends EventArgs { + allow: boolean; + readonly dragInformation: BootstrapSchedulerAppointmentDragInfo[]; + readonly mouseEvent: any; + } + + interface AppointmentDropEventArgs extends EventArgs { + readonly dragInformation: BootstrapSchedulerAppointmentDragInfo[]; + handled: boolean; + readonly operation: BootstrapSchedulerAppointmentOperation; + } + + interface AppointmentResizeEventArgs extends EventArgs { + readonly appointmentId: string; + handled: boolean; + readonly newInterval: BootstrapTimeInterval; + readonly oldInterval: BootstrapTimeInterval; + readonly operation: BootstrapSchedulerAppointmentOperation; + } + + interface AppointmentResizingEventArgs extends EventArgs { + allow: boolean; + readonly appointmentId: string; + readonly mouseEvent: any; + readonly newInterval: BootstrapTimeInterval; + readonly oldInterval: BootstrapTimeInterval; + } + + interface AppointmentToolTipShowingEventArgs extends CancelEventArgs { + readonly appointment: BootstrapSchedulerAppointment; + } + + interface AppointmentsSelectionEventArgs extends EventArgs { + readonly appointmentIds: string[]; + } + + interface CellClickEventArgs extends EventArgs { + readonly htmlElement: object; + readonly interval: BootstrapTimeInterval; + readonly resource: string; + } + + interface MenuItemClickedEventArgs extends EventArgs { + handled: boolean; + readonly itemName: string; + } + + interface MoreButtonClickedEventArgs extends ProcessingModeEventArgs { + handled: boolean; + readonly interval: BootstrapTimeInterval; + readonly resource: string; + readonly targetDateTime: Date; + } + + interface ShortcutEventArgs extends EventArgs { + readonly commandName: string; + readonly handled: boolean; + readonly htmlEvent: object; + } + + class BootstrapScheduler extends Control { + appointmentFormCancel(): void; + appointmentFormDelete(): void; + appointmentFormSave(): void; + changeFormContainer(container: any): void; + changePopupMenuContainer(container: any): void; + changeTimeZoneId(timeZoneId: string): void; + changeToolTipContainer(container: any): void; + deleteAppointment(apt: BootstrapSchedulerAppointment): void; + deselectAppointmentById(aptId: any): void; + getActiveViewType(): BootstrapSchedulerViewType; + getAllDayAreaHeight(): number; + getAppointmentById(id: any): BootstrapSchedulerAppointment | null; + getAppointmentProperties(aptId: number, propertyNames: string[], onCallBack: any): string[]; + getGroupType(): BootstrapSchedulerGroupType; + getResourceNavigatorVisible(): boolean; + getScrollAreaHeight(): number; + getSelectedAppointmentIds(): string[]; + getSelectedInterval(): BootstrapTimeInterval | null; + getSelectedResource(): string; + getToolbarVisible(): boolean; + getTopRowTime(viewType: BootstrapSchedulerViewType): number; + getVisibleAppointments(): BootstrapSchedulerAppointment[]; + getVisibleIntervals(): BootstrapTimeInterval[]; + goToDateFormApply(): void; + goToDateFormCancel(): void; + gotoDate(date: Date): void; + gotoToday(): void; + hideLoadingPanel(): void; + inplaceEditFormCancel(): void; + inplaceEditFormSave(): void; + inplaceEditFormShowMore(): void; + insertAppointment(apt: BootstrapSchedulerAppointment): void; + navigateBackward(): void; + navigateForward(): void; + performCallback(parameter: string): void; + refresh(): void; + refreshClientAppointmentProperties(clientAppointment: BootstrapSchedulerAppointment, propertyNames: string[], onCallBack: any): void; + reminderFormCancel(): void; + reminderFormDismiss(): void; + reminderFormDismissAll(): void; + reminderFormSnooze(): void; + selectAppointmentById(aptId: any): void; + selectAppointmentById(aptId: any, scrollToSelection: boolean): void; // tslint:disable-line:unified-signatures + setActiveViewType(value: BootstrapSchedulerViewType): void; + setAllDayAreaHeight(height: number): void; + setGroupType(value: BootstrapSchedulerGroupType): void; + setHeight(height: number): void; + setResourceNavigatorVisible(visible: boolean): void; + setSelection(interval: BootstrapTimeInterval): void; + setSelection(interval: BootstrapTimeInterval, resourceId: string): void; // tslint:disable-line:unified-signatures + setSelection(interval: BootstrapTimeInterval, resourceId: string, scrollToSelection: boolean): void; // tslint:disable-line:unified-signatures + setToolbarVisible(visible: boolean): void; + setTopRowTime(duration: number): void; + setTopRowTime(duration: number, viewType: BootstrapSchedulerViewType): void; // tslint:disable-line:unified-signatures + setVisibleResources(resourceIds: string[]): void; + showAppointmentFormByClientId(aptClientId: string): void; + showAppointmentFormByServerId(aptServerId: string): void; + showInplaceEditor(start: Date, end: Date): void; + showInplaceEditor(start: Date, end: Date, resourceId: string): void; // tslint:disable-line:unified-signatures + showLoadingPanel(): void; + showSelectionToolTip(x: number, y: number): void; + updateAppointment(apt: BootstrapSchedulerAppointment): void; + on(eventName: K, callback: (this: BootstrapScheduler, args?: BootstrapSchedulerEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapScheduler, args?: BootstrapSchedulerEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapScheduler, args?: BootstrapSchedulerEventMap[K]) => void): this; + } + interface BootstrapSchedulerEventMap extends ControlEventMap { + "activeViewChanged": EventArgs; + "activeViewChanging": ActiveViewChangingEventArgs; + "appointmentClick": AppointmentClickEventArgs; + "appointmentDeleting": AppointmentDeletingEventArgs; + "appointmentDoubleClick": AppointmentClickEventArgs; + "appointmentDrag": AppointmentDragEventArgs; + "appointmentDrop": AppointmentDropEventArgs; + "appointmentResize": AppointmentResizeEventArgs; + "appointmentResizing": AppointmentResizingEventArgs; + "appointmentToolTipShowing": AppointmentToolTipShowingEventArgs; + "appointmentsSelectionChanged": AppointmentsSelectionEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "cellClick": CellClickEventArgs; + "cellDoubleClick": CellClickEventArgs; + "endCallback": EndCallbackEventArgs; + "menuItemClicked": MenuItemClickedEventArgs; + "moreButtonClicked": MoreButtonClickedEventArgs; + "selectionChanged": EventArgs; + "selectionChanging": EventArgs; + "shortcut": ShortcutEventArgs; + "visibleIntervalChanged": EventArgs; + } + + class BootstrapTimeInterval { + protected readonly instance: any; + protected constructor(instance: any); + contains(interval: BootstrapTimeInterval): boolean; + equals(interval: BootstrapTimeInterval): boolean; + getAllDay(): boolean; + getDuration(): number; + getEnd(): Date; + getStart(): Date; + intersectsWith(interval: BootstrapTimeInterval): boolean; + intersectsWithExcludingBounds(interval: BootstrapTimeInterval): boolean; + setAllDay(allDayValue: boolean): void; + setDuration(value: number): void; + setEnd(value: Date): void; + setStart(value: Date): void; + } + + class BootstrapSchedulerAppointment { + protected readonly instance: any; + protected constructor(instance: any); + readonly appointmentId: string; + readonly appointmentType: BootstrapSchedulerAppointmentType; + readonly interval: BootstrapTimeInterval | null; + readonly labelIndex: number; + readonly resources: string[]; + readonly statusIndex: number; + addResource(resourceId: object): void; + getAllDay(): boolean; + getAppointmentType(): BootstrapSchedulerAppointmentType; + getDescription(): string; + getDuration(): number; + getEnd(): Date; + getId(): any; + getLabelId(): number; + getLocation(): string; + getRecurrenceInfo(): BootstrapSchedulerRecurrenceInfo | null; + getRecurrencePattern(): BootstrapSchedulerAppointment | null; + getResource(index: number): any; + getStart(): Date; + getStatusId(): number; + getSubject(): string; + setAllDay(allDay: boolean): void; + setAppointmentType(type: BootstrapSchedulerAppointmentType): void; + setDescription(description: string): void; + setDuration(duration: number): void; + setEnd(end: Date): void; + setId(id: any): void; + setLabelId(statusId: number): void; + setLocation(location: string): void; + setRecurrenceInfo(recurrenceInfo: BootstrapSchedulerRecurrenceInfo): void; + setStart(start: Date): void; + setStatusId(statusId: number): void; + setSubject(subject: string): void; + } + + class BootstrapSchedulerAppointmentDragInfo { + protected readonly instance: any; + protected constructor(instance: any); + readonly appointmentId: string; + readonly newInterval: BootstrapTimeInterval | null; + readonly oldInterval: BootstrapTimeInterval | null; + } + + class BootstrapSchedulerAppointmentOperation { + protected readonly instance: any; + protected constructor(instance: any); + apply(): void; + cancel(): void; + } + + class BootstrapSchedulerRecurrenceInfo { + protected readonly instance: any; + protected constructor(instance: any); + getDayNumber(): number; + getDuration(): number; + getEnd(): Date; + getMonth(): number; + getOccurrenceCount(): number; + getPeriodicity(): number; + getRange(): BootstrapSchedulerRecurrenceRange; + getRecurrenceType(): BootstrapSchedulerRecurrenceType; + getStart(): Date; + getWeekDays(): WeekDays; + getWeekOfMonth(): WeekOfMonth; + setDayNumber(dayNumber: number): void; + setDuration(duration: number): void; + setEnd(end: Date): void; + setMonth(month: number): void; + setOccurrenceCount(occurrenceCount: number): void; + setPeriodicity(periodicity: number): void; + setRange(range: BootstrapSchedulerRecurrenceRange): void; + setRecurrenceType(type: BootstrapSchedulerRecurrenceType): void; + setStart(start: Date): void; + setWeekDays(weekDays: WeekDays): void; + setWeekOfMonth(weekOfMonth: WeekOfMonth): void; + } + + class BootstrapSparkline extends Control { + exportTo(fileName: string, format: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapSparkline, args?: BootstrapSparklineEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapSparkline, args?: BootstrapSparklineEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapSparkline, args?: BootstrapSparklineEventMap[K]) => void): this; + } + interface BootstrapSparklineEventMap extends ControlEventMap { + "disposing": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "tooltipHidden": BootstrapChartEventArgsBase; + "tooltipShown": BootstrapChartEventArgsBase; + } + + class BootstrapTimeEdit extends BootstrapClientEdit { + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getDate(): Date; + getText(): string; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setDate(date: Date): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapTimeEdit, args?: BootstrapTimeEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTimeEdit, args?: BootstrapTimeEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTimeEdit, args?: BootstrapTimeEditEventMap[K]) => void): this; + } + interface BootstrapTimeEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "dateChanged": ProcessingModeEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapSpinEdit extends BootstrapClientEdit { + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getMaxValue(): number; + getMinValue(): number; + getNumber(): number; + getText(): string; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setMaxValue(value: number): void; + setMinValue(value: number): void; + setNumber(number: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + setValue(number: number): void; + on(eventName: K, callback: (this: BootstrapSpinEdit, args?: BootstrapSpinEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapSpinEdit, args?: BootstrapSpinEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapSpinEdit, args?: BootstrapSpinEditEventMap[K]) => void): this; + } + interface BootstrapSpinEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "numberChanged": ProcessingModeEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + interface TabControlTabEventArgs extends EventArgs { + readonly tab: BootstrapTab; + } + + interface TabControlTabCancelEventArgs extends ProcessingModeCancelEventArgs { + reloadContentOnCallback: boolean; + readonly tab: BootstrapTab; + } + + interface TabControlTabClickEventArgs extends TabControlTabCancelEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + } + + class BootstrapTabControl extends Control { + adjustSize(): void; + getActiveTab(): BootstrapTab | null; + getActiveTabIndex(): number; + getTab(index: number): BootstrapTab | null; + getTabByName(name: string): BootstrapTab | null; + getTabCount(): number; + setActiveTab(tab: BootstrapTab): void; + setActiveTabIndex(index: number): void; + on(eventName: K, callback: (this: BootstrapTabControl, args?: BootstrapTabControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTabControl, args?: BootstrapTabControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTabControl, args?: BootstrapTabControlEventMap[K]) => void): this; + } + interface BootstrapTabControlEventMap extends ControlEventMap { + "activeTabChanged": TabControlTabEventArgs; + "activeTabChanging": TabControlTabCancelEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "endCallback": EndCallbackEventArgs; + "tabClick": TabControlTabClickEventArgs; + } + + class BootstrapTab { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly name: string; + readonly tabControl: BootstrapTabControl | null; + getActiveIconCssClass(): string; + getActiveImageUrl(): string; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getEnabled(): boolean; + getIconCssClass(): string; + getImageUrl(): string; + getNavigateUrl(): string; + getText(): string; + getVisible(): boolean; + setActiveIconCssClass(cssClass: string): void; + setActiveImageUrl(value: string): void; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setEnabled(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + } + + class BootstrapPageControl extends BootstrapTabControl { + getActiveTab(): BootstrapTab | null; + getTab(index: number): BootstrapTab | null; + getTabByName(name: string): BootstrapTab | null; + getTabContentHTML(tab: BootstrapTab): string; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + setActiveTab(tab: BootstrapTab): void; + setTabContentHTML(tab: BootstrapTab, html: string): void; + on(eventName: K, callback: (this: BootstrapPageControl, args?: BootstrapPageControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPageControl, args?: BootstrapPageControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPageControl, args?: BootstrapPageControlEventMap[K]) => void): this; + } + interface BootstrapPageControlEventMap extends BootstrapTabControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapTagBox extends BootstrapClientEdit { + addItem(texts: string[]): number; + addItem(text: string): number; // tslint:disable-line:unified-signatures + addItem(texts: string[], value: any): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any): number; // tslint:disable-line:unified-signatures unified-signatures + addItem(texts: string[], value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures unified-signatures + addItemCssClass(index: number, className: string): void; + addItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + addTag(text: string): void; + adjustDropDownWindow(): void; + beginUpdate(): void; + clearItems(): void; + clearTagCollection(): void; + endUpdate(): void; + ensureDropDownLoaded(callbackFunction: any): void; + findItemByText(text: string): BootstrapListBoxItem | null; + findItemByValue(value: any): BootstrapListBoxItem | null; + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getItem(index: number): BootstrapListBoxItem | null; + getItemBadgeIconCssClass(index: number): string; + getItemBadgeText(index: number): string; + getItemCount(): number; + getSelectedIndex(): number; + getSelectedItem(): BootstrapListBoxItem | null; + getTagCollection(): string[]; + getTagHtmlElement(index: number): any; + getTagIndexByText(text: string): number; + getTagRemoveButtonHtmlElement(index: number): any; + getTagTextHtmlElement(index: number): any; + getText(): string; + getValue(): string; + hideDropDown(): void; + insertItem(index: number, texts: string[]): void; + insertItem(index: number, text: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, texts: string[], value: any): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any): void; // tslint:disable-line:unified-signatures unified-signatures + insertItem(index: number, texts: string[], value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures unified-signatures + isCustomTag(text: string, caseSensitive: boolean): boolean; + makeItemVisible(index: number): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + removeItem(index: number): void; + removeItemCssClass(index: number, className: string): void; + removeItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + removeTag(index: number): void; + removeTagByText(text: string): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setItemBadgeIconCssClass(index: number, cssClass: string): void; + setItemBadgeText(index: number, text: string): void; + setItemHtml(index: number, html: string): void; + setItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + setItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + setItemTooltip(index: number, tooltip: string): void; + setSelectedIndex(index: number): void; + setSelectedItem(item: BootstrapListBoxItem): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setTagCollection(collection: string[]): void; + setText(text: string): void; + setValue(value: string): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapTagBox, args?: BootstrapTagBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTagBox, args?: BootstrapTagBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTagBox, args?: BootstrapTagBoxEventMap[K]) => void): this; + } + interface BootstrapTagBoxEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "buttonClick": ButtonEditClickEventArgs; + "callbackError": CallbackErrorEventArgs; + "closeUp": EventArgs; + "customHighlighting": ListEditCustomHighlightingEventArgs; + "dropDown": EventArgs; + "endCallback": EndCallbackEventArgs; + "itemFiltering": ListEditItemFilteringEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "queryCloseUp": CancelEventArgs; + "selectedIndexChanged": ProcessingModeEventArgs; + "tagsChanged": EventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + interface ButtonEditClickEventArgs extends ProcessingModeEventArgs { + readonly buttonIndex: number; + } + + class BootstrapButtonEdit extends BootstrapClientEdit { + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getText(): string; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapButtonEdit, args?: BootstrapButtonEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapButtonEdit, args?: BootstrapButtonEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapButtonEdit, args?: BootstrapButtonEditEventMap[K]) => void): this; + } + interface BootstrapButtonEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapMemo extends BootstrapClientEdit { + getCaretPosition(): number; + getText(): string; + selectAll(): void; + setCaretPosition(position: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapMemo, args?: BootstrapMemoEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapMemo, args?: BootstrapMemoEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapMemo, args?: BootstrapMemoEventMap[K]) => void): this; + } + interface BootstrapMemoEventMap extends BootstrapClientEditEventMap { + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapTextBox extends BootstrapClientEdit { + getCaretPosition(): number; + getText(): string; + selectAll(): void; + setCaretPosition(position: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapTextBox, args?: BootstrapTextBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTextBox, args?: BootstrapTextBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTextBox, args?: BootstrapTextBoxEventMap[K]) => void): this; + } + interface BootstrapTextBoxEventMap extends BootstrapClientEditEventMap { + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapToolbar extends BootstrapMenu { + on(eventName: K, callback: (this: BootstrapToolbar, args?: BootstrapToolbarEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapToolbar, args?: BootstrapToolbarEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapToolbar, args?: BootstrapToolbarEventMap[K]) => void): this; + } + interface BootstrapToolbarEventMap extends BootstrapMenuEventMap { // tslint:disable-line:no-empty-interface + } + + interface TreeViewNodeProcessingModeEventArgs extends ProcessingModeEventArgs { + readonly node: BootstrapTreeViewNode; + } + + interface TreeViewNodeClickEventArgs extends TreeViewNodeProcessingModeEventArgs { + readonly htmlElement: any; + readonly htmlEvent: any; + } + + interface TreeViewNodeEventArgs extends EventArgs { + readonly node: BootstrapTreeViewNode; + } + + interface TreeViewNodeCancelEventArgs extends ProcessingModeCancelEventArgs { + readonly node: BootstrapTreeViewNode; + } + + class BootstrapTreeView extends Control { + collapseAll(): void; + expandAll(): void; + getNode(index: number): BootstrapTreeViewNode | null; + getNodeByName(name: string): BootstrapTreeViewNode | null; + getNodeByText(text: string): BootstrapTreeViewNode | null; + getNodeCount(): number; + getRootNode(): BootstrapTreeViewNode | null; + getSelectedNode(): BootstrapTreeViewNode | null; + setSelectedNode(node: BootstrapTreeViewNode): void; + on(eventName: K, callback: (this: BootstrapTreeView, args?: BootstrapTreeViewEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTreeView, args?: BootstrapTreeViewEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTreeView, args?: BootstrapTreeViewEventMap[K]) => void): this; + } + interface BootstrapTreeViewEventMap extends ControlEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "checkedChanged": TreeViewNodeProcessingModeEventArgs; + "endCallback": EndCallbackEventArgs; + "expandedChanged": TreeViewNodeEventArgs; + "expandedChanging": TreeViewNodeCancelEventArgs; + "nodeClick": TreeViewNodeClickEventArgs; + } + + class BootstrapTreeViewNode extends Control { + readonly index: number; + readonly name: string; + readonly parent: BootstrapTreeViewNode | null; + readonly treeView: BootstrapTreeView | null; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getCheckState(): string; + getChecked(): boolean; + getEnabled(): boolean; + getExpanded(): boolean; + getHtmlElement(): any; + getIconCssClass(): string; + getImageUrl(): string; + getNavigateUrl(): string; + getNode(index: number): BootstrapTreeViewNode | null; + getNodeByName(name: string): BootstrapTreeViewNode | null; + getNodeByText(text: string): BootstrapTreeViewNode | null; + getNodeCount(): number; + getText(): string; + getVisible(): boolean; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setChecked(value: boolean): void; + setEnabled(value: boolean): void; + setExpanded(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + on(eventName: K, callback: (this: BootstrapTreeViewNode, args?: BootstrapTreeViewNodeEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTreeViewNode, args?: BootstrapTreeViewNodeEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTreeViewNode, args?: BootstrapTreeViewNodeEventMap[K]) => void): this; + } + interface BootstrapTreeViewNodeEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + interface UploadControlFilesUploadStartEventArgs extends EventArgs { + readonly cancel: boolean; + } + + interface UploadControlFileUploadCompleteEventArgs extends EventArgs { + readonly callbackData: string; + readonly errorText: string; + readonly inputIndex: number; + readonly isValid: boolean; + } + + interface UploadControlFilesUploadCompleteEventArgs extends EventArgs { + readonly callbackData: string; + readonly errorText: string; + } + + interface UploadControlTextChangedEventArgs extends EventArgs { + readonly inputIndex: number; + } + + interface UploadControlUploadingProgressChangedEventArgs extends EventArgs { + readonly currentFileContentLength: number; + readonly currentFileName: string; + readonly currentFileProgress: number; + readonly currentFileUploadedContentLength: number; + readonly fileCount: number; + readonly progress: number; + readonly totalContentLength: number; + readonly uploadedContentLength: number; + } + + interface UploadControlValidationErrorOccurredEventArgs extends EventArgs { + errorText: string; + readonly invalidFiles: BootstrapUploadControlInvalidFileInfo[]; + showAlert: boolean; + readonly validationSettings: BootstrapUploadControlValidationSettings; + } + + interface UploadControlDropZoneEnterEventArgs extends EventArgs { + readonly dropZone: any; + } + + interface UploadControlDropZoneLeaveEventArgs extends EventArgs { + readonly dropZone: any; + } + + class BootstrapUploadControl extends Control { + addFileInput(): void; + cancel(): void; + clearText(): void; + getAddButtonText(): string; + getEnabled(): boolean; + getFileInputCount(): number; + getSelectedFiles(inputIndex: number): BootstrapUploadControlFile[]; + getText(index: number): string; + getUploadButtonText(): string; + removeFileFromSelection(fileIndex: number): void; + removeFileFromSelection(file: BootstrapUploadControlFile): void; // tslint:disable-line:unified-signatures + removeFileInput(index: number): void; + setAddButtonText(text: string): void; + setDialogTriggerID(ids: string): void; + setEnabled(enabled: boolean): void; + setFileInputCount(count: number): void; + setUploadButtonText(text: string): void; + upload(): void; + on(eventName: K, callback: (this: BootstrapUploadControl, args?: BootstrapUploadControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapUploadControl, args?: BootstrapUploadControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapUploadControl, args?: BootstrapUploadControlEventMap[K]) => void): this; + } + interface BootstrapUploadControlEventMap extends ControlEventMap { + "dropZoneEnter": UploadControlDropZoneEnterEventArgs; + "dropZoneLeave": UploadControlDropZoneLeaveEventArgs; + "fileInputCountChanged": EventArgs; + "fileUploadComplete": UploadControlFileUploadCompleteEventArgs; + "filesUploadComplete": UploadControlFilesUploadCompleteEventArgs; + "filesUploadStart": UploadControlFilesUploadStartEventArgs; + "textChanged": UploadControlTextChangedEventArgs; + "uploadingProgressChanged": UploadControlUploadingProgressChangedEventArgs; + "validationErrorOccurred": UploadControlValidationErrorOccurredEventArgs; + } + + class BootstrapUploadControlFile extends Control { + readonly name: string; + readonly size: number; + readonly sourceFileObject: any; + on(eventName: K, callback: (this: BootstrapUploadControlFile, args?: BootstrapUploadControlFileEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapUploadControlFile, args?: BootstrapUploadControlFileEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapUploadControlFile, args?: BootstrapUploadControlFileEventMap[K]) => void): this; + } + interface BootstrapUploadControlFileEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapUploadControlInvalidFileInfo extends Control { + readonly fileName: string; + readonly fileSize: number; + on(eventName: K, callback: (this: BootstrapUploadControlInvalidFileInfo, args?: + BootstrapUploadControlInvalidFileInfoEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapUploadControlInvalidFileInfo, + args?: BootstrapUploadControlInvalidFileInfoEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapUploadControlInvalidFileInfo, + args?: BootstrapUploadControlInvalidFileInfoEventMap[K]) => void): this; + } + interface BootstrapUploadControlInvalidFileInfoEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapUploadControlValidationSettings extends Control { + readonly allowedFileExtensions: string[]; + readonly invalidFileNameCharacters: string[]; + readonly maxFileCount: number; + readonly maxFileSize: number; + on(eventName: K, callback: (this: BootstrapUploadControlValidationSettings, + args?: BootstrapUploadControlValidationSettingsEventMap[K]) => void): this; + once(eventName: K, callback: (this: + BootstrapUploadControlValidationSettings, args?: BootstrapUploadControlValidationSettingsEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: + BootstrapUploadControlValidationSettings, args?: BootstrapUploadControlValidationSettingsEventMap[K]) => void): this; + } + interface BootstrapUploadControlValidationSettingsEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } +} diff --git a/types/devexpress-aspnetcore-bootstrap/tsconfig.json b/types/devexpress-aspnetcore-bootstrap/tsconfig.json new file mode 100644 index 0000000000..1131d37582 --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "devexpress-aspnetcore-bootstrap-tests.ts" + ] +} \ No newline at end of file diff --git a/types/devexpress-aspnetcore-bootstrap/tslint.json b/types/devexpress-aspnetcore-bootstrap/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From b4518ea734b64d0a486b07b8e5c68268834cc2f9 Mon Sep 17 00:00:00 2001 From: taoqf Date: Sat, 12 May 2018 15:30:51 +0800 Subject: [PATCH 11/62] upgrade jsreport-html-to-xlsx to 2.0 --- types/jsreport-html-to-xlsx/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/jsreport-html-to-xlsx/index.d.ts b/types/jsreport-html-to-xlsx/index.d.ts index 84b37480aa..83ac765c1f 100644 --- a/types/jsreport-html-to-xlsx/index.d.ts +++ b/types/jsreport-html-to-xlsx/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsreport-html-to-xlsx 1.4 +// Type definitions for jsreport-html-to-xlsx 2.0 // Project: https://github.com/jsreport/jsreport-html-to-xlsx // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,7 +8,9 @@ import { ExtensionDefinition } from 'jsreport-core'; import { Options as BaseOptions } from 'jsreport-xlsx'; declare module 'jsreport-core' { + type htmlEngine = 'phantom' | 'chrome'; interface Template { + htmlToXlsx: { htmlEngine: htmlEngine; }; recipe: 'html-to-xlsx' | string; } } From 92c29516cf7f91ffabe35199a411b46581038fef Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Mon, 14 May 2018 16:53:24 -0700 Subject: [PATCH 12/62] Fix stripe ICharge interface with missing fields and optional null values --- types/stripe/index.d.ts | 89 ++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 418525d38f..884cbacc06 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -8,6 +8,7 @@ // Kyle Kamperschroer // Kensuke Hoshikawa // Thomas Bruun +// Gal Talmor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -737,12 +738,17 @@ declare namespace Stripe { * charge if a partial refund was issued), positive integer or zero. */ amount_refunded: number; + + /** + * ID of the Connect application that created the charge. [Expandable] + */ + application?: string | null; /** * The application fee (if any) for the charge. See the Connect documentation * for details. [Expandable] */ - application_fee?: string | applicationFees.IApplicationFee; + application_fee?: string | applicationFees.IApplicationFee | null; /** * ID of the balance transaction that describes the impact of this charge on @@ -767,25 +773,33 @@ declare namespace Stripe { /** * ID of the customer this charge is for if one exists. [Expandable] */ - customer: string | customers.ICustomer; + customer: string | customers.ICustomer | null; description?: string; + /** + * The account (if any) the charge was made on behalf of, with an automatic + * transfer. See the [Connect documentation] + * for details. + * [Expandable] + */ + destination?: string | null; + /** * Details about the dispute if the charge has been disputed. */ - dispute?: disputes.IDispute; + dispute?: disputes.IDispute | null; /** * Error code explaining reason for charge failure if available (see the errors section for a list of * codes: https://stripe.com/docs/api#errors). */ - failure_code: string; + failure_code: string | null; /** * Message to user further explaining reason for charge failure if available. */ - failure_message: string; + failure_message: string | null; /** * Hash with information on fraud assessments for the charge. @@ -805,16 +819,30 @@ declare namespace Stripe { /** * ID of the invoice this charge is for if one exists. [Expandable] */ - invoice: string | invoices.IInvoice; + invoice: string | invoices.IInvoice | null; livemode: boolean; metadata: IMetadata; + /** + * The Stripe account ID for which these funds are intended. Automatically + * set if you use the destination parameter. For details, see [Creating + * Separate Charges and Transfers] + * . + */ + on_behalf_of?: string | null; + /** * ID of the order this charge is for if one exists. [Expandable] */ - order: string | orders.IOrder; + order: string | orders.IOrder | null; + + /** + * Details about whether the payment was accepted, and why. See + * understanding declines for details. [Expandable] + */ + outcome?: any; /** * true if the charge succeeded, or was successfully authorized for later capture. @@ -824,12 +852,12 @@ declare namespace Stripe { /** * This is the email address that the receipt for this charge was sent to. */ - receipt_email: string; + receipt_email: string | null; /** * This is the transaction number that appears on email receipts sent for this charge. */ - receipt_number: string; + receipt_number: string | null; /** * Whether or not the charge has been fully refunded. If the charge is only partially refunded, @@ -842,10 +870,15 @@ declare namespace Stripe { */ refunds: IChargeRefunds; + /** + * ID of the review associated with this charge if one exists. [Expandable] + */ + review?: string | null; + /** * Shipping information for the charge. */ - shipping?: IShippingInformation; + shipping?: IShippingInformation | null; /** * For most Stripe users, the source of every charge is a credit or debit card. @@ -858,13 +891,13 @@ declare namespace Stripe { * from another Stripe account. See the Connect documentation for details. * [Expandable] */ - source_transfer: string | transfers.ITransfer; + source_transfer: string | transfers.ITransfer | null; /** * Extra information about a charge. This will appear on your customer’s * credit card statement. */ - statement_descriptor: string; + statement_descriptor: string | null; /** * The status of the payment is either "succeeded", "pending", or "failed". @@ -875,7 +908,15 @@ declare namespace Stripe { * ID of the transfer to the destination account (only applicable if the * charge was created using the destination parameter). [Expandable] */ - transfer: string | transfers.ITransfer; + transfer?: string | transfers.ITransfer; + + /** + * A string that identifies this transaction as part of a group. + * See the [Connect documentation] + * + * for details. + */ + transfer_group?: string | null; } interface IChargeCreationOptions extends IDataOptionsWithMetadata { @@ -1056,7 +1097,7 @@ declare namespace Stripe { } } - interface IChargeRefunds extends IList, resources.ChargeRefunds { } + interface IChargeRefunds extends IList { } } namespace coupons { @@ -4086,7 +4127,7 @@ declare namespace Stripe { * in the card object if the card belongs to an account or recipient * instead. */ - customer?: string | customers.ICustomer; + customer?: string | customers.ICustomer | null; /** * Only applicable on accounts (not customers or recipients). This @@ -4120,7 +4161,7 @@ declare namespace Stripe { /** * The card number */ - number: string; + number?: string; /** * Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown. @@ -4134,20 +4175,20 @@ declare namespace Stripe { */ funding: "credit" | "debit" | "prepaid" | "unknown"; last4: string; - address_city: string; + address_city: string | null; /** * Billing address country, if provided when creating card */ - address_country: string; - address_line1: string; + address_country: string | null; + address_line1: string | null; /** * If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked. */ - address_line1_check: string; - address_line2: string; - address_state: string; + address_line1_check: string | null; + address_line2: string | null; + address_state: string | null; address_zip: string; /** @@ -4169,7 +4210,7 @@ declare namespace Stripe { /** * (For Apple Pay integrations only.) The last four digits of the device account number. */ - dynamic_last4: string; + dynamic_last4: string | null; /** * Cardholder name @@ -4188,7 +4229,7 @@ declare namespace Stripe { * If the card number is tokenized, this is the method that was * used. Can be "apple_pay" or "android_pay". */ - tokenization_method: "apple_pay" | "android_pay"; + tokenization_method: "apple_pay" | "android_pay" | null; } interface ICardUpdateOptions extends IDataOptionsWithMetadata { From 06caab2123387d471212f59a470754da1b8e3a46 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Mon, 14 May 2018 17:11:48 -0700 Subject: [PATCH 13/62] Fix stripe ICharge interface with missing fields and optional null values --- types/stripe/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 884cbacc06..496ae404f0 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1097,7 +1097,7 @@ declare namespace Stripe { } } - interface IChargeRefunds extends IList { } + interface IChargeRefunds extends IList, resources.ChargeRefunds { } } namespace coupons { @@ -5423,18 +5423,18 @@ declare namespace Stripe { * Once entirely refunded, a charge can't be refunded again. * This method will throw an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge. */ - create(data: refunds.IRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - create(data: refunds.IRefundCreationOptions, response?: IResponseFn): Promise; - create(options: HeaderOptions, response?: IResponseFn): Promise; - create(response?: IResponseFn): Promise; + create?(data: refunds.IRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + create?(data: refunds.IRefundCreationOptions, response?: IResponseFn): Promise; + create?(options: HeaderOptions, response?: IResponseFn): Promise; + create?(response?: IResponseFn): Promise; /** * Retrieves the details of an existing refund. */ - retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; - retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; - retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; - retrieve(id: string, response?: IResponseFn): Promise; + retrieve?(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; + retrieve?(id: string, data: IDataOptions, response?: IResponseFn): Promise; + retrieve?(id: string, options: HeaderOptions, response?: IResponseFn): Promise; + retrieve?(id: string, response?: IResponseFn): Promise; /** @@ -5443,18 +5443,18 @@ declare namespace Stripe { * * This request only accepts metadata as an argument. */ - update(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; - update(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; + update?(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; + update?(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; /** * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, * with the most recent refunds appearing first. * For convenience, the 10 most recent refunds are always available by default on the charge object. */ - list(data: refunds.IRefundListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - list(data: refunds.IRefundListOptions, response?: IResponseFn>): Promise>; - list(options: HeaderOptions, response?: IResponseFn>): Promise>; - list(response?: IResponseFn>): Promise>; + list?(data: refunds.IRefundListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + list?(data: refunds.IRefundListOptions, response?: IResponseFn>): Promise>; + list?(options: HeaderOptions, response?: IResponseFn>): Promise>; + list?(response?: IResponseFn>): Promise>; } class Coupons extends StripeResource { From 20d62b5477c55888a6e22e7a6e56cfe0d4101aa7 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 16 May 2018 11:12:01 +1000 Subject: [PATCH 14/62] Fixed indentation --- types/react-calendar-timeline/index.d.ts | 118 +++++++++++------------ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 86c79ca7ae..26a3df52cd 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for react-calendar-timeline v0.15.12 // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov -// Alex Maclean +// Alex Maclean // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -9,7 +9,7 @@ declare module "react-calendar-timeline" { - export interface TimelineGroup { + export interface TimelineGroup { id: number; title: React.ReactNode; } @@ -33,63 +33,63 @@ declare module "react-calendar-timeline" { } export interface ReactCalendarTimelineProps { - groups: TimelineGroup[]; - items: TimelineItem[]; - keys?:{ - groupIdKey: string; - groupTitleKey: string; - itemIdKey: string; - itemTitleKey: string; - itemGroupKey: string; - itemTimeStartKey: string; - itemTimeEndKey: string; - }; - selected?: number[]; - sidebarWidth?: number; - sidebarContent?: any; - rightSidebarWidth?: number; - rightSidebarContent?: any; - dragSnap?: number; - minResizeWidth?: number; - stickyOffset?: number; - stickyHeader?: boolean; - headerRef?: any; - lineHeight?: number; - headerLabelGroupHeight?: number; - headerLabelHeight?: number; - itemHeightRatio?: number; - minZoom?: number; - maxZoom?: number; - clickTolerance?: number; - canMove?: boolean; - canChangeGroup?: boolean; - canResize?: boolean; - useResizeHandle?: boolean; - showCursorLine?: boolean; - stackItems?: boolean; - traditionalZoom?: boolean; - itemTouchSendsClick?: boolean; - onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; - onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; - onItemSelect?(itemId:number, e: any, time: number): any; - onItemClick?(itemId:number, e: any, time: number): any; - onItemDoubleClick?(itemId:number, e: any, time: number): any; - onCanvasClick?(groupId:number, time:number, e:any): any; - onCanvasDoubleClick?(groupId:number, time:number, e:any): any; - moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; - defaultTimeStart?: any; - defaultTimeEnd?: any; - visibleTimeStart?: number; - visibleTimeEnd?: number; - onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; - onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; - onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; - onZoom?(timelineContext: TimelineContext): any; - children?: any; - fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; - minimumWidthForItemContentVisibility?: number; + groups: TimelineGroup[]; + items: TimelineItem[]; + keys?:{ + groupIdKey: string; + groupTitleKey: string; + itemIdKey: string; + itemTitleKey: string; + itemGroupKey: string; + itemTimeStartKey: string; + itemTimeEndKey: string; + }; + selected?: number[]; + sidebarWidth?: number; + sidebarContent?: any; + rightSidebarWidth?: number; + rightSidebarContent?: any; + dragSnap?: number; + minResizeWidth?: number; + stickyOffset?: number; + stickyHeader?: boolean; + headerRef?: any; + lineHeight?: number; + headerLabelGroupHeight?: number; + headerLabelHeight?: number; + itemHeightRatio?: number; + minZoom?: number; + maxZoom?: number; + clickTolerance?: number; + canMove?: boolean; + canChangeGroup?: boolean; + canResize?: boolean; + useResizeHandle?: boolean; + showCursorLine?: boolean; + stackItems?: boolean; + traditionalZoom?: boolean; + itemTouchSendsClick?: boolean; + onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; + onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; + onItemSelect?(itemId:number, e: any, time: number): any; + onItemClick?(itemId:number, e: any, time: number): any; + onItemDoubleClick?(itemId:number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onCanvasDoubleClick?(groupId:number, time:number, e:any): any; + moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; + defaultTimeStart?: any; + defaultTimeEnd?: any; + visibleTimeStart?: number; + visibleTimeEnd?: number; + onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; + onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; + onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + onZoom?(timelineContext: TimelineContext): any; + children?: any; + fullUpdate?: boolean; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; + minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; From 6b80387511b4e4ab007305dd1f8bc3eafb397796 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 16 May 2018 16:03:37 +1000 Subject: [PATCH 15/62] Fixed typing. --- types/react-calendar-timeline/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 26a3df52cd..d5643d0e2a 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -87,8 +87,8 @@ declare module "react-calendar-timeline" { onZoom?(timelineContext: TimelineContext): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>;; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>;; minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; From 6d9d52c150e170c5a5f2ed01d04c2d93022bf73f Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 16 May 2018 16:29:00 +1000 Subject: [PATCH 16/62] Fat fingers. --- types/react-calendar-timeline/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index d5643d0e2a..8c523e68c6 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -87,8 +87,8 @@ declare module "react-calendar-timeline" { onZoom?(timelineContext: TimelineContext): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>;; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>;; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>; minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; From 4e412e57ededaa6382b402208ebcddf9a0b8a771 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:09:29 +0200 Subject: [PATCH 17/62] Typings for intl-locales-supported --- types/intl-locales-supported/index.d.ts | 6 +++++ .../intl-locales-supported-tests.ts | 4 ++++ types/intl-locales-supported/tsconfig.json | 23 +++++++++++++++++++ types/intl-locales-supported/tslint.json | 1 + 4 files changed, 34 insertions(+) create mode 100644 types/intl-locales-supported/index.d.ts create mode 100644 types/intl-locales-supported/intl-locales-supported-tests.ts create mode 100644 types/intl-locales-supported/tsconfig.json create mode 100644 types/intl-locales-supported/tslint.json diff --git a/types/intl-locales-supported/index.d.ts b/types/intl-locales-supported/index.d.ts new file mode 100644 index 0000000000..1ad51f1f6c --- /dev/null +++ b/types/intl-locales-supported/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for intl-locales-supported 1.0 +// Project: https://github.com/yahoo/intl-locales-supported +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function areIntlLocalesSupported(locales: string | string[]): void; diff --git a/types/intl-locales-supported/intl-locales-supported-tests.ts b/types/intl-locales-supported/intl-locales-supported-tests.ts new file mode 100644 index 0000000000..dcddcd545d --- /dev/null +++ b/types/intl-locales-supported/intl-locales-supported-tests.ts @@ -0,0 +1,4 @@ +import areIntlLocalesSupported from "intl-locales-supported"; + +areIntlLocalesSupported("en-GB"); +areIntlLocalesSupported([ "en-GB", "en-US" ]); diff --git a/types/intl-locales-supported/tsconfig.json b/types/intl-locales-supported/tsconfig.json new file mode 100644 index 0000000000..f528331ae4 --- /dev/null +++ b/types/intl-locales-supported/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "intl-locales-supported-tests.ts" + ] +} diff --git a/types/intl-locales-supported/tslint.json b/types/intl-locales-supported/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intl-locales-supported/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0d02c685c52f6042f9189d9c498f7f551a0a6711 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:15:57 +0200 Subject: [PATCH 18/62] Update index.d.ts Update maintainer name --- types/intl-locales-supported/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/intl-locales-supported/index.d.ts b/types/intl-locales-supported/index.d.ts index 1ad51f1f6c..b156905fdf 100644 --- a/types/intl-locales-supported/index.d.ts +++ b/types/intl-locales-supported/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for intl-locales-supported 1.0 // Project: https://github.com/yahoo/intl-locales-supported -// Definitions by: My Self +// Definitions by: Edward Sammut Alessi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export default function areIntlLocalesSupported(locales: string | string[]): void; From d2a9d45da2402d3ab6fd57173ba6747ab3fba4cb Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Wed, 16 May 2018 21:48:18 -0700 Subject: [PATCH 19/62] Fix stripe ICharge interface with missing fields and optional null values --- types/stripe/index.d.ts | 105 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 100 insertions(+), 5 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 496ae404f0..959cfe76ef 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -482,7 +482,7 @@ declare namespace Stripe { /** * ID of the Connect Application that earned the fee. [Expandable] */ - application: string; //TODO: Implement IApplication interface and reference type here for expansion:- "string | IApplication" + application: string | applications.IApplication; /** * Balance transaction that describes the impact of this collected application @@ -742,7 +742,7 @@ declare namespace Stripe { /** * ID of the Connect application that created the charge. [Expandable] */ - application?: string | null; + application?: string | applications.IApplication | null; /** * The application fee (if any) for the charge. See the Connect documentation @@ -783,7 +783,7 @@ declare namespace Stripe { * for details. * [Expandable] */ - destination?: string | null; + destination?: string | accounts.IAccount | null; /** * Details about the dispute if the charge has been disputed. @@ -842,7 +842,7 @@ declare namespace Stripe { * Details about whether the payment was accepted, and why. See * understanding declines for details. [Expandable] */ - outcome?: any; + outcome?: charges.IOutcome; /** * true if the charge succeeded, or was successfully authorized for later capture. @@ -873,7 +873,7 @@ declare namespace Stripe { /** * ID of the review associated with this charge if one exists. [Expandable] */ - review?: string | null; + review?: string | reviews.IReview | null; /** * Shipping information for the charge. @@ -1097,6 +1097,48 @@ declare namespace Stripe { } } + interface IOutcome { + /** + * The value reversed_after_approval indicates the payment was blocked by Stripe after + * bank authorization, and may temporarily appear as “pending” on a cardholder’s statement. + */ + network_status: "approved_by_network" | "declined_by_network" | "not_sent_to_network" | "reversed_after_approval"; + + /** + * An enumerated value providing a more detailed explanation of the outcome’s type. Charges + * blocked by Radar’s default block rule have the value highest_risk_level. Charges placed + * in review by Radar’s default review rule have the value elevated_risk_level. Charges + * authorized, blocked, or placed in review by custom rules have the value rule. See + * understanding declines for more details. + */ + reason: string | null; + + /** + * Stripe’s evaluation of the riskiness of the payment. Possible values for evaluated + * payments are normal, elevated, highest. For non-card payments, and card-based payments + * predating the public assignment of risk levels, this field will have the value not_assessed. + * In the event of an error in the evaluation, this field will have the value unknown. + */ + risk_level?: string | null; + + /** + * The ID of the Radar rule that matched the payment, if applicable. [Expandable] + */ + rule?: string | string[] | null; + + /** + * See [understanding declines] and + * [Radar reviews] for details. + */ + type: "authorized" | "manual_review" | "issuer_declined" | "blocked" | "invalid"; + + /** + * A human-readable description of the outcome type and reason, designed for you (the + * recipient of the payment), not your customer. + */ + seller_message: string; + } + interface IChargeRefunds extends IList, resources.ChargeRefunds { } } @@ -4979,6 +5021,59 @@ declare namespace Stripe { } } + namespace reviews { + interface IReview extends IResourceObject { + /** + * Unique identifier for the object. + */ + "id": string; + + /** + * String representing the object’s type. Objects of the same type share the same value. + */ + "object": "review"; + + /** + * The charge associated with this review. [Expandable] + */ + "charge": string | charges.ICharge; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + "created": number; + + /** + * Has the value true if the object exists in live mode or the value false if the object exists in test mode. + */ + "livemode": false; + + /** + * If true, the review needs action. + */ + "open": true; + + /** + * The reason the review is currently open or closed. + */ + "reason": "rule" | "manual" | "approved" | "refunded" | "refunded_as_fraud" | "disputed"; + } + } + + namespace applications { + interface IApplication extends IResourceObject { + /** + * String representing the object’s type. Objects of the same type share the same value. + */ + "object": "application"; + + /** + * String representing the application’s name. + */ + "name": string; + } + } + class StripeResource { constructor(stripe: Stripe, urlData: any); } From 8a498aace206e32578d0a32318060d2506575cb0 Mon Sep 17 00:00:00 2001 From: "skubarenko.andrey" Date: Thu, 17 May 2018 10:53:21 +0300 Subject: [PATCH 20/62] Add a github id --- types/devexpress-aspnetcore-bootstrap/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/devexpress-aspnetcore-bootstrap/index.d.ts b/types/devexpress-aspnetcore-bootstrap/index.d.ts index 9422ccd2f7..51d1c2ebb4 100644 --- a/types/devexpress-aspnetcore-bootstrap/index.d.ts +++ b/types/devexpress-aspnetcore-bootstrap/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for DevExpress ASP.NET 181.3 // Project: http://devexpress.com/ // Definitions by: DevExpress Inc. +// Andrey Skubarenko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 From 6bb4375444a8f1a1f49a315ff4d4822fd1c1291c Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 17 May 2018 09:46:35 -0700 Subject: [PATCH 21/62] [qrcode] QRCode.toString() supports render opts --- types/qrcode/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index c04a07c20f..aa0ef1ca92 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -40,7 +40,7 @@ export interface QRCodeToDataURLOptions extends QRCodeRenderersOptions { }; } -export interface QRCodeToStringOptions extends QRCodeOptions { +export interface QRCodeToStringOptions extends QRCodeRenderersOptions { /** * Output format. * Default: utf8 From cd7c1bdbfe0b6710d10b4a9e4c8b96361737cece Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 17 May 2018 09:53:19 -0700 Subject: [PATCH 22/62] [qrcode] Update version number --- types/qrcode/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index aa0ef1ca92..1bf0a13454 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for qrcode 0.8.2 +// Type definitions for qrcode 1.2.0 // Project: https://github.com/soldair/node-qrcode // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 5b1307fcc1e03e5bb10d61237197e88a9ad9e360 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Thu, 17 May 2018 10:44:36 -0700 Subject: [PATCH 23/62] Fix stripe ICharge interface with missing fields and optional null values --- types/stripe/index.d.ts | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 959cfe76ef..357d855570 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -5023,40 +5023,35 @@ declare namespace Stripe { namespace reviews { interface IReview extends IResourceObject { - /** - * Unique identifier for the object. - */ - "id": string; - /** * String representing the object’s type. Objects of the same type share the same value. */ - "object": "review"; + object: "review"; /** * The charge associated with this review. [Expandable] */ - "charge": string | charges.ICharge; + charge: string | charges.ICharge; /** * Time at which the object was created. Measured in seconds since the Unix epoch. */ - "created": number; + created: number; /** * Has the value true if the object exists in live mode or the value false if the object exists in test mode. */ - "livemode": false; + livemode: boolean; /** * If true, the review needs action. */ - "open": true; + open: boolean; /** * The reason the review is currently open or closed. */ - "reason": "rule" | "manual" | "approved" | "refunded" | "refunded_as_fraud" | "disputed"; + reason: "rule" | "manual" | "approved" | "refunded" | "refunded_as_fraud" | "disputed"; } } @@ -5065,12 +5060,12 @@ declare namespace Stripe { /** * String representing the object’s type. Objects of the same type share the same value. */ - "object": "application"; + object: "application"; /** * String representing the application’s name. */ - "name": string; + name: string; } } From e803cee3d3fe4a2e7de8cc9d0ecdc383f0ad668e Mon Sep 17 00:00:00 2001 From: Ali Afroozeh Date: Thu, 17 May 2018 23:36:24 +0200 Subject: [PATCH 24/62] Update EventSource definitions to be compatible with lib.es6.d.ts --- types/eventsource/eventsource-tests.ts | 26 +++++++++++++------ types/eventsource/index.d.ts | 18 +++++++------ .../lib/eventsource-polyfill/index.d.ts | 15 ++++++----- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/types/eventsource/eventsource-tests.ts b/types/eventsource/eventsource-tests.ts index 62f867926f..3cef9cfc78 100644 --- a/types/eventsource/eventsource-tests.ts +++ b/types/eventsource/eventsource-tests.ts @@ -1,17 +1,27 @@ import EventSource = require("eventsource"); const eventSource = new EventSource("http://foobar"); -eventSource.onmessage = (x: any) => {}; -eventSource.onerror = (x: any) => {}; -eventSource.onopen = (x: any) => {}; -eventSource.addEventListener = (type: string, x: any) => {}; +let readyState: number = eventSource.readyState; +let url: string = eventSource.url; +let withCredentials: boolean = eventSource.withCredentials; +eventSource.onmessage = (event: Event) => {}; +eventSource.onerror = (event: Event) => {}; +eventSource.onopen = (event: Event) => {}; +eventSource.addEventListener = (type: string, listener: (e: Event) => void) => {}; +eventSource.dispatchEvent = (event: Event) => true; +eventSource.removeEventListener = (type: string, listener: (e: Event) => void) => {}; eventSource.close(); import EventSourcePolyfill = require("eventsource/lib/eventsource-polyfill"); const eventSourcePolyfill = new EventSourcePolyfill("http://foobar"); -eventSourcePolyfill.onmessage = (x: any) => {}; -eventSourcePolyfill.onerror = (x: any) => {}; -eventSourcePolyfill.onopen = (x: any) => {}; -eventSourcePolyfill.addEventListener = (type: string, x: any) => {}; +readyState = eventSourcePolyfill.readyState; +url = eventSourcePolyfill.url; +withCredentials = eventSource.withCredentials; +eventSourcePolyfill.onmessage = (event: Event) => {}; +eventSourcePolyfill.onerror = (event: Event) => {}; +eventSourcePolyfill.onopen = (event: Event) => {}; +eventSourcePolyfill.addEventListener = (type: string, listener: (e: Event) => void) => {}; +eventSourcePolyfill.dispatchEvent = (event: Event) => true; +eventSourcePolyfill.removeEventListener = (type: string, listener: (e: Event) => void) => {}; eventSourcePolyfill.close(); diff --git a/types/eventsource/index.d.ts b/types/eventsource/index.d.ts index 62859d037b..613745e7a5 100644 --- a/types/eventsource/index.d.ts +++ b/types/eventsource/index.d.ts @@ -1,22 +1,24 @@ // Type definitions for eventsource 1.0 // Project: http://github.com/EventSource/eventsource // Definitions by: Scott Lee Davis +// Ali Afroozeh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.8 declare class EventSource { constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict); - - static CLOSED: EventSource.ReadyState; - static CONNECTING: EventSource.ReadyState; - static OPEN: EventSource.ReadyState; - - url: string; - readyState: EventSource.ReadyState; + readonly CLOSED: number; + readonly CONNECTING: number; + readonly OPEN: number; + readonly url: string; + readonly readyState: number; + readonly withCredentials: boolean; onopen: EventListener; onmessage: EventListener; onerror: EventListener; addEventListener(type: string, listener: EventListener): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListener): void; close(): void; } diff --git a/types/eventsource/lib/eventsource-polyfill/index.d.ts b/types/eventsource/lib/eventsource-polyfill/index.d.ts index 3e4ad378e4..1d4347d0aa 100644 --- a/types/eventsource/lib/eventsource-polyfill/index.d.ts +++ b/types/eventsource/lib/eventsource-polyfill/index.d.ts @@ -1,16 +1,17 @@ declare class EventSource { constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict); - - static CLOSED: EventSource.ReadyState; - static CONNECTING: EventSource.ReadyState; - static OPEN: EventSource.ReadyState; - - url: string; - readyState: EventSource.ReadyState; + readonly CLOSED: number; + readonly CONNECTING: number; + readonly OPEN: number; + readonly url: string; + readonly readyState: number; + readonly withCredentials: boolean; onopen: EventListener; onmessage: EventListener; onerror: EventListener; addEventListener(type: string, listener: EventListener): void; + dispatchEvent(evt: Event): boolean; + removeEventListener(type: string, listener?: EventListener): void; close(): void; } From 9c401045a8fbf603c6b4f4035009eb40378ad892 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Fri, 18 May 2018 01:15:32 +0100 Subject: [PATCH 25/62] Initial re-base@3.x type definitions --- types/re-base/index.d.ts | 567 +++++++++++++++++++++++++++++++++ types/re-base/re-base-tests.ts | 9 + types/re-base/tsconfig.json | 22 ++ types/re-base/tslint.json | 1 + 4 files changed, 599 insertions(+) create mode 100644 types/re-base/index.d.ts create mode 100644 types/re-base/re-base-tests.ts create mode 100644 types/re-base/tsconfig.json create mode 100644 types/re-base/tslint.json diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts new file mode 100644 index 0000000000..928bca7c47 --- /dev/null +++ b/types/re-base/index.d.ts @@ -0,0 +1,567 @@ +// Type definitions for re-base 3.2 +// Project: https://github.com/tylermcginnis/re-base#readme +// Definitions by: jordandrako +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface QueryOptions {} + +interface RebaseBinding {} + +declare namespace firebase { + +} + +declare namespace firebase.app { + interface App {} +} + +declare namespace firebase.database { + interface Database {} +} + +declare namespace firebase.firestore { + class Firestore {} +} + +declare namespace rebase { + interface SyncStateOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar`. + */ + state: string; + + /** + * A default value to set when the Firebase endpoint has no value (i.e., on init) (use this if you want a value other than an empty object or empty array) + */ + defaultValue?: string | boolean | number | {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * Will keep any firebase generated keys intact when manipulating data using the asArray option. + */ + keepKeys?: boolean; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + + /** + * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with syncState) to change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does not have read or write permissions at the location. + */ + onFailure?: () => void; + } + + interface BindToStateOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar` (no arrays). + */ + state: string; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + + /** + * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with bindToState) to change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does not have read permissions at the location. + */ + onFailure?: () => void; + } + + interface ListenToOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. + */ + then: (result: any) => void; + + /** + * The callback function that will be invoked if the current user does not have read permissions at the location. + */ + onFailure?: (error: any) => void; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + } + + interface FetchOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. + */ + then?: (result: any) => void; + + /** + * The callback function that will be invoked with an error that occurs reading data from the specified endpoint. + */ + onFailure?: () => void; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + } + + interface PostOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. + */ + then?: (result: any) => void; + } + + interface PushOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. + */ + then?: (result: any) => void; + } + + interface UpdateOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. + */ + then?: (result: any) => void; + } + + interface DocumentReference {} + + interface CollectionReference {} + + interface bindDocOptions { + /** + * Your react component. + */ + context: {}; + + /** + * A property name on your state to bind your document to, if omitted the document will be merged into your existing state. + */ + state?: string; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface listenToDocOptions { + /** + * Your react component. + */ + context: {}; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface bindCollectionOptions { + /** + * Your react component. + */ + context: {}; + + /** + * The state property to bind the collection to. + */ + state?: string; + + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface listenToCollectionOptions { + /** + * Your react component. + */ + context: {}; + + /** + * A callback that will be called with the data. + */ + then: () => void; + + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface getOptions { + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your collection on the `ref` property. + */ + withRefs?: boolean; + } + + interface removeFromCollectionOptions { + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + } + + interface syncDocOptions { + /** + * Your react component. + */ + context: {}; + + /** + * The state property to sync. + */ + state: string; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface Rebase { + /** + * This property contains the initialized firebase app that was passed into re-base. You can access any of the firebase services that you are using off this object. For instance, if you want to use some firebase database methods that re-base doesn't have helpers for or if you are using the auth service and want to quickly access it off of re-base. + */ + initializedApp: firebase.app.App; + + /** + * This property contains an object that you can use when adding data that will be converted to a timestamp by Firebase. See [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) for more info. + */ + timestamp: {}; + + /** + * Allows you to set up two way data binding between your component's state and your Firebase. Whenever your Firebase changes, your component's state will change. Whenever your component's state changes, Firebase will change. + * @param endpoint The relative Firebase endpoint to which you'd like to bind your component's state. + * @param options syncState Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + syncState(endpoint: string, options: SyncStateOptions): RebaseBinding; + + /** + * One way data binding from Firebase to your component's state. Allows you to bind a component's state property to a Firebase endpoint so whenever that Firebase endpoint changes, your component's state will be updated with that change. + * @param endpoint The relative Firebase endpoint that you'd like to bind to your component's state. + * @param options bindToState Options. + * @returns An object which you can pass to removeBinding if you want to remove the listener while the component is still mounted. + */ + bindToState( + endpoint: string, + options: BindToStateOptions + ): RebaseBinding; + + /** + * Allows you to listen to Firebase endpoints without binding those changes to a state property. Instead, a callback will be invoked with the newly updated data. + * @param endpoint The relative Firebase endpoint which contains the data with which you'd like to invoke your callback function. + * @param options listenTo Options. + * @returns An object which you can pass to removeBinding when your component unmounts to remove the Firebase listeners. + */ + listenTo(endpoint: string, options: ListenToOptions): RebaseBinding; + + /** + * Allows you to retrieve the data from a Firebase endpoint just once without subscribing or listening for data changes. + * @param endpoint The relative Firebase endpoint which contains the data you're wanting to fetch. + * @param options fetch Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + fetch(endpoint: string, options: FetchOptions): Promise; + + /** + * Allows you to update a Firebase endpoint with new data. *Replace all the data at this endpoint with the new data*. + * @param endpoint The relative Firebase endpoint that you'd like to update with the new data. + * @param options post Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + post(endpoint: string, options: PostOptions): Promise; + + /** + * Allows you to add data to a Firebase endpoint. *Adds data to a child of the endpoint with a new Firebase push key*. + * @param endpoint The relative Firebase endpoint that you'd like to push the new data to. + * @param options push Options. + * @returns A Firebase [ThenableReference](https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference) which is defined by Firebase as a "Combined Promise and reference; resolves when write is complete, but can be used immediately as the reference to the child location." + */ + push(endpoint: string, options: PushOptions): Promise; + + /** + * Allows you to update data at a Firebase endpoint changing only the properties you pass to it. **Warning: calling update with `options.data` being null will remove all the data at that endpoint**. + * @param endpoint The relative Firebase endpoint that you'd like to update. + * @param options update Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + update(endpoint: string, options: UpdateOptions): Promise; + + /** + * Allows you to delete all data at the endpoint location. + * @param endpoint The relative Firebase endpoint that you'd like to delete data from. + * @param callback A callback that will get invoked once the data is successfully removed Firebase. If there is an error, it will be the only argument to this function. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + remove( + endpoint: string, + callback?: (result: Promise) => void + ): Promise; + + /** + * Bind a document to your component. When then document changes in firestore, your component will re-render with the latest data. + * @param refOrPath DocumentReference or path. + * @param options bindDoc Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + bindDoc( + refOrPath: DocumentReference | string, + options: bindDocOptions + ): RebaseBinding; + + /** + * Listen to a document, when the data changes it will invoke a callback passing it the new data from Firestore. + * @param refOrPath DocumentReference or path. + * @param options listenToDoc Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + listenToDoc( + refOrPath: DocumentReference | string, + options: listenToDocOptions + ): RebaseBinding; + + /** + * Bind a collection to a state property in your component. When then collection changes in firestore, your component will re-render with the latest data. + * @param refOrPath CollectionReference or path. + * @param options bindCollection Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + bindCollection( + refOrPath: CollectionReference | string, + options: bindCollectionOptions + ): RebaseBinding; + + /** + * Listen to a collection, when the data changes it will invoke a callback passing it the new data from Firestore. + * @param refOrPath CollectionReference or path. + * @param options listenToCollection Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + listenToCollection( + refOrPath: CollectionReference | string, + options: listenToCollectionOptions + ): RebaseBinding; + + /** + * Fetch either a Collection or Document. + * @param refOrPath CollectionReference, DocumentReference or path. + * @param options get Options. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + get( + refOrPath: CollectionReference | DocumentReference | string, + options: listenToCollectionOptions + ): Promise; + + /** + * Add a new Document to a Collection. + * @param refOrPath CollectionReference or path. + * @param data The document data. + * @param id The id for the document. If omitted, the Firestore will generate an id for you. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + addToCollection( + refOrPath: CollectionReference | string, + data: {}, + id?: string + ): Promise; + + /** + * Update an existing document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + updateDoc( + refOrPath: DocumentReference | string, + data: {} + ): Promise; + + /** + * Deletes a document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + removeDoc( + refOrPath: DocumentReference | string, + data: {} + ): Promise; + + /** + * Removes documents from a collection. If no query is supplied, it will remove all the documents. If a query is supplied, it will only remove documents that match the query. + * @param refOrPath CollectionReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + removeFromCollection( + refOrPath: CollectionReference | string, + options: removeFromCollectionOptions + ): Promise; + + /** + * Syncs a component's local state with a document in Firestore. + * @param refOrPath DocumentReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + syncDoc( + refOrPath: DocumentReference | string, + options: syncDocOptions + ): RebaseBinding; + + /** + * Clean up a listener. Listeners are automatically cleaned up when components unmount, however if you wish to remove a listener while the component is still mounted this will allow you to do that. An example would be if you want to start listening to a new document or change a query on all collection in response to a prop change. + * @param ref The return value of syncState`, `bindToState`, `listenTo`, `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or `syncDoc`. + */ + removeBinding(ref: RebaseBinding): void; + + /** + * Removes every Firebase/Firestore listener. + */ + reset(): void; + } +} + +declare module "re-base" { + /** + * Accepts an initialized firebase database or firestore database object. + * @param {object} firebaseDatabase Initialized firebase or firestore + * database. + * @return {Rebase} An instance of re-base. + */ + export function createClass( + firebaseDatabase: + | firebase.database.Database + | firebase.firestore.Firestore + ): rebase.Rebase; +} diff --git a/types/re-base/re-base-tests.ts b/types/re-base/re-base-tests.ts new file mode 100644 index 0000000000..702a6ab2dd --- /dev/null +++ b/types/re-base/re-base-tests.ts @@ -0,0 +1,9 @@ +import * as rebase from "re-base"; + +const database = {}; +const base = rebase.createClass(database); + +const _ref = base.syncState("foo", { + context: "bar", + state: "baz" +}); diff --git a/types/re-base/tsconfig.json b/types/re-base/tsconfig.json new file mode 100644 index 0000000000..eb916d27f6 --- /dev/null +++ b/types/re-base/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "re-base-tests.ts" + ] +} diff --git a/types/re-base/tslint.json b/types/re-base/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/re-base/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c97480f5771b860388cfa599aca2c1ed434e2c83 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Thu, 17 May 2018 17:51:13 -0700 Subject: [PATCH 26/62] Fix linting errors. --- types/re-base/index.d.ts | 96 ++++++++++--------------------------- types/re-base/tsconfig.json | 14 ++---- types/re-base/tslint.json | 8 +++- 3 files changed, 36 insertions(+), 82 deletions(-) diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts index 928bca7c47..5934b67295 100644 --- a/types/re-base/index.d.ts +++ b/types/re-base/index.d.ts @@ -3,27 +3,7 @@ // Definitions by: jordandrako // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface QueryOptions {} - -interface RebaseBinding {} - -declare namespace firebase { - -} - -declare namespace firebase.app { - interface App {} -} - -declare namespace firebase.database { - interface Database {} -} - -declare namespace firebase.firestore { - class Firestore {} -} - -declare namespace rebase { +export namespace rebase { interface SyncStateOptions { /** * The context of your component. @@ -53,7 +33,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; /** * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with syncState) to change this.state.loading to false. @@ -85,7 +65,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; /** * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with bindToState) to change this.state.loading to false. @@ -122,7 +102,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; } interface FetchOptions { @@ -149,7 +129,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; } interface PostOptions { @@ -188,10 +168,6 @@ declare namespace rebase { then?: (result: any) => void; } - interface DocumentReference {} - - interface CollectionReference {} - interface bindDocOptions { /** * Your react component. @@ -350,7 +326,7 @@ declare namespace rebase { /** * This property contains the initialized firebase app that was passed into re-base. You can access any of the firebase services that you are using off this object. For instance, if you want to use some firebase database methods that re-base doesn't have helpers for or if you are using the auth service and want to quickly access it off of re-base. */ - initializedApp: firebase.app.App; + initializedApp: {}; /** * This property contains an object that you can use when adding data that will be converted to a timestamp by Firebase. See [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) for more info. @@ -363,7 +339,7 @@ declare namespace rebase { * @param options syncState Options. * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ - syncState(endpoint: string, options: SyncStateOptions): RebaseBinding; + syncState(endpoint: string, options: SyncStateOptions): {}; /** * One way data binding from Firebase to your component's state. Allows you to bind a component's state property to a Firebase endpoint so whenever that Firebase endpoint changes, your component's state will be updated with that change. @@ -371,10 +347,7 @@ declare namespace rebase { * @param options bindToState Options. * @returns An object which you can pass to removeBinding if you want to remove the listener while the component is still mounted. */ - bindToState( - endpoint: string, - options: BindToStateOptions - ): RebaseBinding; + bindToState(endpoint: string, options: BindToStateOptions): {}; /** * Allows you to listen to Firebase endpoints without binding those changes to a state property. Instead, a callback will be invoked with the newly updated data. @@ -382,7 +355,7 @@ declare namespace rebase { * @param options listenTo Options. * @returns An object which you can pass to removeBinding when your component unmounts to remove the Firebase listeners. */ - listenTo(endpoint: string, options: ListenToOptions): RebaseBinding; + listenTo(endpoint: string, options: ListenToOptions): {}; /** * Allows you to retrieve the data from a Firebase endpoint just once without subscribing or listening for data changes. @@ -433,10 +406,7 @@ declare namespace rebase { * @param options bindDoc Options. * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ - bindDoc( - refOrPath: DocumentReference | string, - options: bindDocOptions - ): RebaseBinding; + bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; /** * Listen to a document, when the data changes it will invoke a callback passing it the new data from Firestore. @@ -444,10 +414,7 @@ declare namespace rebase { * @param options listenToDoc Options. * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ - listenToDoc( - refOrPath: DocumentReference | string, - options: listenToDocOptions - ): RebaseBinding; + listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; /** * Bind a collection to a state property in your component. When then collection changes in firestore, your component will re-render with the latest data. @@ -456,9 +423,9 @@ declare namespace rebase { * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ bindCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, options: bindCollectionOptions - ): RebaseBinding; + ): {}; /** * Listen to a collection, when the data changes it will invoke a callback passing it the new data from Firestore. @@ -467,9 +434,9 @@ declare namespace rebase { * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ listenToCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, options: listenToCollectionOptions - ): RebaseBinding; + ): {}; /** * Fetch either a Collection or Document. @@ -478,7 +445,7 @@ declare namespace rebase { * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ get( - refOrPath: CollectionReference | DocumentReference | string, + refOrPath: {} | {} | string, options: listenToCollectionOptions ): Promise; @@ -490,7 +457,7 @@ declare namespace rebase { * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ addToCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, data: {}, id?: string ): Promise; @@ -501,10 +468,7 @@ declare namespace rebase { * @param data The document data. * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ - updateDoc( - refOrPath: DocumentReference | string, - data: {} - ): Promise; + updateDoc(refOrPath: {} | string, data: {}): Promise; /** * Deletes a document. @@ -512,10 +476,7 @@ declare namespace rebase { * @param data The document data. * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ - removeDoc( - refOrPath: DocumentReference | string, - data: {} - ): Promise; + removeDoc(refOrPath: {} | string, data: {}): Promise; /** * Removes documents from a collection. If no query is supplied, it will remove all the documents. If a query is supplied, it will only remove documents that match the query. @@ -524,7 +485,7 @@ declare namespace rebase { * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ removeFromCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, options: removeFromCollectionOptions ): Promise; @@ -534,16 +495,13 @@ declare namespace rebase { * @param options removeFromCollection Options. * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ - syncDoc( - refOrPath: DocumentReference | string, - options: syncDocOptions - ): RebaseBinding; + syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; /** * Clean up a listener. Listeners are automatically cleaned up when components unmount, however if you wish to remove a listener while the component is still mounted this will allow you to do that. An example would be if you want to start listening to a new document or change a query on all collection in response to a prop change. * @param ref The return value of syncState`, `bindToState`, `listenTo`, `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or `syncDoc`. */ - removeBinding(ref: RebaseBinding): void; + removeBinding(ref: {}): void; /** * Removes every Firebase/Firestore listener. @@ -555,13 +513,9 @@ declare namespace rebase { declare module "re-base" { /** * Accepts an initialized firebase database or firestore database object. - * @param {object} firebaseDatabase Initialized firebase or firestore + * @param firebaseDatabase Initialized firebase or firestore * database. - * @return {Rebase} An instance of re-base. + * @return An instance of re-base. */ - export function createClass( - firebaseDatabase: - | firebase.database.Database - | firebase.firestore.Firestore - ): rebase.Rebase; + function createClass(firebaseDatabase: {}): rebase.Rebase; } diff --git a/types/re-base/tsconfig.json b/types/re-base/tsconfig.json index eb916d27f6..ff88a407d4 100644 --- a/types/re-base/tsconfig.json +++ b/types/re-base/tsconfig.json @@ -1,22 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "re-base-tests.ts" - ] + "files": ["index.d.ts", "re-base-tests.ts"] } diff --git a/types/re-base/tslint.json b/types/re-base/tslint.json index 3db14f85ea..c077883976 100644 --- a/types/re-base/tslint.json +++ b/types/re-base/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": false, + "no-declare-current-package": false + } +} From 3388373368ef946a9864a4bb125a857b81e0cea0 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Thu, 17 May 2018 19:38:18 -0700 Subject: [PATCH 27/62] Stricter linting rules --- types/re-base/tslint.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/types/re-base/tslint.json b/types/re-base/tslint.json index c077883976..3db14f85ea 100644 --- a/types/re-base/tslint.json +++ b/types/re-base/tslint.json @@ -1,7 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "max-line-length": false, - "no-declare-current-package": false - } -} +{ "extends": "dtslint/dt.json" } From cc4a1d7951a0edeeea649f03f613e0ad69f27626 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Thu, 17 May 2018 19:40:03 -0700 Subject: [PATCH 28/62] - JSdoc line lengths - remove needless namespace - remove declare namesake module --- types/re-base/index.d.ts | 1155 +++++++++++++++++++++----------------- 1 file changed, 642 insertions(+), 513 deletions(-) diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts index 5934b67295..ba838df0aa 100644 --- a/types/re-base/index.d.ts +++ b/types/re-base/index.d.ts @@ -3,519 +3,648 @@ // Definitions by: jordandrako // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export namespace rebase { - interface SyncStateOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar`. - */ - state: string; - - /** - * A default value to set when the Firebase endpoint has no value (i.e., on init) (use this if you want a value other than an empty object or empty array) - */ - defaultValue?: string | boolean | number | {}; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * Will keep any firebase generated keys intact when manipulating data using the asArray option. - */ - keepKeys?: boolean; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - - /** - * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with syncState) to change this.state.loading to false. - */ - then?: () => void; - - /** - * A callback function that will be invoked if the current user does not have read or write permissions at the location. - */ - onFailure?: () => void; - } - - interface BindToStateOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar` (no arrays). - */ - state: string; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - - /** - * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with bindToState) to change this.state.loading to false. - */ - then?: () => void; - - /** - * A callback function that will be invoked if the current user does not have read permissions at the location. - */ - onFailure?: () => void; - } - - interface ListenToOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. - */ - then: (result: any) => void; - - /** - * The callback function that will be invoked if the current user does not have read permissions at the location. - */ - onFailure?: (error: any) => void; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - } - - interface FetchOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. - */ - then?: (result: any) => void; - - /** - * The callback function that will be invoked with an error that occurs reading data from the specified endpoint. - */ - onFailure?: () => void; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - } - - interface PostOptions { - /** - * The data you're wanting to persist to Firebase. - */ - data: any; - - /** - * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. - */ - then?: (result: any) => void; - } - - interface PushOptions { - /** - * The data you're wanting to persist to Firebase. - */ - data: any; - - /** - * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. - */ - then?: (result: any) => void; - } - - interface UpdateOptions { - /** - * The data you're wanting to persist to Firebase. - */ - data: any; - - /** - * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. - */ - then?: (result: any) => void; - } - - interface bindDocOptions { - /** - * Your react component. - */ - context: {}; - - /** - * A property name on your state to bind your document to, if omitted the document will be merged into your existing state. - */ - state?: string; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface listenToDocOptions { - /** - * Your react component. - */ - context: {}; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface bindCollectionOptions { - /** - * Your react component. - */ - context: {}; - - /** - * The state property to bind the collection to. - */ - state?: string; - - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - - /** - * Will embed firestore generated document ids inside each document in your collections on the `id` property. - */ - withIds?: boolean; - - /** - * will embed the DocumentReference inside each document in your collection on the `ref` property. - */ - withRefs?: boolean; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface listenToCollectionOptions { - /** - * Your react component. - */ - context: {}; - - /** - * A callback that will be called with the data. - */ - then: () => void; - - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - - /** - * Will embed firestore generated document ids inside each document in your collections on the `id` property. - */ - withIds?: boolean; - - /** - * will embed the DocumentReference inside each document in your collection on the `ref` property. - */ - withRefs?: boolean; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface getOptions { - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - - /** - * Will embed firestore generated document ids inside each document in your collections on the `id` property. - */ - withIds?: boolean; - - /** - * will embed the DocumentReference inside each document in your collection on the `ref` property. - */ - withRefs?: boolean; - } - - interface removeFromCollectionOptions { - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - } - - interface syncDocOptions { - /** - * Your react component. - */ - context: {}; - - /** - * The state property to sync. - */ - state: string; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface Rebase { - /** - * This property contains the initialized firebase app that was passed into re-base. You can access any of the firebase services that you are using off this object. For instance, if you want to use some firebase database methods that re-base doesn't have helpers for or if you are using the auth service and want to quickly access it off of re-base. - */ - initializedApp: {}; - - /** - * This property contains an object that you can use when adding data that will be converted to a timestamp by Firebase. See [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) for more info. - */ - timestamp: {}; - - /** - * Allows you to set up two way data binding between your component's state and your Firebase. Whenever your Firebase changes, your component's state will change. Whenever your component's state changes, Firebase will change. - * @param endpoint The relative Firebase endpoint to which you'd like to bind your component's state. - * @param options syncState Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - syncState(endpoint: string, options: SyncStateOptions): {}; - - /** - * One way data binding from Firebase to your component's state. Allows you to bind a component's state property to a Firebase endpoint so whenever that Firebase endpoint changes, your component's state will be updated with that change. - * @param endpoint The relative Firebase endpoint that you'd like to bind to your component's state. - * @param options bindToState Options. - * @returns An object which you can pass to removeBinding if you want to remove the listener while the component is still mounted. - */ - bindToState(endpoint: string, options: BindToStateOptions): {}; - - /** - * Allows you to listen to Firebase endpoints without binding those changes to a state property. Instead, a callback will be invoked with the newly updated data. - * @param endpoint The relative Firebase endpoint which contains the data with which you'd like to invoke your callback function. - * @param options listenTo Options. - * @returns An object which you can pass to removeBinding when your component unmounts to remove the Firebase listeners. - */ - listenTo(endpoint: string, options: ListenToOptions): {}; - - /** - * Allows you to retrieve the data from a Firebase endpoint just once without subscribing or listening for data changes. - * @param endpoint The relative Firebase endpoint which contains the data you're wanting to fetch. - * @param options fetch Options. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - fetch(endpoint: string, options: FetchOptions): Promise; - - /** - * Allows you to update a Firebase endpoint with new data. *Replace all the data at this endpoint with the new data*. - * @param endpoint The relative Firebase endpoint that you'd like to update with the new data. - * @param options post Options. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - post(endpoint: string, options: PostOptions): Promise; - - /** - * Allows you to add data to a Firebase endpoint. *Adds data to a child of the endpoint with a new Firebase push key*. - * @param endpoint The relative Firebase endpoint that you'd like to push the new data to. - * @param options push Options. - * @returns A Firebase [ThenableReference](https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference) which is defined by Firebase as a "Combined Promise and reference; resolves when write is complete, but can be used immediately as the reference to the child location." - */ - push(endpoint: string, options: PushOptions): Promise; - - /** - * Allows you to update data at a Firebase endpoint changing only the properties you pass to it. **Warning: calling update with `options.data` being null will remove all the data at that endpoint**. - * @param endpoint The relative Firebase endpoint that you'd like to update. - * @param options update Options. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - update(endpoint: string, options: UpdateOptions): Promise; - - /** - * Allows you to delete all data at the endpoint location. - * @param endpoint The relative Firebase endpoint that you'd like to delete data from. - * @param callback A callback that will get invoked once the data is successfully removed Firebase. If there is an error, it will be the only argument to this function. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - remove( - endpoint: string, - callback?: (result: Promise) => void - ): Promise; - - /** - * Bind a document to your component. When then document changes in firestore, your component will re-render with the latest data. - * @param refOrPath DocumentReference or path. - * @param options bindDoc Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; - - /** - * Listen to a document, when the data changes it will invoke a callback passing it the new data from Firestore. - * @param refOrPath DocumentReference or path. - * @param options listenToDoc Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; - - /** - * Bind a collection to a state property in your component. When then collection changes in firestore, your component will re-render with the latest data. - * @param refOrPath CollectionReference or path. - * @param options bindCollection Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - bindCollection( - refOrPath: {} | string, - options: bindCollectionOptions - ): {}; - - /** - * Listen to a collection, when the data changes it will invoke a callback passing it the new data from Firestore. - * @param refOrPath CollectionReference or path. - * @param options listenToCollection Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - listenToCollection( - refOrPath: {} | string, - options: listenToCollectionOptions - ): {}; - - /** - * Fetch either a Collection or Document. - * @param refOrPath CollectionReference, DocumentReference or path. - * @param options get Options. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - get( - refOrPath: {} | {} | string, - options: listenToCollectionOptions - ): Promise; - - /** - * Add a new Document to a Collection. - * @param refOrPath CollectionReference or path. - * @param data The document data. - * @param id The id for the document. If omitted, the Firestore will generate an id for you. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - addToCollection( - refOrPath: {} | string, - data: {}, - id?: string - ): Promise; - - /** - * Update an existing document. - * @param refOrPath DocumentReference or path. - * @param data The document data. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - updateDoc(refOrPath: {} | string, data: {}): Promise; - - /** - * Deletes a document. - * @param refOrPath DocumentReference or path. - * @param data The document data. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - removeDoc(refOrPath: {} | string, data: {}): Promise; - - /** - * Removes documents from a collection. If no query is supplied, it will remove all the documents. If a query is supplied, it will only remove documents that match the query. - * @param refOrPath CollectionReference or path. - * @param options removeFromCollection Options. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - removeFromCollection( - refOrPath: {} | string, - options: removeFromCollectionOptions - ): Promise; - - /** - * Syncs a component's local state with a document in Firestore. - * @param refOrPath DocumentReference or path. - * @param options removeFromCollection Options. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; - - /** - * Clean up a listener. Listeners are automatically cleaned up when components unmount, however if you wish to remove a listener while the component is still mounted this will allow you to do that. An example would be if you want to start listening to a new document or change a query on all collection in response to a prop change. - * @param ref The return value of syncState`, `bindToState`, `listenTo`, `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or `syncDoc`. - */ - removeBinding(ref: {}): void; - - /** - * Removes every Firebase/Firestore listener. - */ - reset(): void; - } -} - -declare module "re-base" { +export interface SyncStateOptions { /** - * Accepts an initialized firebase database or firestore database object. - * @param firebaseDatabase Initialized firebase or firestore - * database. - * @return An instance of re-base. + * The context of your component. */ - function createClass(firebaseDatabase: {}): rebase.Rebase; + context: {}; + + /** + * The state property you want to sync with Firebase; can be an + * arbitrarily nested property a là `foo.bar`. + */ + state: string; + + /** + * A default value to set when the Firebase endpoint has no value (i.e., + * on init) (use this if you want a value other than an empty object or + * empty array) + */ + defaultValue?: string | boolean | number | {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * Will keep any firebase generated keys intact when manipulating data + * using the asArray option. + */ + keepKeys?: boolean; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; + + /** + * The callback function that will be invoked when the initial listener + * is established with Firebase. Typically used (with syncState) to + * change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does + * not have read or write permissions at the location. + */ + onFailure?: () => void; } + +export interface BindToStateOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property you want to sync with Firebase; can be an + * arbitrarily nested property a là `foo.bar` (no arrays). + */ + state: string; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; + + /** + * The callback function that will be invoked when the initial listener + * is established with Firebase. Typically used (with bindToState) to + * change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does + * not have read permissions at the location. + */ + onFailure?: () => void; +} + +export interface ListenToOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the + * specified endpoint when the endpoint changes. + */ + then: (result: any) => void; + + /** + * The callback function that will be invoked if the current user does + * not have read permissions at the location. + */ + onFailure?: (error: any) => void; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; +} + +export interface FetchOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the + * specified endpoint when the endpoint changes. + */ + then?: (result: any) => void; + + /** + * The callback function that will be invoked with an error that occurs + * reading data from the specified endpoint. + */ + onFailure?: () => void; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; +} + +export interface PostOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to + * Firebase. If there is an error, it will be the only argument to this + * function. + */ + then?: (result: any) => void; +} + +export interface PushOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to + * Firebase. If there is an error, it will be the only argument to this + * function. + */ + then?: (result: any) => void; +} + +export interface UpdateOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to + * Firebase. If there is an error, it will be the only argument to this + * function. + */ + then?: (result: any) => void; +} + +export interface bindDocOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * A property name on your state to bind your document to, if omitted + * the document will be merged into your existing state. + */ + state?: string; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface listenToDocOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface bindCollectionOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property to bind the collection to. + */ + state?: string; + + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in + * your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your + * collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface listenToCollectionOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * A callback that will be called with the data. + */ + then: () => void; + + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in + * your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your + * collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface getOptions { + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in + * your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your + * collection on the `ref` property. + */ + withRefs?: boolean; +} + +export interface removeFromCollectionOptions { + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; +} + +export interface syncDocOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property to sync. + */ + state: string; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface Rebase { + /** + * This property contains the initialized firebase app that was passed + * into re-base. You can access any of the firebase services that you + * are using off this object. For instance, if you want to use some + * firebase database methods that re-base doesn't have helpers for or + * if you are using the auth service and want to quickly access it off + * of re-base. + */ + initializedApp: {}; + + /** + * This property contains an object that you can use when adding data + * that will be converted to a timestamp by Firebase. See + * [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) + * for more info. + */ + timestamp: {}; + + /** + * Allows you to set up two way data binding between your component's + * state and your Firebase. Whenever your Firebase changes, your + * component's state will change. Whenever your component's state + * changes, Firebase will change. + * @param endpoint The relative Firebase endpoint to which you'd like + * to bind your component's state. + * @param options syncState Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + syncState(endpoint: string, options: SyncStateOptions): {}; + + /** + * One way data binding from Firebase to your component's state. Allows + * you to bind a component's state property to a Firebase endpoint so + * whenever that Firebase endpoint changes, your component's state will + * be updated with that change. + * @param endpoint The relative Firebase endpoint that you'd like to + * bind to your component's state. + * @param options bindToState Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + bindToState(endpoint: string, options: BindToStateOptions): {}; + + /** + * Allows you to listen to Firebase endpoints without binding those + * changes to a state property. Instead, a callback will be invoked + * with the newly updated data. + * @param endpoint The relative Firebase endpoint which contains the + * data with which you'd like to invoke your callback function. + * @param options listenTo Options. + * @returns An object which you can pass to `removeBinding` when your + * component unmounts to remove the Firebase listeners. + */ + listenTo(endpoint: string, options: ListenToOptions): {}; + + /** + * Allows you to retrieve the data from a Firebase endpoint just once + * without subscribing or listening for data changes. + * @param endpoint The relative Firebase endpoint which contains the + * data you're wanting to fetch. + * @param options fetch Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + fetch(endpoint: string, options: FetchOptions): Promise; + + /** + * Allows you to update a Firebase endpoint with new data. *Replace all + * the data at this endpoint with the new data*. + * @param endpoint The relative Firebase endpoint that you'd like to + * update with the new data. + * @param options post Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + post(endpoint: string, options: PostOptions): Promise; + + /** + * Allows you to add data to a Firebase endpoint. *Adds data to a child + * of the endpoint with a new Firebase push key*. + * @param endpoint The relative Firebase endpoint that you'd like to + * push the new data to. + * @param options push Options. + * @returns A Firebase [ThenableReference](https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference) + * which is defined by Firebase as a "Combined Promise and reference; + * resolves when write is complete, but can be used immediately as the + * reference to the child location." + */ + push(endpoint: string, options: PushOptions): Promise; + + /** + * Allows you to update data at a Firebase endpoint changing only the + * properties you pass to it. **Warning: calling update with + * `options.data` being null will remove all the data at that + * endpoint**. + * @param endpoint The relative Firebase endpoint that you'd like to + * update. + * @param options update Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + update(endpoint: string, options: UpdateOptions): Promise; + + /** + * Allows you to delete all data at the endpoint location. + * @param endpoint The relative Firebase endpoint that you'd like to + * delete data from. + * @param callback A callback that will get invoked once the data is + * successfully removed Firebase. If there is an error, it will be the + * only argument to this function. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + remove( + endpoint: string, + callback?: (result: Promise) => void + ): Promise; + + /** + * Bind a document to your component. When then document changes in + * firestore, your component will re-render with the latest data. + * @param refOrPath DocumentReference or path. + * @param options bindDoc Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; + + /** + * Listen to a document, when the data changes it will invoke a + * callback passing it the new data from Firestore. + * @param refOrPath DocumentReference or path. + * @param options listenToDoc Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; + + /** + * Bind a collection to a state property in your component. When then + * collection changes in firestore, your component will re-render with + * the latest data. + * @param refOrPath CollectionReference or path. + * @param options bindCollection Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + bindCollection( + refOrPath: {} | string, + options: bindCollectionOptions + ): {}; + + /** + * Listen to a collection, when the data changes it will invoke a + * callback passing it the new data from Firestore. + * @param refOrPath CollectionReference or path. + * @param options listenToCollection Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + listenToCollection( + refOrPath: {} | string, + options: listenToCollectionOptions + ): {}; + + /** + * Fetch either a Collection or Document. + * @param refOrPath CollectionReference, DocumentReference or path. + * @param options get Options. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + get( + refOrPath: {} | {} | string, + options: listenToCollectionOptions + ): Promise; + + /** + * Add a new Document to a Collection. + * @param refOrPath CollectionReference or path. + * @param data The document data. + * @param id The id for the document. If omitted, the Firestore will + * generate an id for you. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + addToCollection( + refOrPath: {} | string, + data: {}, + id?: string + ): Promise; + + /** + * Update an existing document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + updateDoc(refOrPath: {} | string, data: {}): Promise; + + /** + * Deletes a document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + removeDoc(refOrPath: {} | string, data: {}): Promise; + + /** + * Removes documents from a collection. If no query is supplied, it + * will remove all the documents. If a query is supplied, it will only + * remove documents that match the query. + * @param refOrPath CollectionReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + removeFromCollection( + refOrPath: {} | string, + options: removeFromCollectionOptions + ): Promise; + + /** + * Syncs a component's local state with a document in Firestore. + * @param refOrPath DocumentReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; + + /** + * Clean up a listener. Listeners are automatically cleaned up when + * components unmount, however if you wish to remove a listener while + * the component is still mounted this will allow you to do that. An + * example would be if you want to start listening to a new document or + * change a query on all collection in response to a prop change. + * @param ref The return value of syncState`, `bindToState`, `listenTo`, + * `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or + * `syncDoc`. + */ + removeBinding(ref: {}): void; + + /** + * Removes every Firebase/Firestore listener. + */ + reset(): void; +} + +/** + * Accepts an initialized firebase/firestore database object. + * @param database Initialized firebase/firestore + * database. + * @return An instance of re-base. + */ +export function createClass(database: {}): Rebase; From f76d4aaa069587cf10fd2a5ff76e848abb18ec31 Mon Sep 17 00:00:00 2001 From: taoqf Date: Sat, 19 May 2018 14:26:35 +0800 Subject: [PATCH 29/62] add v1 --- types/jsreport-html-to-xlsx/v1/index.d.ts | 24 +++++++++++++++++ .../v1/jsreport-html-to-xlsx-tests.ts | 19 ++++++++++++++ types/jsreport-html-to-xlsx/v1/tsconfig.json | 26 +++++++++++++++++++ types/jsreport-html-to-xlsx/v1/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/jsreport-html-to-xlsx/v1/index.d.ts create mode 100644 types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts create mode 100644 types/jsreport-html-to-xlsx/v1/tsconfig.json create mode 100644 types/jsreport-html-to-xlsx/v1/tslint.json diff --git a/types/jsreport-html-to-xlsx/v1/index.d.ts b/types/jsreport-html-to-xlsx/v1/index.d.ts new file mode 100644 index 0000000000..84b37480aa --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for jsreport-html-to-xlsx 1.4 +// Project: https://github.com/jsreport/jsreport-html-to-xlsx +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { ExtensionDefinition } from 'jsreport-core'; +import { Options as BaseOptions } from 'jsreport-xlsx'; + +declare module 'jsreport-core' { + interface Template { + recipe: 'html-to-xlsx' | string; + } +} + +declare namespace JsReportHtml2Xlsx { + interface Options extends BaseOptions { + strategy: string; + } +} + +declare function JsReportHtml2Xlsx(options?: Partial): ExtensionDefinition; + +export = JsReportHtml2Xlsx; diff --git a/types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts b/types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts new file mode 100644 index 0000000000..9540cf7929 --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts @@ -0,0 +1,19 @@ +import JsReport = require('jsreport-core'); +import JsreportHtml2Xlsx = require('jsreport-html-to-xlsx'); +import JsreportXlsx = require('jsreport-xlsx'); + +const jsreport = JsReport(); +jsreport.use(JsreportXlsx()); +jsreport.use(JsreportHtml2Xlsx()); + +(async () => { + const content = `
test
`; + await jsreport.init(); + const resp = await jsreport.render({ + template: { + content, + engine: 'none', + recipe: 'xlsx' + } + }); +})(); diff --git a/types/jsreport-html-to-xlsx/v1/tsconfig.json b/types/jsreport-html-to-xlsx/v1/tsconfig.json new file mode 100644 index 0000000000..6b073aa725 --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "esnext" + ], + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "jsreport-html-to-xlsx": [ "jsreport-html-to-xlsx/v1" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsreport-html-to-xlsx-tests.ts" + ] +} diff --git a/types/jsreport-html-to-xlsx/v1/tslint.json b/types/jsreport-html-to-xlsx/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 82d09842754d551d9a0715b41ab9f978deda9686 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Sat, 19 May 2018 12:55:37 +0200 Subject: [PATCH 30/62] Update index.d.ts --- types/intl-locales-supported/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/intl-locales-supported/index.d.ts b/types/intl-locales-supported/index.d.ts index b156905fdf..76b5a4321e 100644 --- a/types/intl-locales-supported/index.d.ts +++ b/types/intl-locales-supported/index.d.ts @@ -3,4 +3,6 @@ // Definitions by: Edward Sammut Alessi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function areIntlLocalesSupported(locales: string | string[]): void; +export = areIntlLocalesSupported; + +function areIntlLocalesSupported(locales: string | string[]): boolean; From 6d5cd37bbadc2bd180ff8fde7d8c76d040b39b33 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Sat, 19 May 2018 12:55:58 +0200 Subject: [PATCH 31/62] Update intl-locales-supported-tests.ts --- types/intl-locales-supported/intl-locales-supported-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/intl-locales-supported/intl-locales-supported-tests.ts b/types/intl-locales-supported/intl-locales-supported-tests.ts index dcddcd545d..0ef43ea1e0 100644 --- a/types/intl-locales-supported/intl-locales-supported-tests.ts +++ b/types/intl-locales-supported/intl-locales-supported-tests.ts @@ -1,4 +1,4 @@ -import areIntlLocalesSupported from "intl-locales-supported"; +import areIntLocalesSupported = require("intl-locales-supported"); areIntlLocalesSupported("en-GB"); areIntlLocalesSupported([ "en-GB", "en-US" ]); From 5bcb57689662abac60e127b799ef990d69342f88 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Sat, 19 May 2018 13:11:12 +0200 Subject: [PATCH 32/62] Fixes --- types/intl-locales-supported/index.d.ts | 2 +- types/intl-locales-supported/intl-locales-supported-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/intl-locales-supported/index.d.ts b/types/intl-locales-supported/index.d.ts index 76b5a4321e..62d88c0e54 100644 --- a/types/intl-locales-supported/index.d.ts +++ b/types/intl-locales-supported/index.d.ts @@ -5,4 +5,4 @@ export = areIntlLocalesSupported; -function areIntlLocalesSupported(locales: string | string[]): boolean; +declare function areIntlLocalesSupported(locales: string | string[]): boolean; diff --git a/types/intl-locales-supported/intl-locales-supported-tests.ts b/types/intl-locales-supported/intl-locales-supported-tests.ts index 0ef43ea1e0..9d63d0e9ec 100644 --- a/types/intl-locales-supported/intl-locales-supported-tests.ts +++ b/types/intl-locales-supported/intl-locales-supported-tests.ts @@ -1,4 +1,4 @@ -import areIntLocalesSupported = require("intl-locales-supported"); +import areIntlLocalesSupported = require("intl-locales-supported"); areIntlLocalesSupported("en-GB"); areIntlLocalesSupported([ "en-GB", "en-US" ]); From a761e4477db0d7ab909a8f58acd44af217839fb9 Mon Sep 17 00:00:00 2001 From: Ali Afroozeh Date: Tue, 22 May 2018 22:02:52 +0200 Subject: [PATCH 33/62] Add ReadyState typing as static fields --- types/eventsource/eventsource-tests.ts | 12 ++++++++++++ types/eventsource/index.d.ts | 5 +++++ .../eventsource/lib/eventsource-polyfill/index.d.ts | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/types/eventsource/eventsource-tests.ts b/types/eventsource/eventsource-tests.ts index 3cef9cfc78..c1b53030cd 100644 --- a/types/eventsource/eventsource-tests.ts +++ b/types/eventsource/eventsource-tests.ts @@ -2,6 +2,12 @@ import EventSource = require("eventsource"); const eventSource = new EventSource("http://foobar"); let readyState: number = eventSource.readyState; +let closedState: number = eventSource.CLOSED; +closedState = EventSource.CLOSED; +let connectingState: number = eventSource.CONNECTING; +connectingState = EventSource.CONNECTING; +let openState: number = eventSource.OPEN; +openState = EventSource.OPEN; let url: string = eventSource.url; let withCredentials: boolean = eventSource.withCredentials; eventSource.onmessage = (event: Event) => {}; @@ -16,6 +22,12 @@ import EventSourcePolyfill = require("eventsource/lib/eventsource-polyfill"); const eventSourcePolyfill = new EventSourcePolyfill("http://foobar"); readyState = eventSourcePolyfill.readyState; +closedState = eventSource.CLOSED; +closedState = EventSource.CLOSED; +connectingState = eventSource.CONNECTING; +connectingState = EventSource.CONNECTING; +openState = eventSource.OPEN; +openState = EventSource.OPEN; url = eventSourcePolyfill.url; withCredentials = eventSource.withCredentials; eventSourcePolyfill.onmessage = (event: Event) => {}; diff --git a/types/eventsource/index.d.ts b/types/eventsource/index.d.ts index 613745e7a5..1308515917 100644 --- a/types/eventsource/index.d.ts +++ b/types/eventsource/index.d.ts @@ -6,7 +6,12 @@ // TypeScript Version: 2.8 declare class EventSource { + static readonly CLOSED: number; + static readonly CONNECTING: number; + static readonly OPEN: number; + constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict); + readonly CLOSED: number; readonly CONNECTING: number; readonly OPEN: number; diff --git a/types/eventsource/lib/eventsource-polyfill/index.d.ts b/types/eventsource/lib/eventsource-polyfill/index.d.ts index 1d4347d0aa..86b82105cc 100644 --- a/types/eventsource/lib/eventsource-polyfill/index.d.ts +++ b/types/eventsource/lib/eventsource-polyfill/index.d.ts @@ -1,5 +1,10 @@ declare class EventSource { + static readonly CLOSED: number; + static readonly CONNECTING: number; + static readonly OPEN: number; + constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict); + readonly CLOSED: number; readonly CONNECTING: number; readonly OPEN: number; From 6ef11f7677759c1034acdee6d5e38ec8b1f35ea7 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Fri, 18 May 2018 01:15:32 +0100 Subject: [PATCH 34/62] Initial re-base@3.x type definitions --- types/re-base/index.d.ts | 567 +++++++++++++++++++++++++++++++++ types/re-base/re-base-tests.ts | 9 + types/re-base/tsconfig.json | 22 ++ types/re-base/tslint.json | 1 + 4 files changed, 599 insertions(+) create mode 100644 types/re-base/index.d.ts create mode 100644 types/re-base/re-base-tests.ts create mode 100644 types/re-base/tsconfig.json create mode 100644 types/re-base/tslint.json diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts new file mode 100644 index 0000000000..928bca7c47 --- /dev/null +++ b/types/re-base/index.d.ts @@ -0,0 +1,567 @@ +// Type definitions for re-base 3.2 +// Project: https://github.com/tylermcginnis/re-base#readme +// Definitions by: jordandrako +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface QueryOptions {} + +interface RebaseBinding {} + +declare namespace firebase { + +} + +declare namespace firebase.app { + interface App {} +} + +declare namespace firebase.database { + interface Database {} +} + +declare namespace firebase.firestore { + class Firestore {} +} + +declare namespace rebase { + interface SyncStateOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar`. + */ + state: string; + + /** + * A default value to set when the Firebase endpoint has no value (i.e., on init) (use this if you want a value other than an empty object or empty array) + */ + defaultValue?: string | boolean | number | {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * Will keep any firebase generated keys intact when manipulating data using the asArray option. + */ + keepKeys?: boolean; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + + /** + * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with syncState) to change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does not have read or write permissions at the location. + */ + onFailure?: () => void; + } + + interface BindToStateOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar` (no arrays). + */ + state: string; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + + /** + * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with bindToState) to change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does not have read permissions at the location. + */ + onFailure?: () => void; + } + + interface ListenToOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. + */ + then: (result: any) => void; + + /** + * The callback function that will be invoked if the current user does not have read permissions at the location. + */ + onFailure?: (error: any) => void; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + } + + interface FetchOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. + */ + then?: (result: any) => void; + + /** + * The callback function that will be invoked with an error that occurs reading data from the specified endpoint. + */ + onFailure?: () => void; + + /** + * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. + */ + queries?: QueryOptions; + } + + interface PostOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. + */ + then?: (result: any) => void; + } + + interface PushOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. + */ + then?: (result: any) => void; + } + + interface UpdateOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. + */ + then?: (result: any) => void; + } + + interface DocumentReference {} + + interface CollectionReference {} + + interface bindDocOptions { + /** + * Your react component. + */ + context: {}; + + /** + * A property name on your state to bind your document to, if omitted the document will be merged into your existing state. + */ + state?: string; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface listenToDocOptions { + /** + * Your react component. + */ + context: {}; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface bindCollectionOptions { + /** + * Your react component. + */ + context: {}; + + /** + * The state property to bind the collection to. + */ + state?: string; + + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface listenToCollectionOptions { + /** + * Your react component. + */ + context: {}; + + /** + * A callback that will be called with the data. + */ + then: () => void; + + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface getOptions { + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your collection on the `ref` property. + */ + withRefs?: boolean; + } + + interface removeFromCollectionOptions { + /** + * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + } + + interface syncDocOptions { + /** + * Your react component. + */ + context: {}; + + /** + * The state property to sync. + */ + state: string; + + /** + * A callback that will be called when the listener is set, use for loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions errors. + */ + onFailure?: () => void; + } + + interface Rebase { + /** + * This property contains the initialized firebase app that was passed into re-base. You can access any of the firebase services that you are using off this object. For instance, if you want to use some firebase database methods that re-base doesn't have helpers for or if you are using the auth service and want to quickly access it off of re-base. + */ + initializedApp: firebase.app.App; + + /** + * This property contains an object that you can use when adding data that will be converted to a timestamp by Firebase. See [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) for more info. + */ + timestamp: {}; + + /** + * Allows you to set up two way data binding between your component's state and your Firebase. Whenever your Firebase changes, your component's state will change. Whenever your component's state changes, Firebase will change. + * @param endpoint The relative Firebase endpoint to which you'd like to bind your component's state. + * @param options syncState Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + syncState(endpoint: string, options: SyncStateOptions): RebaseBinding; + + /** + * One way data binding from Firebase to your component's state. Allows you to bind a component's state property to a Firebase endpoint so whenever that Firebase endpoint changes, your component's state will be updated with that change. + * @param endpoint The relative Firebase endpoint that you'd like to bind to your component's state. + * @param options bindToState Options. + * @returns An object which you can pass to removeBinding if you want to remove the listener while the component is still mounted. + */ + bindToState( + endpoint: string, + options: BindToStateOptions + ): RebaseBinding; + + /** + * Allows you to listen to Firebase endpoints without binding those changes to a state property. Instead, a callback will be invoked with the newly updated data. + * @param endpoint The relative Firebase endpoint which contains the data with which you'd like to invoke your callback function. + * @param options listenTo Options. + * @returns An object which you can pass to removeBinding when your component unmounts to remove the Firebase listeners. + */ + listenTo(endpoint: string, options: ListenToOptions): RebaseBinding; + + /** + * Allows you to retrieve the data from a Firebase endpoint just once without subscribing or listening for data changes. + * @param endpoint The relative Firebase endpoint which contains the data you're wanting to fetch. + * @param options fetch Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + fetch(endpoint: string, options: FetchOptions): Promise; + + /** + * Allows you to update a Firebase endpoint with new data. *Replace all the data at this endpoint with the new data*. + * @param endpoint The relative Firebase endpoint that you'd like to update with the new data. + * @param options post Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + post(endpoint: string, options: PostOptions): Promise; + + /** + * Allows you to add data to a Firebase endpoint. *Adds data to a child of the endpoint with a new Firebase push key*. + * @param endpoint The relative Firebase endpoint that you'd like to push the new data to. + * @param options push Options. + * @returns A Firebase [ThenableReference](https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference) which is defined by Firebase as a "Combined Promise and reference; resolves when write is complete, but can be used immediately as the reference to the child location." + */ + push(endpoint: string, options: PushOptions): Promise; + + /** + * Allows you to update data at a Firebase endpoint changing only the properties you pass to it. **Warning: calling update with `options.data` being null will remove all the data at that endpoint**. + * @param endpoint The relative Firebase endpoint that you'd like to update. + * @param options update Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + update(endpoint: string, options: UpdateOptions): Promise; + + /** + * Allows you to delete all data at the endpoint location. + * @param endpoint The relative Firebase endpoint that you'd like to delete data from. + * @param callback A callback that will get invoked once the data is successfully removed Firebase. If there is an error, it will be the only argument to this function. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. + */ + remove( + endpoint: string, + callback?: (result: Promise) => void + ): Promise; + + /** + * Bind a document to your component. When then document changes in firestore, your component will re-render with the latest data. + * @param refOrPath DocumentReference or path. + * @param options bindDoc Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + bindDoc( + refOrPath: DocumentReference | string, + options: bindDocOptions + ): RebaseBinding; + + /** + * Listen to a document, when the data changes it will invoke a callback passing it the new data from Firestore. + * @param refOrPath DocumentReference or path. + * @param options listenToDoc Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + listenToDoc( + refOrPath: DocumentReference | string, + options: listenToDocOptions + ): RebaseBinding; + + /** + * Bind a collection to a state property in your component. When then collection changes in firestore, your component will re-render with the latest data. + * @param refOrPath CollectionReference or path. + * @param options bindCollection Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + bindCollection( + refOrPath: CollectionReference | string, + options: bindCollectionOptions + ): RebaseBinding; + + /** + * Listen to a collection, when the data changes it will invoke a callback passing it the new data from Firestore. + * @param refOrPath CollectionReference or path. + * @param options listenToCollection Options. + * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. + */ + listenToCollection( + refOrPath: CollectionReference | string, + options: listenToCollectionOptions + ): RebaseBinding; + + /** + * Fetch either a Collection or Document. + * @param refOrPath CollectionReference, DocumentReference or path. + * @param options get Options. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + get( + refOrPath: CollectionReference | DocumentReference | string, + options: listenToCollectionOptions + ): Promise; + + /** + * Add a new Document to a Collection. + * @param refOrPath CollectionReference or path. + * @param data The document data. + * @param id The id for the document. If omitted, the Firestore will generate an id for you. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + addToCollection( + refOrPath: CollectionReference | string, + data: {}, + id?: string + ): Promise; + + /** + * Update an existing document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + updateDoc( + refOrPath: DocumentReference | string, + data: {} + ): Promise; + + /** + * Deletes a document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + removeDoc( + refOrPath: DocumentReference | string, + data: {} + ): Promise; + + /** + * Removes documents from a collection. If no query is supplied, it will remove all the documents. If a query is supplied, it will only remove documents that match the query. + * @param refOrPath CollectionReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + removeFromCollection( + refOrPath: CollectionReference | string, + options: removeFromCollectionOptions + ): Promise; + + /** + * Syncs a component's local state with a document in Firestore. + * @param refOrPath DocumentReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. + */ + syncDoc( + refOrPath: DocumentReference | string, + options: syncDocOptions + ): RebaseBinding; + + /** + * Clean up a listener. Listeners are automatically cleaned up when components unmount, however if you wish to remove a listener while the component is still mounted this will allow you to do that. An example would be if you want to start listening to a new document or change a query on all collection in response to a prop change. + * @param ref The return value of syncState`, `bindToState`, `listenTo`, `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or `syncDoc`. + */ + removeBinding(ref: RebaseBinding): void; + + /** + * Removes every Firebase/Firestore listener. + */ + reset(): void; + } +} + +declare module "re-base" { + /** + * Accepts an initialized firebase database or firestore database object. + * @param {object} firebaseDatabase Initialized firebase or firestore + * database. + * @return {Rebase} An instance of re-base. + */ + export function createClass( + firebaseDatabase: + | firebase.database.Database + | firebase.firestore.Firestore + ): rebase.Rebase; +} diff --git a/types/re-base/re-base-tests.ts b/types/re-base/re-base-tests.ts new file mode 100644 index 0000000000..702a6ab2dd --- /dev/null +++ b/types/re-base/re-base-tests.ts @@ -0,0 +1,9 @@ +import * as rebase from "re-base"; + +const database = {}; +const base = rebase.createClass(database); + +const _ref = base.syncState("foo", { + context: "bar", + state: "baz" +}); diff --git a/types/re-base/tsconfig.json b/types/re-base/tsconfig.json new file mode 100644 index 0000000000..eb916d27f6 --- /dev/null +++ b/types/re-base/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "re-base-tests.ts" + ] +} diff --git a/types/re-base/tslint.json b/types/re-base/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/re-base/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5b51b45acec73d734905354ce064dc5e9231dc77 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 29 May 2018 17:03:12 -0700 Subject: [PATCH 35/62] Enabled linters and fixed errors. Couldn't enable `unified-signatures` because of some overloads that take `any` as a substitute for node-canvas. --- types/qrcode/index.d.ts | 58 ++++++---------------------- types/qrcode/qrcode-tests.ts | 20 +++++----- types/qrcode/tslint.json | 75 +----------------------------------- 3 files changed, 23 insertions(+), 130 deletions(-) diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index 1bf0a13454..5d607b2908 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for qrcode 1.2.0 +// Type definitions for qrcode 1.2 // Project: https://github.com/soldair/node-qrcode -// Definitions by: York Yao +// Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -22,7 +22,7 @@ export interface QRCodeOptions { * Helper function used internally to convert a kanji to its Shift JIS value. * Provide this function if you need support for Kanji mode. */ - toSJISFunc?: Function; + toSJISFunc?: (codePoint: string) => number; } export interface QRCodeToDataURLOptions extends QRCodeRenderersOptions { @@ -127,10 +127,6 @@ export interface QRCode { */ export function create(text: string | QRCodeSegment[], options: QRCodeOptions): QRCode; -/** - * Draws qr code symbol to canvas. - */ -export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[]): Promise; /** * Draws qr code symbol to canvas. */ @@ -138,15 +134,11 @@ export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCode /** * Draws qr code symbol to canvas. */ -export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeOptions): Promise; +export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options?: QRCodeOptions): Promise; /** * Draws qr code symbol to canvas. */ export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; -/** - * Draws qr code symbol to canvas. - */ -export function toCanvas(text: string | QRCodeSegment[]): Promise; /** * Draws qr code symbol to canvas. */ @@ -154,15 +146,11 @@ export function toCanvas(text: string | QRCodeSegment[], callback: (error: Error /** * Draws qr code symbol to canvas. */ -export function toCanvas(text: string | QRCodeSegment[], options: QRCodeOptions): Promise; +export function toCanvas(text: string | QRCodeSegment[], options?: QRCodeOptions): Promise; /** * Draws qr code symbol to canvas. */ export function toCanvas(text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; -/** - * Draws qr code symbol to node canvas. - */ -export function toCanvas(canvas: any, text: string | QRCodeSegment[]): Promise; /** * Draws qr code symbol to node canvas. */ @@ -170,16 +158,12 @@ export function toCanvas(canvas: any, text: string | QRCodeSegment[], callback: /** * Draws qr code symbol to node canvas. */ -export function toCanvas(canvas: any, text: string | QRCodeSegment[], options: QRCodeOptions): Promise; +export function toCanvas(canvas: any, text: string | QRCodeSegment[], options?: QRCodeOptions): Promise; /** * Draws qr code symbol to node canvas. */ export function toCanvas(canvas: any, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; -/** - * Returns a Data URI containing a representation of the QR Code image. - */ -export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[]): Promise; /** * Returns a Data URI containing a representation of the QR Code image. */ @@ -187,15 +171,12 @@ export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCod /** * Returns a Data URI containing a representation of the QR Code image. */ -export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeToDataURLOptions): Promise; +export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options?: QRCodeToDataURLOptions): Promise; /** * Returns a Data URI containing a representation of the QR Code image. */ export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void; -/** - * Returns a Data URI containing a representation of the QR Code image. - */ -export function toDataURL(text: string | QRCodeSegment[]): Promise; + /** * Returns a Data URI containing a representation of the QR Code image. */ @@ -203,17 +184,12 @@ export function toDataURL(text: string | QRCodeSegment[], callback: (error: Erro /** * Returns a Data URI containing a representation of the QR Code image. */ -export function toDataURL(text: string | QRCodeSegment[], options: QRCodeToDataURLOptions): Promise; +export function toDataURL(text: string | QRCodeSegment[], options?: QRCodeToDataURLOptions): Promise; /** * Returns a Data URI containing a representation of the QR Code image. */ export function toDataURL(text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void; -/** - * Returns a string representation of the QR Code. - * If choosen output format is svg it will returns a string containing xml code. - */ -export function toString(text: string | QRCodeSegment[]): Promise; /** * Returns a string representation of the QR Code. * If choosen output format is svg it will returns a string containing xml code. @@ -223,19 +199,13 @@ export function toString(text: string | QRCodeSegment[], callback: (error: Error * Returns a string representation of the QR Code. * If choosen output format is svg it will returns a string containing xml code. */ -export function toString(text: string | QRCodeSegment[], options: QRCodeToStringOptions): Promise; +export function toString(text: string | QRCodeSegment[], options?: QRCodeToStringOptions): Promise; /** * Returns a string representation of the QR Code. * If choosen output format is svg it will returns a string containing xml code. */ export function toString(text: string | QRCodeSegment[], options: QRCodeToStringOptions, callback: (error: Error, string: string) => void): void; -/** - * Saves QR Code to image file. - * If options.type is not specified, the format will be guessed from file extension. - * Recognized extensions are png, svg, txt. - */ -export function toFile(path: string, text: string | QRCodeSegment[]): Promise; /** * Saves QR Code to image file. * If options.type is not specified, the format will be guessed from file extension. @@ -247,7 +217,7 @@ export function toFile(path: string, text: string | QRCodeSegment[], callback: ( * If options.type is not specified, the format will be guessed from file extension. * Recognized extensions are png, svg, txt. */ -export function toFile(path: string, text: string | QRCodeSegment[], options: QRCodeToFileOptions): Promise; +export function toFile(path: string, text: string | QRCodeSegment[], options?: QRCodeToFileOptions): Promise; /** * Saves QR Code to image file. * If options.type is not specified, the format will be guessed from file extension. @@ -255,10 +225,6 @@ export function toFile(path: string, text: string | QRCodeSegment[], options: QR */ export function toFile(path: string, text: string | QRCodeSegment[], options: QRCodeToFileOptions, callback: (error: Error) => void): void; -/** - * Writes QR Code image to stream. Only works with png format for now. - */ -export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[]): Promise; /** * Writes QR Code image to stream. Only works with png format for now. */ @@ -266,7 +232,7 @@ export function toFileStream(stream: stream.Writable, text: string | QRCodeSegme /** * Writes QR Code image to stream. Only works with png format for now. */ -export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], options: QRCodeOptions): Promise; +export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], options?: QRCodeOptions): Promise; /** * Writes QR Code image to stream. Only works with png format for now. */ diff --git a/types/qrcode/qrcode-tests.ts b/types/qrcode/qrcode-tests.ts index 6a94a5f580..363367cc28 100644 --- a/types/qrcode/qrcode-tests.ts +++ b/types/qrcode/qrcode-tests.ts @@ -2,31 +2,31 @@ import * as QRCode from 'qrcode'; const canvas = document.getElementById('canvas') as HTMLCanvasElement; -QRCode.toCanvas(canvas, 'sample text', function (error) { - if (error) console.error(error) +QRCode.toCanvas(canvas, 'sample text', (error) => { + if (error) console.error(error); console.log('success!'); }); -QRCode.toDataURL('I am a pony!', function (err, url) { +QRCode.toDataURL('I am a pony!', (err, url) => { console.log(url); }); -QRCode.toDataURL('some text', { errorCorrectionLevel: 'H' }, function (err, url) { +QRCode.toDataURL('some text', { errorCorrectionLevel: 'H' }, (err, url) => { console.log(url); }); -QRCode.toDataURL('some text', { version: 2 }, function (err, url) { +QRCode.toDataURL('some text', { version: 2 }, (err, url) => { console.log(url); }); QRCode.toDataURL([ { data: 'ABCDEFG', mode: 'alphanumeric' }, { data: '0123456', mode: 'numeric' } -], function (err, url) { +], (err, url) => { console.log(url); }); -QRCode.toCanvas('text', { errorCorrectionLevel: 'H' }, function (err, canvas) { +QRCode.toCanvas('text', { errorCorrectionLevel: 'H' }, (err, canvas) => { if (err) throw err; }); @@ -36,11 +36,11 @@ QRCode.toDataURL('text', { rendererOpts: { quality: 0.3 } -}, function (err, url) { +}, (err, url) => { if (err) throw err; }); -QRCode.toString('http://www.google.com', function (err, string) { +QRCode.toString('http://www.google.com', (err, string) => { if (err) throw err; console.log(string); }); @@ -50,7 +50,7 @@ QRCode.toFile('path/to/filename.png', 'Some text', { dark: '#00F', // Blue dots light: '#0000' // Transparent background } -}, function (err) { +}, (err) => { if (err) throw err; console.log('done'); }); diff --git a/types/qrcode/tslint.json b/types/qrcode/tslint.json index a41bf5d19a..08b1465cd6 100644 --- a/types/qrcode/tslint.json +++ b/types/qrcode/tslint.json @@ -1,79 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } From d065c5666ee2d2bf31e2d89bfa32b863c6d493ef Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Thu, 17 May 2018 17:51:13 -0700 Subject: [PATCH 36/62] Fix linting errors. --- types/re-base/index.d.ts | 96 ++++++++++--------------------------- types/re-base/tsconfig.json | 14 ++---- types/re-base/tslint.json | 8 +++- 3 files changed, 36 insertions(+), 82 deletions(-) diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts index 928bca7c47..5934b67295 100644 --- a/types/re-base/index.d.ts +++ b/types/re-base/index.d.ts @@ -3,27 +3,7 @@ // Definitions by: jordandrako // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface QueryOptions {} - -interface RebaseBinding {} - -declare namespace firebase { - -} - -declare namespace firebase.app { - interface App {} -} - -declare namespace firebase.database { - interface Database {} -} - -declare namespace firebase.firestore { - class Firestore {} -} - -declare namespace rebase { +export namespace rebase { interface SyncStateOptions { /** * The context of your component. @@ -53,7 +33,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; /** * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with syncState) to change this.state.loading to false. @@ -85,7 +65,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; /** * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with bindToState) to change this.state.loading to false. @@ -122,7 +102,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; } interface FetchOptions { @@ -149,7 +129,7 @@ declare namespace rebase { /** * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. */ - queries?: QueryOptions; + queries?: {}; } interface PostOptions { @@ -188,10 +168,6 @@ declare namespace rebase { then?: (result: any) => void; } - interface DocumentReference {} - - interface CollectionReference {} - interface bindDocOptions { /** * Your react component. @@ -350,7 +326,7 @@ declare namespace rebase { /** * This property contains the initialized firebase app that was passed into re-base. You can access any of the firebase services that you are using off this object. For instance, if you want to use some firebase database methods that re-base doesn't have helpers for or if you are using the auth service and want to quickly access it off of re-base. */ - initializedApp: firebase.app.App; + initializedApp: {}; /** * This property contains an object that you can use when adding data that will be converted to a timestamp by Firebase. See [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) for more info. @@ -363,7 +339,7 @@ declare namespace rebase { * @param options syncState Options. * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ - syncState(endpoint: string, options: SyncStateOptions): RebaseBinding; + syncState(endpoint: string, options: SyncStateOptions): {}; /** * One way data binding from Firebase to your component's state. Allows you to bind a component's state property to a Firebase endpoint so whenever that Firebase endpoint changes, your component's state will be updated with that change. @@ -371,10 +347,7 @@ declare namespace rebase { * @param options bindToState Options. * @returns An object which you can pass to removeBinding if you want to remove the listener while the component is still mounted. */ - bindToState( - endpoint: string, - options: BindToStateOptions - ): RebaseBinding; + bindToState(endpoint: string, options: BindToStateOptions): {}; /** * Allows you to listen to Firebase endpoints without binding those changes to a state property. Instead, a callback will be invoked with the newly updated data. @@ -382,7 +355,7 @@ declare namespace rebase { * @param options listenTo Options. * @returns An object which you can pass to removeBinding when your component unmounts to remove the Firebase listeners. */ - listenTo(endpoint: string, options: ListenToOptions): RebaseBinding; + listenTo(endpoint: string, options: ListenToOptions): {}; /** * Allows you to retrieve the data from a Firebase endpoint just once without subscribing or listening for data changes. @@ -433,10 +406,7 @@ declare namespace rebase { * @param options bindDoc Options. * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ - bindDoc( - refOrPath: DocumentReference | string, - options: bindDocOptions - ): RebaseBinding; + bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; /** * Listen to a document, when the data changes it will invoke a callback passing it the new data from Firestore. @@ -444,10 +414,7 @@ declare namespace rebase { * @param options listenToDoc Options. * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ - listenToDoc( - refOrPath: DocumentReference | string, - options: listenToDocOptions - ): RebaseBinding; + listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; /** * Bind a collection to a state property in your component. When then collection changes in firestore, your component will re-render with the latest data. @@ -456,9 +423,9 @@ declare namespace rebase { * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ bindCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, options: bindCollectionOptions - ): RebaseBinding; + ): {}; /** * Listen to a collection, when the data changes it will invoke a callback passing it the new data from Firestore. @@ -467,9 +434,9 @@ declare namespace rebase { * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. */ listenToCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, options: listenToCollectionOptions - ): RebaseBinding; + ): {}; /** * Fetch either a Collection or Document. @@ -478,7 +445,7 @@ declare namespace rebase { * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ get( - refOrPath: CollectionReference | DocumentReference | string, + refOrPath: {} | {} | string, options: listenToCollectionOptions ): Promise; @@ -490,7 +457,7 @@ declare namespace rebase { * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ addToCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, data: {}, id?: string ): Promise; @@ -501,10 +468,7 @@ declare namespace rebase { * @param data The document data. * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ - updateDoc( - refOrPath: DocumentReference | string, - data: {} - ): Promise; + updateDoc(refOrPath: {} | string, data: {}): Promise; /** * Deletes a document. @@ -512,10 +476,7 @@ declare namespace rebase { * @param data The document data. * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ - removeDoc( - refOrPath: DocumentReference | string, - data: {} - ): Promise; + removeDoc(refOrPath: {} | string, data: {}): Promise; /** * Removes documents from a collection. If no query is supplied, it will remove all the documents. If a query is supplied, it will only remove documents that match the query. @@ -524,7 +485,7 @@ declare namespace rebase { * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ removeFromCollection( - refOrPath: CollectionReference | string, + refOrPath: {} | string, options: removeFromCollectionOptions ): Promise; @@ -534,16 +495,13 @@ declare namespace rebase { * @param options removeFromCollection Options. * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. */ - syncDoc( - refOrPath: DocumentReference | string, - options: syncDocOptions - ): RebaseBinding; + syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; /** * Clean up a listener. Listeners are automatically cleaned up when components unmount, however if you wish to remove a listener while the component is still mounted this will allow you to do that. An example would be if you want to start listening to a new document or change a query on all collection in response to a prop change. * @param ref The return value of syncState`, `bindToState`, `listenTo`, `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or `syncDoc`. */ - removeBinding(ref: RebaseBinding): void; + removeBinding(ref: {}): void; /** * Removes every Firebase/Firestore listener. @@ -555,13 +513,9 @@ declare namespace rebase { declare module "re-base" { /** * Accepts an initialized firebase database or firestore database object. - * @param {object} firebaseDatabase Initialized firebase or firestore + * @param firebaseDatabase Initialized firebase or firestore * database. - * @return {Rebase} An instance of re-base. + * @return An instance of re-base. */ - export function createClass( - firebaseDatabase: - | firebase.database.Database - | firebase.firestore.Firestore - ): rebase.Rebase; + function createClass(firebaseDatabase: {}): rebase.Rebase; } diff --git a/types/re-base/tsconfig.json b/types/re-base/tsconfig.json index eb916d27f6..ff88a407d4 100644 --- a/types/re-base/tsconfig.json +++ b/types/re-base/tsconfig.json @@ -1,22 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "re-base-tests.ts" - ] + "files": ["index.d.ts", "re-base-tests.ts"] } diff --git a/types/re-base/tslint.json b/types/re-base/tslint.json index 3db14f85ea..c077883976 100644 --- a/types/re-base/tslint.json +++ b/types/re-base/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": false, + "no-declare-current-package": false + } +} From e5af6babf3691a7e80dee85f7d699b275f17510a Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Thu, 17 May 2018 19:38:18 -0700 Subject: [PATCH 37/62] Stricter linting rules --- types/re-base/tslint.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/types/re-base/tslint.json b/types/re-base/tslint.json index c077883976..3db14f85ea 100644 --- a/types/re-base/tslint.json +++ b/types/re-base/tslint.json @@ -1,7 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "max-line-length": false, - "no-declare-current-package": false - } -} +{ "extends": "dtslint/dt.json" } From 8fc58a68c35469a9796cd0e9dc5f76e982515fd2 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Thu, 17 May 2018 19:40:03 -0700 Subject: [PATCH 38/62] - JSdoc line lengths - remove needless namespace - remove declare namesake module --- types/re-base/index.d.ts | 1155 +++++++++++++++++++++----------------- 1 file changed, 642 insertions(+), 513 deletions(-) diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts index 5934b67295..ba838df0aa 100644 --- a/types/re-base/index.d.ts +++ b/types/re-base/index.d.ts @@ -3,519 +3,648 @@ // Definitions by: jordandrako // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export namespace rebase { - interface SyncStateOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar`. - */ - state: string; - - /** - * A default value to set when the Firebase endpoint has no value (i.e., on init) (use this if you want a value other than an empty object or empty array) - */ - defaultValue?: string | boolean | number | {}; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * Will keep any firebase generated keys intact when manipulating data using the asArray option. - */ - keepKeys?: boolean; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - - /** - * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with syncState) to change this.state.loading to false. - */ - then?: () => void; - - /** - * A callback function that will be invoked if the current user does not have read or write permissions at the location. - */ - onFailure?: () => void; - } - - interface BindToStateOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * The state property you want to sync with Firebase; can be an arbitrarily nested property a là `foo.bar` (no arrays). - */ - state: string; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - - /** - * The callback function that will be invoked when the initial listener is established with Firebase. Typically used (with bindToState) to change this.state.loading to false. - */ - then?: () => void; - - /** - * A callback function that will be invoked if the current user does not have read permissions at the location. - */ - onFailure?: () => void; - } - - interface ListenToOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. - */ - then: (result: any) => void; - - /** - * The callback function that will be invoked if the current user does not have read permissions at the location. - */ - onFailure?: (error: any) => void; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - } - - interface FetchOptions { - /** - * The context of your component. - */ - context: {}; - - /** - * Returns the Firebase data at the specified endpoint as an Array instead of an Object. - */ - asArray?: boolean; - - /** - * The callback function that will be invoked with the data from the specified endpoint when the endpoint changes. - */ - then?: (result: any) => void; - - /** - * The callback function that will be invoked with an error that occurs reading data from the specified endpoint. - */ - onFailure?: () => void; - - /** - * Queries to be used with your read operations. See [Query Options](https://github.com/tylermcginnis/re-base#queries) for more details. - */ - queries?: {}; - } - - interface PostOptions { - /** - * The data you're wanting to persist to Firebase. - */ - data: any; - - /** - * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. - */ - then?: (result: any) => void; - } - - interface PushOptions { - /** - * The data you're wanting to persist to Firebase. - */ - data: any; - - /** - * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. - */ - then?: (result: any) => void; - } - - interface UpdateOptions { - /** - * The data you're wanting to persist to Firebase. - */ - data: any; - - /** - * A callback that will get invoked once the new data has been saved to Firebase. If there is an error, it will be the only argument to this function. - */ - then?: (result: any) => void; - } - - interface bindDocOptions { - /** - * Your react component. - */ - context: {}; - - /** - * A property name on your state to bind your document to, if omitted the document will be merged into your existing state. - */ - state?: string; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface listenToDocOptions { - /** - * Your react component. - */ - context: {}; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface bindCollectionOptions { - /** - * Your react component. - */ - context: {}; - - /** - * The state property to bind the collection to. - */ - state?: string; - - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - - /** - * Will embed firestore generated document ids inside each document in your collections on the `id` property. - */ - withIds?: boolean; - - /** - * will embed the DocumentReference inside each document in your collection on the `ref` property. - */ - withRefs?: boolean; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface listenToCollectionOptions { - /** - * Your react component. - */ - context: {}; - - /** - * A callback that will be called with the data. - */ - then: () => void; - - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - - /** - * Will embed firestore generated document ids inside each document in your collections on the `id` property. - */ - withIds?: boolean; - - /** - * will embed the DocumentReference inside each document in your collection on the `ref` property. - */ - withRefs?: boolean; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface getOptions { - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - - /** - * Will embed firestore generated document ids inside each document in your collections on the `id` property. - */ - withIds?: boolean; - - /** - * will embed the DocumentReference inside each document in your collection on the `ref` property. - */ - withRefs?: boolean; - } - - interface removeFromCollectionOptions { - /** - * A function that receives the created ref as its only argument. You can chain any Firestore queries you want to perform. See [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). - */ - query?: () => void; - } - - interface syncDocOptions { - /** - * Your react component. - */ - context: {}; - - /** - * The state property to sync. - */ - state: string; - - /** - * A callback that will be called when the listener is set, use for loading indicators. - */ - then?: () => void; - - /** - * A callback that will be called with any errors such as permissions errors. - */ - onFailure?: () => void; - } - - interface Rebase { - /** - * This property contains the initialized firebase app that was passed into re-base. You can access any of the firebase services that you are using off this object. For instance, if you want to use some firebase database methods that re-base doesn't have helpers for or if you are using the auth service and want to quickly access it off of re-base. - */ - initializedApp: {}; - - /** - * This property contains an object that you can use when adding data that will be converted to a timestamp by Firebase. See [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) for more info. - */ - timestamp: {}; - - /** - * Allows you to set up two way data binding between your component's state and your Firebase. Whenever your Firebase changes, your component's state will change. Whenever your component's state changes, Firebase will change. - * @param endpoint The relative Firebase endpoint to which you'd like to bind your component's state. - * @param options syncState Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - syncState(endpoint: string, options: SyncStateOptions): {}; - - /** - * One way data binding from Firebase to your component's state. Allows you to bind a component's state property to a Firebase endpoint so whenever that Firebase endpoint changes, your component's state will be updated with that change. - * @param endpoint The relative Firebase endpoint that you'd like to bind to your component's state. - * @param options bindToState Options. - * @returns An object which you can pass to removeBinding if you want to remove the listener while the component is still mounted. - */ - bindToState(endpoint: string, options: BindToStateOptions): {}; - - /** - * Allows you to listen to Firebase endpoints without binding those changes to a state property. Instead, a callback will be invoked with the newly updated data. - * @param endpoint The relative Firebase endpoint which contains the data with which you'd like to invoke your callback function. - * @param options listenTo Options. - * @returns An object which you can pass to removeBinding when your component unmounts to remove the Firebase listeners. - */ - listenTo(endpoint: string, options: ListenToOptions): {}; - - /** - * Allows you to retrieve the data from a Firebase endpoint just once without subscribing or listening for data changes. - * @param endpoint The relative Firebase endpoint which contains the data you're wanting to fetch. - * @param options fetch Options. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - fetch(endpoint: string, options: FetchOptions): Promise; - - /** - * Allows you to update a Firebase endpoint with new data. *Replace all the data at this endpoint with the new data*. - * @param endpoint The relative Firebase endpoint that you'd like to update with the new data. - * @param options post Options. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - post(endpoint: string, options: PostOptions): Promise; - - /** - * Allows you to add data to a Firebase endpoint. *Adds data to a child of the endpoint with a new Firebase push key*. - * @param endpoint The relative Firebase endpoint that you'd like to push the new data to. - * @param options push Options. - * @returns A Firebase [ThenableReference](https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference) which is defined by Firebase as a "Combined Promise and reference; resolves when write is complete, but can be used immediately as the reference to the child location." - */ - push(endpoint: string, options: PushOptions): Promise; - - /** - * Allows you to update data at a Firebase endpoint changing only the properties you pass to it. **Warning: calling update with `options.data` being null will remove all the data at that endpoint**. - * @param endpoint The relative Firebase endpoint that you'd like to update. - * @param options update Options. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - update(endpoint: string, options: UpdateOptions): Promise; - - /** - * Allows you to delete all data at the endpoint location. - * @param endpoint The relative Firebase endpoint that you'd like to delete data from. - * @param callback A callback that will get invoked once the data is successfully removed Firebase. If there is an error, it will be the only argument to this function. - * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) which resolves when the write is complete and rejects if there is an error. - */ - remove( - endpoint: string, - callback?: (result: Promise) => void - ): Promise; - - /** - * Bind a document to your component. When then document changes in firestore, your component will re-render with the latest data. - * @param refOrPath DocumentReference or path. - * @param options bindDoc Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; - - /** - * Listen to a document, when the data changes it will invoke a callback passing it the new data from Firestore. - * @param refOrPath DocumentReference or path. - * @param options listenToDoc Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; - - /** - * Bind a collection to a state property in your component. When then collection changes in firestore, your component will re-render with the latest data. - * @param refOrPath CollectionReference or path. - * @param options bindCollection Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - bindCollection( - refOrPath: {} | string, - options: bindCollectionOptions - ): {}; - - /** - * Listen to a collection, when the data changes it will invoke a callback passing it the new data from Firestore. - * @param refOrPath CollectionReference or path. - * @param options listenToCollection Options. - * @returns An object which you can pass to `removeBinding` if you want to remove the listener while the component is still mounted. - */ - listenToCollection( - refOrPath: {} | string, - options: listenToCollectionOptions - ): {}; - - /** - * Fetch either a Collection or Document. - * @param refOrPath CollectionReference, DocumentReference or path. - * @param options get Options. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - get( - refOrPath: {} | {} | string, - options: listenToCollectionOptions - ): Promise; - - /** - * Add a new Document to a Collection. - * @param refOrPath CollectionReference or path. - * @param data The document data. - * @param id The id for the document. If omitted, the Firestore will generate an id for you. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - addToCollection( - refOrPath: {} | string, - data: {}, - id?: string - ): Promise; - - /** - * Update an existing document. - * @param refOrPath DocumentReference or path. - * @param data The document data. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - updateDoc(refOrPath: {} | string, data: {}): Promise; - - /** - * Deletes a document. - * @param refOrPath DocumentReference or path. - * @param data The document data. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - removeDoc(refOrPath: {} | string, data: {}): Promise; - - /** - * Removes documents from a collection. If no query is supplied, it will remove all the documents. If a query is supplied, it will only remove documents that match the query. - * @param refOrPath CollectionReference or path. - * @param options removeFromCollection Options. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - removeFromCollection( - refOrPath: {} | string, - options: removeFromCollectionOptions - ): Promise; - - /** - * Syncs a component's local state with a document in Firestore. - * @param refOrPath DocumentReference or path. - * @param options removeFromCollection Options. - * @returns A Promise thats resolve with the resulting data or rejects if the document/collection does not exist or there are any read errors. - */ - syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; - - /** - * Clean up a listener. Listeners are automatically cleaned up when components unmount, however if you wish to remove a listener while the component is still mounted this will allow you to do that. An example would be if you want to start listening to a new document or change a query on all collection in response to a prop change. - * @param ref The return value of syncState`, `bindToState`, `listenTo`, `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or `syncDoc`. - */ - removeBinding(ref: {}): void; - - /** - * Removes every Firebase/Firestore listener. - */ - reset(): void; - } -} - -declare module "re-base" { +export interface SyncStateOptions { /** - * Accepts an initialized firebase database or firestore database object. - * @param firebaseDatabase Initialized firebase or firestore - * database. - * @return An instance of re-base. + * The context of your component. */ - function createClass(firebaseDatabase: {}): rebase.Rebase; + context: {}; + + /** + * The state property you want to sync with Firebase; can be an + * arbitrarily nested property a là `foo.bar`. + */ + state: string; + + /** + * A default value to set when the Firebase endpoint has no value (i.e., + * on init) (use this if you want a value other than an empty object or + * empty array) + */ + defaultValue?: string | boolean | number | {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * Will keep any firebase generated keys intact when manipulating data + * using the asArray option. + */ + keepKeys?: boolean; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; + + /** + * The callback function that will be invoked when the initial listener + * is established with Firebase. Typically used (with syncState) to + * change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does + * not have read or write permissions at the location. + */ + onFailure?: () => void; } + +export interface BindToStateOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property you want to sync with Firebase; can be an + * arbitrarily nested property a là `foo.bar` (no arrays). + */ + state: string; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; + + /** + * The callback function that will be invoked when the initial listener + * is established with Firebase. Typically used (with bindToState) to + * change this.state.loading to false. + */ + then?: () => void; + + /** + * A callback function that will be invoked if the current user does + * not have read permissions at the location. + */ + onFailure?: () => void; +} + +export interface ListenToOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the + * specified endpoint when the endpoint changes. + */ + then: (result: any) => void; + + /** + * The callback function that will be invoked if the current user does + * not have read permissions at the location. + */ + onFailure?: (error: any) => void; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; +} + +export interface FetchOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * Returns the Firebase data at the specified endpoint as an Array + * instead of an Object. + */ + asArray?: boolean; + + /** + * The callback function that will be invoked with the data from the + * specified endpoint when the endpoint changes. + */ + then?: (result: any) => void; + + /** + * The callback function that will be invoked with an error that occurs + * reading data from the specified endpoint. + */ + onFailure?: () => void; + + /** + * Queries to be used with your read operations. See + * [Query Options](https://github.com/tylermcginnis/re-base#queries) + * for more details. + */ + queries?: {}; +} + +export interface PostOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to + * Firebase. If there is an error, it will be the only argument to this + * function. + */ + then?: (result: any) => void; +} + +export interface PushOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to + * Firebase. If there is an error, it will be the only argument to this + * function. + */ + then?: (result: any) => void; +} + +export interface UpdateOptions { + /** + * The data you're wanting to persist to Firebase. + */ + data: any; + + /** + * A callback that will get invoked once the new data has been saved to + * Firebase. If there is an error, it will be the only argument to this + * function. + */ + then?: (result: any) => void; +} + +export interface bindDocOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * A property name on your state to bind your document to, if omitted + * the document will be merged into your existing state. + */ + state?: string; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface listenToDocOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface bindCollectionOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property to bind the collection to. + */ + state?: string; + + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in + * your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your + * collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface listenToCollectionOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * A callback that will be called with the data. + */ + then: () => void; + + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in + * your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your + * collection on the `ref` property. + */ + withRefs?: boolean; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface getOptions { + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; + + /** + * Will embed firestore generated document ids inside each document in + * your collections on the `id` property. + */ + withIds?: boolean; + + /** + * will embed the DocumentReference inside each document in your + * collection on the `ref` property. + */ + withRefs?: boolean; +} + +export interface removeFromCollectionOptions { + /** + * A function that receives the created ref as its only argument. You + * can chain any Firestore queries you want to perform. See + * [Using Firestore Queries](https://github.com/tylermcginnis/re-base#firestorequeries). + */ + query?: () => void; +} + +export interface syncDocOptions { + /** + * The context of your component. + */ + context: {}; + + /** + * The state property to sync. + */ + state: string; + + /** + * A callback that will be called when the listener is set, use for + * loading indicators. + */ + then?: () => void; + + /** + * A callback that will be called with any errors such as permissions + * errors. + */ + onFailure?: () => void; +} + +export interface Rebase { + /** + * This property contains the initialized firebase app that was passed + * into re-base. You can access any of the firebase services that you + * are using off this object. For instance, if you want to use some + * firebase database methods that re-base doesn't have helpers for or + * if you are using the auth service and want to quickly access it off + * of re-base. + */ + initializedApp: {}; + + /** + * This property contains an object that you can use when adding data + * that will be converted to a timestamp by Firebase. See + * [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) + * for more info. + */ + timestamp: {}; + + /** + * Allows you to set up two way data binding between your component's + * state and your Firebase. Whenever your Firebase changes, your + * component's state will change. Whenever your component's state + * changes, Firebase will change. + * @param endpoint The relative Firebase endpoint to which you'd like + * to bind your component's state. + * @param options syncState Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + syncState(endpoint: string, options: SyncStateOptions): {}; + + /** + * One way data binding from Firebase to your component's state. Allows + * you to bind a component's state property to a Firebase endpoint so + * whenever that Firebase endpoint changes, your component's state will + * be updated with that change. + * @param endpoint The relative Firebase endpoint that you'd like to + * bind to your component's state. + * @param options bindToState Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + bindToState(endpoint: string, options: BindToStateOptions): {}; + + /** + * Allows you to listen to Firebase endpoints without binding those + * changes to a state property. Instead, a callback will be invoked + * with the newly updated data. + * @param endpoint The relative Firebase endpoint which contains the + * data with which you'd like to invoke your callback function. + * @param options listenTo Options. + * @returns An object which you can pass to `removeBinding` when your + * component unmounts to remove the Firebase listeners. + */ + listenTo(endpoint: string, options: ListenToOptions): {}; + + /** + * Allows you to retrieve the data from a Firebase endpoint just once + * without subscribing or listening for data changes. + * @param endpoint The relative Firebase endpoint which contains the + * data you're wanting to fetch. + * @param options fetch Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + fetch(endpoint: string, options: FetchOptions): Promise; + + /** + * Allows you to update a Firebase endpoint with new data. *Replace all + * the data at this endpoint with the new data*. + * @param endpoint The relative Firebase endpoint that you'd like to + * update with the new data. + * @param options post Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + post(endpoint: string, options: PostOptions): Promise; + + /** + * Allows you to add data to a Firebase endpoint. *Adds data to a child + * of the endpoint with a new Firebase push key*. + * @param endpoint The relative Firebase endpoint that you'd like to + * push the new data to. + * @param options push Options. + * @returns A Firebase [ThenableReference](https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference) + * which is defined by Firebase as a "Combined Promise and reference; + * resolves when write is complete, but can be used immediately as the + * reference to the child location." + */ + push(endpoint: string, options: PushOptions): Promise; + + /** + * Allows you to update data at a Firebase endpoint changing only the + * properties you pass to it. **Warning: calling update with + * `options.data` being null will remove all the data at that + * endpoint**. + * @param endpoint The relative Firebase endpoint that you'd like to + * update. + * @param options update Options. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + update(endpoint: string, options: UpdateOptions): Promise; + + /** + * Allows you to delete all data at the endpoint location. + * @param endpoint The relative Firebase endpoint that you'd like to + * delete data from. + * @param callback A callback that will get invoked once the data is + * successfully removed Firebase. If there is an error, it will be the + * only argument to this function. + * @returns A Firebase [Promise](https://firebase.google.com/docs/reference/js/firebase.Promise) + * which resolves when the write is complete and rejects if there is an + * error. + */ + remove( + endpoint: string, + callback?: (result: Promise) => void + ): Promise; + + /** + * Bind a document to your component. When then document changes in + * firestore, your component will re-render with the latest data. + * @param refOrPath DocumentReference or path. + * @param options bindDoc Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; + + /** + * Listen to a document, when the data changes it will invoke a + * callback passing it the new data from Firestore. + * @param refOrPath DocumentReference or path. + * @param options listenToDoc Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; + + /** + * Bind a collection to a state property in your component. When then + * collection changes in firestore, your component will re-render with + * the latest data. + * @param refOrPath CollectionReference or path. + * @param options bindCollection Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + bindCollection( + refOrPath: {} | string, + options: bindCollectionOptions + ): {}; + + /** + * Listen to a collection, when the data changes it will invoke a + * callback passing it the new data from Firestore. + * @param refOrPath CollectionReference or path. + * @param options listenToCollection Options. + * @returns An object which you can pass to `removeBinding` if you want + * to remove the listener while the component is still mounted. + */ + listenToCollection( + refOrPath: {} | string, + options: listenToCollectionOptions + ): {}; + + /** + * Fetch either a Collection or Document. + * @param refOrPath CollectionReference, DocumentReference or path. + * @param options get Options. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + get( + refOrPath: {} | {} | string, + options: listenToCollectionOptions + ): Promise; + + /** + * Add a new Document to a Collection. + * @param refOrPath CollectionReference or path. + * @param data The document data. + * @param id The id for the document. If omitted, the Firestore will + * generate an id for you. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + addToCollection( + refOrPath: {} | string, + data: {}, + id?: string + ): Promise; + + /** + * Update an existing document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + updateDoc(refOrPath: {} | string, data: {}): Promise; + + /** + * Deletes a document. + * @param refOrPath DocumentReference or path. + * @param data The document data. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + removeDoc(refOrPath: {} | string, data: {}): Promise; + + /** + * Removes documents from a collection. If no query is supplied, it + * will remove all the documents. If a query is supplied, it will only + * remove documents that match the query. + * @param refOrPath CollectionReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + removeFromCollection( + refOrPath: {} | string, + options: removeFromCollectionOptions + ): Promise; + + /** + * Syncs a component's local state with a document in Firestore. + * @param refOrPath DocumentReference or path. + * @param options removeFromCollection Options. + * @returns A Promise thats resolve with the resulting data or rejects + * if the document/collection does not exist or there are any read + * errors. + */ + syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; + + /** + * Clean up a listener. Listeners are automatically cleaned up when + * components unmount, however if you wish to remove a listener while + * the component is still mounted this will allow you to do that. An + * example would be if you want to start listening to a new document or + * change a query on all collection in response to a prop change. + * @param ref The return value of syncState`, `bindToState`, `listenTo`, + * `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or + * `syncDoc`. + */ + removeBinding(ref: {}): void; + + /** + * Removes every Firebase/Firestore listener. + */ + reset(): void; +} + +/** + * Accepts an initialized firebase/firestore database object. + * @param database Initialized firebase/firestore + * database. + * @return An instance of re-base. + */ +export function createClass(database: {}): Rebase; From 120f16f2445f25ab8ebe7cf310c0bc6b9c643ccc Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Tue, 29 May 2018 16:37:34 -0700 Subject: [PATCH 39/62] Replace `{}` with `object`, add RebaseBinding interface. --- types/re-base/index.d.ts | 75 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts index ba838df0aa..235ba513dc 100644 --- a/types/re-base/index.d.ts +++ b/types/re-base/index.d.ts @@ -3,11 +3,18 @@ // Definitions by: jordandrako // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export interface RebaseBinding { + context: object; + endpoint: string; + id: number; + method: string; +} + export interface SyncStateOptions { /** * The context of your component. */ - context: {}; + context: object; /** * The state property you want to sync with Firebase; can be an @@ -20,7 +27,7 @@ export interface SyncStateOptions { * on init) (use this if you want a value other than an empty object or * empty array) */ - defaultValue?: string | boolean | number | {}; + defaultValue?: string | boolean | number | object; /** * Returns the Firebase data at the specified endpoint as an Array @@ -39,7 +46,7 @@ export interface SyncStateOptions { * [Query Options](https://github.com/tylermcginnis/re-base#queries) * for more details. */ - queries?: {}; + queries?: object; /** * The callback function that will be invoked when the initial listener @@ -59,7 +66,7 @@ export interface BindToStateOptions { /** * The context of your component. */ - context: {}; + context: object; /** * The state property you want to sync with Firebase; can be an @@ -78,7 +85,7 @@ export interface BindToStateOptions { * [Query Options](https://github.com/tylermcginnis/re-base#queries) * for more details. */ - queries?: {}; + queries?: object; /** * The callback function that will be invoked when the initial listener @@ -98,7 +105,7 @@ export interface ListenToOptions { /** * The context of your component. */ - context: {}; + context: object; /** * Returns the Firebase data at the specified endpoint as an Array @@ -123,14 +130,14 @@ export interface ListenToOptions { * [Query Options](https://github.com/tylermcginnis/re-base#queries) * for more details. */ - queries?: {}; + queries?: object; } export interface FetchOptions { /** * The context of your component. */ - context: {}; + context: object; /** * Returns the Firebase data at the specified endpoint as an Array @@ -155,7 +162,7 @@ export interface FetchOptions { * [Query Options](https://github.com/tylermcginnis/re-base#queries) * for more details. */ - queries?: {}; + queries?: object; } export interface PostOptions { @@ -204,7 +211,7 @@ export interface bindDocOptions { /** * The context of your component. */ - context: {}; + context: object; /** * A property name on your state to bind your document to, if omitted @@ -229,7 +236,7 @@ export interface listenToDocOptions { /** * The context of your component. */ - context: {}; + context: object; /** * A callback that will be called when the listener is set, use for @@ -248,7 +255,7 @@ export interface bindCollectionOptions { /** * The context of your component. */ - context: {}; + context: object; /** * The state property to bind the collection to. @@ -291,7 +298,7 @@ export interface listenToCollectionOptions { /** * The context of your component. */ - context: {}; + context: object; /** * A callback that will be called with the data. @@ -358,7 +365,7 @@ export interface syncDocOptions { /** * The context of your component. */ - context: {}; + context: object; /** * The state property to sync. @@ -387,7 +394,7 @@ export interface Rebase { * if you are using the auth service and want to quickly access it off * of re-base. */ - initializedApp: {}; + initializedApp: object; /** * This property contains an object that you can use when adding data @@ -395,7 +402,7 @@ export interface Rebase { * [the docs](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue) * for more info. */ - timestamp: {}; + timestamp: object; /** * Allows you to set up two way data binding between your component's @@ -408,7 +415,7 @@ export interface Rebase { * @returns An object which you can pass to `removeBinding` if you want * to remove the listener while the component is still mounted. */ - syncState(endpoint: string, options: SyncStateOptions): {}; + syncState(endpoint: string, options: SyncStateOptions): RebaseBinding; /** * One way data binding from Firebase to your component's state. Allows @@ -421,7 +428,7 @@ export interface Rebase { * @returns An object which you can pass to `removeBinding` if you want * to remove the listener while the component is still mounted. */ - bindToState(endpoint: string, options: BindToStateOptions): {}; + bindToState(endpoint: string, options: BindToStateOptions): RebaseBinding; /** * Allows you to listen to Firebase endpoints without binding those @@ -433,7 +440,7 @@ export interface Rebase { * @returns An object which you can pass to `removeBinding` when your * component unmounts to remove the Firebase listeners. */ - listenTo(endpoint: string, options: ListenToOptions): {}; + listenTo(endpoint: string, options: ListenToOptions): RebaseBinding; /** * Allows you to retrieve the data from a Firebase endpoint just once @@ -510,7 +517,7 @@ export interface Rebase { * @returns An object which you can pass to `removeBinding` if you want * to remove the listener while the component is still mounted. */ - bindDoc(refOrPath: {} | string, options: bindDocOptions): {}; + bindDoc(refOrPath: object | string, options: bindDocOptions): object; /** * Listen to a document, when the data changes it will invoke a @@ -520,7 +527,7 @@ export interface Rebase { * @returns An object which you can pass to `removeBinding` if you want * to remove the listener while the component is still mounted. */ - listenToDoc(refOrPath: {} | string, options: listenToDocOptions): {}; + listenToDoc(refOrPath: object | string, options: listenToDocOptions): object; /** * Bind a collection to a state property in your component. When then @@ -532,9 +539,9 @@ export interface Rebase { * to remove the listener while the component is still mounted. */ bindCollection( - refOrPath: {} | string, + refOrPath: object | string, options: bindCollectionOptions - ): {}; + ): RebaseBinding; /** * Listen to a collection, when the data changes it will invoke a @@ -545,9 +552,9 @@ export interface Rebase { * to remove the listener while the component is still mounted. */ listenToCollection( - refOrPath: {} | string, + refOrPath: object | string, options: listenToCollectionOptions - ): {}; + ): RebaseBinding; /** * Fetch either a Collection or Document. @@ -558,7 +565,7 @@ export interface Rebase { * errors. */ get( - refOrPath: {} | {} | string, + refOrPath: object | object | string, options: listenToCollectionOptions ): Promise; @@ -573,8 +580,8 @@ export interface Rebase { * errors. */ addToCollection( - refOrPath: {} | string, - data: {}, + refOrPath: object | string, + data: object, id?: string ): Promise; @@ -586,7 +593,7 @@ export interface Rebase { * if the document/collection does not exist or there are any read * errors. */ - updateDoc(refOrPath: {} | string, data: {}): Promise; + updateDoc(refOrPath: object | string, data: object): Promise; /** * Deletes a document. @@ -596,7 +603,7 @@ export interface Rebase { * if the document/collection does not exist or there are any read * errors. */ - removeDoc(refOrPath: {} | string, data: {}): Promise; + removeDoc(refOrPath: object | string, data: object): Promise; /** * Removes documents from a collection. If no query is supplied, it @@ -609,7 +616,7 @@ export interface Rebase { * errors. */ removeFromCollection( - refOrPath: {} | string, + refOrPath: object | string, options: removeFromCollectionOptions ): Promise; @@ -621,7 +628,7 @@ export interface Rebase { * if the document/collection does not exist or there are any read * errors. */ - syncDoc(refOrPath: {} | string, options: syncDocOptions): {}; + syncDoc(refOrPath: object | string, options: syncDocOptions): object; /** * Clean up a listener. Listeners are automatically cleaned up when @@ -633,7 +640,7 @@ export interface Rebase { * `listenToCollection`, `bindCollection`, `listenToDoc`, `bindDoc` or * `syncDoc`. */ - removeBinding(ref: {}): void; + removeBinding(ref: object): void; /** * Removes every Firebase/Firestore listener. @@ -647,4 +654,4 @@ export interface Rebase { * database. * @return An instance of re-base. */ -export function createClass(database: {}): Rebase; +export function createClass(database: object): Rebase; From 98fcd1ae6e250c401f71342aa3c040e1cbb902f2 Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Tue, 29 May 2018 17:24:53 -0700 Subject: [PATCH 40/62] Require ts v2.2 --- types/re-base/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/re-base/index.d.ts b/types/re-base/index.d.ts index 26d8622a0e..4367476b9b 100644 --- a/types/re-base/index.d.ts +++ b/types/re-base/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tylermcginnis/re-base#readme // Definitions by: jordandrako // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export interface RebaseBinding { context: object; From 8b3949c37489cc5e67451a94cdbd1f7ff06e7b4b Mon Sep 17 00:00:00 2001 From: Jordan Janzen Date: Tue, 29 May 2018 17:25:02 -0700 Subject: [PATCH 41/62] Fix test. --- types/re-base/re-base-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/re-base/re-base-tests.ts b/types/re-base/re-base-tests.ts index 702a6ab2dd..0edc9ea542 100644 --- a/types/re-base/re-base-tests.ts +++ b/types/re-base/re-base-tests.ts @@ -2,8 +2,9 @@ import * as rebase from "re-base"; const database = {}; const base = rebase.createClass(database); +const bar = {}; const _ref = base.syncState("foo", { - context: "bar", - state: "baz" + context: bar, + state: "foo" }); From c64fec9022880267c4f47a5494b705b0c4226275 Mon Sep 17 00:00:00 2001 From: Craig Bruce Date: Thu, 31 May 2018 11:43:28 +1000 Subject: [PATCH 42/62] Fix all TSLint errors and begin first test --- .../cast.framework.breaks.d.ts | 20 +- .../cast.framework.d.ts | 89 ++-- .../cast.framework.events.d.ts | 325 ++++++------ .../cast.framework.messages.d.ts | 465 +++++++++--------- .../cast.framework.system.d.ts | 302 ++++++------ .../cast.framework.ui.d.ts | 99 ++-- .../chromecast-caf-receiver-tests.ts | 67 +-- types/chromecast-caf-receiver/index.d.ts | 21 +- types/chromecast-caf-receiver/tsconfig.json | 20 +- types/chromecast-caf-receiver/tslint.json | 9 +- 10 files changed, 673 insertions(+), 744 deletions(-) diff --git a/types/chromecast-caf-receiver/cast.framework.breaks.d.ts b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts index 4fed094a12..309d87fd74 100644 --- a/types/chromecast-caf-receiver/cast.framework.breaks.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts @@ -1,21 +1,9 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// -/// -/// -/// - -import { Break, BreakClip } from './cast.framework.messages'; +import { Break, BreakClip } from "./cast.framework.messages"; export = cast.framework.breaks; declare namespace cast.framework.breaks { - export class BreakSeekData { + class BreakSeekData { constructor(seekFrom: number, seekTo: number, breaks: Break[]); /** @@ -35,7 +23,7 @@ declare namespace cast.framework.breaks { } /** Provide context information for break clip load interceptor. */ - export class BreakClipLoadInterceptorContext { + class BreakClipLoadInterceptorContext { constructor(brk: Break); /** @@ -45,7 +33,7 @@ declare namespace cast.framework.breaks { } /** Interface to manage breaks */ - export interface BreakManager { + interface BreakManager { /** * Get current media break by id. * @param {*} id diff --git a/types/chromecast-caf-receiver/cast.framework.d.ts b/types/chromecast-caf-receiver/cast.framework.d.ts index a22e9a24b9..1435859859 100644 --- a/types/chromecast-caf-receiver/cast.framework.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.d.ts @@ -1,16 +1,4 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// -/// -/// -/// - -import { EventType } from './cast.framework.events'; +import { EventType } from "./cast.framework.events"; import { PlayerState, PlayStringId, @@ -27,38 +15,35 @@ import { LiveSeekableRange, MediaInformation, ErrorData, - RequestData, -} from './cast.framework.messages'; -import { BreakManager } from './cast.framework.breaks'; -import { EventHandler, RequestHandler, BinaryHandler } from './cast'; + RequestData +} from "./cast.framework.messages"; +import { BreakManager } from "./cast.framework.breaks"; +import { EventHandler, RequestHandler, BinaryHandler } from "./index"; import { + EventType as SystemEventType, ApplicationData, Sender, StandbyState, - SystemState, -} from './cast.framework.system'; + SystemState +} from "./cast.framework.system"; export = cast.framework; - +type HTMLMediaElement = any; declare namespace cast.framework { - export type LoggerLevel = - | 'DEBUG' - | 'VERBOSE' - | 'INFO' - | 'WARNING' - | 'ERROR' - | 'NONE'; + type LoggerLevel = + | "DEBUG" + | "VERBOSE" + | "INFO" + | "WARNING" + | "ERROR" + | "NONE"; - export type ContentProtection = - | 'NONE' - | 'CLEARKEY' - | 'PLAYREADY' - | 'WIDEVINE'; + type ContentProtection = "NONE" | "CLEARKEY" | "PLAYREADY" | "WIDEVINE"; /** * Manages text tracks. */ - export class TextTracksManager { + class TextTracksManager { constructor(params: any); /** @@ -120,7 +105,7 @@ declare namespace cast.framework { /** * QueueManager exposes several queue manipulation APIs to developers. */ - export class QueueManager { + class QueueManager { constructor(params: any); /** @@ -162,7 +147,7 @@ declare namespace cast.framework { /** * Base implementation of a queue. */ - export class QueueBase { + class QueueBase { /** * Fetches a window of items using the specified item id as reference; called by the receiver MediaManager when it needs more queue items; often as a request from senders. If only one of nextCount and prevCount is non-zero; fetchItems should only return items after or before the reference item; if both nextCount and prevCount are non-zero; a window of items including the reference item should be returned. */ @@ -175,7 +160,9 @@ declare namespace cast.framework { /** * Initializes the queue with the requestData. This is called when a new LOAD request comes in to the receiver. If this returns or resolves to null; our default queueing implementation will create a queue based on queueData.items or the single media in the load request data. */ - initialize(requestData: LoadRequestData): QueueData | Promise; + initialize( + requestData: LoadRequestData + ): QueueData | Promise; /** * Returns next items after the reference item; often the end of the current queue; called by the receiver MediaManager. @@ -211,7 +198,7 @@ declare namespace cast.framework { /** * Controls and monitors media playback. */ - export class PlayerManager { + class PlayerManager { constructor(params: any); /** @@ -444,7 +431,7 @@ declare namespace cast.framework { /** * Configuration to customize playback behavior. */ - export class PlaybackConfig { + class PlaybackConfig { /** * Duration of buffered media in seconds to start buffering. */ @@ -523,7 +510,7 @@ declare namespace cast.framework { /** * HTTP(s) Request/Response information. */ - export class NetworkRequestInfo { + class NetworkRequestInfo { /** * The content of the request. Can be used to modify license request body. */ @@ -545,7 +532,7 @@ declare namespace cast.framework { withCredentials: boolean; } /** Cast receiver context options. All options are optionals. */ - export class CastReceiverOptions { + class CastReceiverOptions { /** * Optional map of custom messages namespaces to initialize and their types. * Custom messages namespaces need to be initiated before the application started; @@ -624,7 +611,7 @@ declare namespace cast.framework { } /** Manages loading of underlying libraries and initializes underlying cast receiver SDK. */ - export class CastReceiverContext { + class CastReceiverContext { /** Returns the CastReceiverContext singleton instance. */ static getInstance(): CastReceiverContext; @@ -633,12 +620,18 @@ declare namespace cast.framework { /** * Sets message listener on custom message channel. */ - addCustomMessageListener(namespace: string, listener: EventHandler): void; + addCustomMessageListener( + namespace: string, + listener: EventHandler + ): void; /** * Add listener to cast system events. */ - addEventListener(type: EventType, handler: EventHandler): void; + addEventListener( + type: SystemEventType | SystemEventType[], + handler: EventHandler + ): void; /** * Checks if the given media params of video or audio streams are supported by the platform. @@ -690,7 +683,7 @@ declare namespace cast.framework { /** * Reports if the cast application is the HDMI active input. */ - getVisibilityState(): VisibilityState; + getVisibilityState(): any; /** * When the application calls start; the system will send the ready event to indicate @@ -720,7 +713,11 @@ declare namespace cast.framework { /** * Sends a message to a specific sender. */ - sendCustomMessage(namespace: string, senderId: string, message: any): void; + sendCustomMessage( + namespace: string, + senderId: string, + message: any + ): void; /** * This function should be called in response to the feedbackstarted event if the application @@ -760,7 +757,7 @@ declare namespace cast.framework { } /** Manages audio tracks. */ - export class AudioTracksManager { + class AudioTracksManager { constructor(params: any); getActiveId(): number; getActiveTrack(): Track; diff --git a/types/chromecast-caf-receiver/cast.framework.events.d.ts b/types/chromecast-caf-receiver/cast.framework.events.d.ts index c5e2e71771..0ad1bfee8c 100644 --- a/types/chromecast-caf-receiver/cast.framework.events.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.events.d.ts @@ -1,147 +1,135 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// -/// -/// -/// - import { RequestData, MediaInformation, Track, - MediaStatus, -} from './cast.framework.messages'; + MediaStatus +} from "./cast.framework.messages"; export = cast.framework.events; declare namespace cast.framework.events { - export type EventType = - | 'ALL' - | 'ABORT' - | 'CAN_PLAY' - | 'CAN_PLAY_THROUGH' - | 'DURATION_CHANGE' - | 'EMPTIED' - | 'ENDED' - | 'LOADED_DATA' - | 'LOADED_METADATA' - | 'LOAD_START' - | 'PAUSE' - | 'PLAY' - | 'PLAYING' - | 'PROGRESS' - | 'RATE_CHANGE' - | 'SEEKED' - | 'SEEKING' - | 'STALLED' - | 'TIME_UPDATE' - | 'SUSPEND' - | 'WAITING' - | 'BITRATE_CHANGED' - | 'BREAK_STARTED' - | 'BREAK_ENDED' - | 'BREAK_CLIP_LOADING' - | 'BREAK_CLIP_STARTED' - | 'BREAK_CLIP_ENDED' - | 'BUFFERING' - | 'CACHE_LOADED' - | 'CACHE_HIT' - | 'CACHE_INSERTED' - | 'CLIP_STARTED' - | 'CLIP_ENDED' - | 'EMSG' - | 'ERROR' - | 'ID3' - | 'MEDIA_STATUS' - | 'MEDIA_FINISHED' - | 'PLAYER_PRELOADING' - | 'PLAYER_PRELOADING_CANCELLED' - | 'PLAYER_LOAD_COMPLETE' - | 'PLAYER_LOADING' - | 'SEGMENT_DOWNLOADED' - | 'REQUEST_SEEK' - | 'REQUEST_LOAD' - | 'REQUEST_STOP' - | 'REQUEST_PAUSE' - | 'REQUEST_PLAY' - | 'REQUEST_PLAY_AGAIN' - | 'REQUEST_PLAYBACK_RATE_CHANGE' - | 'REQUEST_SKIP_AD' - | 'REQUEST_VOLUME_CHANGE' - | 'REQUEST_EDIT_TRACKS_INFO' - | 'REQUEST_EDIT_AUDIO_TRACKS' - | 'REQUEST_SET_CREDENTIALS' - | 'REQUEST_LOAD_BY_ENTITY' - | 'REQUEST_USER_ACTION' - | 'REQUEST_DISPLAY_STATUS' - | 'REQUEST_CUSTOM_COMMAND' - | 'REQUEST_FOCUS_STATE' - | 'REQUEST_QUEUE_LOAD' - | 'REQUEST_QUEUE_INSERT' - | 'REQUEST_QUEUE_UPDATE' - | 'REQUEST_QUEUE_REMOVE' - | 'REQUEST_QUEUE_REORDER' - | 'REQUEST_QUEUE_GET_ITEM_RANGE' - | 'REQUEST_QUEUE_GET_ITEMS' - | 'REQUEST_QUEUE_GET_ITEM_IDS' - | 'REQUEST_PRECACHE'; + type EventType = + | "ALL" + | "ABORT" + | "CAN_PLAY" + | "CAN_PLAY_THROUGH" + | "DURATION_CHANGE" + | "EMPTIED" + | "ENDED" + | "LOADED_DATA" + | "LOADED_METADATA" + | "LOAD_START" + | "PAUSE" + | "PLAY" + | "PLAYING" + | "PROGRESS" + | "RATE_CHANGE" + | "SEEKED" + | "SEEKING" + | "STALLED" + | "TIME_UPDATE" + | "SUSPEND" + | "WAITING" + | "BITRATE_CHANGED" + | "BREAK_STARTED" + | "BREAK_ENDED" + | "BREAK_CLIP_LOADING" + | "BREAK_CLIP_STARTED" + | "BREAK_CLIP_ENDED" + | "BUFFERING" + | "CACHE_LOADED" + | "CACHE_HIT" + | "CACHE_INSERTED" + | "CLIP_STARTED" + | "CLIP_ENDED" + | "EMSG" + | "ERROR" + | "ID3" + | "MEDIA_STATUS" + | "MEDIA_FINISHED" + | "PLAYER_PRELOADING" + | "PLAYER_PRELOADING_CANCELLED" + | "PLAYER_LOAD_COMPLETE" + | "PLAYER_LOADING" + | "SEGMENT_DOWNLOADED" + | "REQUEST_SEEK" + | "REQUEST_LOAD" + | "REQUEST_STOP" + | "REQUEST_PAUSE" + | "REQUEST_PLAY" + | "REQUEST_PLAY_AGAIN" + | "REQUEST_PLAYBACK_RATE_CHANGE" + | "REQUEST_SKIP_AD" + | "REQUEST_VOLUME_CHANGE" + | "REQUEST_EDIT_TRACKS_INFO" + | "REQUEST_EDIT_AUDIO_TRACKS" + | "REQUEST_SET_CREDENTIALS" + | "REQUEST_LOAD_BY_ENTITY" + | "REQUEST_USER_ACTION" + | "REQUEST_DISPLAY_STATUS" + | "REQUEST_CUSTOM_COMMAND" + | "REQUEST_FOCUS_STATE" + | "REQUEST_QUEUE_LOAD" + | "REQUEST_QUEUE_INSERT" + | "REQUEST_QUEUE_UPDATE" + | "REQUEST_QUEUE_REMOVE" + | "REQUEST_QUEUE_REORDER" + | "REQUEST_QUEUE_GET_ITEM_RANGE" + | "REQUEST_QUEUE_GET_ITEMS" + | "REQUEST_QUEUE_GET_ITEM_IDS" + | "REQUEST_PRECACHE"; - export type DetailedErrorCode = - | 'MEDIA_UNKNOWN' - | 'MEDIA_ABORTED' - | 'MEDIA_DECODE' - | 'MEDIA_NETWORK' - | 'MEDIA_SRC_NOT_SUPPORTED' - | 'SOURCE_BUFFER_FAILURE' - | 'MEDIAKEYS_UNKNOWN' - | 'MEDIAKEYS_NETWORK' - | 'MEDIAKEYS_UNSUPPORTED' - | 'MEDIAKEYS_WEBCRYPTO' - | 'NETWORK_UNKNOWN' - | 'SEGMENT_NETWORK' - | 'HLS_NETWORK_MASTER_PLAYLIST' - | 'HLS_NETWORK_PLAYLIST' - | 'HLS_NETWORK_NO_KEY_RESPONSE' - | 'HLS_NETWORK_KEY_LOAD' - | 'HLS_NETWORK_INVALID_SEGMENT' - | 'HLS_SEGMENT_PARSING' - | 'DASH_NETWORK' - | 'DASH_NO_INIT' - | 'SMOOTH_NETWORK' - | 'SMOOTH_NO_MEDIA_DATA' - | 'MANIFEST_UNKNOWN' - | 'HLS_MANIFEST_MASTER' - | 'HLS_MANIFEST_PLAYLIST' - | 'DASH_MANIFEST_UNKNOWN' - | 'DASH_MANIFEST_NO_PERIODS' - | 'DASH_MANIFEST_NO_MIMETYPE' - | 'DASH_INVALID_SEGMENT_INFO' - | 'SMOOTH_MANIFEST' - | 'SEGMENT_UNKNOWN' - | 'TEXT_UNKNOWN' - | 'APP' - | 'BREAK_CLIP_LOADING_ERROR' - | 'BREAK_SEEK_INTERCEPTOR_ERROR' - | 'IMAGE_ERROR' - | 'LOAD_INTERRUPTED' - | 'GENERIC'; + type DetailedErrorCode = + | "MEDIA_UNKNOWN" + | "MEDIA_ABORTED" + | "MEDIA_DECODE" + | "MEDIA_NETWORK" + | "MEDIA_SRC_NOT_SUPPORTED" + | "SOURCE_BUFFER_FAILURE" + | "MEDIAKEYS_UNKNOWN" + | "MEDIAKEYS_NETWORK" + | "MEDIAKEYS_UNSUPPORTED" + | "MEDIAKEYS_WEBCRYPTO" + | "NETWORK_UNKNOWN" + | "SEGMENT_NETWORK" + | "HLS_NETWORK_MASTER_PLAYLIST" + | "HLS_NETWORK_PLAYLIST" + | "HLS_NETWORK_NO_KEY_RESPONSE" + | "HLS_NETWORK_KEY_LOAD" + | "HLS_NETWORK_INVALID_SEGMENT" + | "HLS_SEGMENT_PARSING" + | "DASH_NETWORK" + | "DASH_NO_INIT" + | "SMOOTH_NETWORK" + | "SMOOTH_NO_MEDIA_DATA" + | "MANIFEST_UNKNOWN" + | "HLS_MANIFEST_MASTER" + | "HLS_MANIFEST_PLAYLIST" + | "DASH_MANIFEST_UNKNOWN" + | "DASH_MANIFEST_NO_PERIODS" + | "DASH_MANIFEST_NO_MIMETYPE" + | "DASH_INVALID_SEGMENT_INFO" + | "SMOOTH_MANIFEST" + | "SEGMENT_UNKNOWN" + | "TEXT_UNKNOWN" + | "APP" + | "BREAK_CLIP_LOADING_ERROR" + | "BREAK_SEEK_INTERCEPTOR_ERROR" + | "IMAGE_ERROR" + | "LOAD_INTERRUPTED" + | "GENERIC"; - export type EndedReason = - | 'END_OF_STREAM' - | 'ERROR' - | 'STOPPED' - | 'INTERRUPTED' - | 'SKIPPED' - | 'BREAK_SWITCH'; + type EndedReason = + | "END_OF_STREAM" + | "ERROR" + | "STOPPED" + | "INTERRUPTED" + | "SKIPPED" + | "BREAK_SWITCH"; /** * Event data for @see{@link EventType.SEGMENT_DOWNLOADED} event. */ - export class SegmentDownloadedEvent { + class SegmentDownloadedEvent extends Event { constructor(downloadTime?: number, size?: number); /** @@ -158,8 +146,12 @@ declare namespace cast.framework.events { /** * Event data for all events that represent requests made to the receiver. */ - export class RequestEvent { - constructor(type: EventType, requestData?: RequestData, senderId?: string); + class RequestEvent extends Event { + constructor( + type: EventType, + requestData?: RequestData, + senderId?: string + ); /** * The data that was sent with the request. @@ -172,11 +164,22 @@ declare namespace cast.framework.events { senderId?: string; } + /** + * Event data superclass for all events dispatched by @see{@link PlayerManager} + */ + class Event { + constructor(type: EventType); + + /** + * Type of the event. + */ + type: EventType; + } /** * Event data for @see{@link EventType.MEDIA_STATUS} event. */ - export class MediaStatusEvent { - constructor(mediaStatus?: MediaStatus); + class MediaStatusEvent extends Event { + constructor(type: EventType, mediaStatus?: MediaStatus); /** * The media status that was sent. @@ -186,7 +189,7 @@ declare namespace cast.framework.events { /** * Event data for pause events forwarded from the MediaElement. */ - export class MediaPauseEvent { + class MediaPauseEvent extends Event { constructor(currentMediaTime?: number, ended?: boolean); /** @@ -197,7 +200,7 @@ declare namespace cast.framework.events { /** * Event data for @see{@link EventType.MEDIA_FINISHED} event. */ - export class MediaFinishedEvent { + class MediaFinishedEvent extends Event { constructor(currentMediaTime?: number, endedReason?: EndedReason); /** @@ -213,7 +216,7 @@ declare namespace cast.framework.events { /** * Event data for all events forwarded from the MediaElement. */ - export class MediaElementEvent { + class MediaElementEvent extends Event { constructor(type: EventType, currentMediaTime?: number); /** @@ -224,7 +227,7 @@ declare namespace cast.framework.events { /** * Event data for all events pertaining to processing a load / preload request. made to the player. */ - export class LoadEvent { + class LoadEvent extends Event { constructor(type: EventType, media?: MediaInformation); /** @@ -235,7 +238,7 @@ declare namespace cast.framework.events { /** * Event data for @see{@link EventType.INBAND_TRACK_ADDED} event. */ - export class InbandTrackAddedEvent { + class InbandTrackAddedEvent { constructor(track: Track); /** @@ -245,7 +248,7 @@ declare namespace cast.framework.events { } /** Event data for @see{@link EventType.ID3} event. */ - export class Id3Event { + class Id3Event extends Event { constructor(segmentData: Uint8Array); /** @@ -253,21 +256,10 @@ declare namespace cast.framework.events { */ segmentData: Uint8Array; } - /** - * Event data superclass for all events dispatched by @see{@link PlayerManager} - */ - export class Event { - constructor(type: EventType); - - /** - * Type of the event. - */ - type: EventType; - } /** * Event data for @see{@link EventType.EMSG} event. */ - export class EmsgEvent { + class EmsgEvent extends Event { constructor(emsgData: any); /** @@ -323,7 +315,7 @@ declare namespace cast.framework.events { /** * Event data for @see{@link EventType.CLIP_ENDED} event. */ - export class ClipEndedEvent { + class ClipEndedEvent extends Event { constructor(currentMediaTime: number, endedReason?: EndedReason); /** @@ -340,7 +332,7 @@ declare namespace cast.framework.events { /** * Event data for @see{@link EventType.CACHE_LOADED} event. */ - export class CacheLoadedEvent { + class CacheLoadedEvent extends Event { constructor(media?: MediaInformation); /** @@ -349,7 +341,7 @@ declare namespace cast.framework.events { media: MediaInformation; } - export class CacheItemEvent { + class CacheItemEvent extends Event { constructor(type: EventType, url: string); /** @@ -358,7 +350,7 @@ declare namespace cast.framework.events { url: string; } - export class BufferingEvent { + class BufferingEvent extends Event { constructor(isBuffering: boolean); /** @@ -367,7 +359,7 @@ declare namespace cast.framework.events { isBuffering: boolean; } - export class BreaksEvent { + class BreaksEvent extends Event { constructor( type: EventType, currentMediaTime?: number, @@ -381,17 +373,17 @@ declare namespace cast.framework.events { /** * The break clip's id. Refer to BreakClip.id */ - breakClipId: string; + breakClipId?: string; /** * The time in the currently playing media when the break event occurred. */ - currentMediaTime: string; + currentMediaTime?: string; /** * The reason the break clip ended. */ - endedReason: EndedReason; + endedReason?: EndedReason; /** * Index of break clip; which starts from 1. @@ -406,16 +398,23 @@ declare namespace cast.framework.events { /** * When to skip current break clip in sec; after break clip begins to play. */ - whenSkippable: number; + whenSkippable?: number; } /** * Event data for @see {@link EventType.BITRATE_CHANGED} event. */ - export class BitrateChangedEvent { + class BitrateChangedEvent { constructor(totalBitrate?: number); /** The bitrate of the media (audio and video) in bits per second. */ totalBitrate: number; } + + class ErrorEvent extends Event { + constructor(detailedErrorCode: DetailedErrorCode, error?: any); + + detailedErrorCode: DetailedErrorCode; + error?: any; + } } diff --git a/types/chromecast-caf-receiver/cast.framework.messages.d.ts b/types/chromecast-caf-receiver/cast.framework.messages.d.ts index dc5c1ac07b..311232e5e0 100644 --- a/types/chromecast-caf-receiver/cast.framework.messages.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.messages.d.ts @@ -1,212 +1,202 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// -/// -/// -/// - -import { DetailedErrorCode } from './cast.framework.events'; +import { Event, DetailedErrorCode } from "./cast.framework.events"; export = cast.framework.messages; declare namespace cast.framework.messages { - export type UserAction = - | 'LIKE' - | 'DISLIKE' - | 'FOLLOW' - | 'UNFOLLOW' - | 'FLAG' - | 'SKIP_AD'; + type UserAction = + | "LIKE" + | "DISLIKE" + | "FOLLOW" + | "UNFOLLOW" + | "FLAG" + | "SKIP_AD"; - export type UserActionContext = - | 'UNKNOWN_CONTEXT' - | 'ALBUM' - | 'ARTIST' - | 'PLAYLIST' - | 'EPISODE' - | 'SERIES' - | 'MOVIE' - | 'CHANNEL' - | 'TEAM' - | 'PLAYER' - | 'COACH'; + type UserActionContext = + | "UNKNOWN_CONTEXT" + | "ALBUM" + | "ARTIST" + | "PLAYLIST" + | "EPISODE" + | "SERIES" + | "MOVIE" + | "CHANNEL" + | "TEAM" + | "PLAYER" + | "COACH"; - export type TextTrackType = - | 'SUBTITLES' - | 'CAPTIONS' - | 'DESCRIPTIONS' - | 'CHAPTERS' - | 'METADATA'; + type TextTrackType = + | "SUBTITLES" + | "CAPTIONS" + | "DESCRIPTIONS" + | "CHAPTERS" + | "METADATA"; - export type TextTrackWindowType = 'NONE' | 'NORMAL' | 'ROUNDED_CORNERS'; + type TextTrackWindowType = "NONE" | "NORMAL" | "ROUNDED_CORNERS"; - export type TrackType = 'TEXT' | 'AUDIO' | 'VIDEO'; + type TrackType = "TEXT" | "AUDIO" | "VIDEO"; - export type TextTrackFontGenericFamily = - | 'SANS_SERIF' - | 'MONOSPACED_SANS_SERIF' - | 'SERIF' - | 'MONOSPACED_SERIF' - | 'CASUAL' - | 'CURSIVE' - | 'SMALL_CAPITALS'; + type TextTrackFontGenericFamily = + | "SANS_SERIF" + | "MONOSPACED_SANS_SERIF" + | "SERIF" + | "MONOSPACED_SERIF" + | "CASUAL" + | "CURSIVE" + | "SMALL_CAPITALS"; - export type TextTrackFontStyle = 'NORMAL' | 'BOLD' | 'BOLD_ITALIC' | 'ITALIC'; + type TextTrackFontStyle = "NORMAL" | "BOLD" | "BOLD_ITALIC" | "ITALIC"; - export type TextTrackEdgeType = - | 'NONE' - | 'OUTLINE' - | 'DROP_SHADOW' - | 'RAISED' - | 'DEPRESSED'; + type TextTrackEdgeType = + | "NONE" + | "OUTLINE" + | "DROP_SHADOW" + | "RAISED" + | "DEPRESSED"; - export type Command = - | 'PAUSE' - | 'SEEK' - | 'STREAM_VOLUME' - | 'STREAM_MUTE' - | 'ALL_BASIC_MEDIA' - | 'QUEUE_NEXT' - | 'QUEUE_PREV' - | 'QUEUE_SHUFFLE' - | 'SKIP_AD'; + type Command = + | "PAUSE" + | "SEEK" + | "STREAM_VOLUME" + | "STREAM_MUTE" + | "ALL_BASIC_MEDIA" + | "QUEUE_NEXT" + | "QUEUE_PREV" + | "QUEUE_SHUFFLE" + | "SKIP_AD"; - export type SeekResumeState = 'PLAYBACK_START' | 'PLAYBACK_PAUSE'; + type SeekResumeState = "PLAYBACK_START" | "PLAYBACK_PAUSE"; - export type StreamingProtocolType = - | 'UNKNOWN' - | 'MPEG_DASH' - | 'HLS' - | 'SMOOTH_STREAMING'; + type StreamingProtocolType = + | "UNKNOWN" + | "MPEG_DASH" + | "HLS" + | "SMOOTH_STREAMING"; - export type StreamType = 'BUFFERED' | 'LIVE' | 'NONE'; + type StreamType = "BUFFERED" | "LIVE" | "NONE"; - export type FocusState = 'IN_FOCUS' | 'NOT_IN_FOCUS'; + type FocusState = "IN_FOCUS" | "NOT_IN_FOCUS"; - export type ExtendedPlayerState = 'LOADING'; + type ExtendedPlayerState = "LOADING"; - export type ErrorType = - | 'INVALID_PLAYER_STATE' - | 'LOAD_FAILED' - | 'LOAD_CANCELLED' - | 'INVALID_REQUEST' - | 'ERROR'; + type ErrorType = + | "INVALID_PLAYER_STATE" + | "LOAD_FAILED" + | "LOAD_CANCELLED" + | "INVALID_REQUEST" + | "ERROR"; - export type ErrorReason = - | 'INVALID_COMMAND' - | 'INVALID_PARAMS' - | 'INVALID_MEDIA_SESSION_ID' - | 'SKIP_LIMIT_REACHED' - | 'NOT_SUPPORTED' - | 'LANGUAGE_NOT_SUPPORTED' - | 'END_OF_QUEUE' - | 'APP_ERROR' - | 'AUTHENTICATION_EXPIRED' - | 'PREMIUM_ACCOUNT_REQUIRED' - | 'CONCURRENT_STREAM_LIMIT' - | 'PARENTAL_CONTROL_RESTRICTED' - | 'NOT_AVAILABLE_IN_REGION' - | 'CONTENT_ALREADY_PLAYING' - | 'INVALID_REQUEST' - | 'GENERIC_LOAD_ERROR'; + type ErrorReason = + | "INVALID_COMMAND" + | "INVALID_PARAMS" + | "INVALID_MEDIA_SESSION_ID" + | "SKIP_LIMIT_REACHED" + | "NOT_SUPPORTED" + | "LANGUAGE_NOT_SUPPORTED" + | "END_OF_QUEUE" + | "APP_ERROR" + | "AUTHENTICATION_EXPIRED" + | "PREMIUM_ACCOUNT_REQUIRED" + | "CONCURRENT_STREAM_LIMIT" + | "PARENTAL_CONTROL_RESTRICTED" + | "NOT_AVAILABLE_IN_REGION" + | "CONTENT_ALREADY_PLAYING" + | "INVALID_REQUEST" + | "GENERIC_LOAD_ERROR"; - export type RepeatMode = - | 'REPEAT_OFF' - | 'REPEAT_ALL' - | 'REPEAT_SINGLE' - | 'REPEAT_ALL_AND_SHUFFLE'; + type RepeatMode = + | "REPEAT_OFF" + | "REPEAT_ALL" + | "REPEAT_SINGLE" + | "REPEAT_ALL_AND_SHUFFLE"; - export type IdleReason = 'CANCELLED' | 'INTERRUPTED' | 'FINISHED' | 'ERROR'; + type IdleReason = "CANCELLED" | "INTERRUPTED" | "FINISHED" | "ERROR"; - export type HlsSegmentFormat = 'AAC' | 'AC3' | 'MP3' | 'TS' | 'TS_AAC'; + type HlsSegmentFormat = "AAC" | "AC3" | "MP3" | "TS" | "TS_AAC"; - export type HdrType = 'SDR' | 'HDR' | 'DV'; + type HdrType = "SDR" | "HDR" | "DV"; - export type PlayStringId = - | 'FREE_TRIAL_ABOUT_TO_EXPIRE' - | 'SUBSCRIPTION_ABOUT_TO_EXPIRE' - | 'STREAM_HIJACKED'; + type PlayStringId = + | "FREE_TRIAL_ABOUT_TO_EXPIRE" + | "SUBSCRIPTION_ABOUT_TO_EXPIRE" + | "STREAM_HIJACKED"; - export type GetStatusOptions = 'NO_METADATA' | 'NO_QUEUE_ITEMS'; + type GetStatusOptions = "NO_METADATA" | "NO_QUEUE_ITEMS"; - export type MessageType = - | 'MEDIA_STATUS' - | 'CLOUD_STATUS' - | 'QUEUE_CHANGE' - | 'QUEUE_ITEMS' - | 'QUEUE_ITEM_IDS' - | 'GET_STATUS' - | 'LOAD' - | 'PAUSE' - | 'STOP' - | 'PLAY' - | 'SKIP_AD' - | 'PLAY_AGAIN' - | 'SEEK' - | 'SET_PLAYBACK_RATE' - | 'SET_VOLUME' - | 'EDIT_TRACKS_INFO' - | 'EDIT_AUDIO_TRACKS' - | 'PRECACHE' - | 'PRELOAD' - | 'QUEUE_LOAD' - | 'QUEUE_INSERT' - | 'QUEUE_UPDATE' - | 'QUEUE_REMOVE' - | 'QUEUE_REORDER' - | 'QUEUE_NEXT' - | 'QUEUE_PREV' - | 'QUEUE_GET_ITEM_RANGE' - | 'QUEUE_GET_ITEMS' - | 'QUEUE_GET_ITEM_IDS' - | 'QUEUE_SHUFFLE' - | 'SET_CREDENTIALS' - | 'LOAD_BY_ENTITY' - | 'USER_ACTION' - | 'DISPLAY_STATUS' - | 'FOCUS_STATE' - | 'CUSTOM_COMMAND'; + type MessageType = + | "MEDIA_STATUS" + | "CLOUD_STATUS" + | "QUEUE_CHANGE" + | "QUEUE_ITEMS" + | "QUEUE_ITEM_IDS" + | "GET_STATUS" + | "LOAD" + | "PAUSE" + | "STOP" + | "PLAY" + | "SKIP_AD" + | "PLAY_AGAIN" + | "SEEK" + | "SET_PLAYBACK_RATE" + | "SET_VOLUME" + | "EDIT_TRACKS_INFO" + | "EDIT_AUDIO_TRACKS" + | "PRECACHE" + | "PRELOAD" + | "QUEUE_LOAD" + | "QUEUE_INSERT" + | "QUEUE_UPDATE" + | "QUEUE_REMOVE" + | "QUEUE_REORDER" + | "QUEUE_NEXT" + | "QUEUE_PREV" + | "QUEUE_GET_ITEM_RANGE" + | "QUEUE_GET_ITEMS" + | "QUEUE_GET_ITEM_IDS" + | "QUEUE_SHUFFLE" + | "SET_CREDENTIALS" + | "LOAD_BY_ENTITY" + | "USER_ACTION" + | "DISPLAY_STATUS" + | "FOCUS_STATE" + | "CUSTOM_COMMAND"; - export type PlayerState = 'IDLE' | 'PLAYING' | 'PAUSED' | 'BUFFERING'; + type PlayerState = "IDLE" | "PLAYING" | "PAUSED" | "BUFFERING"; - export type QueueChangeType = - | 'INSERT' - | 'REMOVE' - | 'ITEMS_CHANGE' - | 'UPDATE' - | 'NO_CHANGE'; + type QueueChangeType = + | "INSERT" + | "REMOVE" + | "ITEMS_CHANGE" + | "UPDATE" + | "NO_CHANGE"; - export type QueueType = - | 'ALBUM' - | 'PLAYLIST' - | 'AUDIOBOOK' - | 'RADIO_STATION' - | 'PODCAST_SERIES' - | 'TV_SERIES' - | 'VIDEO_PLAYLIST' - | 'LIVE_TV' - | 'MOVIE'; + type QueueType = + | "ALBUM" + | "PLAYLIST" + | "AUDIOBOOK" + | "RADIO_STATION" + | "PODCAST_SERIES" + | "TV_SERIES" + | "VIDEO_PLAYLIST" + | "LIVE_TV" + | "MOVIE"; - export type MetadataType = - | 'GENERIC' - | 'MOVIE' - | 'TV_SHOW' - | 'MUSIC_TRACK' - | 'PHOTO'; + type MetadataType = + | "GENERIC" + | "MOVIE" + | "TV_SHOW" + | "MUSIC_TRACK" + | "PHOTO"; /** * RefreshCredentials request data. */ - export interface RefreshCredentialsRequestData { } + interface RefreshCredentialsRequestData { + [key: string]: any; + } /** * Media event SET_VOLUME request data. */ - export interface VolumeRequestData extends RequestData { + interface VolumeRequestData extends RequestData { /** * The media stream volume */ @@ -216,7 +206,7 @@ declare namespace cast.framework.messages { /** * Represents the volume of a media session stream. */ - export interface Volume { + interface Volume { /** * Value from 0 to 1 that represents the current stream volume level. */ @@ -231,7 +221,7 @@ declare namespace cast.framework.messages { /** * Video information such as video resolution and High Dynamic Range (HDR). */ - export class VideoInformation { + class VideoInformation { constructor(width: number, height: number, hdrType: HdrType); /** @@ -253,7 +243,7 @@ declare namespace cast.framework.messages { /** * VAST ad request configuration. */ - export interface VastAdsRequest { + interface VastAdsRequest { /** * Specifies a VAST document to be used as the ads response instead of making a request via an ad tag url. This can be useful for debugging and other situations where a VAST response is already available. */ @@ -268,7 +258,7 @@ declare namespace cast.framework.messages { /** * UserAction request data. */ - export interface UserActionRequestData { + interface UserActionRequestData { /** * Optional request source. It contain the assistent query that initiate the request. */ @@ -288,7 +278,7 @@ declare namespace cast.framework.messages { /** * A TV episode media description. */ - export interface TvShowMediaMetadata { + interface TvShowMediaMetadata { /** * TV episode number. A positive integer. */ @@ -342,7 +332,7 @@ declare namespace cast.framework.messages { /** * Describes track metadata information. */ - export class Track { + class Track { constructor(trackId: number, trackType: TrackType); /** @@ -388,7 +378,7 @@ declare namespace cast.framework.messages { /** * Describes style information for a text track. */ - export interface TextTrackStyle { + interface TextTrackStyle { /** * The background 32 bit RGBA color. The alpha channel should be used for transparent backgrounds. */ @@ -453,7 +443,7 @@ declare namespace cast.framework.messages { /** * Media event playback rate request data. */ - export interface SetPlaybackRateRequestData extends RequestData { + interface SetPlaybackRateRequestData extends RequestData { /** * New playback rate (>0). */ @@ -468,7 +458,7 @@ declare namespace cast.framework.messages { /** * SetCredentials request data. */ - export interface SetCredentialsRequestData { + interface SetCredentialsRequestData { /** * Credentials to use by receiver. */ @@ -488,7 +478,7 @@ declare namespace cast.framework.messages { /** * Media event SEEK request data. */ - export interface SeekRequestData extends RequestData { + interface SeekRequestData extends RequestData { /** * Seconds since beginning of content. */ @@ -508,7 +498,7 @@ declare namespace cast.framework.messages { /** * Provides seekable range in seconds. */ - export class SeekableRange { + class SeekableRange { constructor(start?: number, end?: number); /** @@ -525,7 +515,7 @@ declare namespace cast.framework.messages { /** * Media event request data. */ - export class RequestData { + class RequestData { constructor(type: MessageType); /** @@ -547,7 +537,7 @@ declare namespace cast.framework.messages { /** * Media event UPDATE queue request data. */ - export interface QueueUpdateRequestData { + interface QueueUpdateRequestData { /** * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). */ @@ -582,7 +572,7 @@ declare namespace cast.framework.messages { /** * Media event queue REORDER request data. */ - export class QueueReorderRequestData extends RequestData { + class QueueReorderRequestData extends RequestData { constructor(itemIds: number[]); /** @@ -601,21 +591,21 @@ declare namespace cast.framework.messages { insertBefore?: number; /** - * IDs of the items to be reordered; in the new order. Items not provided will keep their existing order. The provided list will be inserted at the position determined by insertBefore. For example: + * IDs of the items to be reordered; in the new order. Items not provided will keep their existing order. The provided list will be inserted at the position determined by insertBefore. For example: - If insertBefore is not specified Existing queue: “A”;”D”;”G”;”H”;”B”;”E” itemIds: “D”;”H”;”B” New Order: “A”;”G”;”E”;“D”;”H”;”B” + If insertBefore is not specified Existing queue: “A”;”D”;”G”;”H”;”B”;”E” itemIds: “D”;”H”;”B” New Order: “A”;”G”;”E”;“D”;”H”;”B” - If insertBefore is “A” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “D”;”H”;”B”;“A”;”G”;”E” + If insertBefore is “A” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “D”;”H”;”B”;“A”;”G”;”E” - If insertBefore is “G” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “A”;“D”;”H”;”B”;”G”;”E” - */ + If insertBefore is “G” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “A”;“D”;”H”;”B”;”G”;”E” + */ itemIds: number[]; } /** * Media event queue REMOVE request data. */ - export class QueueRemoveRequestData extends RequestData { + class QueueRemoveRequestData extends RequestData { constructor(itemIds: number[]); /** @@ -636,8 +626,8 @@ declare namespace cast.framework.messages { /** * Media event queue LOAD request data. */ - export interface QueueLoadRequestData extends RequestData { - constructor(items: QueueItem[]): QueueLoadRequestData; + class QueueLoadRequestData extends RequestData { + constructor(items: QueueItem[]); /** * Seconds (since the beginning of content) to start playback of the first item to be played. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user casts the item that was playing locally so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). @@ -663,7 +653,7 @@ declare namespace cast.framework.messages { /** * Queue item information. Application developers may need to create a QueueItem to insert a queue element using InsertQueueItems. In this case they should not provide an itemId (as the actual itemId will be assigned when the item is inserted in the queue). This prevents ID collisions with items added from a sender app. */ - export class QueueItem { + class QueueItem { constructor(opt_itemId?: number); /** @@ -710,7 +700,7 @@ declare namespace cast.framework.messages { /** * Media event queue INSERT request data. */ - export class QueueInsertRequestData extends RequestData { + class QueueInsertRequestData extends RequestData { constructor(items: QueueItem[]); /** @@ -742,7 +732,7 @@ declare namespace cast.framework.messages { /** * Represents a data message containing the full list of queue ids. */ - export interface QueueIds { + interface QueueIds { /** * List of queue item ids. */ @@ -762,7 +752,7 @@ declare namespace cast.framework.messages { /** * Queue data as part of the LOAD request. */ - export class QueueData { + class QueueData { constructor( id?: string, name?: string, @@ -822,7 +812,7 @@ declare namespace cast.framework.messages { /** * Represents a queue change message; such as insert; remove; and update. */ - export interface QueueChange { + interface QueueChange { /** * The actual queue change type. */ @@ -857,7 +847,7 @@ declare namespace cast.framework.messages { /** * Media event PRELOAD request data. */ - export class PreloadRequestData implements LoadRequestData { + class PreloadRequestData implements LoadRequestData { /** * Array of trackIds that are active. If the array is not provided; the default tracks will be active. */ @@ -913,7 +903,7 @@ declare namespace cast.framework.messages { /** * Media event PRECACHE request data. (Some fields of the load request; like autoplay and queueData; are ignored). */ - export class PrecacheRequestData implements LoadRequestData { + class PrecacheRequestData implements LoadRequestData { /** * Array of trackIds that are active. If the array is not provided; the default tracks will be active. */ @@ -969,7 +959,7 @@ declare namespace cast.framework.messages { /** * PlayString request data. */ - export class PlayStringRequestData { + class PlayStringRequestData { constructor(stringId: PlayStringId, opt_arguments?: string[]); /** @@ -986,7 +976,7 @@ declare namespace cast.framework.messages { /** * A photo media description. */ - export interface PhotoMediaMetadata { + interface PhotoMediaMetadata { /** * Name of the photographer. */ @@ -1036,7 +1026,7 @@ declare namespace cast.framework.messages { /** * A music track media description. */ - export interface MusicTrackMediaMetadata { + interface MusicTrackMediaMetadata { /** * Album artist name. */ @@ -1101,7 +1091,7 @@ declare namespace cast.framework.messages { /** * A movie media description. */ - export interface MovieMediaMetadata { + interface MovieMediaMetadata { /** * Content images. Examples would include cover art or a thumbnail of the currently playing media. */ @@ -1135,7 +1125,7 @@ declare namespace cast.framework.messages { /** * Represents the status of a media session. */ - export interface MediaStatus { + interface MediaStatus { /** * List of IDs corresponding to the active tracks. */ @@ -1244,7 +1234,7 @@ declare namespace cast.framework.messages { /** * Common media metadata used as part of MediaInformation */ - export class MediaMetadata { + class MediaMetadata { constructor(type: MetadataType); /** @@ -1256,7 +1246,7 @@ declare namespace cast.framework.messages { /** * Represents the media information. */ - export interface MediaInformation { + interface MediaInformation { /** * Partial list of break clips that includes current break clip that receiver is playing or ones that receiver will play shortly after; instead of sending whole list of clips. This is to avoid overflow of MediaStatus message. */ @@ -1326,7 +1316,7 @@ declare namespace cast.framework.messages { /** * Media event LOAD request data. */ - export interface LoadRequestData extends RequestData { + interface LoadRequestData extends RequestData { /** * Array of trackIds that are active. If the array is not provided; the default tracks will be active. */ @@ -1371,7 +1361,7 @@ declare namespace cast.framework.messages { /** * LoadByEntity request data. */ - export interface LoadByEntityRequestData { + interface LoadByEntityRequestData { /** * Content entity information; typically represented by a stringified JSON object */ @@ -1391,7 +1381,7 @@ declare namespace cast.framework.messages { /** * Provides live seekable range with start and end time in seconds and two more attributes. */ - export class LiveSeekableRange { + class LiveSeekableRange { constructor( start?: number, end?: number, @@ -1413,7 +1403,7 @@ declare namespace cast.framework.messages { /** * Represents a data message containing item information for each requested ids. */ - export interface ItemsInfo { + interface ItemsInfo { /** * List of changed itemIds. */ @@ -1434,7 +1424,7 @@ declare namespace cast.framework.messages { * An image that describes a receiver application or media item. * This could be an application icon; cover art; or a thumbnail. */ - export class Image { + class Image { constructor(url: string); /** @@ -1453,7 +1443,7 @@ declare namespace cast.framework.messages { width?: number; } /** Media event GET_STATUS request data. */ - export interface GetStatusRequestData extends RequestData { + interface GetStatusRequestData extends RequestData { /** * The options of a GET_STATUS request. */ @@ -1463,8 +1453,8 @@ declare namespace cast.framework.messages { /** * Get items info request data. */ - export interface GetItemsInfoRequestData extends RequestData { - constructor(itemIds: number[]): GetItemsInfoRequestData; + class GetItemsInfoRequestData extends RequestData { + constructor(itemIds: number[]); /** * List of item ids to be requested. @@ -1474,7 +1464,7 @@ declare namespace cast.framework.messages { /** * A generic media description. */ - export interface GenericMediaMetadata { + interface GenericMediaMetadata extends MediaMetadata { /** * Content images. Examples would include cover art or a thumbnail of the currently playing media. */ @@ -1504,7 +1494,7 @@ declare namespace cast.framework.messages { /** * Focus state change message. */ - export interface FocusStateRequestData { + interface FocusStateRequestData { /** * The focus state of the app. */ @@ -1512,7 +1502,7 @@ declare namespace cast.framework.messages { } /** Fetch items request data. */ - export class FetchItemsRequestData extends RequestData { + class FetchItemsRequestData extends RequestData { constructor(itemId: number, nextCount: number, prevCount: number); /** @@ -1534,8 +1524,11 @@ declare namespace cast.framework.messages { /** * Extended media status information */ - export class ExtendedMediaStatus { - constructor(playerState: MediaInformation, opt_media?: MediaInformation); + class ExtendedMediaStatus { + constructor( + playerState: MediaInformation, + opt_media?: MediaInformation + ); /** * @@ -1549,7 +1542,7 @@ declare namespace cast.framework.messages { } /** Event data for @see{@link EventType.ERROR} event. */ - export class ErrorEvent { + class ErrorEvent extends Event { constructor(detailedErrorCode?: DetailedErrorCode, error?: any); /** * An error code representing the cause of the error. @@ -1564,7 +1557,7 @@ declare namespace cast.framework.messages { error?: any; } - export class ErrorData { + class ErrorData { constructor(type: ErrorType); /** @@ -1574,13 +1567,13 @@ declare namespace cast.framework.messages { customData?: any; /** - Id of the request; used to correlate request/response. - */ + Id of the request; used to correlate request/response. + */ requestId?: number; } /** Media event EDIT_TRACKS_INFO request data. */ - export interface EditTracksInfoRequestData extends RequestData { + interface EditTracksInfoRequestData extends RequestData { /** * Array of the Track trackIds that should be active. * If it is not provided; the active tracks will not change. @@ -1616,7 +1609,7 @@ declare namespace cast.framework.messages { /** * Media event EDIT_AUDIO_TRACKS request data. If language is not provided; the default audio track for the media will be enabled. */ - export interface EditAudioTracksRequestData extends RequestData { + interface EditAudioTracksRequestData extends RequestData { /** * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. * It allows receiver apps to use user saved preference instead of spoken language. @@ -1630,7 +1623,7 @@ declare namespace cast.framework.messages { } /** DisplayStatus request data. */ - export interface DisplayStatusRequestData { + interface DisplayStatusRequestData { /** * Optional request source. It contain the assistent query that initiate the request. */ @@ -1638,7 +1631,7 @@ declare namespace cast.framework.messages { } /** CustomCommand request data. */ - export interface CustomCommandRequestData { + interface CustomCommandRequestData { /** * Custom Data; typically represented by a stringified JSON object. */ @@ -1649,12 +1642,8 @@ declare namespace cast.framework.messages { */ source: string; } - /** Cloud media status. Media status that is only sent to the cloud sender. */ - export class CloudMediaStatus { - constructor(); - } - export class BreakStatus { + class BreakStatus { constructor(currentBreakTime: number, currentBreakClipTime: number); /** @@ -1688,7 +1677,7 @@ declare namespace cast.framework.messages { /** * Represents break clip (e.g. a clip of ad during ad break) */ - export class BreakClip { + class BreakClip { constructor(id: string); /** @@ -1719,7 +1708,7 @@ declare namespace cast.framework.messages { /** * The format of the HLS media segment. */ - hlsSegmentFormat: HlsSegmentFormat; + hlsSegmentFormat?: HlsSegmentFormat; /** * Unique id of break clip. */ @@ -1735,7 +1724,7 @@ declare namespace cast.framework.messages { /** * VAST ad request configuration. Used if contentId or contentUrl is not provided. */ - vastAdsRequest: VastAdsRequest; + vastAdsRequest?: VastAdsRequest; /** * The time in sec when this break clip becomes skippable. * 5 means that end user can skip this break clip after 5 seconds. @@ -1745,7 +1734,7 @@ declare namespace cast.framework.messages { } /** Represents break (e.g. ad break) included in main video. */ - export class Break { + class Break { constructor(id: string, breakClipIds: string[], position: number); /** * List of ids of break clip that this break includes. diff --git a/types/chromecast-caf-receiver/cast.framework.system.d.ts b/types/chromecast-caf-receiver/cast.framework.system.d.ts index 1f465761b0..92e7732f7f 100644 --- a/types/chromecast-caf-receiver/cast.framework.system.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.system.d.ts @@ -1,177 +1,191 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// -/// -/// -/// - -import { EventType } from './cast.framework.events'; +import { EventType } from "./cast.framework.events"; export = cast.framework.system; declare namespace cast.framework.system { - export type SystemState = - | 'NOT_STARTED' - | 'STARTING_IN_BACKGROUND' - | 'STARTING' - | 'READY' - | 'STOPPING_IN_BACKGROUND' - | 'STOPPING'; + type EventType = + // Fired when the system is ready. + | "READY" + // Fired when the application is terminated. + | "SHUTDOWN" + // Fired when a new sender has connected. + | "SENDER_CONNECTED" + // Fired when a sender has disconnected. + | "SENDER_DISCONNECTED" + // Fired when there is a system error. + | "ERROR" + // Fired when the system volume has changed. + | "SYSTEM_VOLUME_CHANGED" + // Fired when the visibility of the application has changed (for example after a HDMI Input change or when the TV is turned off/on and the cast device is externally powered). Note that this API has the same effect as the webkitvisibilitychange event raised by your document, we provided it as CastReceiverManager API for convenience and to avoid a dependency on a webkit-prefixed event. + | "VISIBILITY_CHANGED" + // Fired when the standby state of the TV has changed. This event is related to the visibility chnaged event, as if the TV is in standby the visibility will be false, the visibility is more granular (as it also detects that the TV has selected a different channel) but it is not reliably detected in all TVs, standby can be used in those cases as most TVs implement it. + | "STANDBY_CHANGED" + | "MAX_VIDEO_RESOLUTION_CHANGED" + | "FEEDBACK_STARTED"; - export type StandbyState = 'STANDBY' | 'NOT_STANDBY' | 'UNKNOWN'; + type SystemState = + | "NOT_STARTED" + | "STARTING_IN_BACKGROUND" + | "STARTING" + | "READY" + | "STOPPING_IN_BACKGROUND" + | "STOPPING"; - export type DisconnectReason = 'REQUESTED_BY_SENDER' | 'ERROR' | 'UNKNOWN'; + type StandbyState = "STANDBY" | "NOT_STANDBY" | "UNKNOWN"; - /** - * Event dispatched by @see{@link CastReceiverManager} when the visibility of the application changes (HDMI input change; TV is turned off). - */ - export class VisibilityChangedEvent { - constructor(isVisible: boolean); + type DisconnectReason = "REQUESTED_BY_SENDER" | "ERROR" | "UNKNOWN"; /** - * Whether the Cast device is the active input or not. + * Event dispatched by @see{@link CastReceiverManager} when the visibility of the application changes (HDMI input change; TV is turned off). */ - isVisible: boolean; - } + class VisibilityChangedEvent { + constructor(isVisible: boolean); - /** - * Represents the system volume data. - */ - export interface SystemVolumeData { - /** - * The level (from 0.0 to 1.0) of the system volume. - */ - level: number; + /** + * Whether the Cast device is the active input or not. + */ + isVisible: boolean; + } /** - * Whether the system volume is muted or not. + * Represents the system volume data. */ - muted: boolean; - } - /** - * Event dispatched by @see{CastReceiverManager} when the system volume changes. - */ - export class SystemVolumeChangedEvent extends Event { - constructor(volume: SystemVolumeData); + interface SystemVolumeData { + /** + * The level (from 0.0 to 1.0) of the system volume. + */ + level: number; + + /** + * Whether the system volume is muted or not. + */ + muted: boolean; + } + /** + * Event dispatched by @see{CastReceiverManager} when the system volume changes. + */ + class SystemVolumeChangedEvent extends Event { + constructor(volume: SystemVolumeData); + + /** + * The system volume data + */ + data: SystemVolumeData; + } + /** + * Event dispatched by @see{@link CastReceiverManager} when the TV enters/leaves the standby state. + */ + class StandbyChangedEvent { + constructor(isStandby: boolean); + + /** + * + */ + isStandby: boolean; + } + /** + * Whether the TV is in standby or not. + */ + interface ShutdownEvent extends Event { + [key: string]: any; + } /** - * The system volume data + * Event dispatched by @see{@link CastReceiverManager} when a sender is disconnected. */ - data: SystemVolumeData; - } - /** - * Event dispatched by @see{@link CastReceiverManager} when the TV enters/leaves the standby state. - */ - export class StandbyChangedEvent { - constructor(isStandby: boolean); + class SenderDisconnectedEvent extends Event { + constructor(senderId: string, userAgent: string); + /** + * The ID of the sender connected. + */ + senderId: string; + + /** + * The user agent of the sender. + */ + userAgent: string; + + /** + * The reason the sender was disconnected. + */ + reason?: DisconnectReason; + } /** - * + * Event dispatched by @see{@link CastReceiverManager} when a sender is connected. */ - isStandby: boolean; - } - /** - * Whether the TV is in standby or not. - */ - export interface ShutdownEvent extends Event {} + class SenderConnectedEvent extends Event { + constructor(senderId: string, userAgent: string); + /** + * The ID of the sender connected. + */ + senderId: string; - /** - * Event dispatched by @see{@link CastReceiverManager} when a sender is disconnected. - */ - export class SenderDisconnectedEvent extends Event { - constructor(senderId: string, userAgent: string); - /** - * The ID of the sender connected. - */ - senderId: string; + /** + * The user agent of the sender. + */ + userAgent: string; + } /** - * The user agent of the sender. + * Represents the data of a connected sender device. */ - userAgent: string; + interface Sender { + /** + * The sender Id. + */ + id: string; + + /** + * Indicate the sender supports large messages (>64KB). + */ + largeMessageSupported?: boolean; + + /** + * The userAgent of the sender. + */ + userAgent?: string; + } /** - * The reason the sender was disconnected. + * Event dispatched by CastReceiverManager when the system is ready. */ - reason?: DisconnectReason; - } + class ReadyEvent { + constructor(applicationData: ApplicationData); - /** - * Event dispatched by @see{@link CastReceiverManager} when a sender is connected. - */ - export class SenderConnectedEvent extends Event { - constructor(senderId: string, userAgent: string); - /** - * The ID of the sender connected. - */ - senderId: string; + /** + * The application data + */ + data: ApplicationData; + } /** - * The user agent of the sender. + * Event dispatched by @see{@link CastReceiverManager} when the system needs to update the restriction on maximum video resolution. */ - userAgent: string; - } + class MaxVideoResolutionChangedEvent extends Event { + constructor(height: number); - /** - * Represents the data of a connected sender device. - */ - export interface Sender { - /** - * The sender Id. - */ - id: string; + /** + * Maximum video resolution requested by the system. The value of 0 means there is no restriction. + */ + height: number; + } + /** Event dispatched by @see{@link CastReceiverManager} when the systems starts to create feedback report. */ + interface FeedbackStartedEvent extends Event { + [key: string]: any; + } + /** Event dispatched by @see{@link CastReceiverContext} which contains system information. */ + class Event { + constructor(type: EventType, data?: any); + type: EventType; + data?: any; + } - /** - * Indicate the sender supports large messages (>64KB). - */ - largeMessageSupported?: boolean; - - /** - * The userAgent of the sender. - */ - userAgent?: string; - } - - /** - * Event dispatched by CastReceiverManager when the system is ready. - */ - export class ReadyEvent { - constructor(applicationData: ApplicationData); - - /** - * The application data - */ - data: ApplicationData; - } - - /** - * Event dispatched by @see{@link CastReceiverManager} when the system needs to update the restriction on maximum video resolution. - */ - export class MaxVideoResolutionChangedEvent extends Event { - constructor(height: number); - - /** - * Maximum video resolution requested by the system. The value of 0 means there is no restriction. - */ - height: number; - } - /** Event dispatched by @see{@link CastReceiverManager} when the systems starts to create feedback report. */ - export interface FeedbackStartedEvent extends Event {} - /** Event dispatched by @see{@link CastReceiverContext} which contains system information. */ - export class Event { - constructor(type: EventType, data?: any); - } - - /** Represents the data of the launched application. */ - export interface ApplicationData { - id(): string; - launchingSenderId(): string; - name(): string; - namespaces(): string[]; - sessionId(): number; - } + /** Represents the data of the launched application. */ + interface ApplicationData { + id(): string; + launchingSenderId(): string; + name(): string; + namespaces(): string[]; + sessionId(): number; + } } diff --git a/types/chromecast-caf-receiver/cast.framework.ui.d.ts b/types/chromecast-caf-receiver/cast.framework.ui.d.ts index fbc61f56d0..b13f036be2 100644 --- a/types/chromecast-caf-receiver/cast.framework.ui.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.ui.d.ts @@ -1,59 +1,48 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// -/// -/// -/// - -import { PlayerDataEventType } from './cast.framework.ui'; -import { MediaMetadata } from './cast.framework.messages'; +import { PlayerDataEventType } from "./cast.framework.ui"; +import { MediaMetadata } from "./cast.framework.messages"; +import { PlayerDataChangedEventHandler } from "./index"; export = cast.framework.ui; declare namespace cast.framework.ui { - export type ContentType = 'VIDEO' | 'AUDIO' | 'IMAGE'; + type ContentType = "video" | "audio" | "image"; - export type State = - | 'LAUNCHING' - | 'IDLE' - | 'LOADING' - | 'BUFFERING' - | 'PAUSED' - | 'PLAYING'; + type State = + | "launching" + | "idle" + | "loading" + | "buffering" + | "paused" + | "playing"; - export type PlayerDataEventType = - | 'ANY_CHANGE' - | 'STATE_CHANGED' - | 'IS_SEEKING_CHANGED' - | 'DURATION_CHANGED' - | 'CURRENT_TIME_CHANGED' - | 'METADATA_CHANGED' - | 'TITLE_CHANGED' - | 'SUBTITLE_CHANGED' - | 'THUMBNAIL_URL_CHANGED' - | 'NEXT_TITLE_CHANGED' - | 'NEXT_SUBTITLE_CHANGED' - | 'NEXT_THUMBNAIL_URL_CHANGED' - | 'PRELOADING_NEXT_CHANGED' - | 'CONTENT_TYPE_CHANGED' - | 'IS_LIVE_CHANGED' - | 'BREAK_PERCENTAGE_POSITIONS_CHANGED' - | 'IS_PLAYING_BREAK_CHANGED' - | 'IS_BREAK_SKIPPABLE_CHANGED' - | 'WHEN_SKIPPABLE_CHANGED' - | 'NUMBER_BREAK_CLIPS_CHANGED' - | 'CURRENT_BREAK_CLIP_NUMBER_CHANGED' - | 'DISPLAY_STATUS_CHANGED'; + type PlayerDataEventType = + | "ANY_CHANGE" + | "STATE_CHANGED" + | "IS_SEEKING_CHANGED" + | "DURATION_CHANGED" + | "CURRENT_TIME_CHANGED" + | "METADATA_CHANGED" + | "TITLE_CHANGED" + | "SUBTITLE_CHANGED" + | "THUMBNAIL_URL_CHANGED" + | "NEXT_TITLE_CHANGED" + | "NEXT_SUBTITLE_CHANGED" + | "NEXT_THUMBNAIL_URL_CHANGED" + | "PRELOADING_NEXT_CHANGED" + | "CONTENT_TYPE_CHANGED" + | "IS_LIVE_CHANGED" + | "BREAK_PERCENTAGE_POSITIONS_CHANGED" + | "IS_PLAYING_BREAK_CHANGED" + | "IS_BREAK_SKIPPABLE_CHANGED" + | "WHEN_SKIPPABLE_CHANGED" + | "NUMBER_BREAK_CLIPS_CHANGED" + | "CURRENT_BREAK_CLIP_NUMBER_CHANGED" + | "DISPLAY_STATUS_CHANGED"; /** * Player data changed event. Provides the changed field (type); and new value. */ - export class PlayerDataChangedEvent { + class PlayerDataChangedEvent { constructor(type: PlayerDataEventType, field: string, value: any); /** @@ -74,23 +63,29 @@ declare namespace cast.framework.ui { /** * Player data binder. Bind a player data object to the player state. The player data will be updated to reflect correctly the current player state without firing any change event. */ - export class PlayerDataBinder { - constructor(playerData: PlayerData | any); + class PlayerDataBinder { + constructor(playerData: PlayerData); /** * Add listener to player data changes. */ - // addEventListener: (type: PlayerDataEventType; listener: PlayerDataChangedEventHandler); + addEventListener: ( + type: PlayerDataEventType, + listener: PlayerDataChangedEventHandler + ) => void; /** * Remove listener to player data changes. */ - // removeEventListener: (type: PlayerDataEventType; listener: PlayerDataChangedEventHandler); + removeEventListener: ( + type: PlayerDataEventType, + listener: PlayerDataChangedEventHandler + ) => void; } /** * Player data. Provide the player media and break state. */ - export interface PlayerData { + interface PlayerData { /** * Array of breaks positions in percentage. */ @@ -144,7 +139,7 @@ declare namespace cast.framework.ui { /** * Media metadata. */ - metadata: MediaMetadata | any; + metadata: MediaMetadata; /** * Next Item subtitle. diff --git a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts index a4f59bd985..29d842b060 100644 --- a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts +++ b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts @@ -1,66 +1,3 @@ -// Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import { BreakSeekData } from "chromecast-caf-receiver/cast.framework.breaks"; -/// -/// -/// -/// -/// -/// -/// - -import { TextTracksManager } from "cast.framework"; -import { StandbyChangedEvent } from "cast.framework.system"; -import { PlayerData, ContentType } from "cast.framework.ui"; -import { BreakManager } from "cast.framework.breaks"; -import { MediaStatusEvent } from "cast.framework.events"; -import { Track, Break, MediaStatus, QueueData } from "cast.framework.messages"; - -const ct = ContentType.VIDEO; -// framework tests -const track = new Track(123, {}); -const ttm = new TextTracksManager({}); -ttm.addTracks(track); - -// $ExpectError -ttm.addTracks("should fail"); - -// system tests -const sce = new StandbyChangedEvent(true); -// $ExpectError -const wrongSce = new StandbyChangedEvent("error"); - -const result: boolean = sce.isStandby; -// $ExpectError -const failure: string = sce.isStandby; - -// ui tests -const pd = new PlayerData(); - -const cn: number = pd.currentBreakClipNumber; -// $ExpectError -const wrongCn: boolean = pd.currentBreakClipNumber; - -// breaks tests -const bm: BreakManager = new BreakManager(); -const brk1: Break = bm.getBreakById("123"); -// $ExpectError -const brk2: string = bm.getBreakById("123"); -// $ExpectError -const brk3: Break = bm.getBreakById(123); -// events tests - -const evt: MediaStatusEvent = new MediaStatusEvent(); -const ms: MediaStatus = evt.mediaStatus; -// $ExpectError -const ms: string = evt.mediaStatus; - -// messages tests -const qd = new QueueData("id", "name", "description", "mode"); -// $ExpectError -const wrongQd = new QueueData({}); -const name: string = qd.name; -// $ExpectError -const wrongName: number = qd.name; +const breakSeekData = new BreakSeekData(0, 100, []); diff --git a/types/chromecast-caf-receiver/index.d.ts b/types/chromecast-caf-receiver/index.d.ts index 5dc89456e6..73a13f53ca 100644 --- a/types/chromecast-caf-receiver/index.d.ts +++ b/types/chromecast-caf-receiver/index.d.ts @@ -1,7 +1,8 @@ // Type definitions for chromecast-caf-receiver 3.x -// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ -// Definitions by: Craig Bruce https://github.com/craigrbruce +// Project: https://github.com/googlecast +// Definitions by: Craig Bruce // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// @@ -14,12 +15,10 @@ import { PlayerDataChangedEvent } from './cast.framework.ui'; import { NetworkRequestInfo } from './cast.framework'; import { Event } from './cast.framework.events'; -export = cast; -declare namespace cast { - export type EventHandler = (event: Event) => void; - export type PlayerDataChangedEventHandler = ( - event: PlayerDataChangedEvent - ) => void; - export type RequestHandler = (request: NetworkRequestInfo) => void; - export type BinaryHandler = (data: Uint8Array) => Uint8Array; -} +export as namespace cast; +export type EventHandler = (event: Event) => void; +export type PlayerDataChangedEventHandler = ( + event: PlayerDataChangedEvent +) => void; +export type RequestHandler = (request: NetworkRequestInfo) => void; +export type BinaryHandler = (data: Uint8Array) => Uint8Array; diff --git a/types/chromecast-caf-receiver/tsconfig.json b/types/chromecast-caf-receiver/tsconfig.json index 5c13aa8765..452dd41e91 100644 --- a/types/chromecast-caf-receiver/tsconfig.json +++ b/types/chromecast-caf-receiver/tsconfig.json @@ -1,22 +1,26 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": false, + "esModuleInterop": true }, "files": [ "index.d.ts", - "chromecast-caf-receiver-tests.ts" + "chromecast-caf-receiver-tests.ts", + "cast.framework.d.ts", + "cast.framework.breaks.d.ts", + "cast.framework.events.d.ts", + "cast.framework.messages.d.ts", + "cast.framework.system.d.ts", + "cast.framework.ui.d.ts" ] } diff --git a/types/chromecast-caf-receiver/tslint.json b/types/chromecast-caf-receiver/tslint.json index 3db14f85ea..f85a173bd5 100644 --- a/types/chromecast-caf-receiver/tslint.json +++ b/types/chromecast-caf-receiver/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-redundant-jsdoc-2": false, + "jsdoc-format": false, + "max-line-length": false + } +} From 2534c15d9ede387030eca0be0566a9799c50f091 Mon Sep 17 00:00:00 2001 From: Craig Bruce Date: Thu, 31 May 2018 13:40:18 +1000 Subject: [PATCH 43/62] write a simple spread of tests for a few classes from each namespace --- .../cast.framework.d.ts | 6 +- .../chromecast-caf-receiver-tests.ts | 105 +++++++++++++++++- 2 files changed, 107 insertions(+), 4 deletions(-) diff --git a/types/chromecast-caf-receiver/cast.framework.d.ts b/types/chromecast-caf-receiver/cast.framework.d.ts index 1435859859..2ee078021a 100644 --- a/types/chromecast-caf-receiver/cast.framework.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.d.ts @@ -44,7 +44,7 @@ declare namespace cast.framework { * Manages text tracks. */ class TextTracksManager { - constructor(params: any); + constructor(params?: any); /** * Adds text tracks to the list. @@ -106,7 +106,7 @@ declare namespace cast.framework { * QueueManager exposes several queue manipulation APIs to developers. */ class QueueManager { - constructor(params: any); + constructor(params?: any); /** * Returns the current queue item. @@ -199,7 +199,7 @@ declare namespace cast.framework { * Controls and monitors media playback. */ class PlayerManager { - constructor(params: any); + constructor(params?: any); /** * Adds an event listener for player event. diff --git a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts index 29d842b060..a75834b0a8 100644 --- a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts +++ b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts @@ -1,3 +1,106 @@ -import { BreakSeekData } from "chromecast-caf-receiver/cast.framework.breaks"; +import { + PlayerData, + PlayerDataBinder +} from "chromecast-caf-receiver/cast.framework.ui"; +import { + ReadyEvent, + ApplicationData +} from "chromecast-caf-receiver/cast.framework.system"; +import { + RequestEvent, + Event +} from "chromecast-caf-receiver/cast.framework.events"; +import { + QueueBase, + TextTracksManager, + QueueManager, + PlayerManager +} from "chromecast-caf-receiver/cast.framework"; +import { + BreakSeekData, + BreakClipLoadInterceptorContext, + BreakManager +} from "chromecast-caf-receiver/cast.framework.breaks"; +import { + Break, + BreakClip, + LoadRequestData, + Track, + MediaMetadata +} from "chromecast-caf-receiver/cast.framework.messages"; +const track = new Track(1, "TEXT"); +const breakClip = new BreakClip("id"); +const adBreak = new Break("id", ["id"], 1); +const rEvent = new RequestEvent("BITRATE_CHANGED", { requestId: 2 }); +const pManager = new PlayerManager(); +pManager.addEventListener("STALLED", () => {}); +const ttManager = new TextTracksManager(); +const qManager = new QueueManager(); +const qBase = new QueueBase(); +const items = qBase.fetchItems(1, 3, 4); const breakSeekData = new BreakSeekData(0, 100, []); +const breakClipLoadContext = new BreakClipLoadInterceptorContext(adBreak); +const breakManager: BreakManager = { + getBreakById: () => adBreak, + getBreakClipById: () => breakClip, + getBreakClips: () => [breakClip], + getBreaks: () => [adBreak], + getPlayWatchedBreak: () => true, + setBreakClipLoadInterceptor: () => {}, + setBreakSeekInterceptor: () => {}, + setPlayWatchedBreak: () => {}, + setVastTrackingInterceptor: () => {} +}; + +const lrd: LoadRequestData = { + requestId: 1, + activeTrackIds: [1, 2], + media: { + tracks: [], + textTrackStyle: {}, + streamType: "BUFFERED", + metadata: { metadataType: "GENERIC" }, + hlsSegmentFormat: "AAC", + contentId: "id", + contentType: "type", + breakClips: [breakClip], + breaks: [adBreak] + }, + queueData: {} +}; + +const appData: ApplicationData = { + id: () => "id", + launchingSenderId: () => "launch-id", + name: () => "name", + namespaces: () => ["namespace"], + sessionId: () => 1 +}; + +const readyEvent = new ReadyEvent(appData); +const data = readyEvent.data; +const pData: PlayerData = { + breakPercentagePositions: [1], + contentType: "video", + currentBreakClipNumber: 2, + currentTime: 1234, + displayStatus: true, + duration: 222, + isBreakSkippable: false, + isLive: true, + isPlayingBreak: false, + isSeeking: true, + metadata: new MediaMetadata("GENERIC"), + nextSubtitle: "sub", + nextThumbnailUrl: "url", + nextTitle: "title", + numberBreakClips: 3, + preloadingNext: false, + state: "paused", + thumbnailUrl: "url", + title: "title", + whenSkippable: 321 +}; +const binder = new PlayerDataBinder(pData); +binder.addEventListener("ANY_CHANGE", e => {}); From f24e32d8ad345ac7d89438ed75e7afe2451cde29 Mon Sep 17 00:00:00 2001 From: danielcollette Date: Thu, 31 May 2018 17:11:03 -0400 Subject: [PATCH 44/62] change markerStyle to any --- types/leaflet.locatecontrol/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/leaflet.locatecontrol/index.d.ts b/types/leaflet.locatecontrol/index.d.ts index 542461cec7..458f7232ca 100644 --- a/types/leaflet.locatecontrol/index.d.ts +++ b/types/leaflet.locatecontrol/index.d.ts @@ -27,7 +27,7 @@ declare module 'leaflet' { drawMarker?: boolean; markerClass?: any; circleStyle?: PathOptions; - markerStyle?: PathOptions; + markerStyle?: any; followCircleStyle?: PathOptions; followMarkerStyle?: PathOptions; icon?: string; From d3000065ecaefa4d5ad41165e695ae34ca518805 Mon Sep 17 00:00:00 2001 From: Andrew Codispoti Date: Sat, 2 Jun 2018 19:37:05 -0400 Subject: [PATCH 45/62] Added a new type definition for the missing method getDateStr in react-native-datepicker. --- types/react-native-datepicker/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-native-datepicker/index.d.ts b/types/react-native-datepicker/index.d.ts index ceb0e612aa..dfc8bd5b13 100644 --- a/types/react-native-datepicker/index.d.ts +++ b/types/react-native-datepicker/index.d.ts @@ -30,6 +30,7 @@ export interface DatePickerProps { placeholder?: string; modalOnResponderTerminationRequest?(e: any): boolean; is24Hour?: boolean; + getDateStr?: (date: Date) => string; style?: any; customStyles?: any; minuteInterval?: number; From 298e6e8ef2cf4f340592e7c2a359d904be1484f5 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Mon, 4 Jun 2018 04:32:45 -0400 Subject: [PATCH 46/62] (react-native-material-textfield) Add style prop --- .../index.d.ts | 22 +++++++++++++------ .../react-native-material-textfield-tests.tsx | 8 ++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/types/react-native-material-textfield/index.d.ts b/types/react-native-material-textfield/index.d.ts index 9b6c2941af..5f3ffc437f 100644 --- a/types/react-native-material-textfield/index.d.ts +++ b/types/react-native-material-textfield/index.d.ts @@ -1,11 +1,18 @@ // Type definitions for react-native-material-textfield 0.12 // Project: https://github.com/n4kz/react-native-material-textfield // Definitions by: Ville Venäläinen +// Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.6 import * as React from 'react'; -import { TextInputProps, TextStyle, ViewStyle, View } from 'react-native'; +import { + StyleProp, + TextInputProps, + TextStyle, + ViewStyle, + View +} from 'react-native'; export interface TextFieldProps extends TextInputProps { animationDuration?: number; @@ -17,9 +24,10 @@ export interface TextFieldProps extends TextInputProps { labelPadding?: number; inputContainerPadding?: number; - labelTextStyle?: TextStyle; - titleTextStyle?: TextStyle; - affixTextStyle?: TextStyle; + style?: StyleProp; + labelTextStyle?: StyleProp; + titleTextStyle?: StyleProp; + affixTextStyle?: StyleProp; tintColor?: string; textColor?: string; @@ -47,8 +55,8 @@ export interface TextFieldProps extends TextInputProps { prefix?: string; suffix?: string; - containerStyle?: ViewStyle; - inputContainerStyle?: ViewStyle; + containerStyle?: StyleProp; + inputContainerStyle?: StyleProp; onPress?(event: Event): void; onChangeText?(text: string): void; diff --git a/types/react-native-material-textfield/react-native-material-textfield-tests.tsx b/types/react-native-material-textfield/react-native-material-textfield-tests.tsx index 08b33e31d0..50fb2b166b 100644 --- a/types/react-native-material-textfield/react-native-material-textfield-tests.tsx +++ b/types/react-native-material-textfield/react-native-material-textfield-tests.tsx @@ -1,13 +1,15 @@ import * as React from 'react'; -import { View, Text } from 'react-native'; +import { View } from 'react-native'; import { TextField } from 'react-native-material-textfield'; -const Example = () => +const Example = () => ( - ; + +); From e02a423e30ff3baa3eb334aa22b82dea8119079b Mon Sep 17 00:00:00 2001 From: Shane Fitzpatrick Date: Tue, 5 Jun 2018 09:50:28 -0700 Subject: [PATCH 47/62] react-native: Add event for TextInput onFocus and onBlur --- types/react-native/index.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index ef574ec807..eaa2dcccfc 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1078,6 +1078,12 @@ export type ReturnKeyTypeAndroid = "none" | "previous"; export type ReturnKeyTypeIOS = "default" | "google" | "join" | "route" | "yahoo" | "emergency-call"; export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS +export interface TextInputFocusEventData { + target: number, + text: string, + eventCount: number +} + /** * @see https://facebook.github.io/react-native/docs/textinput.html#props */ @@ -1159,7 +1165,7 @@ export interface TextInputProps /** * Callback that is called when the text input is blurred */ - onBlur?: () => void; + onBlur?: (e: NativeSyntheticEvent) => void; /** * Callback that is called when the text input's text changes. @@ -1198,7 +1204,7 @@ export interface TextInputProps /** * Callback that is called when the text input is focused */ - onFocus?: () => void; + onFocus?: (e: NativeSyntheticEvent) => void; /** * Callback that is called when the text input selection is changed. From ca916022152dd46e86acad208759811e622a00be Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 6 Jun 2018 11:55:06 +1000 Subject: [PATCH 48/62] Updated to 0.16.3 --- types/react-calendar-timeline/index.d.ts | 155 ++++++++++++++--------- 1 file changed, 95 insertions(+), 60 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 8c523e68c6..2ff17f6a82 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-calendar-timeline v0.15.12 +// Type definitions for react-calendar-timeline v0.16.3 // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov // Alex Maclean @@ -12,6 +12,7 @@ declare module "react-calendar-timeline" { export interface TimelineGroup { id: number; title: React.ReactNode; + rightTitle?: React.ReactNode; } export interface TimelineItem { @@ -21,9 +22,10 @@ declare module "react-calendar-timeline" { start_time: any; end_time: any; canMove?: boolean; - canResize?: boolean; + canResize?: boolean | "left" | "right" | "both"; canChangeGroup?: boolean; className?: string; + itemProps?: {}; } export interface TimelineContext { @@ -32,65 +34,98 @@ declare module "react-calendar-timeline" { timelineWidth: number } - export interface ReactCalendarTimelineProps { - groups: TimelineGroup[]; - items: TimelineItem[]; - keys?:{ - groupIdKey: string; - groupTitleKey: string; - itemIdKey: string; - itemTitleKey: string; - itemGroupKey: string; - itemTimeStartKey: string; - itemTimeEndKey: string; - }; - selected?: number[]; - sidebarWidth?: number; - sidebarContent?: any; - rightSidebarWidth?: number; - rightSidebarContent?: any; - dragSnap?: number; - minResizeWidth?: number; - stickyOffset?: number; - stickyHeader?: boolean; - headerRef?: any; - lineHeight?: number; - headerLabelGroupHeight?: number; - headerLabelHeight?: number; - itemHeightRatio?: number; - minZoom?: number; - maxZoom?: number; - clickTolerance?: number; - canMove?: boolean; - canChangeGroup?: boolean; - canResize?: boolean; - useResizeHandle?: boolean; - showCursorLine?: boolean; - stackItems?: boolean; - traditionalZoom?: boolean; - itemTouchSendsClick?: boolean; - onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; - onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; - onItemSelect?(itemId:number, e: any, time: number): any; - onItemClick?(itemId:number, e: any, time: number): any; - onItemDoubleClick?(itemId:number, e: any, time: number): any; - onCanvasClick?(groupId:number, time:number, e:any): any; - onCanvasDoubleClick?(groupId:number, time:number, e:any): any; - moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; - defaultTimeStart?: any; - defaultTimeEnd?: any; - visibleTimeStart?: number; - visibleTimeEnd?: number; - onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; - onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; - onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; - onZoom?(timelineContext: TimelineContext): any; - children?: any; - fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>; - minimumWidthForItemContentVisibility?: number; + export interface TimelineTimeSteps { + second: number, + minute: number, + hour: number, + day: number, + month: number, + year: number } + + export interface TimelineHeaderLabelFormat { + yearShort: string, + yearLong: string, + monthShort: string, + monthMedium: string, + monthMediumLong: string, + monthLong: string, + dayShort: string, + dayLong: string, + hourShort: string, + hourMedium: string, + hourMediumLong: string, + hourLong: string, + time: string + } + + export interface ReactCalendarTimelineProps { + groups: TimelineGroup[]; + items: TimelineItem[]; + keys?:{ + groupIdKey: string; + groupTitleKey: string; + itemIdKey: string; + itemTitleKey: string; + itemGroupKey: string; + itemTimeStartKey: string; + itemTimeEndKey: string; + }; + defaultTimeStart?: any; + defaultTimeEnd?: any; + visibleTimeStart?: any; + visibleTimeEnd?: any; + selected?: number[]; + sidebarWidth?: number; + sidebarContent?: React.ReactNode; + rightSidebarWidth?: number; + rightSidebarContent?: React.ReactNode; + dragSnap?: number; + minResizeWidth?: number; + stickyOffset?: number; + stickyHeader?: boolean; + headerRef?: any; + lineHeight?: number; + headerLabelGroupHeight?: number; + headerLabelHeight?: number; + itemHeightRatio?: number; + minZoom?: number; + maxZoom?: number; + clickTolerance?: number; + canMove?: boolean; + canChangeGroup?: boolean; + canResize?: boolean | "left" | "right" | "both"; + useResizeHandle?: boolean; + showCursorLine?: boolean; + stackItems?: boolean; + traditionalZoom?: boolean; + itemTouchSendsClick?: boolean; + timeSteps?: TimelineTimeSteps, + onItemMove?(itemId: number, dragTime: number, newGroupOrder: number): any; + onItemResize?(itemId: number, newResizeEnd: number, edge: "left" | "right"): any; + onItemSelect?(itemId: number, e: any, time: number): any; + onItemClick?(itemId: number, e: any, time: number): any; + onItemDoubleClick?(itemId: number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onCanvasDoubleClick?(group: TimelineGroup, time: number, e: any): any; + onCanvasContextMenu?(group: TimelineGroup, time: number, e: any): any; + onZoom?(timelineContext: TimelineContext): any; + moveResizeValidator?(action:"move" | "resize", itemId: number, time: number, resizeEdge: "left" | "right"): any; + headerLabelFormats?: TimelineHeaderLabelFormat, + subHeaderLabelFormats?: TimelineHeaderLabelFormat, + onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; + onTimeInit?(canvasTimeStart: number, canvasTimeEnd: number): any; + onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>; + minimumWidthForItemContentVisibility?: number; + children?: any; + } + + export const defaultHeaderLabelFormats: TimelineHeaderLabelFormat; + export const defaultSubHeaderLabelFormats: TimelineHeaderLabelFormat; + let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; + } From 226ec2c9c9de617650ba05c8deca2a7d61f85727 Mon Sep 17 00:00:00 2001 From: Kei Son Date: Thu, 7 Jun 2018 16:27:53 +0800 Subject: [PATCH 49/62] Add missing errors --- types/restify-errors/index.d.ts | 5 +++++ types/restify-errors/restify-errors-tests.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/types/restify-errors/index.d.ts b/types/restify-errors/index.d.ts index ecec86f8f7..fb9c136ab1 100644 --- a/types/restify-errors/index.d.ts +++ b/types/restify-errors/index.d.ts @@ -130,6 +130,11 @@ export class InsufficientStorageError extends DefinedHttpError { } export class BandwidthLimitExceededError extends DefinedHttpError { } export class NotExtendedError extends DefinedHttpError { } export class NetworkAuthenticationRequiredError extends DefinedHttpError { } +export class PayloadTooLargeError extends DefinedHttpError { } +export class UriTooLongError extends DefinedHttpError { } +export class MisdirectedRequestError extends DefinedHttpError { } +export class UnavailableForLegalReasonsError extends DefinedHttpError { } +export class LoopDetectedError extends DefinedHttpError { } export class BadDigestError extends DefinedRestError { } export class BadMethodError extends DefinedRestError { } diff --git a/types/restify-errors/restify-errors-tests.ts b/types/restify-errors/restify-errors-tests.ts index 600a0545fb..2bda424f6a 100644 --- a/types/restify-errors/restify-errors-tests.ts +++ b/types/restify-errors/restify-errors-tests.ts @@ -62,6 +62,12 @@ httpError = new restifyErrors.InsufficientStorageError(); httpError = new restifyErrors.BandwidthLimitExceededError(); httpError = new restifyErrors.NotExtendedError(); httpError = new restifyErrors.NetworkAuthenticationRequiredError(); +httpError = new restifyErrors.PayloadTooLargeError(); +httpError = new restifyErrors.UriTooLongError(); +httpError = new restifyErrors.MisdirectedRequestError(); +httpError = new restifyErrors.UnavailableForLegalReasonsError(); +httpError = new restifyErrors.LoopDetectedError(); +httpError = new restifyErrors.NetworkAuthenticationRequiredError(); // RestErrors let restError = new restifyErrors.BadDigestError(); From 4acc2d229c2dee699d27a714afff5d1401a86115 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Thu, 7 Jun 2018 08:13:30 -0400 Subject: [PATCH 50/62] Adding ImperativeRouter type --- types/next/router.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 5a17bd2a53..544c29bc7e 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -61,4 +61,5 @@ export function withRouter( ): React.ComponentType; export const Singleton: SingletonRouter; +export type ImperativeRouter = RouterProps; export default Singleton; From 997a0150e9a8a72cefb28565e36bb6ed1ea5c0b4 Mon Sep 17 00:00:00 2001 From: Zachary Wade Date: Thu, 7 Jun 2018 10:53:00 -0400 Subject: [PATCH 51/62] added the Object.TYPE enum as well as fixed typos on Object.type2String and Object.string2Type --- types/nodegit/diff-binary-file.d.ts | 4 +++- types/nodegit/object.d.ts | 29 ++++++++++++++++++++++------- types/nodegit/odb-expand-id.d.ts | 3 ++- types/nodegit/odb.d.ts | 3 ++- types/nodegit/reference.d.ts | 2 +- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/types/nodegit/diff-binary-file.d.ts b/types/nodegit/diff-binary-file.d.ts index 46b67f406e..362e1a63fc 100644 --- a/types/nodegit/diff-binary-file.d.ts +++ b/types/nodegit/diff-binary-file.d.ts @@ -1,5 +1,7 @@ +import { Object } from './object'; + export class DiffBinaryFile { - type: number; + type: Object.TYPE; data: string; datalen: number; inflatedlen: number; diff --git a/types/nodegit/object.d.ts b/types/nodegit/object.d.ts index 4ec5a19b6c..be7e879b95 100644 --- a/types/nodegit/object.d.ts +++ b/types/nodegit/object.d.ts @@ -3,20 +3,35 @@ import { Repository } from './repository'; import { Buf } from './buf'; export class Object { - static size(type: number): number; - static lookup(repo: Repository, id: Oid, type: number): Promise; - static lookupPrefix(repo: Repository, id: Oid, len: number, type: number): Promise; - static string2type(str: string): number; - static type2string(type: number): string; - static typeisloose(type: number): number; + static size(type: Object.TYPE): number; + static lookup(repo: Repository, id: Oid, type: Object.TYPE): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number, type: Object.TYPE): Promise; + static string2Type(str: string): Object.TYPE; + static type2String(type: Object.TYPE): string; + static typeisloose(type: Object.TYPE): number; dup(): Promise; free(): void; id(): Oid; - lookupByPath(path: string, type: number): Promise; + lookupByPath(path: string, type: Object.TYPE): Promise; owner(): Repository; peel(targetType: number): Promise; shortId(): Promise; type(): number; } + +export namespace Object { + const enum TYPE { + ANY = -2, + BAD = -1, + EXT1 = 0, + COMMIT = 1, + TREE = 2, + BLOB = 3, + TAG = 4, + EXT2 = 5, + OFS_DELTA = 6, + REF_DELTA = 7 + } +} diff --git a/types/nodegit/odb-expand-id.d.ts b/types/nodegit/odb-expand-id.d.ts index d4fe264c3a..5576fbad58 100644 --- a/types/nodegit/odb-expand-id.d.ts +++ b/types/nodegit/odb-expand-id.d.ts @@ -1,7 +1,8 @@ import { Oid } from './oid'; +import { Object } from './object'; export class OdbExpandId { id: Oid; length: number; - type: number; + type: Object.TYPE; } diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts index db0aacda61..e5348d088f 100644 --- a/types/nodegit/odb.d.ts +++ b/types/nodegit/odb.d.ts @@ -1,6 +1,7 @@ import { Oid } from './oid'; import { OdbObject } from './odb-object'; import { OdbExpandId } from './odb-expand-id'; +import { Object } from './object'; export namespace Odb { const enum STREAM { @@ -17,6 +18,6 @@ export class Odb { free(): void; read(id: Oid): Promise; - write(data: Buffer, len: number, type: number): Promise; + write(data: Buffer, len: number, type: Object.TYPE): Promise; expandIds(ids: OdbExpandId, count: number): number; } diff --git a/types/nodegit/reference.d.ts b/types/nodegit/reference.d.ts index 80e16c9350..cc6cb90e28 100644 --- a/types/nodegit/reference.d.ts +++ b/types/nodegit/reference.d.ts @@ -41,7 +41,7 @@ export class Reference { isTag(): number; name(): string; owner(): Repository; - peel(type: number): Promise; + peel(type: Object.TYPE): Promise; rename(newName: string, force: number, logMessage: string): Promise; resolve(): Promise; setTarget(id: Oid, logMessage: string): Promise; From 270369930e5141e65d4e8a1f7443a35c5441065b Mon Sep 17 00:00:00 2001 From: bradleat Date: Thu, 7 Jun 2018 14:55:44 -0700 Subject: [PATCH 52/62] inverted support see: https://github.com/archriss/react-native-snap-carousel/issues/197 they forgot to document it, but it works --- types/react-native-snap-carousel/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/react-native-snap-carousel/index.d.ts b/types/react-native-snap-carousel/index.d.ts index 5b5406f6fa..56b083638b 100644 --- a/types/react-native-snap-carousel/index.d.ts +++ b/types/react-native-snap-carousel/index.d.ts @@ -45,6 +45,10 @@ export interface CarouselProps extends React.Props { * Width in pixels of your slides, must be the same for all of them * Note: Required with horizontal carousel */ + /** + * Reverses the direction of scroll. Uses scale transforms of -1. + */ + inverted?: boolean; itemWidth?: number; /** * Height in pixels of carousel's items, must be the same for all of them From caaaebc65f28a3d7808857b73ec56166638819fc Mon Sep 17 00:00:00 2001 From: Craig Bruce <“craigrbruce@gmail.com”> Date: Fri, 8 Jun 2018 10:45:02 +1000 Subject: [PATCH 53/62] Remove tslint rules and fix JSDoc formatting. Rewrite email address on previous commits. --- .../cast.framework.breaks.d.ts | 6 - .../cast.framework.d.ts | 47 ++- .../cast.framework.messages.d.ts | 374 ++++++++++++------ .../cast.framework.system.d.ts | 23 +- .../cast.framework.ui.d.ts | 18 +- types/chromecast-caf-receiver/tslint.json | 3 - 6 files changed, 312 insertions(+), 159 deletions(-) diff --git a/types/chromecast-caf-receiver/cast.framework.breaks.d.ts b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts index 309d87fd74..21adf13fb0 100644 --- a/types/chromecast-caf-receiver/cast.framework.breaks.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts @@ -36,13 +36,11 @@ declare namespace cast.framework.breaks { interface BreakManager { /** * Get current media break by id. - * @param {*} id */ getBreakById(id: string): Break; /** * Get current media break clip by id - * @param {*} id */ getBreakClipById(id: string): BreakClip; @@ -61,7 +59,6 @@ declare namespace cast.framework.breaks { * By default VAST fetching and parsing logic in default interceptor. * So if customized interceptor is set by developer; * the VAST logic will be overridden and developers should implement their own VAST fetching and parsing logic in the provided interceptor. - * @param {*} interceptor */ setBreakClipLoadInterceptor( interceptor: ( @@ -72,7 +69,6 @@ declare namespace cast.framework.breaks { /** * Provide an interceptor for developer to specify what breaks they want to play after seek. - * @param {*} seekInterceptor */ setBreakSeekInterceptor( seekInterceptor: (breakSeekData: BreakSeekData) => void @@ -80,7 +76,6 @@ declare namespace cast.framework.breaks { /** * Set a flag to control if the watched client stitching break should be played. - * @param {*} playWatchedBreak */ setPlayWatchedBreak(playWatchedBreak: boolean): void; @@ -89,7 +84,6 @@ declare namespace cast.framework.breaks { * The input of the interceptor is a string of the tracking URL. * The interceptor can either return a modified string of URL or a Promise of modified string of URL. * The interceptor can also return null if you want to send the tracking URL by your own code instead of by CAF. - * @param {*} interceptor */ setVastTrackingInterceptor( interceptor?: (trackingUrl: string) => void diff --git a/types/chromecast-caf-receiver/cast.framework.d.ts b/types/chromecast-caf-receiver/cast.framework.d.ts index 2ee078021a..28b0c69e2d 100644 --- a/types/chromecast-caf-receiver/cast.framework.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.d.ts @@ -149,7 +149,9 @@ declare namespace cast.framework { */ class QueueBase { /** - * Fetches a window of items using the specified item id as reference; called by the receiver MediaManager when it needs more queue items; often as a request from senders. If only one of nextCount and prevCount is non-zero; fetchItems should only return items after or before the reference item; if both nextCount and prevCount are non-zero; a window of items including the reference item should be returned. + * Fetches a window of items using the specified item id as reference; called by the receiver MediaManager when it needs more queue items; + * often as a request from senders. If only one of nextCount and prevCount is non-zero; fetchItems should only return items after or before + * the reference item; if both nextCount and prevCount are non-zero; a window of items including the reference item should be returned. */ fetchItems( itemId: number, @@ -158,7 +160,9 @@ declare namespace cast.framework { ): QueueItem[] | Promise; /** - * Initializes the queue with the requestData. This is called when a new LOAD request comes in to the receiver. If this returns or resolves to null; our default queueing implementation will create a queue based on queueData.items or the single media in the load request data. + * Initializes the queue with the requestData. This is called when a new LOAD request comes in to the receiver. + * If this returns or resolves to null; our default queueing implementation will create a queue based on queueData.items or the single media + * in the load request data. */ initialize( requestData: LoadRequestData @@ -175,12 +179,14 @@ declare namespace cast.framework { onCurrentItemIdChanged(itemId: number): void; /** - * A callback for informing the following items have been inserted into the receiver queue in this session. A cloud based implementation can optionally choose to update its queue based on the new information. + * A callback for informing the following items have been inserted into the receiver queue in this session. + * A cloud based implementation can optionally choose to update its queue based on the new information. */ onItemsInserted(items: QueueItem[], insertBefore?: number): void; /** - * A callback for informing the following items have been removed from the receiver queue in this session. A cloud based implementation can optionally choose to update its queue based on the new information. + * A callback for informing the following items have been removed from the receiver queue in this session. + * A cloud based implementation can optionally choose to update its queue based on the new information. */ onItemsRemoved(itemIds: number[]): void; @@ -219,9 +225,6 @@ declare namespace cast.framework { includeQueueItems?: boolean ): void; - /** - * - */ getAudioTracksManager(): AudioTracksManager; /** @@ -280,7 +283,8 @@ declare namespace cast.framework { getPlayerState(): PlayerState; /** - * Get the preferred playback rate. (Can be used on shutdown event to save latest preferred playback rate to a persistent storage; so it can be used in next session in the cast options). + * Get the preferred playback rate. (Can be used on shutdown event to save latest preferred playback rate to a persistent storage; + * so it can be used in next session in the cast options). */ getPreferredPlaybackRate(): number; @@ -294,9 +298,6 @@ declare namespace cast.framework { */ getQueueManager(): QueueManager; - /** - * - */ getTextTracksManager(): TextTracksManager; /** @@ -365,7 +366,10 @@ declare namespace cast.framework { ): void; /** - * Sets the IDLE reason. This allows applications that want to force the IDLE state to indicate the reason that made the player going to IDLE state (a custom error; for example). The idle reason will be sent in the next status message. NOTE: Most applications do not need to set this value; it is only needed if they want to make the player go to IDLE in special circumstances and the default idleReason does not reflect their intended behavior. + * Sets the IDLE reason. This allows applications that want to force the IDLE state to indicate the reason that made the player going to IDLE state + * (a custom error; for example). The idle reason will be sent in the next status message. NOTE: Most applications do not need to set this value; + * it is only needed if they want to make the player go to IDLE in special circumstances and the default idleReason does not reflect their intended + * behavior. */ setIdleReason(idleReason: IdleReason): void; @@ -383,7 +387,9 @@ declare namespace cast.framework { ): void; /** - * Sets a handler to return or modify PlaybackConfig; for a specific load request. The handler paramaters are the load request data and default playback config for the receiver (provided in the context options). The handler should returns a modified playback config; or null to prevent the media from playing. The return value can be a promise to allow waiting for data from the server. + * Sets a handler to return or modify PlaybackConfig; for a specific load request. The handler paramaters are the load request data + * and default playback config for the receiver (provided in the context options). The handler should returns a modified playback config; + * or null to prevent the media from playing. The return value can be a promise to allow waiting for data from the server. */ setMediaPlaybackInfoHandler( handler: ( @@ -393,14 +399,19 @@ declare namespace cast.framework { ): void; /** - * Sets a handler to return the media url for a load request. This handler can be used to avoid having the media content url published as part of the media status. By default the media contentId is used as the content url. + * Sets a handler to return the media url for a load request. This handler can be used to avoid having the media content url published as part + * of the media status. By default the media contentId is used as the content url. */ setMediaUrlResolver( resolver: (loadRequestData: LoadRequestData) => void ): void; /** - * Provide an interceptor of incoming and outgoing messages. The interceptor can update the request data; and return updated data; a promise of updated data if need to get more data from the server; or null if the request should not be handled. Note that if load message interceptor is provided; and no interceptor is provided for preload - the load interceptor will be called for preload messages. + * Provide an interceptor of incoming and outgoing messages. + * The interceptor can update the request data; and return updated data; a promise of + * updated data if need to get more data from the server; or null if the request should not be handled. + * Note that if load message interceptor is provided; and no interceptor is provided for preload - + * the load interceptor will be called for preload messages. */ setMessageInterceptor( type: MessageType, @@ -413,12 +424,14 @@ declare namespace cast.framework { setPlaybackConfig(playbackConfig: PlaybackConfig): void; /** - * Set the preferred playback rate for follow up load or media items. The preferred playback rate will be updated automatically to the latest playback rate that was provided by a load request or explicit set of playback rate. + * Set the preferred playback rate for follow up load or media items. The preferred playback rate will be updated automatically to the latest + * playback rate that was provided by a load request or explicit set of playback rate. */ setPreferredPlaybackRate(preferredPlaybackRate: number): void; /** - * Set the preferred text track language. The preferred text track language will be updated automatically to the latest enabled language by a load request or explicit change to text tracks. (Should be called only in idle state; and Will only apply to next loaded media). + * Set the preferred text track language. The preferred text track language will be updated automatically to the latest enabled language + * by a load request or explicit change to text tracks. (Should be called only in idle state; and Will only apply to next loaded media). */ setPreferredTextLanguage(preferredTextLanguage: string): void; diff --git a/types/chromecast-caf-receiver/cast.framework.messages.d.ts b/types/chromecast-caf-receiver/cast.framework.messages.d.ts index 311232e5e0..d6dda6d145 100644 --- a/types/chromecast-caf-receiver/cast.framework.messages.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.messages.d.ts @@ -224,19 +224,10 @@ declare namespace cast.framework.messages { class VideoInformation { constructor(width: number, height: number, hdrType: HdrType); - /** - * - */ width: number; - /** - * - */ height: number; - /** - * - */ hdrType: HdrType; } @@ -245,7 +236,10 @@ declare namespace cast.framework.messages { */ interface VastAdsRequest { /** - * Specifies a VAST document to be used as the ads response instead of making a request via an ad tag url. This can be useful for debugging and other situations where a VAST response is already available. + * Specifies a VAST document to be used as the ads response instead of making a + * request via an ad tag url. + * This can be useful for debugging and other situations where a VAST response is + * already available. */ adsResponse?: string; @@ -260,7 +254,8 @@ declare namespace cast.framework.messages { */ interface UserActionRequestData { /** - * Optional request source. It contain the assistent query that initiate the request. + * Optional request source. + * It contain the assistent query that initiate the request. */ source?: string; @@ -295,7 +290,8 @@ declare namespace cast.framework.messages { episodeTitle?: string; /** - * Content images. Examples would include cover art or a thumbnail of the currently playing media. + * Content images. Examples would include cover art or a thumbnail of + * the currently playing media. */ images?: Image[]; @@ -356,12 +352,19 @@ declare namespace cast.framework.messages { subtype?: string; /** - * It can be the url of the track or any other identifier that allows the receiver to find the content (when the track is not inband or included in the manifest). For example it can be the url of a vtt file. + * It can be the url of the track or any other identifier that allows the receiver + * to find the content (when the track is not inband or included in the manifest). + * For example it can be the url of a vtt file. */ trackContentId?: string; /** - * It represents the MIME type of the track content. For example if the track is a vtt file it will be ‘text/vtt’. This field is needed for out of band tracks; so it is usually provided if a trackContentId has also been provided. It is not mandatory if the receiver has a way to identify the content from the trackContentId; but recommended. The track content type; if provided; must be consistent with the track type. + * It represents the MIME type of the track content. For example if the track + * is a vtt file it will be ‘text/vtt’. This field is needed for out of band tracks; + * so it is usually provided if a trackContentId has also been provided. + * It is not mandatory if the receiver has a way to identify the content from + * the trackContentId; but recommended. + * The track content type; if provided; must be consistent with the track type. */ trackContentType?: string; @@ -394,9 +397,6 @@ declare namespace cast.framework.messages { */ edgeColor?: string; - /** - * - */ edgeType?: TextTrackEdgeType; /** @@ -430,7 +430,8 @@ declare namespace cast.framework.messages { windowColor?: string; /** - * Rounded corner radius absolute value in pixels (px). This value will be ignored if windowType is not ROUNDED_CORNERS. + * Rounded corner radius absolute value in pixels (px). This value will be ignored + * if windowType is not ROUNDED_CORNERS. */ windowRoundedCornerRadius?: number; @@ -450,7 +451,10 @@ declare namespace cast.framework.messages { playbackRate?: number; /** - * New playback rate relative to current playback rate. New rate will be the result of multiplying the current rate with the value. For example a value of 1.1 will increase rate by 10%. (Only used if the playbackRate value is not provided). + * New playback rate relative to current playback rate. + * New rate will be the result of multiplying the current rate with the value. + * For example a value of 1.1 will increase rate by 10%. + * (Only used if the playbackRate value is not provided). */ relativePlaybackRate?: number; } @@ -465,7 +469,8 @@ declare namespace cast.framework.messages { credentials?: string; /** - * If it is a response for refresh credentials; it will indicate the request id of the refresh credentials request. + * If it is a response for refresh credentials; it will indicate the request id + * of the refresh credentials request. */ forRequestId?: number; @@ -485,7 +490,8 @@ declare namespace cast.framework.messages { currentTime?: number; /** - * Seconds relative to the current playback position. If this field is defined; the currentTime field will be ignored. + * Seconds relative to the current playback position. If this field is defined; + * the currentTime field will be ignored. */ relativeTime?: number; @@ -519,7 +525,9 @@ declare namespace cast.framework.messages { constructor(type: MessageType); /** - * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + * Application-specific data for this request. + * It enables the sender and receiver to easily extend the media protocol + * without having to use a new namespace with custom messages. */ customData?: any; @@ -539,22 +547,35 @@ declare namespace cast.framework.messages { */ interface QueueUpdateRequestData { /** - * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + * ID of the current media Item after the deletion + * (if not provided; the currentItem value will be the same as before the deletion; + * if it does not exist because it has been deleted; the currentItem will point to + * the next logical item in the list). */ currentItemId?: number; /** - * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + * Seconds since the beginning of content to start playback of the current item. + * If provided; this value will take precedence over the startTime value provided + * at the QueueItem level but only the first time the item is played. + * This is to cover the common case where the user jumps to the middle of an + * item so the currentTime does not apply to the item permanently like the + * QueueItem startTime does. It avoids having to reset the startTime dynamically + * (that may not be possible if the phone has gone to sleep). */ currentTime?: number; /** - * List of queue items to be updated. No reordering will happen; the items will retain the existing order. + * List of queue items to be updated. No reordering will happen; the items will + * retain the existing order. */ items?: QueueItem[]; /** - * Skip/Go back number of items with respect to the position of currentItem (it can be negative). If it is out of boundaries; the currentItem will be the next logical item in the queue wrapping around the boundaries. The new currentItem position will follow the rules of the queue repeat behavior. + * Skip/Go back number of items with respect to the position of currentItem + * (it can be negative). If it is out of boundaries; the currentItem will be the + * next logical item in the queue wrapping around the boundaries. + * The new currentItem position will follow the rules of the queue repeat behavior. */ jump?: number; @@ -564,7 +585,9 @@ declare namespace cast.framework.messages { repeatMode?: RepeatMode; /** - * Shuffle the queue items when the update is processed. After the queue items are shuffled; the item at the currentItem position will be loaded. + * Shuffle the queue items when the update is processed. + * After the queue items are shuffled; the item at the currentItem position will + * be loaded. */ shuffle?: boolean; } @@ -576,29 +599,43 @@ declare namespace cast.framework.messages { constructor(itemIds: number[]); /** - * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + * ID of the current media Item after the deletion (if not provided; + * the currentItem value will be the same as before the deletion; + * if it does not exist because it has been deleted; + * the currentItem will point to the next logical item in the list). */ currentItemId?: number; /** - * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + * Seconds since the beginning of content to start playback of the current item. + * If provided; this value will take precedence over the startTime value provided + * at the QueueItem level but only the first time the item is played. + * This is to cover the common case where the user jumps to the middle of an + * item so the currentTime does not apply to the item permanently like + * the QueueItem startTime does. It avoids having to reset the startTime dynamically + * (that may not be possible if the phone has gone to sleep). */ currentTime?: number; /** - * ID of the item that will be located immediately after the reordered list. If the ID is not found or it is not provided; the reordered list will be appended at the end of the existing list. + * ID of the item that will be located immediately after the reordered list. + * If the ID is not found or it is not provided; + * the reordered list will be appended at the end of the existing list. */ insertBefore?: number; /** - * IDs of the items to be reordered; in the new order. Items not provided will keep their existing order. The provided list will be inserted at the position determined by insertBefore. For example: - - If insertBefore is not specified Existing queue: “A”;”D”;”G”;”H”;”B”;”E” itemIds: “D”;”H”;”B” New Order: “A”;”G”;”E”;“D”;”H”;”B” - - If insertBefore is “A” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “D”;”H”;”B”;“A”;”G”;”E” - - If insertBefore is “G” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “A”;“D”;”H”;”B”;”G”;”E” - */ + * IDs of the items to be reordered; in the new order. + * Items not provided will keep their existing order. + * The provided list will be inserted at the position determined by insertBefore. + * For example: + * If insertBefore is not specified Existing queue: “A”;”D”;”G”;”H”;”B”;”E” itemIds: + * “D”;”H”;”B” New Order: “A”;”G”;”E”;“D”;”H”;”B” + * If insertBefore is “A” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: + * “D”;”H”;”B” New Order: “D”;”H”;”B”;“A”;”G”;”E” + * If insertBefore is “G” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: + * “D”;”H”;”B” New Order: “A”;“D”;”H”;”B”;”G”;”E” + */ itemIds: number[]; } @@ -609,12 +646,21 @@ declare namespace cast.framework.messages { constructor(itemIds: number[]); /** - * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + * ID of the current media Item after the deletion + * (if not provided; the currentItem value will be the same as before the deletion; + * if it does not exist because it has been deleted; + * the currentItem will point to the next logical item in the list). */ currentItemId?: number; /** - * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + * Seconds since the beginning of content to start playback of the current item. + * If provided; this value will take precedence over the startTime value provided + * at the QueueItem level but only the first time the item is played. + * This is to cover the common case where the user jumps to the middle of an + * item so the currentTime does not apply to the item permanently like the + * QueueItem startTime does. It avoids having to reset the startTime dynamically + * (that may not be possible if the phone has gone to sleep). */ currentTime?: number; @@ -630,7 +676,14 @@ declare namespace cast.framework.messages { constructor(items: QueueItem[]); /** - * Seconds (since the beginning of content) to start playback of the first item to be played. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user casts the item that was playing locally so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + * Seconds (since the beginning of content) to start playback of the first item to + * be played. If provided; this value will take precedence over the + * startTime value provided at the QueueItem level but only the first + * time the item is played. This is to cover the common case where the user + * casts the item that was playing locally so the currentTime does not apply + * to the item permanently like the QueueItem startTime does. + * It avoids having to reset the startTime dynamically + * (that may not be possible if the phone has gone to sleep). */ currentTime?: number; @@ -645,24 +698,37 @@ declare namespace cast.framework.messages { repeatMode?: RepeatMode; /** - * The index of the item in the items array that must be the first currentItem (the item that will be played first). Note this is the index of the array (starts at 0) and not the itemId (as it is not known until the queue is created). If repeatMode is REPEAT_OFF playback will end when the last item in the array is played (elements before the startIndex will not be played). This may be useful for continuation scenarios where the user was already using the sender app and in the middle decides to cast. In this way the sender app does not need to map between the local and remote queue positions or saves one extra QUEUE_UPDATE request. + * The index of the item in the items array that must be the first currentItem + * (the item that will be played first). Note this is the index of the array + * (starts at 0) and not the itemId (as it is not known until the queue is created). + * If repeatMode is REPEAT_OFF playback will end when the last item in the array is + * played (elements before the startIndex will not be played). + * This may be useful for continuation scenarios where the user was already + * using the sender app and in the middle decides to cast. + * In this way the sender app does not need to map between the local and remote queue + * positions or saves one extra QUEUE_UPDATE request. */ startIndex?: number; } /** - * Queue item information. Application developers may need to create a QueueItem to insert a queue element using InsertQueueItems. In this case they should not provide an itemId (as the actual itemId will be assigned when the item is inserted in the queue). This prevents ID collisions with items added from a sender app. + * Queue item information. Application developers may need to create a QueueItem to + * insert a queue element using InsertQueueItems. In this case they should not + * provide an itemId (as the actual itemId will be assigned when the item is inserted + * in the queue). This prevents ID collisions with items added from a sender app. */ class QueueItem { constructor(opt_itemId?: number); /** - * Array of Track trackIds that are active. If the array is not provided; the default tracks will be active. + * Array of Track trackIds that are active. If the array is not provided; + * the default tracks will be active. */ activeTrackIds?: number[]; /** - * If the autoplay parameter is not specified or is true; the media player will begin playing the element in the queue when the item becomes the currentItem. + * If the autoplay parameter is not specified or is true; the media player + * will begin playing the element in the queue when the item becomes the currentItem. */ autoplay?: boolean; @@ -672,7 +738,9 @@ declare namespace cast.framework.messages { customData?: any; /** - * Unique identifier of the item in the queue. The attribute is optional because for LOAD or INSERT should not be provided (as it will be assigned by the receiver when an item is first created/inserted). + * Unique identifier of the item in the queue. + * The attribute is optional because for LOAD or INSERT should not be provided + * (as it will be assigned by the receiver when an item is first created/inserted). */ itemId?: number; @@ -682,17 +750,36 @@ declare namespace cast.framework.messages { media?: MediaInformation; /** - * Playback duration of the item; if it is larger than the actual duration - startTime it will be ignored (default behavior). It can be negative; in such case the duration will be the actual asset duration minus the duration provided. It can be used for photo slideshows to control the duration the item should be presented or for live events to control the duration that the program should be played. It may be useful for autoplay scenarios to avoid displaying all the credits after an episode has ended. + * Playback duration of the item; if it is larger than the actual duration - + * startTime it will be ignored (default behavior). + * It can be negative; in such case the duration will be the actual asset + * duration minus the duration provided. + * It can be used for photo slideshows to control the duration the item should + * be presented or for live events to control the duration that the program + * should be played. It may be useful for autoplay scenarios to avoid displaying all + * the credits after an episode has ended. */ playbackDuration?: number; /** - * This parameter is a hint for the receiver to preload this media item before it is played. It allows for a smooth transition between items played from the queue. The time is expressed in seconds; relative to the beginning of this item playback (usually the end of the previous item playback). Only positive values are valid. For example; if the value is 10 seconds; this item will be preloaded 10 seconds before the previous item has finished. The receiver will try to honor this value but will not guarantee it; for example if the value is larger than the previous item duration the receiver may just preload this item shortly after the previous item has started playing (there will never be two items being preloaded in parallel). Also; if an item is inserted in the queue just after the currentItem and the time to preload is higher than the time left on the currentItem; the preload will just happen as soon as possible. + * This parameter is a hint for the receiver to preload this media + * item before it is played. It allows for a smooth transition between items + * played from the queue. The time is expressed in seconds; relative to + * the beginning of this item playback (usually the end of the previous item playback). + * Only positive values are valid. For example; if the value is 10 seconds; this item + * will be preloaded 10 seconds before the previous item has finished. + * The receiver will try to honor this value but will not guarantee it; + * for example if the value is larger than the previous item duration the + * receiver may just preload this item shortly after the previous item has started playing + * (there will never be two items being preloaded in parallel). + * Also; if an item is inserted in the queue just after the currentItem and the time to preload is higher than the + * time left on the currentItem; the preload will just happen as soon as possible. */ preloadTime?: number; /** - * Seconds since beginning of content. If the content is live content; and startTime is not specified; the stream will start at the live position. + * Seconds since beginning of content. If the content is live content; + * and startTime is not specified; the stream will start at the live position. */ startTime?: number; } @@ -704,27 +791,42 @@ declare namespace cast.framework.messages { constructor(items: QueueItem[]); /** - * ID of the current media Item after the insertion (if not provided; the currentItem value will be the same as before the insertion). + * ID of the current media Item after the insertion (if not provided; + * the currentItem value will be the same as before the insertion). */ currentItemId?: number; /** - * Index (relative to the items array; starting with 0) of the new current media Item. For inserted items we use the index (similar to startIndex in QUEUE_LOAD) and not currentItemId; because the itemId is unknown until the items are inserted. If not provided; the currentItem value will be the same as before the insertion (unless currentItemId is provided). This param allows to make atomic the common use case of insert and play an item. + * Index (relative to the items array; starting with 0) of the new current media Item. + * For inserted items we use the index (similar to startIndex in QUEUE_LOAD) and not + * currentItemId; because the itemId is unknown until the items are inserted. + * If not provided; the currentItem value will be the same as before the insertion + * (unless currentItemId is provided). This param allows to make atomic the common use + * case of insert and play an item. */ currentItemIndex?: number; /** - * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + * Seconds since the beginning of content to start playback of the current item. + * If provided; this value will take precedence over the startTime value provided + * at the QueueItem level but only the first time the item is played. + * This is to cover the common case where the user jumps to the middle of an + * item so the currentTime does not apply to the item permanently like the + * QueueItem startTime does. It avoids having to reset the startTime dynamically + * (that may not be possible if the phone has gone to sleep). */ currentTime?: number; /** - * ID of the item that will be located immediately after the inserted list. If the ID is not found or it is not provided; the list will be appended at the end of the existing list. + * ID of the item that will be located immediately after the inserted list. + * If the ID is not found or it is not provided; the list will be appended at + * the end of the existing list. */ insertBefore?: number; /** - * List of queue items. The itemId field of the items should be empty. It is sorted (first element will be played first). + * List of queue items. The itemId field of the items should be empty. + * It is sorted (first element will be played first). */ items: QueueItem[]; } @@ -743,9 +845,6 @@ declare namespace cast.framework.messages { */ requestId?: number; - /** - * - */ type: MessageType; } @@ -834,13 +933,11 @@ declare namespace cast.framework.messages { requestId?: number; /** - * The queue change sequence ID. Used to coordinate state sync between various senders and the receiver. + * The queue change sequence ID. Used to coordinate state sync between various + * senders and the receiver. */ sequenceNumber?: number; - /** - * - */ type: MessageType; } @@ -849,11 +946,14 @@ declare namespace cast.framework.messages { */ class PreloadRequestData implements LoadRequestData { /** - * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + * Array of trackIds that are active. If the array is not provided; + * the default tracks will be active. */ activeTrackIds: number[]; /** - * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + * If the autoplay parameter is specified; the media player will begin playing + * the content when it is loaded. Even if autoplay is not specified;the media player + * implementation may choose to begin playback immediately. */ autoplay?: boolean; /** @@ -861,15 +961,19 @@ declare namespace cast.framework.messages { */ credentials?: string; /** - * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + * Optional credentials type. The type 'cloud' is a reserved type used by load + * requests that were originated by voice assistant commands. */ credentialsType?: string; /** - * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + * Seconds since beginning of content. If the content is live content; + * and currentTime is not specified; the stream will start at the live position. */ currentTime?: number; /** - * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + * If the autoplay parameter is specified; the media player will begin playing + * the content when it is loaded. Even if autoplay is not specified; the media + * player implementation may choose to begin playback immediately. */ media: MediaInformation; /** @@ -881,7 +985,9 @@ declare namespace cast.framework.messages { */ queueData: QueueData; /** - * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + * Application-specific data for this request. + * It enables the sender and receiver to easily extend the media protocol + * without having to use a new namespace with custom messages. */ customData?: any; /** @@ -901,15 +1007,19 @@ declare namespace cast.framework.messages { } /** - * Media event PRECACHE request data. (Some fields of the load request; like autoplay and queueData; are ignored). + * Media event PRECACHE request data. (Some fields of the load request; + * like autoplay and queueData; are ignored). */ class PrecacheRequestData implements LoadRequestData { /** - * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + * Array of trackIds that are active. If the array is not provided; + * the default tracks will be active. */ activeTrackIds: number[]; /** - * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + * If the autoplay parameter is specified; the media player will begin playing + * the content when it is loaded. Even if autoplay is not specified;the media player + * implementation may choose to begin playback immediately. */ autoplay?: boolean; /** @@ -917,15 +1027,19 @@ declare namespace cast.framework.messages { */ credentials?: string; /** - * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + * Optional credentials type. The type 'cloud' is a reserved type used by load + * requests that were originated by voice assistant commands. */ credentialsType?: string; /** - * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + * Seconds since beginning of content. If the content is live content; and + * currentTime is not specified; the stream will start at the live position. */ currentTime?: number; /** - * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + * If the autoplay parameter is specified; the media player will begin playing + * the content when it is loaded. Even if autoplay is not specified; + * the media player implementation may choose to begin playback immediately. */ media: MediaInformation; /** @@ -937,7 +1051,9 @@ declare namespace cast.framework.messages { */ queueData: QueueData; /** - * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + * Application-specific data for this request. + * It enables the sender and receiver to easily extend the media protocol + * without having to use a new namespace with custom messages. */ customData?: any; /** @@ -1058,7 +1174,8 @@ declare namespace cast.framework.messages { discNumber?: number; /** - * Content images. Examples would include cover art or a thumbnail of the currently playing media. + * Content images. Examples would include cover art or a thumbnail of the + * currently playing media. */ images: Image[]; @@ -1093,7 +1210,8 @@ declare namespace cast.framework.messages { */ interface MovieMediaMetadata { /** - * Content images. Examples would include cover art or a thumbnail of the currently playing media. + * Content images. Examples would include cover art or a thumbnail of the + * currently playing media. */ images: Image[]; @@ -1132,7 +1250,8 @@ declare namespace cast.framework.messages { activeTrackIds: number[]; /** - * Status of break; if receiver is playing break. This field will be defined only when receiver is playing break. + * Status of break; if receiver is playing break. + * This field will be defined only when receiver is playing break. */ breakStatus: BreakStatus; @@ -1167,12 +1286,14 @@ declare namespace cast.framework.messages { items: QueueItem[]; /** - * Seekable range of a live or event stream. It uses relative media time in seconds. It will be undefined for VOD streams. + * Seekable range of a live or event stream. It uses relative media time in seconds. + * It will be undefined for VOD streams. */ liveSeekableRange: LiveSeekableRange; /** - * ID of the media Item currently loading. If there is no item being loaded; it will be undefined. + * ID of the media Item currently loading. If there is no item being loaded; + * it will be undefined. */ loadingItemId?: number; @@ -1197,7 +1318,10 @@ declare namespace cast.framework.messages { playerState: PlayerState; /** - * ID of the next Item; only available if it has been preloaded. Media items can be preloaded and cached temporarily in memory; so when they are loaded later on; the process is faster (as the media does not have to be fetched from the network). + * ID of the next Item; only available if it has been preloaded. + * Media items can be preloaded and cached temporarily in memory; + * so when they are loaded later on; the process is faster + * (as the media does not have to be fetched from the network). */ preloadedItemId?: number; @@ -1216,9 +1340,6 @@ declare namespace cast.framework.messages { */ supportedMediaCommands: number; - /** - * - */ type: MessageType; /** @@ -1248,7 +1369,9 @@ declare namespace cast.framework.messages { */ interface MediaInformation { /** - * Partial list of break clips that includes current break clip that receiver is playing or ones that receiver will play shortly after; instead of sending whole list of clips. This is to avoid overflow of MediaStatus message. + * Partial list of break clips that includes current break clip that receiver + * is playing or ones that receiver will play shortly after; instead of sending + * whole list of clips. This is to avoid overflow of MediaStatus message. */ breakClips: BreakClip[]; @@ -1268,7 +1391,9 @@ declare namespace cast.framework.messages { contentType: string; /** - * Optional media url; to allow using contentId for real id. If contentUrl is provided; it will be used as media url; otherwise the contentId will be used as the media url. + * Optional media url; to allow using contentId for real id. If contentUrl + * is provided; it will be used as media url; otherwise the contentId will + * be used as the media url. */ contentUrl?: string; @@ -1318,12 +1443,16 @@ declare namespace cast.framework.messages { */ interface LoadRequestData extends RequestData { /** - * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + * Array of trackIds that are active. If the array is not provided; the + * default tracks will be active. */ activeTrackIds: number[]; /** - * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + * If the autoplay parameter is specified; the media player will begin + * playing the content when it is loaded. Even if autoplay is not + * specified;the media player implementation may choose to begin playback + * immediately. */ autoplay?: boolean; @@ -1333,17 +1462,21 @@ declare namespace cast.framework.messages { credentials?: string; /** - * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + * Optional credentials type. The type 'cloud' is a reserved type used by + * load requests that were originated by voice assistant commands. */ credentialsType?: string; /** - * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + * Seconds since beginning of content. If the content is live content; + * and currentTime is not specified; the stream will start at the live position. */ currentTime?: number; /** - * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + * If the autoplay parameter is specified; the media player will begin playing + * the content when it is loaded. Even if autoplay is not specified; the media + * player implementation may choose to begin playback immediately. */ media: MediaInformation; @@ -1379,7 +1512,8 @@ declare namespace cast.framework.messages { } /** - * Provides live seekable range with start and end time in seconds and two more attributes. + * Provides live seekable range with start and end time in seconds and two more + * attributes. */ class LiveSeekableRange { constructor( @@ -1390,12 +1524,15 @@ declare namespace cast.framework.messages { ); /** - * A boolean value indicates whether a live stream is ended. If it is done; the end of live seekable range should stop updating. + * A boolean value indicates whether a live stream is ended. If it is done; + * the end of live seekable range should stop updating. */ isLiveDone?: boolean; /** - * A boolean value indicates whether the live seekable range is a moving window. If false; it will be either a expanding range or a fixed range meaning live has ended. + * A boolean value indicates whether the live seekable range is a moving window. + * If false; it will be either a expanding range or a fixed range meaning live + * has ended. */ isMovingWindow?: boolean; } @@ -1414,9 +1551,6 @@ declare namespace cast.framework.messages { */ requestId?: number; - /** - * - */ type: MessageType; } @@ -1466,7 +1600,8 @@ declare namespace cast.framework.messages { */ interface GenericMediaMetadata extends MediaMetadata { /** - * Content images. Examples would include cover art or a thumbnail of the currently playing media. + * Content images. Examples would include cover art or a thumbnail of the + * currently playing media. */ images: Image[]; @@ -1476,7 +1611,7 @@ declare namespace cast.framework.messages { releaseDate?: string; /** - *@deprecated - use @see{@link releaseDate} instead + * @deprecated - use @see{@link releaseDate} instead */ releaseYear?: number; @@ -1530,20 +1665,15 @@ declare namespace cast.framework.messages { opt_media?: MediaInformation ); - /** - * - */ media: MediaInformation; - /** - * - */ playerState: ExtendedPlayerState; } /** Event data for @see{@link EventType.ERROR} event. */ class ErrorEvent extends Event { constructor(detailedErrorCode?: DetailedErrorCode, error?: any); + /** * An error code representing the cause of the error. */ @@ -1552,7 +1682,8 @@ declare namespace cast.framework.messages { /** * The error object. * This could be an Error object (e.g.; if an Error was thrown in an event handler) - * or an object with error information (e.g.; if the receiver received an invalid command). + * or an object with error information (e.g.; if the receiver received an invalid + * command). */ error?: any; } @@ -1562,13 +1693,14 @@ declare namespace cast.framework.messages { /** * Application-specific data for this request. - * It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + * It enables the sender and receiver to easily extend the media protocol + * without having to use a new namespace with custom messages. */ customData?: any; /** - Id of the request; used to correlate request/response. - */ + * Id of the request; used to correlate request/response. + */ requestId?: number; } @@ -1590,35 +1722,33 @@ declare namespace cast.framework.messages { enableTextTracks?: boolean; /** - * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. + * Indicates that the provided language was not explicit user request; but rather + * inferred from used language in voice query. * It allows receiver apps to use user saved preference instead of spoken language. */ isSuggestedLanguage?: boolean; /** - * Language for the tracks that should be active. The language field will take precedence over activeTrackIds if both are specified. + * Language for the tracks that should be active. The language field will take + * precedence over activeTrackIds if both are specified. */ language?: string; - /** - * - */ textTrackStyle?: TextTrackStyle; } /** - * Media event EDIT_AUDIO_TRACKS request data. If language is not provided; the default audio track for the media will be enabled. + * Media event EDIT_AUDIO_TRACKS request data. If language is not provided; + * the default audio track for the media will be enabled. */ interface EditAudioTracksRequestData extends RequestData { /** - * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. + * Indicates that the provided language was not explicit user request; + * but rather inferred from used language in voice query. * It allows receiver apps to use user saved preference instead of spoken language. */ isSuggestedLanguage?: boolean; - /** - * - */ language?: string; } @@ -1694,7 +1824,8 @@ declare namespace cast.framework.messages { contentType?: string; /** * Optional break media url; to allow using contentId for real id. - * If contentUrl is provided; it will be used as media url; otherwise the contentId will be used as the media url. + * If contentUrl is provided; it will be used as media url; + * otherwise the contentId will be used as the media url. */ contentUrl?: string; /** @@ -1751,13 +1882,16 @@ declare namespace cast.framework.messages { /** * If true; indicates this is embedded break in main stream. */ + isEmbedded?: boolean; /** * Whether break is watched. - * Sender can change color of progress bar marker corresponding to this break once this field changes from false to true; + * Sender can change color of progress bar marker corresponding to this break once + * this field changes from false to true; * denoting that the end-user already watched this break. */ isWatched: boolean; + /** * Where the break is located inside main video. -1 represents the end of main video. */ diff --git a/types/chromecast-caf-receiver/cast.framework.system.d.ts b/types/chromecast-caf-receiver/cast.framework.system.d.ts index 92e7732f7f..d055e252fb 100644 --- a/types/chromecast-caf-receiver/cast.framework.system.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.system.d.ts @@ -5,7 +5,7 @@ declare namespace cast.framework.system { type EventType = // Fired when the system is ready. | "READY" - // Fired when the application is terminated. + // Fired when the application is terminated | "SHUTDOWN" // Fired when a new sender has connected. | "SENDER_CONNECTED" @@ -15,9 +15,19 @@ declare namespace cast.framework.system { | "ERROR" // Fired when the system volume has changed. | "SYSTEM_VOLUME_CHANGED" - // Fired when the visibility of the application has changed (for example after a HDMI Input change or when the TV is turned off/on and the cast device is externally powered). Note that this API has the same effect as the webkitvisibilitychange event raised by your document, we provided it as CastReceiverManager API for convenience and to avoid a dependency on a webkit-prefixed event. + // Fired when the visibility of the application has changed + // (for example after a HDMI Input change or when the TV is turned + // off/on and the cast device is externally powered). + // Note that this API has the same effect as the webkitvisibilitychange event raised + // by your document, we provided it as CastReceiverManager API for convenience and + // to avoid a dependency on a webkit-prefixed event. | "VISIBILITY_CHANGED" - // Fired when the standby state of the TV has changed. This event is related to the visibility chnaged event, as if the TV is in standby the visibility will be false, the visibility is more granular (as it also detects that the TV has selected a different channel) but it is not reliably detected in all TVs, standby can be used in those cases as most TVs implement it. + // Fired when the standby state of the TV has changed. + // This event is related to the visibility chnaged event, as if the TV is in standby + // the visibility will be false, the visibility is more granular + // (as it also detects that the TV has selected a different channel) + // but it is not reliably detected in all TVs, + // standby can be used in those cases as most TVs implement it. | "STANDBY_CHANGED" | "MAX_VIDEO_RESOLUTION_CHANGED" | "FEEDBACK_STARTED"; @@ -51,7 +61,7 @@ declare namespace cast.framework.system { */ interface SystemVolumeData { /** - * The level (from 0.0 to 1.0) of the system volume. + * The level (from 0.0 to 1.0) of the system volume */ level: number; @@ -77,9 +87,6 @@ declare namespace cast.framework.system { class StandbyChangedEvent { constructor(isStandby: boolean); - /** - * - */ isStandby: boolean; } /** @@ -136,7 +143,7 @@ declare namespace cast.framework.system { id: string; /** - * Indicate the sender supports large messages (>64KB). + * Indicate the sender supports large messages (>64KB) */ largeMessageSupported?: boolean; diff --git a/types/chromecast-caf-receiver/cast.framework.ui.d.ts b/types/chromecast-caf-receiver/cast.framework.ui.d.ts index b13f036be2..77d93c8082 100644 --- a/types/chromecast-caf-receiver/cast.framework.ui.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.ui.d.ts @@ -50,9 +50,6 @@ declare namespace cast.framework.ui { */ field: string; - /** - * - */ type: PlayerDataEventType; /** @@ -61,7 +58,8 @@ declare namespace cast.framework.ui { value: any; } /** - * Player data binder. Bind a player data object to the player state. The player data will be updated to reflect correctly the current player state without firing any change event. + * Player data binder. Bind a player data object to the player state. + * The player data will be updated to reflect correctly the current player state without firing any change event. */ class PlayerDataBinder { constructor(playerData: PlayerData); @@ -107,7 +105,17 @@ declare namespace cast.framework.ui { currentTime: number; /** - * Whether the player metadata (ie: title; currentTime) should be displayed. This will be true if at least one field in the metadata should be displayed. In some cases; displayStatus will be true; but parts of the metadata should be hidden (ie: the media title while media is seeking). In these cases; additional css can be applied to hide those elements. For cases where the media is audio-only; this will almost always be true. In cases where the media is video; this will be true when: (1) the video is loading; buffering; or seeking (2) a play request was made in the last five seconds while media is already playing; (3) there is a request made to show the status in the last five seconds; or (4) the media was paused in the last five seconds. + * Whether the player metadata (ie: title; currentTime) should be displayed. + * This will be true if at least one field in the metadata should be displayed. + * In some cases; displayStatus will be true; but parts of the metadata should be hidden + * (ie: the media title while media is seeking). + * In these cases; additional css can be applied to hide those elements. + * For cases where the media is audio-only; this will almost always be true. + * In cases where the media is video; this will be true when: + * (1) the video is loading; buffering; or seeking + * (2) a play request was made in the last five seconds while media is already playing; + * (3) there is a request made to show the status in the last five seconds; or + * (4) the media was paused in the last five seconds. */ displayStatus: boolean; diff --git a/types/chromecast-caf-receiver/tslint.json b/types/chromecast-caf-receiver/tslint.json index f85a173bd5..495d29983d 100644 --- a/types/chromecast-caf-receiver/tslint.json +++ b/types/chromecast-caf-receiver/tslint.json @@ -1,8 +1,5 @@ { "extends": "dtslint/dt.json", "rules": { - "no-redundant-jsdoc-2": false, - "jsdoc-format": false, - "max-line-length": false } } From f9ec668d5982ab153ef6c174ee731a39c880e47e Mon Sep 17 00:00:00 2001 From: Craig Bruce <“craigrbruce@gmail.com”> Date: Fri, 8 Jun 2018 14:25:02 +1000 Subject: [PATCH 54/62] Fix current media time type in BreaksEvent --- types/chromecast-caf-receiver/cast.framework.events.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chromecast-caf-receiver/cast.framework.events.d.ts b/types/chromecast-caf-receiver/cast.framework.events.d.ts index 0ad1bfee8c..0c69727a05 100644 --- a/types/chromecast-caf-receiver/cast.framework.events.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.events.d.ts @@ -378,7 +378,7 @@ declare namespace cast.framework.events { /** * The time in the currently playing media when the break event occurred. */ - currentMediaTime?: string; + currentMediaTime?: number; /** * The reason the break clip ended. From bc93f0695f1aeef6c0dc0a801e0a21af2fb8b411 Mon Sep 17 00:00:00 2001 From: ComFreek Date: Sat, 2 Jun 2018 18:17:19 +0200 Subject: [PATCH 55/62] libxmljs: add typings for latest version Important changes of the v0.18 version: - The previous libxmljs-tests.ts file used a require, thus made any variable from the imported 'libxmljs' typed 'any'. Hence, the test file actually tested no type declarations at all. This has been fixed via an ordinary 'import' statement. - Enabled strict null checks in tsconfig.json - Removed some exported classes (such as XMLDocument, HTMLDocument) which are neither used nor exported anymore in more recent libxmljs versions. - Added null return values to functions which sometimes return null, e.g. prevSibling(): Node|null. --- types/libxmljs/index.d.ts | 207 +++++++++++++++++++----------- types/libxmljs/libxmljs-tests.ts | 39 +++--- types/libxmljs/tsconfig.json | 2 +- types/libxmljs/tslint.json | 80 +----------- types/libxslt/index.d.ts | 56 +++----- types/libxslt/internal-types.d.ts | 11 ++ types/libxslt/libxslt-tests.ts | 4 +- types/libxslt/tsconfig.json | 1 + types/libxslt/tslint.json | 80 +----------- 9 files changed, 187 insertions(+), 293 deletions(-) create mode 100644 types/libxslt/internal-types.d.ts diff --git a/types/libxmljs/index.d.ts b/types/libxmljs/index.d.ts index ceeb1a3783..7fc9e9e2bf 100644 --- a/types/libxmljs/index.d.ts +++ b/types/libxmljs/index.d.ts @@ -1,114 +1,173 @@ -// Type definitions for Libxmljs v0.14.2 -// Project: https://github.com/polotek/libxmljs +// Type definitions for Libxmljs 0.18 +// Project: https://github.com/libxmljs/libxmljs // Definitions by: François de Campredon +// ComFreek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +import { EventEmitter } from 'events'; +export const version: string; +export const libxml_version: string; +export const libxml_parser_version: string; +// tslint:disable-next-line:strict-export-declare-modifiers +interface ParseOptions { + [optionName: string]: string; +} -import events = require('events'); +export function parseXml(source: string, options?: ParseOptions): Document; +export function parseXmlString(source: string, options?: ParseOptions): Document; -export declare function parseXml(source: string): XMLDocument; -export declare function parseHtml(source: string): HTMLDocument; -export declare function parseXmlString(source: string, options?: { [key: string]: string }): XMLDocument; -export declare function parseHtmlString(source: string): HTMLDocument; +export function parseHtml(source: string, options?: ParseOptions): Document; +export function parseHtmlString(source: string, options?: ParseOptions): Document; +export function parseHtmlFragment(source: string, options?: ParseOptions): Document; +export function memoryUsage(): number; +export function nodeCount(): number; -export declare class XMLDocument { - constructor(version: number, encoding: string); - child(idx: number): Element | undefined; +export class Document { + /** + * Create a new XML Document + * @param version XML document version, defaults to 1.0 + * @param encoding Encoding, defaults to utf8 + */ + constructor(version?: number, encoding?: string); + + errors: SyntaxError[]; + + child(idx: number): Element|null; childNodes(): Element[]; - errors(): SyntaxError[]; encoding(): string; - encoding(enc: string): void; + encoding(enc: string): this; find(xpath: string): Element[]; - get(xpath: string): Element | undefined; - node(name: string, content: string): Element; - root(): Element; - toString(): string; - validate(xsdDoc: XMLDocument): boolean; - validationErrors: XmlError[]; - version(): Number; + get(xpath: string): Element|null; + node(name: string, content?: string): Element; + root(): Element|null; + root(newRoot: Node): Node; + toString(formatted?: boolean): string; + type(): 'document'; + version(): string; + setDtd(name: string, ext: string, sys: string): void; + getDtd(): { + name: string; + externalId: string; + systemId: string; + }; } -export declare class HTMLDocument extends XMLDocument { +export class Node { + doc(): Document; + parent(): Element|Document; + /** + * The namespace or null in case of comment nodes + */ + namespace(): Namespace|null; + /** + * An array of namespaces that the object belongs to. + * + * @param local If it is true, only the namespace declarations local to this + * node are returned, rather than all of the namespaces in scope + * at this node (including the ones from the parent elements). + */ + namespaces(local?: boolean): Namespace[]; + + prevSibling(): Node|null; + nextSibling(): Node|null; + + type(): 'comment'|'element'|'text'|'attribute'; + remove(): this; + clone(): this; + /** + * Serializes the node to a string. The string will contain all contents of the node formatted as XML and can be used to print the node. + */ + toString(format?: boolean|{ + declaration: boolean; + selfCloseEmpty: boolean; + whitespace: boolean; + type: 'xml'|'html'|'xhtml' + }): string; } - -export declare class Element { - constructor(doc: XMLDocument, name: string, content?: string); +export class Element extends Node { + constructor(doc: Document, name: string, content?: string); + node(name: string, content?: string): Element; name(): string; - name(newName: string): void; + name(newName: string): this; text(): string; - attr(name: string): Attribute; - attr(attr: Attribute): void; - attr(attrObject: { [key: string]: string; }): void; + text(newText: string): this; + attr(name: string): Attribute|null; + attr(attrObject: { [key: string]: string; }): this; attrs(): Attribute[]; - parent(): Element; - doc(): XMLDocument; - child(idx: number): Element | undefined; - childNodes(): Element[]; - addChild(child: Element): Element; - nextSibling(): Element; - nextElement(): Element; - addNextSibling(siblingNode: Element): Element; - prevSibling(): Element; - prevElement(): Element; - addPrevSibling(siblingNode: Element): Element; - find(xpath: string): Element[]; - find(xpath: string, ns_uri: string): Element[]; - find(xpath: string, namespaces: { [key: string]: string; }): Element[]; - get(xpath: string): Element | undefined; - get(xpath: string, ns_uri: string): Element | undefined; - get(xpath: string, ns_uri: { [key: string]: string; }): Element | undefined; - defineNamespace(href: string): Namespace; - defineNamespace(prefix: string, href: string): Namespace; - namespace(): Namespace; - namespace(ns: Namespace): void; - namespace(href: string): void; - namespace(prefix: string, href: string): void; - remove(): void; + + doc(): Document; + child(idx: number): Node | null; + childNodes(): Node[]; + + /** + * @return The original element, not the child. + */ + addChild(child: Element): this; + + prevElement(): Element|null; + nextElement(): Element|null; + addNextSibling(siblingNode: Node): Node; + + find(xpath: string, ns_uri?: string): Node[]; + find(xpath: string, namespaces: { [key: string]: string; }): Node[]; + get(xpath: string, ns_uri?: string): Element|null; + + defineNamespace(prefixOrHref: string, hrefInCaseOfPrefix?: string): Namespace; + + namespace(): Namespace|null; + namespace(newNamespace: Namespace): this; + namespace(prefixOrHref: string, hrefInCaseOfPrefix?: string): Namespace; + + replace(replacement: string): string; + replace(replacement: Element): Element; + path(): string; - type(): string; } - -export declare class Attribute { - constructor(node: Element, name: string, value: string); - constructor(node: Element, name: string, value: string, ns: Namespace); +export class Attribute { name(): string; - namespace(): Namespace; - namespace(ns: Namespace): Namespace; - nextSibling(): Attribute; - node(): Element; - prevSibling(): Attribute; - remove(): void; value(): string; + value(newValue: string): Attribute; + namespace(): Namespace; + + remove(): void; } -export declare class Namespace { - constructor(node: Element, prefix: string, href: string); +export class Namespace { href(): string; prefix(): string; } -export declare class SaxParser extends events.EventEmitter { +export class SaxParser extends EventEmitter { + constructor(); parseString(source: string): boolean; } - -export declare class SaxPushParser extends events.EventEmitter { +export class SaxPushParser extends EventEmitter { + constructor(); push(source: string): boolean; } -export interface XmlError { - domain: number; - code: number; - message: string; - level: number; - file?: string; +export interface SyntaxError { + domain: number|null; + code: number|null; + message: string|null; + level: number|null; + file: string|null; + line: number|null; + /** + * 1-based column number, 0 if not applicable/available. + */ column: number; - line: number; + + str1: number|null; + str2: number|null; + str3: number|null; + int1: number|null; } diff --git a/types/libxmljs/libxmljs-tests.ts b/types/libxmljs/libxmljs-tests.ts index 87d634aab4..367d74c69d 100644 --- a/types/libxmljs/libxmljs-tests.ts +++ b/types/libxmljs/libxmljs-tests.ts @@ -1,7 +1,6 @@ +import * as libxmljs from 'libxmljs'; - -var libxmljs = require("libxmljs"); -var xml = '' + +const xml = '' + '' + '' + 'grandchild content' + @@ -9,40 +8,42 @@ var xml = '' + 'with content!' + ''; -var xmlDoc = libxmljs.parseXml(xml); +const xmlDoc = libxmljs.parseXml(xml); // xpath queries -var gchild = xmlDoc.get('//grandchild'); +const gchild = xmlDoc.get('//grandchild')!; console.log(gchild.text()); // prints "grandchild content" -var children = xmlDoc.root().childNodes(); -var child = children[0]; +const children = xmlDoc.root()!.childNodes(); +const child = children[0] as libxmljs.Element; -console.log(child.attr('foo').value()); // prints "bar" +console.log(child.attr('foo')!.value()); // prints "bar" -var parser = new libxmljs.SaxParser(); +const parser = new libxmljs.SaxParser(); -parser.on('startDocument', null); -parser.on('startElement', null); +parser.on('startDocument', () => 0); +parser.on('startElement', () => 0); -var parser2 = new libxmljs.SaxPushParser(); +const parser2 = new libxmljs.SaxPushParser(); // connect any callbacks here parser2 - .on('startDocument', null) - .on('startElement', null) + .on('startDocument', () => 0) + .on('startElement', () => 0); -var xmlChunk: any; +const xmlChunk = ''; -while(xmlChunk) { +while (xmlChunk) { parser2.push(xmlChunk); } -var doc = new libxmljs.Document(); - doc.node('root') +const doc = new libxmljs.Document(); + ((doc.node('root') .node('child').attr({foo: 'bar'}) .node('grandchild', 'grandchild content').attr({baz: 'fizbuzz'}) .parent() - .parent() + ) as libxmljs.Element).parent() .node('sibling', 'with content!'); + +const {name, externalId, systemId} = doc.getDtd(); diff --git a/types/libxmljs/tsconfig.json b/types/libxmljs/tsconfig.json index 7201fffe81..45835560c6 100644 --- a/types/libxmljs/tsconfig.json +++ b/types/libxmljs/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/libxmljs/tslint.json b/types/libxmljs/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/libxmljs/tslint.json +++ b/types/libxmljs/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/libxslt/index.d.ts b/types/libxslt/index.d.ts index 329525d7df..3b400d08e7 100644 --- a/types/libxslt/index.d.ts +++ b/types/libxslt/index.d.ts @@ -1,59 +1,37 @@ -// Type definitions for node-libxslt +// Type definitions for node-libxslt 0.7 // Project: https://github.com/albanm/node-libxslt // Definitions by: Alejandro Sánchez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// +// TypeScript Version: 2.2 import * as xmljs from 'libxmljs'; +import { + ApplyCallback, + ApplyResult, + ApplyStringCallback, + OutputFormat, + ParseCallback +} from './internal-types'; export const libxmljs: typeof xmljs; -type OutputFormat = 'document' | 'string'; - export interface ApplyOptions { outputFormat?: OutputFormat; noWrapParams?: boolean; } -type ApplyResult = string | xmljs.XMLDocument; - -type ApplyCallback = (err: Error, result: ApplyResult) => void; - -type ApplyStringCallback = (err: Error, result: string) => void; - -type ApplyDocumentCallback = (err: Error, result: xmljs.XMLDocument) => void; - export interface Stylesheet { - apply(source: string, params?: Object): string; - - apply(source: string, params: Object, options: ApplyOptions): ApplyResult; - - apply(source: string, params: Object, options: ApplyOptions, callback: ApplyCallback): void; - - apply(source: string, callback: ApplyStringCallback): void; - - apply(source: xmljs.XMLDocument, params?: Object): xmljs.XMLDocument; - - apply(source: xmljs.XMLDocument, params: Object, options: ApplyOptions): ApplyResult; - - apply(source: xmljs.XMLDocument, params: Object, options: ApplyOptions, callback: ApplyCallback): void; - - apply(source: xmljs.XMLDocument, callback: ApplyDocumentCallback): void; - - applyToFile(sourcePath: string, params: Object, options: ApplyOptions, callback: ApplyStringCallback): void; + apply(source: string, params?: object): string; + apply(source: string|xmljs.Document, params: object, options: ApplyOptions): ApplyResult; + apply(source: string|xmljs.Document, params: object, options: ApplyOptions, callback: ApplyCallback): void; + apply(source: string|xmljs.Document, callback: ApplyStringCallback): void; + apply(source: xmljs.Document, params?: object): xmljs.Document; + applyToFile(sourcePath: string, params: object, options: ApplyOptions, callback: ApplyStringCallback): void; applyToFile(sourcePath: string, callback: ApplyStringCallback): void; } -type ParseCallback = (err: Error, stylesheet: Stylesheet) => void; - -export function parse(source: string): Stylesheet; - -export function parse(source: string, callback: ParseCallback): void; - -export function parse(source: xmljs.XMLDocument): Stylesheet; - -export function parse(source: xmljs.XMLDocument, callback: ParseCallback): void; +export function parse(source: string|xmljs.Document): Stylesheet; +export function parse(source: string|xmljs.Document, callback: ParseCallback): void; export function parseFile(sourcePath: string, callback: ParseCallback): void; diff --git a/types/libxslt/internal-types.d.ts b/types/libxslt/internal-types.d.ts new file mode 100644 index 0000000000..a0d4041e52 --- /dev/null +++ b/types/libxslt/internal-types.d.ts @@ -0,0 +1,11 @@ +import * as xmljs from 'libxmljs'; +import { Stylesheet } from './index'; + +export type OutputFormat = 'document' | 'string'; + +export type ApplyResult = string | xmljs.Document; +export type ApplyCallback = (err: Error, result: ApplyResult) => void; +export type ApplyStringCallback = (err: Error, result: string) => void; +export type ApplyDocumentCallback = (err: Error, result: xmljs.Document) => void; + +export type ParseCallback = (err: Error, stylesheet: Stylesheet) => void; diff --git a/types/libxslt/libxslt-tests.ts b/types/libxslt/libxslt-tests.ts index bed54e5f52..1530ad0eb1 100644 --- a/types/libxslt/libxslt-tests.ts +++ b/types/libxslt/libxslt-tests.ts @@ -1,7 +1,7 @@ import * as libxslt from 'libxslt'; import * as libxmljs from 'libxmljs'; -const document: libxmljs.XMLDocument = libxslt.libxmljs.parseXmlString(''); +const document: libxmljs.Document = libxslt.libxmljs.parseXmlString(''); let stylesheet: libxslt.Stylesheet; @@ -36,7 +36,7 @@ applyOptions = { let transformedString: string; -let transformedDocument: libxmljs.XMLDocument; +let transformedDocument: libxmljs.Document; transformedString = stylesheet.apply(''); diff --git a/types/libxslt/tsconfig.json b/types/libxslt/tsconfig.json index a7f7f94ffc..00f8d27037 100644 --- a/types/libxslt/tsconfig.json +++ b/types/libxslt/tsconfig.json @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", + "internal-types.d.ts", "libxslt-tests.ts" ] } \ No newline at end of file diff --git a/types/libxslt/tslint.json b/types/libxslt/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/libxslt/tslint.json +++ b/types/libxslt/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From 16acbedbaa8530da2a054379dbb5e2e03e92f7a3 Mon Sep 17 00:00:00 2001 From: danielcollette Date: Fri, 8 Jun 2018 14:29:27 -0400 Subject: [PATCH 56/62] change to PathOptions or MarkerOptions --- types/leaflet.locatecontrol/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/leaflet.locatecontrol/index.d.ts b/types/leaflet.locatecontrol/index.d.ts index 458f7232ca..0afcd0d613 100644 --- a/types/leaflet.locatecontrol/index.d.ts +++ b/types/leaflet.locatecontrol/index.d.ts @@ -27,7 +27,7 @@ declare module 'leaflet' { drawMarker?: boolean; markerClass?: any; circleStyle?: PathOptions; - markerStyle?: any; + markerStyle?: PathOptions | MarkerOptions; followCircleStyle?: PathOptions; followMarkerStyle?: PathOptions; icon?: string; From 0f53b0059db2cf39c09d7992c34e4b2db926d6b5 Mon Sep 17 00:00:00 2001 From: Sunny Juneja Date: Fri, 8 Jun 2018 15:46:23 -0700 Subject: [PATCH 57/62] Chartist: Relax constraints on meta. --- types/chartist/chartist-tests.ts | 2 +- types/chartist/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index 53ba63497c..270e6e0970 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -247,7 +247,7 @@ new Chartist.Pie('.ct-chart', { value: 70, name: 'Series 3', className: 'my-custom-class-three', - meta: 'Meta Three' + meta: { description: 'Meta Three' } }] }); diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index a4fb2c832d..80cc589ee2 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Chartist v0.9.81 // Project: https://github.com/gionkunz/chartist-js -// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman , Anastasiia Antonova +// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman , Anastasiia Antonova , Sunny Juneja // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Chartist { @@ -101,7 +101,7 @@ declare namespace Chartist { value?: number; data?: Array; className?: string; - meta?: string; // I assume this could probably be a number as well? + meta?: any; } interface IChartistBase { From 42e514d82c6971218608e8d07519d6d537a7cc2d Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 8 Jun 2018 16:50:54 -0700 Subject: [PATCH 58/62] ember: Fix no-unnecessary-class error (#26392) --- types/ember/index.d.ts | 2 +- types/ember/tslint.json | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 91c45b94e7..56a0879ae5 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -2368,7 +2368,7 @@ declare module 'ember' { function Exception(message: string): void; class SafeString { constructor(str: string); - static toString(): string; + toString(): string; } function parse(string: string): any; function print(ast: any): void; diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 7069614893..f77f8d2ed8 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -24,8 +24,6 @@ "only-arrow-functions": false, "no-submodule-imports": false, - "no-unnecessary-class": false, - // false positives "unified-signatures": false } From ce4abcf585e1da3ce14c2f2f999a5b7a04644095 Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Sat, 9 Jun 2018 11:52:11 +0300 Subject: [PATCH 59/62] [jest] add toHaveBeenNthCalledWith matcher --- types/jest/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index af86996795..fd602b18d9 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -13,6 +13,7 @@ // Ahn // Josh Goldberg // Bradley Ayers +// Andrew Makarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -473,6 +474,11 @@ declare namespace jest { * to test what arguments it was last called with. */ toHaveBeenLastCalledWith(...params: any[]): R; + /** + * If you have a mock function, you can use `.toHaveBeenNthCalledWith` + * to test what arguments it was nth called with. + */ + toHaveBeenNthCalledWith(nthCall: number, ...params: any[]): R; /** * Used to check that an object has a `.length` property * and it is set to a certain numeric value. From e1a31cd5494b0c3adc58aa096d547ba4cd3eb7f6 Mon Sep 17 00:00:00 2001 From: LinChen Date: Sat, 9 Jun 2018 21:24:20 +0800 Subject: [PATCH 60/62] [chen] make webAuth support social login Auth0.js support social login by using webAuth.authorize({ connection: 'twitter' }); https://auth0.com/docs/libraries/auth0js/v9 but @types/react-native-auth0 stop us to pass it in, so add "connnection" as a legal parameter --- types/react-native-auth0/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-native-auth0/index.d.ts b/types/react-native-auth0/index.d.ts index 1291baeafd..b6a4e769e8 100644 --- a/types/react-native-auth0/index.d.ts +++ b/types/react-native-auth0/index.d.ts @@ -137,6 +137,7 @@ export interface AuthorizeParams { nonce?: string; audience?: string; scope?: string; + connection?: string; } export interface ClearSessionParams { From 028d2422e95393529d5b14ba3acb328870c07f4a Mon Sep 17 00:00:00 2001 From: Shane Fitzpatrick Date: Sat, 9 Jun 2018 08:21:28 -0700 Subject: [PATCH 61/62] Adding a test --- types/react-native/test/index.tsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index b3487057ed..1f506eb124 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -49,8 +49,10 @@ import { NativeModules, MaskedViewIOS, TextInput, + TextInputFocusEventData, InputAccessoryView, - StatusBar + StatusBar, + NativeSyntheticEvent } from "react-native"; declare module "react-native" { @@ -447,6 +449,25 @@ class TextInputRefTest extends React.Component<{}, {username: string}> { } } +class TextInputFocusBlurEventTest extends React.Component { + handleOnBlur(e: NativeSyntheticEvent) { + } + + handleOnFocus(e: NativeSyntheticEvent) { + } + + render() { + return ( + + ) => this.handleOnBlur(e)} + onFocus={(e: NativeSyntheticEvent) => this.handleOnFocus(e)} + /> + + ) + } +} + class StatusBarTest extends React.Component { render() { StatusBar.setBarStyle("dark-content", true); From 4aafc97af0cb7b52353648aafbddb1af80d3715b Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Mon, 11 Jun 2018 10:43:01 +0300 Subject: [PATCH 62/62] =?UTF-8?q?[jest]=20Added=20tests=20for=20=E2=80=9Ct?= =?UTF-8?q?oHaveBeenNthCalledWith=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/jest/jest-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index a90a7a9e5a..09e9ecef99 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -731,3 +731,9 @@ test('moduleName 2', () => { const moduleName = require('../moduleName'); expect(moduleName()).toEqual(2); }); + +describe('toHaveBeenNthCalledWith', () => { + const fn = jest.fn(); + + expect(fn).toHaveBeenNthCalledWith(3, "foo"); +});