diff --git a/notNeededPackages.json b/notNeededPackages.json index eb46f0f99bd9ec..05d2932fb73c9b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -728,6 +728,10 @@ "libraryName": "chokidar", "asOfVersion": "2.1.3" }, + "chordsheetjs": { + "libraryName": "chordsheetjs", + "asOfVersion": "6.2.0" + }, "chunked-dc": { "libraryName": "chunked-dc", "asOfVersion": "0.2.2" @@ -1561,6 +1565,14 @@ "libraryName": "dexie", "asOfVersion": "1.3.1" }, + "dhis2__ui-constants": { + "libraryName": "@dhis2/ui-constants", + "asOfVersion": "9.0.0" + }, + "dhis2__ui-icons": { + "libraryName": "@dhis2/ui-icons", + "asOfVersion": "9.0.0" + }, "dialog-polyfill": { "libraryName": "dialog-polyfill", "asOfVersion": "0.5.2" @@ -1573,6 +1585,10 @@ "libraryName": "dice-coefficient", "asOfVersion": "2.0.0" }, + "diff": { + "libraryName": "diff", + "asOfVersion": "8.0.0" + }, "diff2html": { "libraryName": "diff2html", "asOfVersion": "3.0.0" @@ -4509,6 +4525,10 @@ "libraryName": "node-pg-migrate", "asOfVersion": "2.15.0" }, + "node-powershell": { + "libraryName": "node-powershell", + "asOfVersion": "5.0.0" + }, "node-resque": { "libraryName": "node-resque", "asOfVersion": "6.0.1" @@ -4701,6 +4721,10 @@ "libraryName": "otplib", "asOfVersion": "10.0.0" }, + "overlayscrollbars": { + "libraryName": "overlayscrollbars", + "asOfVersion": "2.0.0" + }, "overwatch-api": { "libraryName": "overwatch-api", "asOfVersion": "0.7.1" @@ -5611,6 +5635,10 @@ "libraryName": "react-axe", "asOfVersion": "3.5.0" }, + "react-bootstrap": { + "libraryName": "react-bootstrap", + "asOfVersion": "1.1.0" + }, "react-bootstrap-daterangepicker": { "libraryName": "react-bootstrap-daterangepicker", "asOfVersion": "7.0.0" diff --git a/types/chordsheetjs/chordsheetjs-tests.ts b/types/chordsheetjs/chordsheetjs-tests.ts deleted file mode 100644 index a61971459ec07b..00000000000000 --- a/types/chordsheetjs/chordsheetjs-tests.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { HtmlTableFormatter, Song } from "chordsheetjs"; - -const song = new Song({ key: "value" }); -const formatter = new HtmlTableFormatter(); -formatter.format(song); diff --git a/types/chordsheetjs/index.d.ts b/types/chordsheetjs/index.d.ts deleted file mode 100644 index eabb3185f06681..00000000000000 --- a/types/chordsheetjs/index.d.ts +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Represents a chord with the corresponding (partial) lyrics - */ -export class ChordLyricsPair { - /** - * Initialises a ChordLyricsPair - * @param chords The chords - * @param lyrics The lyrics - */ - constructor(chords: string, lyrics: string); - - chords: string; - lyrics: string; - - /** - * Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets) - */ - isRenderable: () => boolean; - - /** - * Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song - */ - clone: () => ChordLyricsPair; - - toString: () => string; -} - -/** - * Represents a tag/directive. See https://www.chordpro.org/chordpro/ChordPro-Directives.html - */ -export class Tag { - constructor(name: string, value: string | null); - - /** - * The tag full name. When the original tag used the short name, `name` will return the full name. - */ - name: string; - - /** - * The tag value - */ - value: string | null; - - static parse(tag: string): Tag | null; - static parseWithRegex(tag: string, regex: string): Tag | null; - - /** - * The original tag name that was used to construct the tag. - */ - originalName: string; - - /** - * Checks whether the tag value is a non-empty string. - */ - hasValue(): boolean; - - /** - * Checks whether the tag is usually rendered inline. It currently only applies to comment tags. - */ - isRenderable(): boolean; - - /** - * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`) - */ - isMetaTag(): boolean; - - /** - * Returns a clone of the tag. - */ - clone(): Tag; - - toString(): string; -} - -/** - * Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag - */ -export class Line { - constructor(); - - /** - * The items (ChordLyricsPair or Tag) of which the line consists - */ - items: Array; - - /** - * The line type, This is set by the ChordProParser when it read tags like {start_of_chorus} or {start_of_verse} - * Values can be 'verse', 'chorus' or 'none' - */ - type: "verse" | "chorus" | "none"; - - /** - * Indicates whether the line contains any items - */ - isEmpty(): boolean; - - /** - * Adds an item to the line - * @param item The item to be added - */ - addItem(item: ChordLyricsPair | Tag): void; - - /** - * Indicates whether the line contains items that are renderable - */ - hasRenderableItems(): boolean; - - /** - * Returns a deep copy of the line and all of its items - */ - clone(): Line; - - /** - * Indicates whether the line type is 'verse' - */ - isVerse(): boolean; - - /** - * Indicates whether the line type is 'chorus' - */ - isChorus(): boolean; - - /** - * Indicates whether the line contains items that are renderable. Please use hasRenderableItems - * @deprecated - */ - hasContent(): boolean; - - addChordLyricsPair( - chords: ChordLyricsPair | string, - lyrics: string, - ): ChordLyricsPair; - ensureChordLyricsPair(): void; - chords(chr: string): void; - lyrics(chr: string): void; - addTag(name: Tag | string, value: string | null): Tag; -} - -/** - * Represents a paragraph of lines in a chord sheet - */ -export class Paragraph { - constructor(); - - /** - * The Line items of which the paragraph consists - */ - lines: Line[]; - - addLine(line: Line): void; - - /** - * Tries to determine the common type for all lines. If the types for all lines are equal, it returns that type. - * If not, it returns 'indeterminate'. - */ - type: string; -} - -/** - * Represents a song in a chord sheet. Currently a chord sheet can only have one song. - */ -export class Song { - constructor(metadata: object); - - /** - * The Line items of which the song consists - */ - lines: Line[]; - - /** - * The Paragraph items of which the song consists - */ - paragraphs: Paragraph[]; - - currentLine: Line; - currentParagraph: Paragraph; - assignMetaData(metadata: object): void; - - /** - * Returns the song lines, skipping the leading empty lines (empty as in not rendering any content). This is useful - * if you want to skip the "header lines": the lines that only contain meta data. - */ - bodyLines: Line[]; - - chords(chr: string): void; - lyrics(chr: string): void; - addLine(): Line; - setCurrentLineType(type: string): void; - flushLine(): void; - finish(): void; - addChordLyricsPair(): ChordLyricsPair; - ensureLine(): void; - addParagraph(): Paragraph; - ensureParagraph(): void; - addTag(tagContents: string): Tag; - - /** - * Returns a deep clone of the song - */ - clone(): Song; - - setMetaData(name: string, value: string): void; - metaData: object; - optimizedMetaData: object; - getOptimizedMetaData(): object; - optimizeMetaDataValue( - valueSet: string[] | undefined, - ): string | string[] | null; - getMetaData(name: string): string | null; -} - -/** - * Represents a parser warning, currently only used by ChordProParser. - */ -export class ParserWarning { - /** - * The warning message - */ - message: string; - - /** - * The line number on which the warning occurred - */ - lineNumber: string; - - toString(): string; -} - -/** - * Parses a ChordPro chord sheet - */ -export class ChordProParser { - /** - * Parses a ChordPro chord sheet into a song - * @param chordProChordSheet The ChordPro chord sheet - */ - parse(chordProChordSheet: string): Song; - - song: Song; - lineNumber: number; - sectionType: string; - warnings: ParserWarning[]; - - parseDocument(document: string): void; - readLyrics(chr: string): void; - readChords(chr: string): void; - readTag(chr: string): void; - readComment(chr: string): void; - finishTag(): void; - resetTag(): void; - applyTag(tag: Tag): void; - startSection(sectionType: string, tag: Tag): void; - endSection(sectionType: string, tag: Tag): void; - checkCurrentSectionType(sectionType: string, tag: Tag): void; - addWarning(message: string): void; -} - -export interface ChordSheetParserProps { - preserveWhitespace: boolean; -} - -/** - * Formats a song into a plain text chord sheet - */ -export class ChordSheetParser { - constructor(props: ChordSheetParserProps); - - song: Song; - lines: Line[]; - songLine: Line; - chordLyricsPair: ChordLyricsPair; - currentLine: number; - lineCount: number; - processingText: string; - preserveWhitespace: boolean; - - /** - * Parses a chord sheet into a song - * @param chordSheet The ChordPro chord sheet - */ - parse(chordSheet: string): Song; - - parseLine(line: string): void; - parseNonEmptyLine(line: string): void; - initialize(document: string): void; - readLine(): Line; - hasNextLine(): boolean; - parseLyricsWithChords(chordsLine: string, lyricsLine: string): void; - processCharacters(chordsLine: string, lyricsLine: string): void; - addCharacter(chr: string, nextChar: string): void; - shouldAddCharacterToChords(nextChar: string): boolean; - ensureChordLyricsPairInitialized(): void; -} - -export interface SongHeader { - title: string; - subtitle: string; -} - -export class TextFormatter { - constructor(); - /** - * Formats a song into a plain text chord sheet - * @param song The song to be formatted - */ - format(song: Song): string; - formatHeader(header: SongHeader): string; - formatParagraphs(song: Song): string; - formatParagraph(paragraph: Paragraph): string; - formatLine(line: Line): string; - formatTitle(title: string): string; - formatSubtitle(subtitle: string): string; - formatTopLine(line: Line): string | null; - chordLyricsPairLength(chordLyricsPair: ChordLyricsPair): number; - formatItemTop(item: Tag | ChordLyricsPair | Line): string; - formatLineBottom(line: Line): string; - formatLineWithFormatter( - line: Line, - formatter: (x: string) => string, - ): string; - formatItemBottom(item: Tag | ChordLyricsPair | Line): string; -} - -/** - * Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like - * PDF conversion. - */ -export class HtmlTableFormatter { - constructor(); - /** - * Formats a song into HTML. - * @param song The song to be formatted - */ - format(song: Song): string; -} - -/** - * Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages. - */ -export class HtmlDivFormatter { - constructor(); - /** - * Formats a song into HTML. - * @param song The song to be formatted - */ - format(song: Song): string; -} - -/** - * Formats a song into a ChordPro chord sheet - */ -export class ChordProFormatter { - constructor(); - /** - * Formats a song into a ChordPro chord sheet. - * @param song The song to be formatted - */ - format(song: Song): string; - - formatLine(line: Line): string; - formatItem(item: Tag | ChordLyricsPair | Line): string; - formatTag(tag: Tag): string; - formatChordLyricsPair(chordLyricsPair: ChordLyricsPair): string; - formatChordLyricsPairChords(chordLyricsPair: ChordLyricsPair): string; - formatChordLyricsPairLyrics(chordLyricsPair: ChordLyricsPair): string; -} diff --git a/types/chordsheetjs/package.json b/types/chordsheetjs/package.json deleted file mode 100644 index 7b467422daba1b..00000000000000 --- a/types/chordsheetjs/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/chordsheetjs", - "version": "2.8.9999", - "projects": [ - "https://github.com/martijnversluis/ChordSheetJS" - ], - "devDependencies": { - "@types/chordsheetjs": "workspace:." - }, - "owners": [ - { - "name": "Adam Bloom", - "githubUsername": "adamsbloom" - } - ] -} diff --git a/types/chordsheetjs/tsconfig.json b/types/chordsheetjs/tsconfig.json deleted file mode 100644 index f24ea3bcae8ba2..00000000000000 --- a/types/chordsheetjs/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "chordsheetjs-tests.ts" - ] -} diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 89a9c435ac92dd..e8d8deedb2581d 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -2,6 +2,9 @@ /// /// +// Helpers +type SetRequired = Omit & Required>; + //////////////////// // Global object //////////////////// @@ -7019,181 +7022,177 @@ declare namespace chrome { * Permissions: "notifications" */ export namespace notifications { - export type TemplateType = "basic" | "image" | "list" | "progress"; - - export interface ButtonOptions { + export interface NotificationButton { + /** @deprecated since Chrome 59. Button icons not visible for Mac OS X users. */ + iconUrl?: string; title: string; - iconUrl?: string | undefined; } - export interface ItemOptions { - /** Title of one item of a list notification. */ - title: string; + export interface NotificationItem { /** Additional details about this item. */ message: string; + /** Title of one item of a list notification. */ + title: string; } - export type NotificationOptions = - & { - /** - * Optional. - * Alternate notification content with a lower-weight font. - * @since Chrome 31 - */ - contextMessage?: string | undefined; - /** Optional. Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. */ - priority?: number | undefined; - /** Optional. A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n). */ - eventTime?: number | undefined; - /** Optional. Text and icons for up to two notification action buttons. */ - buttons?: ButtonOptions[] | undefined; - /** Optional. Items for multi-item notifications. */ - items?: ItemOptions[] | undefined; - /** - * Optional. - * Current progress ranges from 0 to 100. - * @since Chrome 30 - */ - progress?: number | undefined; - /** - * Optional. - * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification. - * @since Chrome 32 - */ - isClickable?: boolean | undefined; - /** - * Optional. - * A URL to the app icon mask. URLs have the same restrictions as iconUrl. The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered. - * @since Chrome 38 - */ - appIconMaskUrl?: string | undefined; - /** Optional. A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl. */ - imageUrl?: string | undefined; - /** - * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. - * This defaults to false. - * @since Chrome 50 - */ - requireInteraction?: boolean | undefined; - /** - * Optional. - * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false. - * @since Chrome 70 - */ - silent?: boolean | undefined; - } - & (T extends true ? { - /** - * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. - * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method. - */ - iconUrl: string; - /** Main notification content. Required for notifications.create method. */ - message: string; - /** Which type of notification to display. Required for notifications.create method. */ - type: TemplateType; - /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */ - title: string; - } - : { - /** - * Optional. - * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. - * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method. - */ - iconUrl?: string | undefined; - /** Optional. Main notification content. Required for notifications.create method. */ - message?: string | undefined; - /** Optional. Which type of notification to display. Required for notifications.create method. */ - type?: TemplateType | undefined; - /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */ - title?: string | undefined; - }); - - export interface NotificationClosedEvent - extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> - {} - - export interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {} + export interface NotificationOptions { + /** + * A URL to the app icon mask. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}. + * + * The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered. + * @deprecated since Chrome 59. The app icon mask is not visible for Mac OS X users. + */ + appIconMaskUrl?: string; + /** Text and icons for up to two notification action buttons. */ + buttons?: NotificationButton[]; + /** Alternate notification content with a lower-weight font. */ + contextMessage?: string; + /** A timestamp associated with the notification, in milliseconds past the epoch (e.g. `Date.now() + n`). */ + eventTime?: number; + /** + * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. + * + * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file + * + * **Note:** This value is required for the {@link notifications.create}() method. + */ + iconUrl?: string; + /** + * A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as {@link notifications.NotificationOptions.iconUrl iconUrl}. + * @deprecated since Chrome 59. The image is not visible for Mac OS X users. + */ + imageUrl?: string; + /** @deprecated since Chrome 67. This UI hint is ignored as of Chrome 67 */ + isClickable?: boolean; + /** Items for multi-item notifications. Users on Mac OS X only see the first item. */ + items?: NotificationItem[]; + /** + * Main notification content. + * + * **Note:** This value is required for the {@link notifications.create}() method. + */ + message?: string; + /** Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. On platforms that don't support a notification center (Windows, Linux & Mac), -2 and -1 result in an error as notifications with those priorities will not be shown at all. */ + priority?: number; + /** Current progress ranges from 0 to 100. */ + progress?: number; + /** + * Indicates that the notification should remain visible on screen until the user activates or dismisses the notification. This defaults to false. + * @since Chrome 50 + */ + requireInteraction?: boolean; + /** + * Indicates that no sounds or vibrations should be made when the notification is being shown. This defaults to false. + * @since Chrome 70 + */ + silent?: boolean; + /** + * Title of the notification (e.g. sender name for email). + * + * **Note:** This value is required for the {@link notifications.create}() method. + */ + title?: string; + /** Which type of notification to display. + * + * **Note:** This value is required for the {@link notifications.create}() method. + */ + type?: `${TemplateType}`; + } - export interface NotificationButtonClickedEvent - extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void> - {} + type NotificationCreateOptions = SetRequired; - export interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {} + export enum PermissionLevel { + /** Specifies that the user has elected to show notifications from the app or extension. This is the default at install time. */ + GRANTED = "granted", + /** Specifies that the user has elected not to show notifications from the app or extension. */ + DENIED = "denied", + } - export interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {} + export enum TemplateType { + /** Contains an icon, title, message, expandedMessage, and up to two buttons. */ + BASIC = "basic", + /** Contains an icon, title, message, expandedMessage, image, and up to two buttons. */ + IMAGE = "image", + /** Contains an icon, title, message, items, and up to two buttons. Users on Mac OS X only see the first item. */ + LIST = "list", + /** Contains an icon, title, message, progress, and up to two buttons. */ + PROGRESS = "progress", + } - /** The notification closed, either by the system or by user action. */ - export var onClosed: NotificationClosedEvent; - /** The user clicked in a non-button area of the notification. */ - export var onClicked: NotificationClickedEvent; - /** The user pressed a button in the notification. */ - export var onButtonClicked: NotificationButtonClickedEvent; - /** - * The user changes the permission level. - * @since Chrome 32 - */ - export var onPermissionLevelChanged: NotificationPermissionLevelChangedEvent; /** - * The user clicked on a link for the app's notification settings. - * @since Chrome 32 + * Clears the specified notification. + * @param notificationId The id of the notification to be cleared. This is returned by {@link notifications.create} method. + * + * Can return its result via Promise since Chrome 116 */ - export var onShowSettings: NotificationShowSettingsEvent; + export function clear(notificationId: string): Promise; + export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void; /** * Creates and displays a notification. - * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. - * The notificationId parameter is required before Chrome 42. + * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. The identifier may not be longer than 500 characters. + * + * The `notificationId` parameter is required before Chrome 42. * @param options Contents of the notification. - * @param callback Returns the notification id (either supplied or generated) that represents the created notification. - * The callback is required before Chrome 42. + * + * Can return its result via Promise since Chrome 116 */ + export function create(notificationId: string, options: NotificationCreateOptions): Promise; + export function create(options: NotificationCreateOptions): Promise; export function create( notificationId: string, - options: NotificationOptions, - callback?: (notificationId: string) => void, + options: NotificationCreateOptions, + callback: (notificationId: string) => void, ): void; + export function create(options: NotificationCreateOptions, callback: (notificationId: string) => void): void; + /** - * Creates and displays a notification. - * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. - * The notificationId parameter is required before Chrome 42. - * @param options Contents of the notification. - * @param callback Returns the notification id (either supplied or generated) that represents the created notification. - * The callback is required before Chrome 42. + * Retrieves all the notifications of this app or extension. + * + * Can return its result via Promise since Chrome 116 + */ + export function getAll(): Promise<{ [key: string]: true }>; + export function getAll(callback: (notifications: { [key: string]: true }) => void): void; + + /** + * Retrieves whether the user has enabled notifications from this app or extension. + * + * Can return its result via Promise since Chrome 116 */ - export function create(options: NotificationOptions, callback?: (notificationId: string) => void): void; + export function getPermissionLevel(): Promise<`${PermissionLevel}`>; + export function getPermissionLevel(callback: (level: `${PermissionLevel}`) => void): void; + /** * Updates an existing notification. - * @param notificationId The id of the notification to be updated. This is returned by notifications.create method. + * @param notificationId The id of the notification to be updated. This is returned by {@link notifications.create} method. * @param options Contents of the notification to update to. - * @param callback Called to indicate whether a matching notification existed. - * The callback is required before Chrome 42. + * + * Can return its result via Promise since Chrome 116 */ + export function update(notificationId: string, options: NotificationOptions): Promise; export function update( notificationId: string, options: NotificationOptions, - callback?: (wasUpdated: boolean) => void, + callback: (wasUpdated: boolean) => void, ): void; + + /** The user pressed a button in the notification. */ + export const onButtonClicked: events.Event<(notificationId: string, buttonIndex: number) => void>; + + /** The user clicked in a non-button area of the notification. */ + export const onClicked: events.Event<(notificationId: string) => void>; + + /** The notification closed, either by the system or by user action. */ + export const onClosed: events.Event<(notificationId: string, byUser: boolean) => void>; + + /** The user changes the permission level. As of Chrome 47, only ChromeOS has UI that dispatches this event. */ + export const onPermissionLevelChanged: events.Event<(level: `${PermissionLevel}`) => void>; + /** - * Clears the specified notification. - * @param notificationId The id of the notification to be cleared. This is returned by notifications.create method. - * @param callback Called to indicate whether a matching notification existed. - * The callback is required before Chrome 42. - */ - export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void; - /** - * Retrieves all the notifications. - * @since Chrome 29 - * @param callback Returns the set of notification_ids currently in the system. - */ - export function getAll(callback: (notifications: { [key: string]: true }) => void): void; - /** - * Retrieves whether the user has enabled notifications from this app or extension. - * @since Chrome 32 - * @param callback Returns the current permission level. + * The user clicked on a link for the app's notification settings. As of Chrome 47, only ChromeOS has UI that dispatches this event. As of Chrome 65, that UI has been removed from ChromeOS, too. + * @deprecated since Chrome 65. Custom notification settings button is no longer supported. */ - export function getPermissionLevel(callback: (level: string) => void): void; + export const onShowSettings: events.Event<() => void>; } //////////////////// diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index b2f38ab3874302..8ce20db0ca0d99 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -320,20 +320,116 @@ function proxySettings() { chrome.proxy.settings.onChange.hasListeners(); // $ExpectType boolean } -function testNotificationCreation() { - // @ts-expect-error - chrome.notifications.create("id", {}); +// https://developer.chrome.com/docs/extensions/reference/api/notifications +function testNotification() { + chrome.notifications.PermissionLevel.DENIED === "denied"; + chrome.notifications.PermissionLevel.GRANTED === "granted"; + + chrome.notifications.TemplateType.BASIC === "basic"; + chrome.notifications.TemplateType.IMAGE === "image"; + chrome.notifications.TemplateType.LIST === "list"; + chrome.notifications.TemplateType.PROGRESS === "progress"; + + const notificationId = "2199ce04-c5ca-4651-a8a9-5f4afd4c5a05"; + + chrome.notifications.clear(notificationId); // $ExpectType Promise + chrome.notifications.clear(notificationId, (wasCleared) => { // $ExpectType void + wasCleared; // $ExpectType boolean + }); // @ts-expect-error - chrome.notifications.create("id", { message: "", type: "", title: "" }); + chrome.notifications.clear(notificationId, () => {}).then(() => {}); + + const notificationCreateOptions: chrome.notifications.NotificationCreateOptions = { + title: "Title", + message: "Message", + iconUrl: "https://fakeimg.pl/300", + type: "basic", + }; + + chrome.notifications.create(notificationId, notificationCreateOptions); // $ExpectType Promise + chrome.notifications.create(notificationId, notificationCreateOptions, (notificationId) => { // $ExpectType void + notificationId; // $ExpectType string + }); + // @ts-expect-error Some of the required properties are missing: type, iconUrl, title and message. + chrome.notifications.create(notificationId, {}); // @ts-expect-error - chrome.notifications.create("id", { iconUrl: "", type: "", title: "" }); + chrome.notifications.create(notificationId, notificationCreateOptions, () => {}).then(() => {}); + + chrome.notifications.getAll(); // $ExpectType Promise<{ [key: string]: true }> + chrome.notifications.getAll((notifications) => { // $ExpectType void + notifications; // $ExpectType { [key: string]: true } + }); // @ts-expect-error - chrome.notifications.create("id", { iconUrl: "", message: "", title: "" }); + chrome.notifications.getAll(() => {}).then(() => {}); + + chrome.notifications.getPermissionLevel(); // $ExpectType Promise<"denied" | "granted"> + chrome.notifications.getPermissionLevel((permissionLevel) => { // $ExpectType void + permissionLevel; // $ExpectType "denied" | "granted" + }); // @ts-expect-error - chrome.notifications.create("id", { iconUrl: "", message: "", type: "" }); + chrome.notifications.getPermissionLevel(() => {}).then(() => {}); + + chrome.notifications.onButtonClicked.addListener((notificationId, buttonIndex) => { // $ExpectType void + notificationId; // $ExpectType string + buttonIndex; // $ExpectType number + }); + chrome.notifications.onButtonClicked.removeListener((notificationId, buttonIndex) => { // $ExpectType void + notificationId; // $ExpectType string + buttonIndex; // $ExpectType number + }); + chrome.notifications.onButtonClicked.hasListener((notificationId, buttonIndex) => { // $ExpectType boolean + notificationId; // $ExpectType string + buttonIndex; // $ExpectType number + }); + chrome.notifications.onButtonClicked.hasListeners(); // $ExpectType boolean + + chrome.notifications.onClicked.addListener((notificationId) => { // $ExpectType void + notificationId; // $ExpectType string + }); + chrome.notifications.onClicked.removeListener((notificationId) => { // $ExpectType void + notificationId; // $ExpectType string + }); + chrome.notifications.onClicked.hasListener((notificationId) => { // $ExpectType boolean + notificationId; // $ExpectType string + }); + chrome.notifications.onClicked.hasListeners(); // $ExpectType boolean + + chrome.notifications.onClosed.addListener((notificationId, byUser) => { // $ExpectType void + notificationId; // $ExpectType string + byUser; // $ExpectType boolean + }); + chrome.notifications.onClosed.removeListener((notificationId, byUser) => { // $ExpectType void + notificationId; // $ExpectType string + byUser; // $ExpectType boolean + }); + chrome.notifications.onClosed.hasListener((notificationId, byUser) => { // $ExpectType boolean + notificationId; // $ExpectType string + byUser; // $ExpectType boolean + }); + chrome.notifications.onClosed.hasListeners(); // $ExpectType boolean + + chrome.notifications.onPermissionLevelChanged.addListener((permissionLevel) => { // $ExpectType void + permissionLevel; // $ExpectType "denied" | "granted" + }); + chrome.notifications.onPermissionLevelChanged.removeListener((permissionLevel) => { // $ExpectType void + permissionLevel; // $ExpectType "denied" | "granted" + }); + chrome.notifications.onPermissionLevelChanged.hasListener((permissionLevel) => { // $ExpectType boolean + permissionLevel; // $ExpectType "denied" | "granted" + }); + chrome.notifications.onPermissionLevelChanged.hasListeners(); // $ExpectType boolean + + chrome.notifications.onShowSettings.addListener(() => {}); // $ExpectType void + chrome.notifications.onShowSettings.removeListener(() => {}); // $ExpectType void + chrome.notifications.onShowSettings.hasListener(() => {}); // $ExpectType boolean + chrome.notifications.onShowSettings.hasListeners(); // $ExpectType boolean + + chrome.notifications.update(notificationId, {}); // $ExpectType Promise + chrome.notifications.update(notificationId, {}, (wasUpdated) => { // $ExpectType void + wasUpdated; // $ExpectType boolean + }); // @ts-expect-error - chrome.notifications.create("id", { iconUrl: "", message: "", type: "", title: "" }); - chrome.notifications.create("id", { iconUrl: "", message: "", type: "basic", title: "" }); + chrome.notifications.update(notificationId, {}, () => {}).then(() => {}); } // https://developer.chrome.com/docs/extensions/reference/api/contentSettings diff --git a/types/clover-format/.eslintrc.json b/types/clover-format/.eslintrc.json new file mode 100644 index 00000000000000..4c387a7c50e573 --- /dev/null +++ b/types/clover-format/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "@definitelytyped/no-type-only-packages": "off" + } +} diff --git a/types/chordsheetjs/.npmignore b/types/clover-format/.npmignore similarity index 100% rename from types/chordsheetjs/.npmignore rename to types/clover-format/.npmignore diff --git a/types/clover-format/index.d.ts b/types/clover-format/index.d.ts new file mode 100644 index 00000000000000..0882bee25fb678 --- /dev/null +++ b/types/clover-format/index.d.ts @@ -0,0 +1,149 @@ +/** Metrics information for projects/packages/files/classes. */ +export interface ClassMetrics { + /** the cyclomatic complexity */ + complexity?: number; + /** the number of contained conditionals (2 * number of branches) */ + conditionals: number; + /** the number of contained conditionals (2 * number of branches) with coverage */ + coveredconditionals: number; + /** the number of contained statements, conditionals and methods */ + elements: number; + /** the number of contained statements, conditionals and methods with coverage */ + coveredelements: number; + /** the number of contained statements */ + statements: number; + /** the number of contained statements with coverage */ + coveredstatements: number; + /** the number of contained methods */ + methods: number; + /** the number of contained methods with coverage */ + coveredmethods: number; + /** the total duration of all contained test methods */ + testduration?: number; + /** the total number of test method failures */ + testfailures?: number; + /** the total number of test method passes */ + testpasses?: number; + /** the total number of test methods run */ + testruns?: number; +} + +/** Metrics information for projects/packages/files. */ +export interface FileMetrics extends ClassMetrics { + classes?: number; + /** the total number of lines of code */ + loc?: number; + /** the total number of non-comment lines of code */ + ncloc?: number; +} + +/** Metrics information for projects/packages. */ +export interface PackageMetrics extends FileMetrics { + /** the total number of contained files */ + files?: number; +} + +/** Metrics information for projects. */ +export interface ProjectMetrics extends PackageMetrics { + /** the total number of packages */ + files?: number; +} + +/** Metrics information for projects/packages/files/classes. */ +export type Metrics = + | ClassMetrics + | FileMetrics + | PackageMetrics + | ProjectMetrics; + +/** + * Top-most element describing the coverage report. + * Contains a project and a test project. + */ +export interface Coverage { + /** version number */ + clover: string; + /** seconds since UTC Epoch */ + generated: number; +} + +/** Project metrics relating to test source. */ +export interface Project { + /** project name (optional) */ + name?: string; + /** seconds since UTC */ + timestamp: number; +} + +export interface Package { + /** the.package.name */ + name: string; +} + +export interface File { + /** the file name e.g. Foo.java or Bar.groovy */ + name: string; + /** the filesystem-specific original path to the file e.g. c:\path\to\Bar.groovy */ + path: string; +} + +export interface Class { + /** the unqualified class name */ + name: string; +} + +/** Line-specific information. */ +export interface Method { + /** the line number */ + num: number; + /** the type of syntactic construct */ + type: "method"; + /** the cyclomatic complexity of the construct */ + complexity?: number; + /** the number of times the construct was executed */ + count?: number; + /** the signature of the method */ + signature?: string; + /** only applicable if the method was identified as a test method; the duration of the test */ + testduration?: number; + /** only applicable if the method was identified as a test method; true if the test passed, false otherwise */ + testsuccess?: boolean; + /** visibility */ + visibility?: "private" | "protected" | "package" | "public"; +} + +/** Line-specific information. */ +export interface Statement { + /** the line number */ + num: number; + /** the type of syntactic construct */ + type: "stmt"; + /** the number of times the construct was executed */ + count?: number; +} + +/** Line-specific information. */ +export interface Condition { + /** the line number */ + num: number; + /** the type of syntactic construct */ + type: "cond"; + /** the number of times the true branch was executed */ + truecount?: number; + /** the number of times the false branch was executed */ + falsecount?: number; +} + +/** Line-specific information. */ +export type Line = Method | Statement | Condition; + +export interface Elements { + coverage: Coverage; + project: Project; + testproject: Project; + metrics: Metrics; + package: Package; + file: File; + class: Class; + line: Line; +} diff --git a/types/clover-format/package.json b/types/clover-format/package.json new file mode 100644 index 00000000000000..2bd5aa71bd4c8a --- /dev/null +++ b/types/clover-format/package.json @@ -0,0 +1,19 @@ +{ + "private": true, + "name": "@types/clover-format", + "version": "1.0.9999", + "nonNpm": true, + "nonNpmDescription": "clover file format", + "projects": [ + "https://bitbucket.org/atlassian/clover/src/master/etc/schema/clover.xsd" + ], + "devDependencies": { + "@types/clover-format": "workspace:." + }, + "owners": [ + { + "name": "Kyℓe Hensel", + "githubUsername": "k-yle" + } + ] +} diff --git a/types/clover-format/test/clover-format-tests.ts b/types/clover-format/test/clover-format-tests.ts new file mode 100644 index 00000000000000..fca66f4ec17019 --- /dev/null +++ b/types/clover-format/test/clover-format-tests.ts @@ -0,0 +1,25 @@ +import type * as Clover from "clover-format"; + +const coverage: Clover.Coverage = { + generated: Date.now(), + clover: "3.2.0", +}; + +const project: Clover.Project = { + timestamp: Date.now(), + name: "All files", +}; + +const metrics: Clover.Metrics = { + statements: 5, + coveredstatements: 1, + conditionals: 3, + coveredconditionals: 3, + methods: 6, + coveredmethods: 6, + elements: 123, + coveredelements: 119, + complexity: 0, + loc: 1, + ncloc: 1, +}; diff --git a/types/node-powershell/tsconfig.json b/types/clover-format/tsconfig.json similarity index 90% rename from types/node-powershell/tsconfig.json rename to types/clover-format/tsconfig.json index 4e09e611fc8c24..edb8e7ce387eea 100644 --- a/types/node-powershell/tsconfig.json +++ b/types/clover-format/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "node-powershell-tests.ts" + "test/clover-format-tests.ts" ] } diff --git a/types/dhis2__ui-constants/dhis2__ui-constants-tests.ts b/types/dhis2__ui-constants/dhis2__ui-constants-tests.ts deleted file mode 100644 index 26dffd645c847b..00000000000000 --- a/types/dhis2__ui-constants/dhis2__ui-constants-tests.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { colors, elevations, layer, theme } from "@dhis2/ui-constants"; - -colors.blue050; -colors.blue100; -colors.blue200; -colors.blue300; -colors.blue400; -colors.blue500; -colors.blue600; -colors.blue700; -colors.blue800; -colors.blue900; - -elevations.e100; -elevations.e200; -elevations.e300; -elevations.e400; - -layer.alert; -layer.applicationTop; -layer.blocking; - -theme.default; -theme.error; -theme.valid; -theme.warning; -theme.disabled; -theme.focus; -theme.fonts; diff --git a/types/dhis2__ui-constants/index.d.ts b/types/dhis2__ui-constants/index.d.ts deleted file mode 100644 index 0982ea621bc35f..00000000000000 --- a/types/dhis2__ui-constants/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -// https://github.com/dhis2/ui/blob/master/constants/src/colors.js -export type ColorBase = "blue" | "teal" | "red" | "yellow" | "green" | "grey"; -export type ColorVariant = "900" | "800" | "700" | "600" | "500" | "400" | "300" | "200" | "100" | "050"; -export type ColorProp = `${ColorBase}${ColorVariant}` | "white"; -export const colors: Record; - -// https://github.com/dhis2/ui/blob/master/constants/src/elevations.js -export type ElevantionVariant = "e100" | "e200" | "e300" | "e400"; -export const elevations: Record; - -// https://github.com/dhis2/ui/blob/master/constants/src/theme.js -export type ThemeBase = "primary" | "secondary"; -export type ThemeVariant = "900" | "800" | "700" | "600" | "500" | "400" | "300" | "200" | "100" | "050"; -export type ThemeProp = - | `${ThemeBase}${ThemeVariant}` - | "default" - | "error" - | "valid" - | "warning" - | "disabled" - | "focus" - | "fonts"; -export const theme: Record; - -// https://github.com/dhis2/ui/blob/master/constants/src/spacers.js -export type SpacerVariant = - | "dp4" - | "dp8" - | "dp12" - | "dp16" - | "dp24" - | "dp32" - | "dp48" - | "dp64" - | "dp96" - | "dp128" - | "dp192" - | "dp256" - | "dp384" - | "dp512" - | "dp640"; -export const spacersNum: Record; -export const spacers: Record; - -// https://github.com/dhis2/ui/blob/master/constants/src/layers.js -export type LayerVariant = "applicationTop" | "blocking" | "alert"; -export const layer: Record; diff --git a/types/dhis2__ui-constants/package.json b/types/dhis2__ui-constants/package.json deleted file mode 100644 index 78ab29670b577e..00000000000000 --- a/types/dhis2__ui-constants/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/dhis2__ui-constants", - "version": "7.8.9999", - "projects": [ - "https://github.com/dhis2/ui/tree/master/constants" - ], - "devDependencies": { - "@types/dhis2__ui-constants": "workspace:." - }, - "owners": [ - { - "name": "Alexis Rico", - "githubUsername": "SferaDev" - } - ] -} diff --git a/types/dhis2__ui-icons/.npmignore b/types/dhis2__ui-icons/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/dhis2__ui-icons/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/dhis2__ui-icons/dhis2__ui-icons-tests.tsx b/types/dhis2__ui-icons/dhis2__ui-icons-tests.tsx deleted file mode 100644 index bf5c85b91cc8e7..00000000000000 --- a/types/dhis2__ui-icons/dhis2__ui-icons-tests.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { IconAdd16 } from "@dhis2/ui-icons"; -import * as React from "react"; - -const icon = ; -const iconWithColor = ; -// @ts-expect-error -const iconWithInvalidProp = ; diff --git a/types/dhis2__ui-icons/index.d.ts b/types/dhis2__ui-icons/index.d.ts deleted file mode 100644 index a0d0e338fcc30b..00000000000000 --- a/types/dhis2__ui-icons/index.d.ts +++ /dev/null @@ -1,261 +0,0 @@ -import * as React from "react"; - -// https://github.com/dhis2/ui/blob/master/icons/templates/icon-template.js -export interface IconProps { - color?: string; -} - -// https://github.com/dhis2/ui/tree/master/icons/src/svg -export const IconAdd16: React.FC; -export const IconAdd24: React.FC; -export const IconAddCircle16: React.FC; -export const IconAddCircle24: React.FC; -export const IconApps16: React.FC; -export const IconApps24: React.FC; -export const IconArchive16: React.FC; -export const IconArchive24: React.FC; -export const IconArrowDown16: React.FC; -export const IconArrowDown24: React.FC; -export const IconArrowLeft16: React.FC; -export const IconArrowLeft24: React.FC; -export const IconArrowLeftMulti16: React.FC; -export const IconArrowLeftMulti24: React.FC; -export const IconArrowRight16: React.FC; -export const IconArrowRight24: React.FC; -export const IconArrowRightMulti16: React.FC; -export const IconArrowRightMulti24: React.FC; -export const IconArrowUp16: React.FC; -export const IconArrowUp24: React.FC; -export const IconAt16: React.FC; -export const IconAt24: React.FC; -export const IconAttachment16: React.FC; -export const IconAttachment24: React.FC; -export const IconBlock16: React.FC; -export const IconBlock24: React.FC; -export const IconCalendar16: React.FC; -export const IconCalendar24: React.FC; -export const IconCheckmark12: React.FC; -export const IconCheckmark16: React.FC; -export const IconCheckmark24: React.FC; -export const IconCheckmarkCircle16: React.FC; -export const IconCheckmarkCircle24: React.FC; -export const IconChevronDown16: React.FC; -export const IconChevronDown24: React.FC; -export const IconChevronLeft16: React.FC; -export const IconChevronLeft24: React.FC; -export const IconChevronRight16: React.FC; -export const IconChevronRight24: React.FC; -export const IconChevronUp16: React.FC; -export const IconChevronUp24: React.FC; -export const IconClock16: React.FC; -export const IconClock24: React.FC; -export const IconClockHistory16: React.FC; -export const IconClockHistory24: React.FC; -export const IconColor16: React.FC; -export const IconColor24: React.FC; -export const IconCopy16: React.FC; -export const IconCopy24: React.FC; -export const IconCross16: React.FC; -export const IconCross24: React.FC; -export const IconDashboardWindow16: React.FC; -export const IconDashboardWindow24: React.FC; -export const IconDataInteger16: React.FC; -export const IconDataInteger24: React.FC; -export const IconDataString16: React.FC; -export const IconDataString24: React.FC; -export const IconDelete16: React.FC; -export const IconDelete24: React.FC; -export const IconDimensionCategoryOptionGroupset16: React.FC; -export const IconDimensionData16: React.FC; -export const IconDimensionDataElementGroupset16: React.FC; -export const IconDimensionDataSet16: React.FC; -export const IconDimensionEventDataItem16: React.FC; -export const IconDimensionIndicator16: React.FC; -export const IconDimensionOrgUnit16: React.FC; -export const IconDimensionOrgUnitGroupset16: React.FC; -export const IconDimensionProgramIndicator16: React.FC; -export const IconDimensionValidationRule16: React.FC; -export const IconDirectionNorth16: React.FC; -export const IconDirectionNorth24: React.FC; -export const IconDownload16: React.FC; -export const IconDownload24: React.FC; -export const IconDragHandle16: React.FC; -export const IconDragHandle24: React.FC; -export const IconDuplicate16: React.FC; -export const IconDuplicate24: React.FC; -export const IconEdit16: React.FC; -export const IconEdit24: React.FC; -export const IconEditItems16: React.FC; -export const IconEditItems24: React.FC; -export const IconEmptyFrame16: React.FC; -export const IconEmptyFrame24: React.FC; -export const IconError16: React.FC; -export const IconError24: React.FC; -export const IconErrorFilled16: React.FC; -export const IconErrorFilled24: React.FC; -export const IconExportItems24: React.FC; -export const IconFaceAdd16: React.FC; -export const IconFaceAdd24: React.FC; -export const IconFile16: React.FC; -export const IconFile24: React.FC; -export const IconFileDocument16: React.FC; -export const IconFileDocument24: React.FC; -export const IconFilter16: React.FC; -export const IconFilter24: React.FC; -export const IconFlag16: React.FC; -export const IconFlag24: React.FC; -export const IconFolder16: React.FC; -export const IconFolder24: React.FC; -export const IconFolderOpen16: React.FC; -export const IconFolderOpen24: React.FC; -export const IconFullscreen16: React.FC; -export const IconFullscreen24: React.FC; -export const IconFullscreenExit16: React.FC; -export const IconFullscreenExit24: React.FC; -export const IconHome16: React.FC; -export const IconHome24: React.FC; -export const IconImage16: React.FC; -export const IconImage24: React.FC; -export const IconImportItems24: React.FC; -export const IconInfo16: React.FC; -export const IconInfo24: React.FC; -export const IconInfoFilled16: React.FC; -export const IconInfoFilled24: React.FC; -export const IconLaunch16: React.FC; -export const IconLaunch24: React.FC; -export const IconLayoutColumns16: React.FC; -export const IconLayoutColumns24: React.FC; -export const IconLayoutRows16: React.FC; -export const IconLayoutRows24: React.FC; -export const IconLegend16: React.FC; -export const IconLegend24: React.FC; -export const IconLink16: React.FC; -export const IconLink24: React.FC; -export const IconList16: React.FC; -export const IconList24: React.FC; -export const IconLocation16: React.FC; -export const IconLocation24: React.FC; -export const IconLock16: React.FC; -export const IconLock24: React.FC; -export const IconLockOpen16: React.FC; -export const IconLockOpen24: React.FC; -export const IconLogOut16: React.FC; -export const IconLogOut24: React.FC; -export const IconMail16: React.FC; -export const IconMail24: React.FC; -export const IconMailOpen16: React.FC; -export const IconMailOpen24: React.FC; -export const IconMessages16: React.FC; -export const IconMessages24: React.FC; -export const IconMore16: React.FC; -export const IconMore24: React.FC; -export const IconMove16: React.FC; -export const IconMove24: React.FC; -export const IconPushLeft16: React.FC; -export const IconPushLeft24: React.FC; -export const IconPushRight16: React.FC; -export const IconPushRight24: React.FC; -export const IconQuestion16: React.FC; -export const IconQuestion24: React.FC; -export const IconQuestionFilled16: React.FC; -export const IconQuestionFilled24: React.FC; -export const IconQueue16: React.FC; -export const IconQueue24: React.FC; -export const IconRedo16: React.FC; -export const IconRedo24: React.FC; -export const IconReorder16: React.FC; -export const IconReorder24: React.FC; -export const IconReply16: React.FC; -export const IconReply24: React.FC; -export const IconRuler16: React.FC; -export const IconRuler24: React.FC; -export const IconSave16: React.FC; -export const IconSave24: React.FC; -export const IconSearch16: React.FC; -export const IconSearch24: React.FC; -export const IconSettings16: React.FC; -export const IconSettings24: React.FC; -export const IconShare16: React.FC; -export const IconShare24: React.FC; -export const IconStar16: React.FC; -export const IconStar24: React.FC; -export const IconStarFilled16: React.FC; -export const IconStarFilled24: React.FC; -export const IconSubscribe16: React.FC; -export const IconSubscribe24: React.FC; -export const IconSubscribeOff16: React.FC; -export const IconSubscribeOff24: React.FC; -export const IconSubtractCircle16: React.FC; -export const IconSubtractCircle24: React.FC; -export const IconSync16: React.FC; -export const IconSync24: React.FC; -export const IconTable16: React.FC; -export const IconTable24: React.FC; -export const IconTerminalWindow16: React.FC; -export const IconTerminalWindow24: React.FC; -export const IconTextBold16: React.FC; -export const IconTextBold24: React.FC; -export const IconTextBox16: React.FC; -export const IconTextBox24: React.FC; -export const IconTextHeading16: React.FC; -export const IconTextHeading24: React.FC; -export const IconTextItalic16: React.FC; -export const IconTextItalic24: React.FC; -export const IconTextListOrdered16: React.FC; -export const IconTextListOrdered24: React.FC; -export const IconTextListUnordered16: React.FC; -export const IconTextListUnordered24: React.FC; -export const IconThumbDown16: React.FC; -export const IconThumbDown24: React.FC; -export const IconThumbUp16: React.FC; -export const IconThumbUp24: React.FC; -export const IconTranslate16: React.FC; -export const IconTranslate24: React.FC; -export const IconUndo16: React.FC; -export const IconUndo24: React.FC; -export const IconUpload16: React.FC; -export const IconUpload24: React.FC; -export const IconUser16: React.FC; -export const IconUser24: React.FC; -export const IconUserGroup16: React.FC; -export const IconUserGroup24: React.FC; -export const IconView16: React.FC; -export const IconView24: React.FC; -export const IconViewOff16: React.FC; -export const IconViewOff24: React.FC; -export const IconVisualizationArea16: React.FC; -export const IconVisualizationArea24: React.FC; -export const IconVisualizationAreaStacked16: React.FC; -export const IconVisualizationAreaStacked24: React.FC; -export const IconVisualizationBar16: React.FC; -export const IconVisualizationBar24: React.FC; -export const IconVisualizationBarStacked16: React.FC; -export const IconVisualizationBarStacked24: React.FC; -export const IconVisualizationColumn16: React.FC; -export const IconVisualizationColumn24: React.FC; -export const IconVisualizationColumnMulti16: React.FC; -export const IconVisualizationColumnMulti24: React.FC; -export const IconVisualizationColumnStacked16: React.FC; -export const IconVisualizationColumnStacked24: React.FC; -export const IconVisualizationGauge16: React.FC; -export const IconVisualizationGauge24: React.FC; -export const IconVisualizationLine16: React.FC; -export const IconVisualizationLine24: React.FC; -export const IconVisualizationLineMulti16: React.FC; -export const IconVisualizationLineMulti24: React.FC; -export const IconVisualizationPie16: React.FC; -export const IconVisualizationPie24: React.FC; -export const IconVisualizationRadar16: React.FC; -export const IconVisualizationRadar24: React.FC; -export const IconVisualizationScatter16: React.FC; -export const IconVisualizationScatter24: React.FC; -export const IconVisualizationSingleValue16: React.FC; -export const IconVisualizationSingleValue24: React.FC; -export const IconWarning16: React.FC; -export const IconWarning24: React.FC; -export const IconWarningFilled16: React.FC; -export const IconWarningFilled24: React.FC; -export const IconWindow16: React.FC; -export const IconWindow24: React.FC; -export const IconWorld16: React.FC; -export const IconWorld24: React.FC; diff --git a/types/dhis2__ui-icons/package.json b/types/dhis2__ui-icons/package.json deleted file mode 100644 index a9928629cb4419..00000000000000 --- a/types/dhis2__ui-icons/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/dhis2__ui-icons", - "version": "7.8.9999", - "projects": [ - "https://github.com/dhis2/ui/tree/master/icons" - ], - "minimumTypeScriptVersion": "5.1", - "dependencies": { - "@types/react": "*" - }, - "devDependencies": { - "@types/dhis2__ui-icons": "workspace:." - }, - "owners": [ - { - "name": "Alexis Rico", - "githubUsername": "SferaDev" - } - ] -} diff --git a/types/dhis2__ui-icons/tsconfig.json b/types/dhis2__ui-icons/tsconfig.json deleted file mode 100644 index 679f28d752fe3c..00000000000000 --- a/types/dhis2__ui-icons/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "DOM" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "jsx": "react-jsx", - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "dhis2__ui-icons-tests.tsx" - ] -} diff --git a/types/diff/.eslintrc.json b/types/diff/.eslintrc.json deleted file mode 100644 index 79ee5b5a1a5836..00000000000000 --- a/types/diff/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@definitelytyped/no-single-element-tuple-type": "off" - } -} diff --git a/types/diff/.npmignore b/types/diff/.npmignore deleted file mode 100644 index 54c4a06d9989eb..00000000000000 --- a/types/diff/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts -/v3/ diff --git a/types/diff/diff-tests.mts b/types/diff/diff-tests.mts deleted file mode 100644 index c29780d96d2f28..00000000000000 --- a/types/diff/diff-tests.mts +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-expect-error -import ThereIsNoDefaultExport, { Diff } from "diff"; - -new Diff(); diff --git a/types/diff/diff-tests.ts b/types/diff/diff-tests.ts deleted file mode 100644 index 256967f4f6acb0..00000000000000 --- a/types/diff/diff-tests.ts +++ /dev/null @@ -1,178 +0,0 @@ -import Diff = require("diff"); - -const one = "beep boop"; -const other = "beep boob blah"; - -let changes = Diff.diffChars(one, other); -examineChanges(changes); - -// $ExpectType void -Diff.diffChars(one, other, { - callback: (value) => { - value; // $ExpectType Change[] - }, -}); -// $ExpectType void -Diff.diffChars(one, other, (value) => { - value; // $ExpectType Change[] -}); -Diff.diffWords("吾輩は猫である。名前はまだ無い。", "吾輩は猫である。名前はたぬき。", { - intlSegmenter: new Intl.Segmenter("ja-JP", { granularity: "word" }), -}); -// $ExpectType Change[] -Diff.diffLines( - "line\nold value\nline", - "line\nnew value\nline", - { - stripTrailingCr: true, - ignoreNewlineAtEof: true, - maxEditLength: 1, - oneChangePerToken: true, - }, -); -// $ExpectType void -Diff.createPatch("filename", "A", "a", undefined, undefined, { - callback: (value) => { - value; // $ExpectType string - }, -}); - -const diffArraysResult = Diff.diffArrays(["a", "b", "c"], ["a", "c", "d"]); -diffArraysResult.forEach(result => { - result.added; // $ExpectType boolean | undefined - result.removed; // $ExpectType boolean | undefined - result.value; // $ExpectType string[] - result.count; // $ExpectType number | undefined -}); - -interface DiffObj { - value: number; -} -const a: DiffObj = { value: 0 }; -const b: DiffObj = { value: 1 }; -const c: DiffObj = { value: 2 }; -const d: DiffObj = { value: 3 }; -const arrayOptions: Diff.ArrayOptions = { - comparator: (left, right) => { - return left.value === right.value; - }, -}; -const arrayChanges = Diff.diffArrays([a, b, c], [a, b, d], arrayOptions); -arrayChanges.forEach(result => { - result.added; // $ExpectType boolean | undefined - result.removed; // $ExpectType boolean | undefined - result.value; // $ExpectType DiffObj[] - result.count; // $ExpectType number | undefined -}); - -// -------------------------- - -class LineDiffWithoutWhitespace extends Diff.Diff { - tokenize(value: string): any { - return value.split(/^/m); - } - - equals(left: string, right: string): boolean { - return left.trim() === right.trim(); - } -} - -const obj = new LineDiffWithoutWhitespace(); -changes = obj.diff(one, other); -examineChanges(changes); - -function examineChanges(diff: Diff.Change[]) { - diff.forEach(part => { - part.added; // $ExpectType boolean - part.removed; // $ExpectType boolean - part.value; // $ExpectType string - part.count; // $ExpectType number | undefined - }); -} - -function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: Diff.ParsedDiff) { - const verifyPatch = Diff.parsePatch( - Diff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr, "old", "new", { - context: 1, - stripTrailingCr: true, - }), - ); - - if ( - JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) - !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort()) - ) { - throw new Error("Patch did not match uniDiff"); - } -} -function verifyApplyMethods(oldStr: string, newStr: string, uniDiffStr: string) { - const uniDiff = Diff.parsePatch(uniDiffStr)[0]; - const verifyApply = [Diff.applyPatch(oldStr, uniDiff), Diff.applyPatch(oldStr, [uniDiff])]; - const options: Diff.ApplyPatchesOptions = { - loadFile(index, callback) { - index; // $ExpectType ParsedDiff - callback(undefined, one); - }, - patched(index, content) { - index; // $ExpectType ParsedDiff - if (content !== false) { - verifyApply.push(content); - } - }, - complete(err) { - if (err) { - throw err; - } - - verifyApply.forEach(result => { - if (result !== newStr) { - throw new Error("Result did not match newStr"); - } - }); - }, - compareLine(_, line, operator, patchContent) { - if (operator === " ") { - return true; - } - return line === patchContent; - }, - fuzzFactor: 0, - }; - Diff.applyPatches([uniDiff], options); - Diff.applyPatches(uniDiffStr, options); -} - -const uniDiffPatch = Diff.structuredPatch("oldFile.ts", "newFile.ts", one, other, "old", "new", { - context: 1, -}); -verifyPatchMethods(one, other, uniDiffPatch); - -const formatted: string = Diff.formatPatch(uniDiffPatch); - -const uniDiffStr = Diff.createPatch("file.ts", one, other, "old", "new", { context: 1 }); -verifyApplyMethods(one, other, uniDiffStr); - -const file1 = "line1\nline2\nline3\nline4\n"; -const file2 = "line1\nline2\nline5\nline4\n"; -const patch = Diff.structuredPatch("file1", "file2", file1, file2); -// $ExpectType ParsedDiff -const reversedPatch = Diff.reversePatch(patch); -// $ExpectType ParsedDiff[] -const verifyPatch = Diff.parsePatch( - Diff.createTwoFilesPatch("oldFile.ts", "newFile.ts", "old content", "new content", "old", "new", { - context: 1, - }), -); - -const wordDiff = new Diff.Diff(); -wordDiff.equals = function(left, right, options) { - if (options.ignoreWhitespace) { - if (!options.newlineIsToken || !left.includes("\n")) { - left = left.trim(); - } - if (!options.newlineIsToken || !right.includes("\n")) { - right = right.trim(); - } - } - return Diff.Diff.prototype.equals.call(this, left, right, options); -}; diff --git a/types/diff/index.d.mts b/types/diff/index.d.mts deleted file mode 100644 index 8e893de15df158..00000000000000 --- a/types/diff/index.d.mts +++ /dev/null @@ -1 +0,0 @@ -export * from "./index.js"; diff --git a/types/diff/index.d.ts b/types/diff/index.d.ts deleted file mode 100644 index f44b69be39aec4..00000000000000 --- a/types/diff/index.d.ts +++ /dev/null @@ -1,470 +0,0 @@ -export as namespace Diff; - -export type Callback = (value: T) => void; - -export interface CallbackOptions { - /** - * if provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated. The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument. - */ - callback: Callback; -} - -export interface BaseOptions { - /** - * `true` to ignore casing difference. - * @default false - */ - ignoreCase?: boolean | undefined; - - /** - * a number specifying the maximum edit distance to consider between the old and new texts. If the edit distance is higher than this, jsdiff will return `undefined` instead of a diff. You can use this to limit the computational cost of diffing large, very different texts by giving up early if the cost will be huge. Works for functions that return change objects and also for `structuredPatch`, but not other patch-generation functions. - */ - maxEditLength?: number | undefined; - - /** - * if `true`, the array of change objects returned will contain one change object per token (e.g. one per line if calling `diffLines`), instead of runs of consecutive tokens that are all added / all removed / all conserved being combined into a single change object. - */ - oneChangePerToken?: boolean | undefined; -} - -export interface WordsOptions extends BaseOptions { - /** - * `true` to ignore leading and trailing whitespace. This is the same as `diffWords()`. - */ - ignoreWhitespace?: boolean | undefined; - - /** - * An optional [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter) object (which must have a `granularity` of `'word'`) for `diffWords` to use to split the text into words. - * - * By default, `diffWords` does not use an `Intl.Segmenter`, just some regexes for splitting text into words. This will tend to give worse results than `Intl.Segmenter` would, but ensures the results are consistent across environments; `Intl.Segmenter` behaviour is only loosely specced and the implementations in browsers could in principle change dramatically in future. If you want to use `diffWords` with an `Intl.Segmenter` but ensure it behaves the same whatever environment you run it in, use an `Intl.Segmenter` polyfill instead of the JavaScript engine's native `Intl.Segmenter` implementation. - * - * Using an `Intl.Segmenter` should allow better word-level diffing of non-English text than the default behaviour. For instance, `Intl.Segmenter`s can generally identify via built-in dictionaries which sequences of adjacent Chinese characters form words, allowing word-level diffing of Chinese. By specifying a language when instantiating the segmenter (e.g. `new Intl.Segmenter('sv', {granularity: 'word'})`) you can also support language-specific rules, like treating Swedish's colon separated contractions (like *k:a* for *kyrka*) as single words; by default this would be seen as two words separated by a colon. - */ - intlSegmenter?: Intl.Segmenter | undefined; -} - -export interface LinesOptions extends BaseOptions { - /** - * `true` to ignore a missing newline character at the end of the last line when comparing it to other lines. (By default, the line `'b\n'` in text `'a\nb\nc'` is not considered equal to the line `'b'` in text `'a\nb'`; this option makes them be considered equal.) Ignored if `ignoreWhitespace` or `newlineIsToken` are also true. - */ - ignoreNewlineAtEof?: boolean | undefined; - - /** - * `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines()`. - */ - ignoreWhitespace?: boolean | undefined; - - /** - * `true` to treat newline characters as separate tokens. This allows for changes to the newline structure - * to occur independently of the line content and to be treated as such. In general this is the more - * human friendly form of `diffLines()` and `diffLines()` is better suited for patches and other computer - * friendly output. - */ - newlineIsToken?: boolean | undefined; - - /** - * `true` to remove all trailing CR (`\r`) characters before performing the diff. Defaults to false. This helps to get a useful diff when diffing UNIX text files against Windows text files. - */ - stripTrailingCr?: boolean | undefined; -} - -export interface JsonOptions extends LinesOptions { - /** - * Replacer used to stringify the properties of the passed objects. - */ - stringifyReplacer?: ((key: string, value: any) => any) | undefined; - - /** - * The value to use when `undefined` values in the passed objects are encountered during stringification. - * Will only be used if `stringifyReplacer` option wasn't specified. - * @default undefined - */ - undefinedReplacement?: any; -} - -export interface ArrayOptions extends BaseOptions { - /** - * Comparator for custom equality checks. - */ - comparator?: ((left: TLeft, right: TRight) => boolean) | undefined; -} - -export interface PatchOptions extends LinesOptions { - /** - * Describes how many lines of context should be included. - * @default 4 - */ - context?: number | undefined; -} - -export interface ApplyPatchOptions { - /** - * If `true`, and if the file to be patched consistently uses different line endings to the patch (i.e. either the file always uses Unix line endings while the patch uses Windows ones, or vice versa), then `applyPatch` will behave as if the line endings in the patch were the same as those in the source file. (If `false`, the patch will usually fail to apply in such circumstances since lines deleted in the patch won't be considered to match those in the source file.) Defaults to `true`. - */ - autoConvertLineEndings?: boolean | undefined; - - /** - * Number of lines that are allowed to differ before rejecting a patch. - * @default 0 - */ - fuzzFactor?: number | undefined; - - /** - * Callback used to compare to given lines to determine if they should be considered equal when patching. - * Should return `false` if the lines should be rejected. - * - * @default strict equality - */ - compareLine?: - | (( - lineNumber: number, - line: string, - operation: "-" | " ", - patchContent: string, - ) => boolean) - | undefined; -} - -export interface ApplyPatchesOptions extends ApplyPatchOptions { - loadFile(index: ParsedDiff, callback: (err: any, data: string) => void): void; - patched(index: ParsedDiff, content: string | false, callback: (err: any) => void): void; - complete(err: any): void; -} - -export interface Change { - count?: number | undefined; - /** - * Text content. - */ - value: string; - /** - * true if the value was inserted into the new string, otherwise false - */ - added: boolean; - /** - * true if the value was removed from the old string, otherwise false - */ - removed: boolean; -} - -export interface ArrayChange { - value: T[]; - count?: number | undefined; - added?: boolean | undefined; - removed?: boolean | undefined; -} - -export interface ParsedDiff { - index?: string | undefined; - oldFileName?: string | undefined; - newFileName?: string | undefined; - oldHeader?: string | undefined; - newHeader?: string | undefined; - hunks: Hunk[]; -} - -export interface Hunk { - oldStart: number; - oldLines: number; - newStart: number; - newLines: number; - lines: string[]; -} - -export interface BestPath { - newPos: number; - components: Change[]; -} - -export class Diff { - diff( - oldString: string, - newString: string, - options?: Callback | (ArrayOptions & Partial>), - ): Change[]; - - pushComponent(components: Change[], added: boolean, removed: boolean): void; - - extractCommon( - basePath: BestPath, - newString: string, - oldString: string, - diagonalPath: number, - ): number; - - equals(left: any, right: any, options: any): boolean; - - removeEmpty(array: any[]): any[]; - - castInput(value: any, options: any): any; - - join(tokens: string[]): string; - - tokenize(value: string, options: any): any; // return types are string or string[] - - postProcess(changes: Change[], options: any): Change[]; -} - -/** - * Diffs two blocks of text, comparing character by character. - * - * @returns A list of change objects. - */ -export function diffChars(oldStr: string, newStr: string, options?: BaseOptions): Change[]; -export function diffChars( - oldStr: string, - newStr: string, - options: Callback | (BaseOptions & CallbackOptions), -): void; - -/** - * Diffs two blocks of text, comparing word by word, ignoring whitespace. - * - * @returns A list of change objects. - */ -export function diffWords(oldStr: string, newStr: string, options?: WordsOptions): Change[]; -export function diffWords( - oldStr: string, - newStr: string, - options: Callback | (WordsOptions & CallbackOptions), -): void; - -/** - * Diffs two blocks of text, comparing word by word, treating whitespace as significant. - * - * @returns A list of change objects. - */ -export function diffWordsWithSpace( - oldStr: string, - newStr: string, - options?: WordsOptions, -): Change[]; -export function diffWordsWithSpace( - oldStr: string, - newStr: string, - options: Callback | (WordsOptions & CallbackOptions), -): void; - -/** - * Diffs two blocks of text, comparing line by line. - * - * @returns A list of change objects. - */ -export function diffLines(oldStr: string, newStr: string, options?: LinesOptions): Change[]; -export function diffLines( - oldStr: string, - newStr: string, - options: Callback | (LinesOptions & CallbackOptions), -): void; - -/** - * Diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace. - * - * @returns A list of change objects. - */ -export function diffTrimmedLines(oldStr: string, newStr: string, options?: LinesOptions): Change[]; -export function diffTrimmedLines( - oldStr: string, - newStr: string, - options: Callback | (LinesOptions & CallbackOptions), -): void; - -/** - * Diffs two blocks of text, comparing sentence by sentence. - * - * @returns A list of change objects. - */ -export function diffSentences(oldStr: string, newStr: string, options?: BaseOptions): Change[]; -export function diffSentences( - oldStr: string, - newStr: string, - options: Callback | (BaseOptions & CallbackOptions), -): void; - -/** - * Diffs two blocks of text, comparing CSS tokens. - * - * @returns A list of change objects. - */ -export function diffCss(oldStr: string, newStr: string, options?: BaseOptions): Change[]; -export function diffCss( - oldStr: string, - newStr: string, - options: Callback | (BaseOptions & CallbackOptions), -): void; - -/** - * Diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter - * in this comparison. - * - * @returns A list of change objects. - */ -export function diffJson( - oldObj: string | object, - newObj: string | object, - options?: JsonOptions, -): Change[]; -export function diffJson( - oldObj: string | object, - newObj: string | object, - options: Callback | (JsonOptions & CallbackOptions), -): void; - -/** - * Diffs two arrays, comparing each item for strict equality (`===`). - * - * @returns A list of change objects. - */ -export function diffArrays( - oldArr: TOld[], - newArr: TNew[], - options?: ArrayOptions, -): Array>; - -/** - * Creates a unified diff patch. - * - * @param oldFileName String to be output in the filename section of the patch for the removals. - * @param newFileName String to be output in the filename section of the patch for the additions. - * @param oldStr Original string value. - * @param newStr New string value. - * @param oldHeader Additional information to include in the old file header. - * @param newHeader Additional information to include in the new file header. - */ -export function createTwoFilesPatch( - oldFileName: string, - newFileName: string, - oldStr: string, - newStr: string, - oldHeader?: string, - newHeader?: string, - options?: PatchOptions, -): string; -export function createTwoFilesPatch( - oldFileName: string, - newFileName: string, - oldStr: string, - newStr: string, - oldHeader?: string, - newHeader?: string, - options?: PatchOptions & CallbackOptions, -): void; - -/** - * Creates a unified diff patch. - * Just like `createTwoFilesPatch()`, but with `oldFileName` being equal to `newFileName`. - * - * @param fileName String to be output in the filename section. - * @param oldStr Original string value. - * @param newStr New string value. - * @param oldHeader Additional information to include in the old file header. - * @param newHeader Additional information to include in the new file header. - */ -export function createPatch( - fileName: string, - oldStr: string, - newStr: string, - oldHeader?: string, - newHeader?: string, - options?: PatchOptions, -): string; -export function createPatch( - fileName: string, - oldStr: string, - newStr: string, - oldHeader?: string, - newHeader?: string, - options?: PatchOptions & CallbackOptions, -): void; - -/** - * This method is similar to `createTwoFilesPatch()`, but returns a data structure suitable for further processing. - * Parameters are the same as `createTwoFilesPatch()`. - * - * @param oldFileName String to be output in the `oldFileName` hunk property. - * @param newFileName String to be output in the `newFileName` hunk property. - * @param oldStr Original string value. - * @param newStr New string value. - * @param oldHeader Additional information to include in the `oldHeader` hunk property. - * @param newHeader Additional information to include in the `newHeader` hunk property. - * @returns An object with an array of hunk objects. - */ -export function structuredPatch( - oldFileName: string, - newFileName: string, - oldStr: string, - newStr: string, - oldHeader?: string, - newHeader?: string, - options?: PatchOptions, -): ParsedDiff; -export function structuredPatch( - oldFileName: string, - newFileName: string, - oldStr: string, - newStr: string, - oldHeader?: string, - newHeader?: string, - options?: PatchOptions & CallbackOptions, -): void; - -/** - * Applies a unified diff patch. - * - * @param patch May be a string diff or the output from the `parsePatch()` or `structuredPatch()` methods. - * @returns A string containing new version of provided data. false when failed - */ -export function applyPatch( - source: string, - patch: string | ParsedDiff | [ParsedDiff], - options?: ApplyPatchOptions, -): string | false; - -/** - * Applies one or more patches. - * This method will iterate over the contents of the patch and apply to data provided through callbacks. - * - * The general flow for each patch index is: - * - * 1. `options.loadFile(index, callback)` is called. The caller should then load the contents of the file - * and then pass that to the `callback(err, data)` callback. Passing an `err` will terminate further patch execution. - * 2. `options.patched(index, content, callback)` is called once the patch has been applied. `content` will be - * the return value from `applyPatch()`. When it's ready, the caller should call `callback(err)` callback. - * Passing an `err` will terminate further patch execution. - * 3. Once all patches have been applied or an error occurs, the `options.complete(err)` callback is made. - */ -export function applyPatches(patch: string | ParsedDiff[], options: ApplyPatchesOptions): void; - -/** - * Parses a patch into structured data. - * - * @returns A JSON object representation of the a patch, suitable for use with the `applyPatch()` method. - */ -export function parsePatch(uniDiff: string): ParsedDiff[]; - -/** - * Converts a list of changes to a serialized XML format. - */ -export function convertChangesToXML(changes: Change[]): string; - -/** - * Converts a list of changes to [DMP](http://code.google.com/p/google-diff-match-patch/wiki/API) format. - */ -export function convertChangesToDMP(changes: Change[]): Array<[1 | 0 | -1, string]>; - -export function merge(mine: string, theirs: string, base: string): ParsedDiff; - -/** - * Returns a new structured patch which when applied will undo the original `patch`. - * `patch` may be either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`). - */ -export function reversePatch(patch: ParsedDiff | ParsedDiff[]): ParsedDiff; - -export function canonicalize(obj: any, stack: any[], replacementStack: any[]): any; - -/** - * creates a unified diff patch. - * patch may be either a single structured patch object (as returned by structuredPatch) - * or an array of them (as returned by parsePatch). - */ -export function formatPatch(patch: ParsedDiff | ParsedDiff[]): string; diff --git a/types/diff/package.json b/types/diff/package.json deleted file mode 100644 index 382bbc259698fe..00000000000000 --- a/types/diff/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "private": true, - "name": "@types/diff", - "version": "7.0.9999", - "projects": [ - "https://github.com/kpdecker/jsdiff" - ], - "devDependencies": { - "@types/diff": "workspace:." - }, - "owners": [ - { - "name": "vvakame", - "githubUsername": "vvakame" - }, - { - "name": "szdc", - "githubUsername": "szdc" - }, - { - "name": "BendingBender", - "githubUsername": "BendingBender" - }, - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz" - } - ], - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.ts" - }, - "./package.json": "./package.json" - } -} diff --git a/types/diff/tsconfig.json b/types/diff/tsconfig.json deleted file mode 100644 index 10038a73d344d2..00000000000000 --- a/types/diff/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "es2022.intl" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "diff-tests.ts", - "diff-tests.mts" - ] -} diff --git a/types/diff/v3/.eslintrc.json b/types/diff/v3/.eslintrc.json deleted file mode 100644 index eac234b88c096f..00000000000000 --- a/types/diff/v3/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": { - "@definitelytyped/export-just-namespace": "off", - "@typescript-eslint/naming-convention": "off" - } -} diff --git a/types/diff/v3/.npmignore b/types/diff/v3/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/diff/v3/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/diff/v3/diff-tests.ts b/types/diff/v3/diff-tests.ts deleted file mode 100644 index 823dc5d2b42801..00000000000000 --- a/types/diff/v3/diff-tests.ts +++ /dev/null @@ -1,123 +0,0 @@ -import jsdiff = require("diff"); -const one = "beep boop"; -const other = "beep boob blah"; - -let diff = jsdiff.diffChars(one, other); -printDiff(diff); - -const diffArraysResult = jsdiff.diffArrays(["a", "b", "c"], ["a", "c", "d"]); -diffArraysResult.forEach(result => { - if (result.added) { - console.log(`added ${result.value.length} line(s):`, ...result.value); - } else if (result.removed) { - console.log(`removed ${result.value.length} line(s):`, ...result.value); - } else { - console.log(`no changes`); - } -}); - -interface DiffObj { - value: number; -} -const a: DiffObj = { value: 0 }; -const b: DiffObj = { value: 1 }; -const c: DiffObj = { value: 2 }; -const d: DiffObj = { value: 3 }; -const arrayOptions: jsdiff.IArrayOptions = { - comparator: (left: DiffObj, right: DiffObj) => { - return left.value === right.value; - }, -}; -const diffResult = jsdiff.diffArrays([a, b, c], [a, b, d], arrayOptions); -diffResult.forEach(result => { - if (result.added) { - console.log(`added ${result.value.length} line(s):`, ...result.value); - } else if (result.removed) { - console.log(`removed ${result.value.length} line(s):`, ...result.value); - } else { - console.log(`no changes`); - } -}); - -// -------------------------- - -class LineDiffWithoutWhitespace extends jsdiff.Diff { - tokenize(value: string): any { - return value.split(/^/m); - } - - equals(left: string, right: string): boolean { - return left.trim() === right.trim(); - } -} - -const obj = new LineDiffWithoutWhitespace(); -diff = obj.diff(one, other); -printDiff(diff); - -function printDiff(diff: jsdiff.IDiffResult[]) { - function addLineHeader(decorator: string, str: string | string[]) { - return (typeof str === "string" ? str.split("\n") : str).map((line, index, array) => { - if (index === array.length - 1 && line === "") { - return line; - } else { - return decorator + line; - } - }).join("\n"); - } - - diff.forEach((part) => { - if (part.added) { - console.log(addLineHeader("+", part.value)); - } else if (part.removed) { - console.log(addLineHeader("-", part.value)); - } else { - console.log(addLineHeader(" ", part.value)); - } - }); -} - -function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { - const verifyPatch = jsdiff.parsePatch( - jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr, "old", "new", { context: 1 }), - ); - - if ( - JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) - !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort()) - ) { - console.error("Patch did not match uniDiff"); - } -} -function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { - const verifyApply = [ - jsdiff.applyPatch(oldStr, uniDiff), - jsdiff.applyPatch(oldStr, [uniDiff]), - ]; - jsdiff.applyPatches([uniDiff], { - loadFile: (index: number, callback: (err: Error, data: string) => void) => { - callback(undefined, one); - }, - patched: (index: number, content: string) => { - verifyApply.push(content); - }, - complete: (err?: Error) => { - if (err) { - console.error(err); - } - - verifyApply.forEach(result => { - if (result !== newStr) { - console.error("Result did not match newStr"); - } - }); - }, - }); -} - -const uniDiffPatch = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other, "old", "new", { context: 1 }); -verifyPatchMethods(one, other, uniDiffPatch); - -const uniDiffStr = jsdiff.createPatch("file.ts", one, other, "old", "new", { context: 1 }); -const uniDiffApply = jsdiff.parsePatch(uniDiffStr)[0]; -verifyApplyMethods(one, other, uniDiffApply); diff --git a/types/diff/v3/index.d.ts b/types/diff/v3/index.d.ts deleted file mode 100644 index 2c2907d3a1b278..00000000000000 --- a/types/diff/v3/index.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -export = JsDiff; -export as namespace JsDiff; - -declare namespace JsDiff { - interface IOptions { - ignoreCase: boolean; - } - - interface ILinesOptions extends IOptions { - ignoreWhitespace?: boolean | undefined; - newlineIsToken?: boolean | undefined; - } - - interface IArrayOptions { - comparator?: ((left: any, right: any) => boolean) | undefined; - } - - interface IDiffResult { - value: string; - count?: number | undefined; - added?: boolean | undefined; - removed?: boolean | undefined; - } - - interface IDiffArraysResult { - value: T[]; - count?: number | undefined; - added?: boolean | undefined; - removed?: boolean | undefined; - } - - interface IBestPath { - newPos: number; - componenets: IDiffResult[]; - } - - interface IHunk { - oldStart: number; - oldLines: number; - newStart: number; - newLines: number; - lines: string[]; - } - - interface IUniDiff { - oldFileName: string; - newFileName: string; - oldHeader: string; - newHeader: string; - index: string; - hunks: IHunk[]; - } - - class Diff { - diff(oldString: string, newString: string, options?: IOptions): IDiffResult[]; - - pushComponent(components: IDiffResult[], added: boolean, removed: boolean): void; - - extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number; - - equals(left: string, right: string): boolean; - - removeEmpty(array: any[]): any[]; - - castInput(value: any): any; - - join(chars: string[]): string; - - tokenize(value: string): any; // return types are string or string[] - } - - function diffChars(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffWords(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffWordsWithSpace(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffJson(oldObj: object, newObj: object, options?: IOptions): IDiffResult[]; - - function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[]; - - function diffCss(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffTrimmedLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[]; - - function diffSentences(oldStr: string, newStr: string, options?: IOptions): IDiffResult[]; - - function diffArrays(oldArr: T[], newArr: T[], options?: IArrayOptions): Array>; - - function createPatch( - fileName: string, - oldStr: string, - newStr: string, - oldHeader: string, - newHeader: string, - options?: { context: number }, - ): string; - - function createTwoFilesPatch( - oldFileName: string, - newFileName: string, - oldStr: string, - newStr: string, - oldHeader: string, - newHeader: string, - options?: { context: number }, - ): string; - - function structuredPatch( - oldFileName: string, - newFileName: string, - oldStr: string, - newStr: string, - oldHeader: string, - newHeader: string, - options?: { context: number }, - ): IUniDiff; - - function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string; - - function applyPatches(uniDiff: IUniDiff[], options: { - loadFile(index: number, callback: (err: Error, data: string) => void): void; - patched(index: number, content: string): void; - complete(err?: Error): void; - }): void; - - function parsePatch(diffStr: string, options?: { strict: boolean }): IUniDiff[]; - - function convertChangesToXML(changes: IDiffResult[]): string; - - function convertChangesToDMP(changes: IDiffResult[]): Array<{ 0: number; 1: string }>; - - function merge(mine: string, theirs: string, base: string): IUniDiff; - - function canonicalize(obj: any, stack: any[], replacementStack: any[]): any; -} diff --git a/types/diff/v3/package.json b/types/diff/v3/package.json deleted file mode 100644 index 946874c16c69f3..00000000000000 --- a/types/diff/v3/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/diff", - "version": "3.5.9999", - "projects": [ - "https://github.com/kpdecker/jsdiff" - ], - "devDependencies": { - "@types/diff": "workspace:." - }, - "owners": [ - { - "name": "vvakame", - "githubUsername": "vvakame" - }, - { - "name": "szdc", - "githubUsername": "szdc" - } - ] -} diff --git a/types/diff/v3/tsconfig.json b/types/diff/v3/tsconfig.json deleted file mode 100644 index e72196f7d70f0e..00000000000000 --- a/types/diff/v3/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "diff-tests.ts" - ] -} diff --git a/types/dhis2__ui-constants/.npmignore b/types/express-partial-response/.npmignore similarity index 100% rename from types/dhis2__ui-constants/.npmignore rename to types/express-partial-response/.npmignore diff --git a/types/express-partial-response/express-partial-response-tests.ts b/types/express-partial-response/express-partial-response-tests.ts new file mode 100644 index 00000000000000..be7c9318ec6efc --- /dev/null +++ b/types/express-partial-response/express-partial-response-tests.ts @@ -0,0 +1,10 @@ +import expressPartialResponse, { Options } from "express-partial-response"; + +// $ExpectType RequestHandler> +expressPartialResponse(); + +// $ExpectType RequestHandler> +expressPartialResponse({}); + +// $ExpectType RequestHandler> +expressPartialResponse({ query: "query" }); diff --git a/types/express-partial-response/index.d.ts b/types/express-partial-response/index.d.ts new file mode 100644 index 00000000000000..f13e78c15bc9ff --- /dev/null +++ b/types/express-partial-response/index.d.ts @@ -0,0 +1,21 @@ +import type { RequestHandler } from "express"; + +declare namespace expressPartialResponse { + interface Options { + /** + * The query parameter name to use for the fields mask + * @default "fields" + */ + query?: string | undefined; + } +} + +/** + * Creates a middleware that enables partial responses using JSON Mask + * + * @param options Configuration options for the middleware + * @returns Express middleware function + */ +declare function expressPartialResponse(options?: expressPartialResponse.Options): RequestHandler; + +export = expressPartialResponse; diff --git a/types/express-partial-response/package.json b/types/express-partial-response/package.json new file mode 100644 index 00000000000000..de71e83992b705 --- /dev/null +++ b/types/express-partial-response/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/express-partial-response", + "version": "1.0.9999", + "projects": [ + "https://github.com/nemtsov/express-partial-response#readme" + ], + "dependencies": { + "@types/express": "*" + }, + "devDependencies": { + "@types/express-partial-response": "workspace:." + }, + "owners": [ + { + "name": "Jimmy Leung", + "githubUsername": "hkleungai" + } + ] +} diff --git a/types/dhis2__ui-constants/tsconfig.json b/types/express-partial-response/tsconfig.json similarity index 89% rename from types/dhis2__ui-constants/tsconfig.json rename to types/express-partial-response/tsconfig.json index da01e82712ff66..8289b369ffdb29 100644 --- a/types/dhis2__ui-constants/tsconfig.json +++ b/types/express-partial-response/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "dhis2__ui-constants-tests.ts" + "express-partial-response-tests.ts" ] } diff --git a/types/express/package.json b/types/express/package.json index cab10478d09cb3..b014dd3687df2b 100644 --- a/types/express/package.json +++ b/types/express/package.json @@ -19,10 +19,6 @@ "name": "Boris Yankov", "githubUsername": "borisyankov" }, - { - "name": "China Medical University Hospital", - "githubUsername": "CMUH" - }, { "name": "Puneet Arora", "githubUsername": "puneetar" diff --git a/types/express/v4/package.json b/types/express/v4/package.json index c49565f33ed9f3..eb898b5dbbba5c 100644 --- a/types/express/v4/package.json +++ b/types/express/v4/package.json @@ -20,10 +20,6 @@ "name": "Boris Yankov", "githubUsername": "borisyankov" }, - { - "name": "China Medical University Hospital", - "githubUsername": "CMUH" - }, { "name": "Puneet Arora", "githubUsername": "puneetar" diff --git a/types/frida-gum/frida-gum-tests.ts b/types/frida-gum/frida-gum-tests.ts index d2ae43d2e8a83a..9111eb70969f67 100644 --- a/types/frida-gum/frida-gum-tests.ts +++ b/types/frida-gum/frida-gum-tests.ts @@ -135,7 +135,7 @@ const nf2 = new NativeFunction(NULL, "void", ["long", "...", "pointer"]); nf2(34, NULL, nf2, { handle: ptr(0xbeef) }); // $ExpectType NativeFunction -const puts = new NativeFunction(Module.getExportByName(null, "puts"), "int", ["pointer"]); +const puts = new NativeFunction(Module.getGlobalExportByName("puts"), "int", ["pointer"]); // $ExpectType NativePointer const message = Memory.allocUtf8String("Hello!"); @@ -150,7 +150,7 @@ puts.apply(otherPuts, [message]); puts(message); // $ExpectType SystemFunction -const open = new SystemFunction(Module.getExportByName(null, "open"), "int", ["pointer", "int"]); +const open = new SystemFunction(Module.getGlobalExportByName("open"), "int", ["pointer", "int"]); const path = Memory.allocUtf8String("/etc/hosts"); @@ -338,77 +338,6 @@ Stalker.invalidate(Process.getCurrentThreadId(), basicBlockStartAddress); // $ExpectType boolean Cloak.hasCurrentThread(); -const obj = new ObjC.Object(ptr("0x42")); - -// $ExpectType Object -obj; - -const b = new ObjC.Block(ptr(0x1234)); -b.declare({ retType: "void", argTypes: ["int"] }); -b.declare({ types: "v12@?0i8" }); - -Java.enumerateClassLoadersSync() - .forEach(classLoader => { - // $ExpectType ClassFactory - const factory = Java.ClassFactory.get(classLoader); - interface Props { - myMethod: Java.MethodDispatcher; - myField: Java.Field; - } - // $ExpectType Wrapper - const MyJavaClass = factory.use("my.java.class"); - // @ts-expect-error - factory.use<{ illegal: string }>(""); - // $ExpectType string - MyJavaClass.$className; - // $ExpectType MethodDispatcher - MyJavaClass.myMethod; - // $ExpectType Wrapper - MyJavaClass.myMethod.holder; - // $ExpectType Wrapper - MyJavaClass.myMethod.holder.myField.holder.myMethod.holder; - MyJavaClass.myMethod.implementation = function(...args) { - // $ExpectType MethodDispatcher - this.myMethod; - // $ExpectType Field - this.myField; - // $ExpectType number - this.myField.value; - }; - // $ExpectType Wrapper - Java.retain(MyJavaClass); - interface AnotherProps { - anotherMethod: Java.MethodDispatcher; - anotherField: Java.Field; - } - const MyAnotherJavaClass = factory.use("my.another.java.class"); - // $ExpectType Wrapper - Java.cast(MyJavaClass, MyAnotherJavaClass); - }); - -Java.perform(() => { - // $ExpectType void - Java.deoptimizeBootImage(); - - Java.enumerateMethods("*!*game*/i").forEach(group => { - const factory = Java.ClassFactory.get(group.loader); - group.classes.forEach(klass => { - const C = factory.use(klass.name); - klass.methods.forEach(methodName => { - const method: Java.MethodDispatcher = C[methodName]; - method.implementation = function(...args) { - return method.apply(this, args); - }; - }); - }); - }); - - // $ExpectType Backtrace - Java.backtrace(); - // $ExpectType Backtrace - Java.backtrace({ limit: 42 }); -}); - Process.enumerateThreads().forEach(t => { t.setHardwareBreakpoint(0, puts); }); diff --git a/types/frida-gum/index.d.ts b/types/frida-gum/index.d.ts index b7f5e3f8d2de4d..f77c836ddd381d 100644 --- a/types/frida-gum/index.d.ts +++ b/types/frida-gum/index.d.ts @@ -490,6 +490,16 @@ declare class Module { */ path: string; + /** + * Ensures that the module initializers have been run. This is important + * during early instrumentation, i.e. code run early in the process + * lifetime, to be able to safely interact with APIs. + * + * One such use-case is interacting with Objective-C classes provided by + * a given module. + */ + ensureInitialized(): void; + /** * Enumerates imports of module. */ @@ -564,48 +574,24 @@ declare class Module { static load(name: string): Module; /** - * Ensures that initializers of the specified module have been run. This is important during early instrumentation, - * i.e. code run early in the process lifetime, to be able to safely interact with APIs. - * - * One such use-case is interacting with ObjC classes provided by a given module. - */ - static ensureInitialized(name: string): void; - - /** - * Looks up the base address of the `name` module. Returns null if the module isn’t loaded. - * - * @param name Module name or path. - */ - static findBaseAddress(name: string): NativePointer | null; - - /** - * Looks up the base address of the `name` module. Throws an exception if the module isn’t loaded. - * - * @param name Module name or path. - */ - static getBaseAddress(name: string): NativePointer; - - /** - * Looks up the absolute address of the export named `exportName` in `moduleName`. If the module isn’t known you may - * pass null instead of its name, but this can be a costly search and should be avoided. + * Looks up the absolute address of the global export named `name`. + * This can be a costly search and should be avoided. * - * Returns null if the module or export doesn't exist. + * Returns null if the export doesn't exist. * - * @param moduleName Module name or path. - * @param exportName Export name to find the address of. + * @param name Export name to find the address of. */ - static findExportByName(moduleName: string | null, exportName: string): NativePointer | null; + static findGlobalExportByName(name: string): NativePointer | null; /** - * Looks up the absolute address of the export named `exportName` in `moduleName`. If the module isn’t known you may - * pass null instead of its name, but this can be a costly search and should be avoided. + * Looks up the absolute address of the global export named `name`. + * This can be a costly search and should be avoided. * - * Throws an exception if the module or export doesn't exist. + * Throws an exception if the export doesn't exist. * - * @param moduleName Module name or path. - * @param exportName Export name to find the address of. + * @param name Export name to find the address of. */ - static getExportByName(moduleName: string | null, exportName: string): NativePointer; + static getGlobalExportByName(name: string): NativePointer; } declare class ThreadObserver { @@ -3796,8 +3782,8 @@ type ApiResolverType = * Resolves Objective-C methods. * * Available on macOS and iOS in processes that have the Objective-C - * runtime loaded. Use `ObjC.available` to check at runtime, or wrap - * your `new ApiResolver("objc")` call in a try-catch. + * runtime loaded. Use `ObjC.available` (in frida-objc-bridge) to check + * at runtime, or wrap your `new ApiResolver("objc")` call in a try-catch. * * Example query: `"-[NSURL* *HTTP*]"` * Which may resolve to: `"-[NSURLRequest valueForHTTPHeaderField:]"` @@ -4743,1412 +4729,6 @@ declare class CallCountSampler extends Sampler { constructor(functions: NativePointerValue[]); } -declare namespace ObjC { - // tslint:disable:no-unnecessary-qualifier - - /** - * Whether the current process has an Objective-C runtime loaded. Do not invoke any other ObjC properties or - * methods unless this is the case. - */ - const available: boolean; - - /** - * Direct access to a big portion of the Objective-C runtime API. - */ - const api: { - [name: string]: any; - }; - - /** - * Dynamically generated bindings for each of the currently registered classes. - * - * You can interact with objects by using dot notation and replacing colons with underscores, i.e.: - * - * ``` - * [NSString stringWithString:@"Hello World"]; - * ``` - * - * becomes: - * - * ``` - * const NSString = ObjC.classes.NSString; - * NSString.stringWithString_("Hello World"); - * ``` - * - * Note the underscore after the method name. - */ - const classes: { - [name: string]: ObjC.Object; - }; - - /** - * Dynamically generated bindings for each of the currently registered protocols. - */ - const protocols: { - [name: string]: Protocol; - }; - - /** - * GCD queue of the main thread. - */ - const mainQueue: NativePointer; - - /** - * Schedule the JavaScript function `work` on the GCD queue specified by `queue`. An NSAutoreleasePool is created - * just before calling `work`, and cleaned up on return. - * - * E.g. on macOS: - * ``` - * const { NSSound } = ObjC.classes; - * ObjC.schedule(ObjC.mainQueue, () => { - * const sound = NSSound.alloc().initWithContentsOfFile_byReference_("/Users/oleavr/.Trash/test.mp3", true).autorelease(); - * sound.play(); - * }); - * ``` - * - * @param queue GCD queue to schedule `work` on. - * @param work Function to call on the specified `queue`. - */ - function schedule(queue: NativePointerValue, work: () => void): void; - - /** - * Dynamically generated wrapper for any Objective-C instance, class, or meta-class. - */ - class Object implements ObjectWrapper, ObjectMethods { - constructor(handle: NativePointer, protocol?: Protocol); - - handle: NativePointer; - - /** - * Whether this is an instance, class, or meta-class. - */ - $kind: ObjectKind; - - /** - * Instance used for chaining up to super-class method implementations. - */ - $super: ObjC.Object; - - /** - * Super-class of this object's class. - */ - $superClass: ObjC.Object; - - /** - * Class that this object is an instance of. - */ - $class: ObjC.Object; - - /** - * Class name of this object. - */ - $className: string; - - /** - * Name of module where this object is implemented. - */ - $moduleName: string; - - /** - * Protocols that this object conforms to. - */ - $protocols: { - [name: string]: Protocol; - }; - - /** - * Native method names exposed by this object’s class and parent classes. - */ - $methods: string[]; - - /** - * Native method names exposed by this object’s class, not including parent classes. - */ - $ownMethods: string[]; - - /** - * Instance variables on this object. Supports both access and assignment. - */ - $ivars: { - [name: string]: any; - }; - - /** - * Determines whether two instances refer to the same underlying object. - * - * @param other Other object instance or address to compare to. - */ - equals(other: ObjC.Object | NativePointer): boolean; - - [name: string]: any; - } - - interface ObjectMethods { - [name: string]: ObjectMethod; - } - - interface ObjectMethod extends ObjectWrapper, AnyFunction { - handle: NativePointer; - - /** - * Objective-C selector. Use `ObjC.selectorAsString()` to convert it to a string. - */ - selector: NativePointer; - - /** - * Current implementation. - * - * You may replace it by assigning to this property. See `ObjC.implement()` for details. - */ - implementation: NativePointer; - - /** - * Return type name. - */ - returnType: string; - - /** - * Argument type names. - */ - argumentTypes: string[]; - - /** - * Signature. - */ - types: string; - - /** - * Makes a new method wrapper with custom NativeFunction options. - * - * Useful for e.g. setting `traps: "all"` to perform execution tracing - * in conjunction with Stalker. - */ - clone: (options: NativeFunctionOptions) => ObjectMethod; - } - - /** - * What kind of object an ObjC.Object represents. - */ - type ObjectKind = "instance" | "class" | "meta-class"; - - /** - * Dynamically generated language binding for any Objective-C protocol. - */ - class Protocol implements ObjectWrapper { - constructor(handle: NativePointer); - - handle: NativePointer; - - /** - * Name visible to the Objective-C runtime. - */ - name: string; - - /** - * Protocols that this protocol conforms to. - */ - protocols: { - [name: string]: Protocol; - }; - - /** - * Properties declared by this protocol. - */ - properties: { - [name: string]: ProtocolPropertyAttributes; - }; - - /** - * Methods declared by this protocol. - */ - methods: { - [name: string]: ProtocolMethodDescription; - }; - } - - interface ProtocolPropertyAttributes { - [name: string]: string; - } - - interface ProtocolMethodDescription { - /** - * Whether this method is required or optional. - */ - required: boolean; - - /** - * Method signature. - */ - types: string; - } - - /** - * Dynamically generated language binding for any Objective-C block. - * - * Also supports implementing a block from scratch by passing in an - * implementation. - */ - class Block implements ObjectWrapper { - constructor(target: NativePointer | MethodSpec, options?: NativeFunctionOptions); - - handle: NativePointer; - - /** - * Signature, if available. - */ - types?: string | undefined; - - /** - * Current implementation. You may replace it by assigning to this property. - */ - implementation: AnyFunction; - - /** - * Declares the signature of an externally defined block. This is needed - * when working with blocks without signature metadata, i.e. when - * `block.types === undefined`. - * - * @param signature Signature to use. - */ - declare(signature: BlockSignature): void; - } - - type BlockImplementation = (this: Block, ...args: any[]) => any; - - type BlockSignature = SimpleBlockSignature | DetailedBlockSignature; - - interface SimpleBlockSignature { - /** - * Return type. - */ - retType: string; - - /** - * Argument types. - */ - argTypes: string[]; - } - - interface DetailedBlockSignature { - /** - * Signature. - */ - types: string; - } - - /** - * Creates a JavaScript implementation compatible with the signature of `method`, where `fn` is used as the - * implementation. Returns a `NativeCallback` that you may assign to an ObjC method’s `implementation` property. - * - * @param method Method to implement. - * @param fn Implementation. - */ - function implement(method: ObjectMethod, fn: AnyFunction): NativeCallback; - - /** - * Creates a new class designed to act as a proxy for a target object. - * - * @param spec Proxy specification. - */ - function registerProxy(spec: ProxySpec): ProxyConstructor; - - /** - * Creates a new Objective-C class. - * - * @param spec Class specification. - */ - function registerClass(spec: ClassSpec): ObjC.Object; - - /** - * Creates a new Objective-C protocol. - * - * @param spec Protocol specification. - */ - function registerProtocol(spec: ProtocolSpec): Protocol; - - /** - * Binds some JavaScript data to an Objective-C instance. - * - * @param obj Objective-C instance to bind data to. - * @param data Data to bind. - */ - function bind(obj: ObjC.Object | NativePointer, data: InstanceData): void; - - /** - * Unbinds previously associated JavaScript data from an Objective-C instance. - * - * @param obj Objective-C instance to unbind data from. - */ - function unbind(obj: ObjC.Object | NativePointer): void; - - /** - * Looks up previously bound data from an Objective-C object. - * - * @param obj Objective-C instance to look up data for. - */ - function getBoundData(obj: ObjC.Object | NativePointer): any; - - /** - * Enumerates loaded classes. - * - * @param callbacks Object with callbacks. - */ - function enumerateLoadedClasses(callbacks: EnumerateLoadedClassesCallbacks): void; - - /** - * Enumerates loaded classes. - * - * @param options Options customizing the enumeration. - * @param callbacks Object with callbacks. - */ - function enumerateLoadedClasses( - options: EnumerateLoadedClassesOptions, - callbacks: EnumerateLoadedClassesCallbacks, - ): void; - - /** - * Synchronous version of `enumerateLoadedClasses()`. - * - * @param options Options customizing the enumeration. - */ - function enumerateLoadedClassesSync(options?: EnumerateLoadedClassesOptions): EnumerateLoadedClassesResult; - - interface EnumerateLoadedClassesOptions { - /** - * Limit enumeration to modules in the given module map. - */ - ownedBy?: ModuleMap | undefined; - } - - interface EnumerateLoadedClassesCallbacks { - onMatch: (name: string, owner: string) => void; - onComplete: () => void; - } - - interface EnumerateLoadedClassesResult { - /** - * Class names grouped by name of owner module. - */ - [owner: string]: string[]; - } - - function choose(specifier: ChooseSpecifier, callbacks: EnumerateCallbacks): void; - - /** - * Synchronous version of `choose()`. - * - * @param specifier What kind of objects to look for. - */ - function chooseSync(specifier: ChooseSpecifier): ObjC.Object[]; - - /** - * Converts the JavaScript string `name` to a selector. - * - * @param name Name to turn into a selector. - */ - function selector(name: string): NativePointer; - - /** - * Converts the selector `sel` to a JavaScript string. - * - * @param sel Selector to turn into a string. - */ - function selectorAsString(sel: NativePointerValue): string; - - interface ProxySpec { - /** - * Name of the proxy class. - * - * Omit this if you don’t care about the globally visible name and would like the runtime to auto-generate one - * for you. - */ - name?: string | undefined; - - /** - * Protocols this proxy class conforms to. - */ - protocols?: Protocol[] | undefined; - - /** - * Methods to implement. - */ - methods?: { - [name: string]: UserMethodImplementation | MethodSpec>; - } | undefined; - - /** - * Callbacks for getting notified about events. - */ - events?: ProxyEventCallbacks | undefined; - } - - interface ProxyEventCallbacks { - /** - * Gets notified right after the object has been deallocated. - * - * This is where you might clean up any associated state. - */ - dealloc?(this: UserMethodInvocation): void; - - /** - * Gets notified about the method name that we’re about to forward - * a call to. - * - * This might be where you’d start out with a temporary callback - * that just logs the names to help you decide which methods to - * override. - * - * @param name Name of method that is about to get called. - */ - forward?(this: UserMethodInvocation, name: string): void; - } - - /** - * Constructor for instantiating a proxy object. - * - * @param target Target object to proxy to. - * @param data Object with arbitrary data. - */ - interface ProxyConstructor { - new(target: ObjC.Object | NativePointer, data?: InstanceData): ProxyInstance; - } - - interface ProxyInstance { - handle: NativePointer; - } - - interface ProxyData extends InstanceData { - /** - * This proxy's target object. - */ - target: ObjC.Object; - - /** - * Used by the implementation. - */ - events: {}; - } - - interface ClassSpec { - /** - * Name of the class. - * - * Omit this if you don’t care about the globally visible name and would like the runtime to auto-generate one - * for you. - */ - name?: string | undefined; - - /** - * Super-class, or `null` to create a new root class. Omit to inherit from `NSObject`. - */ - super?: ObjC.Object | null | undefined; - - /** - * Protocols this class conforms to. - */ - protocols?: Protocol[] | undefined; - - /** - * Methods to implement. - */ - methods?: { - [name: string]: UserMethodImplementation | MethodSpec>; - } | undefined; - } - - type MethodSpec = SimpleMethodSpec | DetailedMethodSpec; - - interface SimpleMethodSpec { - /** - * Return type. - */ - retType: string; - - /** - * Argument types. - */ - argTypes: string[]; - - /** - * Implementation. - */ - implementation: I; - } - - interface DetailedMethodSpec { - /** - * Signature. - */ - types: string; - - /** - * Implementation. - */ - implementation: I; - } - - type UserMethodImplementation = (this: UserMethodInvocation, ...args: any[]) => any; - - interface UserMethodInvocation { - self: T; - super: S; - data: D; - } - - /** - * User-defined data that can be accessed from method implementations. - */ - interface InstanceData { - [name: string]: any; - } - - interface ProtocolSpec { - /** - * Name of the protocol. - * - * Omit this if you don’t care about the globally visible name and would like the runtime to auto-generate one - * for you. - */ - name?: string | undefined; - - /** - * Protocols this protocol conforms to. - */ - protocols?: Protocol[] | undefined; - - methods?: { - [name: string]: ProtocolMethodSpec; - } | undefined; - } - - type ProtocolMethodSpec = SimpleProtocolMethodSpec | DetailedProtocolMethodSpec; - - interface SimpleProtocolMethodSpec { - /** - * Return type. - */ - retType: string; - - /** - * Argument types. - */ - argTypes: string[]; - - /** - * Whether this method is required or optional. Default is required. - */ - optional?: boolean | undefined; - } - - interface DetailedProtocolMethodSpec { - /** - * Method signature. - */ - types: string; - - /** - * Whether this method is required or optional. Default is required. - */ - optional?: boolean | undefined; - } - - type ChooseSpecifier = SimpleChooseSpecifier | DetailedChooseSpecifier; - - type SimpleChooseSpecifier = ObjC.Object; - - interface DetailedChooseSpecifier { - /** - * Which class to look for instances of. E.g.: `ObjC.classes.UIButton`. - */ - class: ObjC.Object; - - /** - * Whether you’re also interested in subclasses matching the given class selector. - * - * The default is to also include subclasses. - */ - subclasses?: boolean | undefined; - } - - // tslint:enable:no-unnecessary-qualifier -} - -declare namespace Java { - /** - * Whether the current process has a Java runtime loaded. Do not invoke any other Java properties or - * methods unless this is the case. - */ - const available: boolean; - - /** - * Which version of Android we're running on. - */ - const androidVersion: string; - - const ACC_PUBLIC: number; - const ACC_PRIVATE: number; - const ACC_PROTECTED: number; - const ACC_STATIC: number; - const ACC_FINAL: number; - const ACC_SYNCHRONIZED: number; - const ACC_BRIDGE: number; - const ACC_VARARGS: number; - const ACC_NATIVE: number; - const ACC_ABSTRACT: number; - const ACC_STRICT: number; - const ACC_SYNTHETIC: number; - - /** - * Calls `func` with the `obj` lock held. - * - * @param obj Instance whose lock to hold. - * @param fn Function to call with lock held. - */ - function synchronized(obj: Wrapper, fn: () => void): void; - - /** - * Enumerates loaded classes. - * - * @param callbacks Object with callbacks. - */ - function enumerateLoadedClasses(callbacks: EnumerateLoadedClassesCallbacks): void; - - /** - * Synchronous version of `enumerateLoadedClasses()`. - */ - function enumerateLoadedClassesSync(): string[]; - - /** - * Enumerates class loaders. - * - * You may pass such a loader to `Java.ClassFactory.get()` to be able to - * `.use()` classes on the specified class loader. - * - * @param callbacks Object with callbacks. - */ - function enumerateClassLoaders(callbacks: EnumerateClassLoadersCallbacks): void; - - /** - * Synchronous version of `enumerateClassLoaders()`. - */ - function enumerateClassLoadersSync(): Wrapper[]; - - /** - * Enumerates methods matching `query`. - * - * @param query Query specified as `class!method`, with globs permitted. May - * also be suffixed with `/` and one or more modifiers: - * - `i`: Case-insensitive matching. - * - `s`: Include method signatures, so e.g. `"putInt"` becomes - * `"putInt(java.lang.String, int): void"`. - * - `u`: User-defined classes only, ignoring system classes. - */ - function enumerateMethods(query: string): EnumerateMethodsMatchGroup[]; - - /** - * Runs `fn` on the main thread of the VM. - * - * @param fn Function to run on the main thread of the VM. - */ - function scheduleOnMainThread(fn: () => void): void; - - /** - * Ensures that the current thread is attached to the VM and calls `fn`. - * (This isn't necessary in callbacks from Java.) - * - * Will defer calling `fn` if the app's class loader is not available yet. - * Use `Java.performNow()` if access to the app's classes is not needed. - * - * @param fn Function to run while attached to the VM. - */ - function perform(fn: () => void): void; - - /** - * Ensures that the current thread is attached to the VM and calls `fn`. - * (This isn't necessary in callbacks from Java.) - * - * @param fn Function to run while attached to the VM. - */ - function performNow(fn: () => void): void; - - /** - * Dynamically generates a JavaScript wrapper for `className` that you can - * instantiate objects from by calling `$new()` on to invoke a constructor. - * Call `$dispose()` on an instance to clean it up explicitly, or wait for - * the JavaScript object to get garbage-collected, or script to get - * unloaded. Static and non-static methods are available, and you can even - * replace method implementations. - * - * Uses the app's class loader, but you may access classes on other loaders - * by calling `Java.ClassFactory.get()`. - * - * @param className Canonical class name to get a wrapper for. - */ - function use = {}>(className: string): Wrapper; - - /** - * Opens the .dex file at `filePath`. - * - * @param filePath Path to .dex to open. - */ - function openClassFile(filePath: string): DexFile; - - /** - * Enumerates live instances of the `className` class by scanning the Java - * VM's heap. - * - * @param className Name of class to enumerate instances of. - * @param callbacks Object with callbacks. - */ - function choose = {}>(className: string, callbacks: ChooseCallbacks): void; - - /** - * Duplicates a JavaScript wrapper for later use outside replacement method. - * - * @param obj An existing wrapper retrieved from `this` in replacement method. - */ - function retain = {}>(obj: Wrapper): Wrapper; - - /** - * Creates a JavaScript wrapper given the existing instance at `handle` of - * given class `klass` as returned from `Java.use()`. - * - * @param handle An existing wrapper or a JNI handle. - * @param klass Class wrapper for type to cast to. - */ - function cast = {}, To extends Members = {}>( - handle: Wrapper | NativePointerValue, - klass: Wrapper, - ): Wrapper; - - /** - * Creates a Java array with elements of the specified `type`, from a - * JavaScript array `elements`. The resulting Java array behaves like - * a JS array, but can be passed by reference to Java APIs in order to - * allow them to modify its contents. - * - * @param type Type name of elements. - * @param elements Array of JavaScript values to use for constructing the - * Java array. - */ - function array(type: string, elements: any[]): any[]; - - /** - * Generates a backtrace for the current thread. - * - * @param options Options to customize the stack-walking. - */ - function backtrace(options?: BacktraceOptions): Backtrace; - - /** - * Determines whether the caller is running on the main thread. - */ - function isMainThread(): boolean; - - /** - * Creates a new Java class. - * - * @param spec Object describing the class to be created. - */ - function registerClass(spec: ClassSpec): Wrapper; - - /** - * Forces the VM to execute everything with its interpreter. Necessary to - * prevent optimizations from bypassing method hooks in some cases, and - * allows ART's Instrumentation APIs to be used for tracing the runtime. - */ - function deoptimizeEverything(): void; - - /** - * Similar to deoptimizeEverything but only deoptimizes boot image code. - * Use with `dalvik.vm.dex2oat-flags --inline-max-code-units=0` for best - * results. - */ - function deoptimizeBootImage(): void; - - const vm: VM; - - /** - * The default class factory used to implement e.g. `Java.use()`. - * Uses the application's main class loader. - */ - const classFactory: ClassFactory; - - interface EnumerateLoadedClassesCallbacks { - /** - * Called with the name of each currently loaded class, and a JNI - * reference for its Java Class object. - * - * Pass the `name` to `Java.use()` to get a JavaScript wrapper. - * You may also `Java.cast()` the `handle` to `java.lang.Class`. - */ - onMatch: (name: string, handle: NativePointer) => void; - - /** - * Called when all loaded classes have been enumerated. - */ - onComplete: () => void; - } - - interface EnumerateClassLoadersCallbacks { - /** - * Called with a `java.lang.ClassLoader` wrapper for each class loader - * found in the VM. - */ - onMatch: (loader: Wrapper) => void; - - /** - * Called when all class loaders have been enumerated. - */ - onComplete: () => void; - } - - /** - * Matching methods grouped by class loader. - */ - interface EnumerateMethodsMatchGroup { - /** - * Class loader, or `null` for the bootstrap class loader. - * - * Typically passed to `ClassFactory.get()` to interact with classes of - * interest. - */ - loader: Wrapper | null; - - /** - * One or more matching classes that have one or more methods matching - * the given query. - */ - classes: [EnumerateMethodsMatchClass, ...EnumerateMethodsMatchClass[]]; - } - - /** - * Class matching query which has one or more matching methods. - */ - interface EnumerateMethodsMatchClass { - /** - * Class name that matched the given query. - */ - name: string; - - /** - * One or more matching method names, each followed by signature when - * the `s` modifier is used. - */ - methods: [string, ...string[]]; - } - - interface ChooseCallbacks = {}> { - /** - * Called with each live instance found with a ready-to-use `instance` - * just as if you would have called `Java.cast()` with a raw handle to - * this particular instance. - * - * May return `EnumerateAction.Stop` to stop the enumeration early. - */ - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - onMatch: (instance: Wrapper) => void | EnumerateAction; - - /** - * Called when all instances have been enumerated. - */ - onComplete: () => void; - } - - /** - * Options that may be passed to `Java.backtrace()`. - */ - interface BacktraceOptions { - /** - * Limit how many frames up the stack to walk. Defaults to 16. - */ - limit?: number; - } - - /** - * Backtrace returned by `Java.backtrace()`. - */ - interface Backtrace { - /** - * ID that can be used for deduplicating identical backtraces. - */ - id: string; - - /** - * Stack frames. - */ - frames: Frame[]; - } - - interface Frame { - /** - * Signature, e.g. `"Landroid/os/Looper;,loopOnce,(Landroid/os/Looper;JI)Z"`. - */ - signature: string; - - /** - * Where the code is from, i.e. the filesystem path to the `.dex` on Android. - */ - origin: string; - - /** - * Class name that method belongs to, e.g. `"android.os.Looper"`. - */ - className: string; - - /** - * Method name, e.g. `"loopOnce"`. - */ - methodName: string; - - /** - * Method flags. E.g. `Java.ACC_PUBLIC | Java.ACC_STATIC`. - */ - methodFlags: number; - - /** - * Source file name, e.g. `"Looper.java"`. - */ - fileName: string; - - /** - * Source line number, e.g. `201`. - */ - lineNumber: number; - } - - type Members = Record; - - /** - * Dynamically generated wrapper for any Java class, instance, or interface. - */ - type Wrapper = {}> = - & { - /** - * Automatically inject holder's type to all fields and methods - */ - [K in keyof T]: T[K] extends Field ? Field : MethodDispatcher; - } - & { - /** - * Allocates and initializes a new instance of the given class. - * - * Use this to create a new instance. - */ - $new: MethodDispatcher; - - /** - * Allocates a new instance without initializing it. - * - * Call `$init()` to initialize it. - */ - $alloc: MethodDispatcher; - - /** - * Initializes an instance that was allocated but not yet initialized. - * This wraps the constructor(s). - * - * Replace the `implementation` property to hook a given constructor. - */ - $init: MethodDispatcher; - - /** - * Eagerly deletes the underlying JNI global reference without having to - * wait for the object to become unreachable and the JavaScript - * runtime's garbage collector to kick in (or script to be unloaded). - * - * Useful when a lot of short-lived objects are created in a loop and - * there's a risk of running out of global handles. - */ - $dispose(): void; - - /** - * Retrieves a `java.lang.Class` wrapper for the current class. - */ - class: Wrapper; - - /** - * Canonical name of class being wrapped. - */ - $className: string; - - /** - * Method and field names exposed by this object’s class, not including - * parent classes. - */ - $ownMembers: string[]; - - /** - * Instance used for chaining up to super-class method implementations. - */ - $super: Wrapper; - - /** - * Methods and fields. - */ - [name: string]: any; - }; - - interface MethodDispatcher = {}> extends Method { - /** - * Available overloads. - */ - overloads: Array>; - - /** - * Obtains a specific overload. - * - * @param args Signature of the overload to obtain. - * For example: `"java.lang.String", "int"`. - */ - overload(...args: string[]): Method; - } - - interface Method = {}> { - (...params: any[]): any; - - /** - * Name of this method. - */ - methodName: string; - - /** - * Class that this method belongs to. - */ - holder: Wrapper; - - /** - * What kind of method this is, i.e. constructor vs static vs instance. - */ - type: MethodType; - - /** - * Pointer to the VM's underlying method object. - */ - handle: NativePointer; - - /** - * Implementation. Assign a new implementation to this property to - * replace the original implementation. Assign `null` at a future point - * to revert back to the original implementation. - */ - implementation: MethodImplementation | null; - - /** - * Method return type. - */ - returnType: Type; - - /** - * Method argument types. - */ - argumentTypes: Type[]; - - /** - * Queries whether the method may be invoked with a given argument list. - */ - canInvokeWith: (...args: any[]) => boolean; - - /** - * Makes a new method wrapper with custom NativeFunction options. - * - * Useful for e.g. setting `traps: "all"` to perform execution tracing - * in conjunction with Stalker. - */ - clone: (options: NativeFunctionOptions) => Method; - } - - type MethodImplementation = {}> = (this: Wrapper, ...params: any[]) => any; - - interface Field = {}> { - /** - * Current value of this field. Assign to update the field's value. - */ - value: Value; - - /** - * Class that this field belongs to. - */ - holder: Wrapper; - - /** - * What kind of field this is, i.e. static vs instance. - */ - fieldType: FieldType; - - /** - * Type of value. - */ - fieldReturnType: Type; - } - - // eslint-disable-next-line @definitelytyped/no-const-enum - const enum MethodType { - Constructor = 1, - Static = 2, - Instance = 3, - } - - // eslint-disable-next-line @definitelytyped/no-const-enum - const enum FieldType { - Static = 1, - Instance = 2, - } - - interface Type { - /** - * VM type name. For example `I` for `int`. - */ - name: string; - - /** - * Frida type name. For example `pointer` for a handle. - */ - type: string; - - /** - * Size in words. - */ - size: number; - - /** - * Size in bytes. - */ - byteSize: number; - - /** - * Class name, if applicable. - */ - className?: string | undefined; - - /** - * Checks whether a given JavaScript `value` is compatible. - */ - isCompatible: (value: any) => boolean; - - /** - * Converts `value` from a JNI value to a JavaScript value. - */ - fromJni?: ((value: any) => any) | undefined; - - /** - * Converts `value` from a JavaScript value to a JNI value. - */ - toJni?: ((value: any) => any) | undefined; - - /** - * Reads a value from memory. - */ - read?: ((address: NativePointerValue) => any) | undefined; - - /** - * Writes a value to memory. - */ - write?: ((address: NativePointerValue, value: any) => void) | undefined; - } - - interface DexFile { - /** - * Loads the contained classes into the VM. - */ - load(): void; - - /** - * Determines available class names. - */ - getClassNames(): string[]; - } - - interface ClassSpec { - /** - * Name of the class. - */ - name: string; - - /** - * Super-class. Omit to inherit from `java.lang.Object`. - */ - superClass?: Wrapper | undefined; - - /** - * Interfaces implemented by this class. - */ - implements?: Wrapper[] | undefined; - - /** - * Name and type of each field to expose. - */ - fields?: { - [name: string]: string; - } | undefined; - - /** - * Methods to implement. Use the special name `$init` to define one or more constructors. - */ - methods?: { - [name: string]: MethodImplementation | MethodSpec | MethodSpec[]; - } | undefined; - } - - interface MethodSpec { - /** - * Return type. Defaults to `void` if omitted. - */ - returnType?: string | undefined; - - /** - * Argument types. Defaults to `[]` if omitted. - */ - argumentTypes?: string[] | undefined; - - /** - * Implementation. - */ - implementation: MethodImplementation; - } - - interface VM { - /** - * Ensures that the current thread is attached to the VM and calls `fn`. - * (This isn't necessary in callbacks from Java.) - * - * @param fn Function to run while attached to the VM. - */ - perform(fn: () => void): void; - - /** - * Gets a wrapper for the current thread's `JNIEnv`. - * - * Throws an exception if the current thread is not attached to the VM. - */ - getEnv(): Env; - - /** - * Tries to get a wrapper for the current thread's `JNIEnv`. - * - * Returns `null` if the current thread is not attached to the VM. - */ - tryGetEnv(): Env | null; - } - - type Env = any; - - class ClassFactory { - /** - * Gets the class factory instance for a given class loader, or the - * default factory when passing `null`. - * - * The default class factory used behind the scenes only interacts - * with the application's main class loader. Other class loaders - * can be discovered through APIs such as `Java.enumerateMethods()` and - * `Java.enumerateClassLoaders()`, and subsequently interacted with - * through this API. - */ - static get(classLoader: Wrapper | null): ClassFactory; - - /** - * Class loader currently being used. For the default class factory this - * is updated by the first call to `Java.perform()`. - */ - readonly loader: Wrapper | null; - - /** - * Path to cache directory currently being used. For the default class - * factory this is updated by the first call to `Java.perform()`. - */ - cacheDir: string; - - /** - * Naming convention to use for temporary files. - * - * Defaults to `{ prefix: "frida", suffix: "dat" }`. - */ - tempFileNaming: TempFileNaming; - - /** - * Dynamically generates a JavaScript wrapper for `className` that you can - * instantiate objects from by calling `$new()` on to invoke a constructor. - * Call `$dispose()` on an instance to clean it up explicitly, or wait for - * the JavaScript object to get garbage-collected, or script to get - * unloaded. Static and non-static methods are available, and you can even - * replace method implementations. - * - * @param className Canonical class name to get a wrapper for. - */ - use = {}>(className: string): Wrapper; - - /** - * Opens the .dex file at `filePath`. - * - * @param filePath Path to .dex to open. - */ - openClassFile(filePath: string): DexFile; - - /** - * Enumerates live instances of the `className` class by scanning the Java - * VM's heap. - * - * @param className Name of class to enumerate instances of. - * @param callbacks Object with callbacks. - */ - choose = {}>(className: string, callbacks: ChooseCallbacks): void; - - /** - * Duplicates a JavaScript wrapper for later use outside replacement method. - * - * @param obj An existing wrapper retrieved from `this` in replacement method. - */ - retain = {}>(obj: Wrapper): Wrapper; - - /** - * Creates a JavaScript wrapper given the existing instance at `handle` of - * given class `klass` as returned from `Java.use()`. - * - * @param handle An existing wrapper or a JNI handle. - * @param klass Class wrapper for type to cast to. - */ - cast = {}, To extends Members = {}>( - handle: Wrapper | NativePointerValue, - klass: Wrapper, - ): Wrapper; - - /** - * Creates a Java array with elements of the specified `type`, from a - * JavaScript array `elements`. The resulting Java array behaves like - * a JS array, but can be passed by reference to Java APIs in order to - * allow them to modify its contents. - * - * @param type Type name of elements. - * @param elements Array of JavaScript values to use for constructing the - * Java array. - */ - array(type: string, elements: any[]): any[]; - - /** - * Creates a new Java class. - * - * @param spec Object describing the class to be created. - */ - registerClass(spec: ClassSpec): Wrapper; - } - - interface TempFileNaming { - /** - * File name prefix to use. - * - * For example: `frida`. - */ - prefix: string; - - /** - * File name suffix to use. - * - * For example: `dat`. - */ - suffix: string; - } -} - /** * Generates machine code for x86. */ diff --git a/types/frida-gum/package.json b/types/frida-gum/package.json index 88dccab16bc89d..b7d1bafe4730a2 100644 --- a/types/frida-gum/package.json +++ b/types/frida-gum/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/frida-gum", - "version": "18.8.9999", + "version": "19.0.9999", "nonNpm": true, "nonNpmDescription": "frida-gum", "projects": [ @@ -18,6 +18,10 @@ { "name": "Francesco Tamagni", "githubUsername": "mrmacete" + }, + { + "name": "Håvard Sørbø", + "githubUsername": "hsorbo" } ] } diff --git a/types/imagesloaded/package.json b/types/imagesloaded/package.json index 260efcb97879d8..2527b78cff9cf0 100644 --- a/types/imagesloaded/package.json +++ b/types/imagesloaded/package.json @@ -12,10 +12,6 @@ "@types/imagesloaded": "workspace:." }, "owners": [ - { - "name": "Chris Charabaruk", - "githubUsername": "coldacid" - }, { "name": "Cameron Little", "githubUsername": "apexskier" diff --git a/types/jsuri/package.json b/types/jsuri/package.json index 5a869129ccc488..a7d127823aa951 100644 --- a/types/jsuri/package.json +++ b/types/jsuri/package.json @@ -9,10 +9,6 @@ "@types/jsuri": "workspace:." }, "owners": [ - { - "name": "Chris Charabaruk", - "githubUsername": "coldacid" - }, { "name": "Florian Wagner", "githubUsername": "flqw" diff --git a/types/node-powershell/.npmignore b/types/node-powershell/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/node-powershell/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/node-powershell/index.d.ts b/types/node-powershell/index.d.ts deleted file mode 100644 index b3dd88570c8ffd..00000000000000 --- a/types/node-powershell/index.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -/// - -interface NodePowershellShellOptions { - /** - * Determines whether to log verbose to the console. - */ - debugMsg?: boolean | undefined; - - /** - * Sets the input encoding for the current shell. - * @default 'utf8' - */ - inputEncoding?: string | undefined; - - /** - * Sets the output encoding for the current shell. - * @default 'utf8' - */ - outputEncoding?: string | undefined; - - /** - * Sets the default execution policy for the current shell session - */ - executionPolicy?: "Bypass" | undefined; - - /** - * Determines whether to load the Windows PS profile - */ - noProfile?: boolean | undefined; - - /** - * Instructs the Shell the use pwsh as the PowerShell runspace - * @default false - */ - pwsh?: boolean | undefined; - - /** - * Instruct the Shell to use pwsh-preview as the PowerShell runspace. - * @default true - */ - pwshPrev?: boolean | undefined; - - /** - * Determines whether to log verbose to the console. - * @default true - */ - verbose?: boolean | undefined; -} - -interface NodePowerShellStream { - stdin: NodeJS.WritableStream; - stdout: NodeJS.ReadableStream; - err: NodeJS.ReadableStream; -} - -/** - * Structure for a single Shell parameter - */ -interface NodeShellParameter { - /** - * The name of the parameter - */ - name?: string | undefined; - /** - * The value of the parameter - * @remark for switches this should be `''` (empty string), or `undefined` - */ - value?: string | number | boolean | unknown[] | Record | Date | undefined; - - /** - * The name of the parameter with the value as its direct value - * @remark for switches this should be `''` (empty string), or `undefined` - */ - [key: string]: string | number | boolean | unknown[] | Record | Date | undefined; -} - -declare class NodePowershell { - /** - * An object containing the {@link https://nodejs.org/api/child_process.html#child_process_child_stderr sdtio (in, out, err)} - * {@link https://nodejs.org/api/stream.html#stream_class_stream_readable [stream.Readable]} of the PowerShell Instance. - */ - streams: NodePowerShellStream; - - /** - * A number representing the process id the PowerShell instance got. - */ - pid: number; - - /** - * An array containing the commands that currently in the pipeline (before invoke() called). - */ - commands: string[]; - - /** - * An array containing the commands ever invoked in the shell, and their results. - */ - history: unknown[]; - - /** - * A string representing the execution state of the current PowerShell instance - * - * Read more: {@link https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.psinvocationstate?view=powershellsdk-1.1.0} - */ - invocationStateInfo: string; - - /** - * A boolean determines whether to log verbose to the console. - */ - verbose: boolean; - - /** - * Creates a new Shell instance. - * By default this starts a {@link https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-5.1 powershell v5.1} process on Windows, - * and a {@link https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.1 PowerShell Core (pwsh) (>= v7)} process on Linux and macOS. - * - * @remark For the best PowerShell performance **on Windows** it is recommended to set `pwsh` to true and install PowerShell Core - */ - constructor(options?: NodePowershellShellOptions); - - /** - * Adds a command to the end of the pipeline of the shell object. - * @param command A PowerShell command or a path to a PowerShell script. - * @returns A promise that fulfills with the array of commands currently in the pipeline, or rejects with an error. - * @example - * ```ts - * await ps.addCommand('Write-Host "Node-Powershell is pretty cool!"') - * ``` - * @example - * ```ts - * await ps.addCommand('New-Item -ItemType Directory -Force -Path C:\\NodePowerShell | Out-Null') - * ``` - */ - addCommand(command: string): Promise; - - /** - * Listens to events emitted from the shell. - * @param eventName required - Possible events: - * - `output` - Emits when shell has an output. - * - `err` - Emits when shell has an error. - * - `end` - Emits when shell ends. - * @param callback required - Callback function to be called when the event emits. - */ - on(eventName: "output" | "err" | "end", callback: (output: string) => void): void; - - /** - * Adds an argument to the last added command. - * @param argument The argument to add to the last command - * @returns A promise that fulfills with the array of commands currently in the pipeline, or rejects with an error. - * @example - * ```ts - * await ps.addCommand('Write-Host'); - * await ps.addParameter({ ForegroundColor: 'Cyan' }); - * await ps.addArgument('Node-PowerShell is pretty cool!'); - * ``` - */ - addArgument(argument: string): Promise; - - /** - * Adds a parameter to the last added command. - * @param parameter The parameter to add to the last command. - * @returns A promise that fulfills with the array of commands currently in the pipeline, or rejects with an error. - * @example - * ```ts - * await ps.addCommand('Write-Host'); - * await ps.addParameter({ ForegroundColor: 'Cyan' }); - * ``` - */ - addParameter(parameter: NodeShellParameter): Promise; - - /** - * Adds multiple parameters to the last added command. - * @param parameters The parameters array to add to the last command - * @returns A promise that fulfills with the array of commands currently in the pipeline, or rejects with an error. - * @example - * ```ts - * await ps.addCommand('Write-Host "Node-PowerShell is pretty cool!"'); - * await powershell.addParameters([ - * { name: "ForegroundColor", value: "Red" }, - * { name: "BackgroundColor", value: "DarkGray" }, - * { name: "NoNewLine", value: true }, - * ]); - * ``` - */ - addParameters(parameters: NodeShellParameter[]): Promise; - - /** - * Empty the commands array. - * @returns A promise that fulfills with an empty array of commands. - */ - clear(): Promise; - - /** - * Runs the commands currently in the shell object pipeline. - * @returns A promise that fulfills with the output of all the commands that were in the pipeline before the call to this function, or rejects with an error. - */ - invoke(): Promise; - - /** - * Releases all resources used by the shell object and closes the PowerShell `child_process`. - * @returns A promise that fulfills with the exit code of the child_process, or rejects with an error. - */ - dispose(): Promise; -} - -declare namespace NodePowershell { - type ShellOptions = NodePowershellShellOptions; - type PowerShellStream = NodePowerShellStream; - type ShellParameter = NodeShellParameter; -} - -export = NodePowershell; diff --git a/types/node-powershell/node-powershell-tests.ts b/types/node-powershell/node-powershell-tests.ts deleted file mode 100644 index 16284e22f9ad28..00000000000000 --- a/types/node-powershell/node-powershell-tests.ts +++ /dev/null @@ -1,38 +0,0 @@ -import nodePowershell = require("node-powershell"); - -// Set base options -const options: nodePowershell.ShellOptions = { - debugMsg: true, -}; - -// Initialization -const powershell = new nodePowershell(options); - -async function run() { - // Adding commands - await powershell.addCommand("Write-Host \"node-powershell is pretty awesome\""); - - // Adding parameters - // $ExpectType string[] - const afterParameters = await powershell.addParameters([ - { name: "ForegroundColor", value: "Red" }, - { name: "NoNewLine", value: true }, - ]); - - // $ExpectType string - const output = await powershell.invoke(); - - // $ExpectType string - const disposedCode = await powershell.dispose(); -} - -// $ExpectType unknown[] -const history = powershell.history; - -powershell.streams.stdin.write("data"); -powershell.streams.stdout.on("data", (data: any) => {}); - -// Events -powershell.on("output", data => {}); -powershell.on("err", err => {}); -powershell.on("end", code => {}); diff --git a/types/node-powershell/package.json b/types/node-powershell/package.json deleted file mode 100644 index c8b991b3fa4481..00000000000000 --- a/types/node-powershell/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "private": true, - "name": "@types/node-powershell", - "version": "4.0.9999", - "projects": [ - "https://github.com/rannn505/node-powershell" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/node-powershell": "workspace:." - }, - "owners": [ - { - "name": "Rodrigo F. Fernandes", - "githubUsername": "rodrigoff" - }, - { - "name": "Jeroen \"Favna\" Claassens", - "githubUsername": "favna" - } - ] -} diff --git a/types/node-red__flow-parser/package.json b/types/node-red__flow-parser/package.json index ba1a27caaccf1a..cc736b69965a7f 100644 --- a/types/node-red__flow-parser/package.json +++ b/types/node-red__flow-parser/package.json @@ -8,10 +8,5 @@ "devDependencies": { "@types/node-red__flow-parser": "workspace:." }, - "owners": [ - { - "name": "Nasser Oloumi", - "githubUsername": "noloumi" - } - ] + "owners": [] } diff --git a/types/overlayscrollbars/.npmignore b/types/overlayscrollbars/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/overlayscrollbars/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/overlayscrollbars/index.d.ts b/types/overlayscrollbars/index.d.ts deleted file mode 100644 index c11e1b13b180bf..00000000000000 --- a/types/overlayscrollbars/index.d.ts +++ /dev/null @@ -1,412 +0,0 @@ -declare namespace OverlayScrollbars { - type ResizeBehavior = "none" | "both" | "horizontal" | "vertical" | "n" | "b" | "h" | "v"; - - type OverflowBehavior = "hidden" | "scroll" | "visible-hidden" | "visible-scroll" | "h" | "s" | "v-h" | "v-s"; - - type VisibilityBehavior = "visible" | "hidden" | "auto" | "v" | "h" | "a"; - - type AutoHideBehavior = "never" | "scroll" | "leave" | "move" | "n" | "s" | "l" | "m"; - - type ScrollBehavior = "always" | "ifneeded" | "never"; - - type BlockBehavior = "begin" | "end" | "center" | "nearest"; - - type Easing = string | null | undefined; - - type Margin = number | boolean; - - type Position = number | string; - - type Extensions = string | readonly string[] | { [extensionName: string]: {} }; - - type BasicEventCallback = (this: OverlayScrollbars) => void; - - type ScrollEventCallback = (this: OverlayScrollbars, args?: UIEvent) => void; - - type OverflowChangedCallback = (this: OverlayScrollbars, args?: OverflowChangedArgs) => void; - - type OverflowAmountChangedCallback = (this: OverlayScrollbars, args?: OverflowAmountChangedArgs) => void; - - type DirectionChangedCallback = (this: OverlayScrollbars, args?: DirectionChangedArgs) => void; - - type SizeChangedCallback = (this: OverlayScrollbars, args?: SizeChangedArgs) => void; - - type UpdatedCallback = (this: OverlayScrollbars, args?: UpdatedArgs) => void; - - type Coordinates = - | { x?: Position | undefined; y?: Position | undefined } - | { l?: Position | undefined; t?: Position | undefined } - | { left?: Position | undefined; top?: Position | undefined } - | [Position, Position] - | Position - | HTMLElement - | JQuery - | { - el: HTMLElement | JQuery; - scroll?: ScrollBehavior | { x?: ScrollBehavior | undefined; y?: ScrollBehavior | undefined } | [ - ScrollBehavior, - ScrollBehavior, - ] | undefined; - block?: BlockBehavior | { x?: BlockBehavior | undefined; y?: BlockBehavior | undefined } | [ - BlockBehavior, - BlockBehavior, - ] | undefined; - margin?: - | Margin - | { - top?: Margin | undefined; - right?: Margin | undefined; - bottom?: Margin | undefined; - left?: Margin | undefined; - } - | [Margin, Margin] - | [Margin, Margin, Margin, Margin] - | undefined; - }; - - interface OverflowChangedArgs { - x: boolean; - y: boolean; - xScrollable: boolean; - yScrollable: boolean; - clipped: boolean; - } - - interface OverflowAmountChangedArgs { - x: number; - y: number; - } - - interface DirectionChangedArgs { - isRTL: number; - dir: string; - } - - interface SizeChangedArgs { - width: number; - height: number; - } - - interface UpdatedArgs { - forced: boolean; - } - - interface Options { - className?: string | null | undefined; - resize?: ResizeBehavior | undefined; - sizeAutoCapable?: boolean | undefined; - clipAlways?: boolean | undefined; - normalizeRTL?: boolean | undefined; - paddingAbsolute?: boolean | undefined; - autoUpdate?: boolean | null | undefined; - autoUpdateInterval?: number | undefined; - updateOnLoad?: string | readonly string[] | null | undefined; - nativeScrollbarsOverlaid?: { - showNativeScrollbars?: boolean | undefined; - initialize?: boolean | undefined; - } | undefined; - overflowBehavior?: { - x?: OverflowBehavior | undefined; - y?: OverflowBehavior | undefined; - } | undefined; - scrollbars?: { - visibility?: VisibilityBehavior | undefined; - autoHide?: AutoHideBehavior | undefined; - autoHideDelay?: number | undefined; - dragScrolling?: boolean | undefined; - clickScrolling?: boolean | undefined; - touchSupport?: boolean | undefined; - snapHandle?: boolean | undefined; - } | undefined; - textarea?: { - dynWidth?: boolean | undefined; - dynHeight?: boolean | undefined; - inheritedAttrs?: string | readonly string[] | null | undefined; - } | undefined; - callbacks?: { - onInitialized?: BasicEventCallback | null | undefined; - onInitializationWithdrawn?: BasicEventCallback | null | undefined; - onDestroyed?: BasicEventCallback | null | undefined; - onScrollStart?: ScrollEventCallback | null | undefined; - onScroll?: ScrollEventCallback | null | undefined; - onScrollStop?: ScrollEventCallback | null | undefined; - onOverflowChanged?: OverflowChangedCallback | null | undefined; - onOverflowAmountChanged?: OverflowAmountChangedCallback | null | undefined; - onDirectionChanged?: DirectionChangedCallback | null | undefined; - onContentSizeChanged?: SizeChangedCallback | null | undefined; - onHostSizeChanged?: SizeChangedCallback | null | undefined; - onUpdated?: UpdatedCallback | null | undefined; - } | undefined; - } - - interface ScrollInfo { - position: { - x: number; - y: number; - }; - ratio: { - x: number; - y: number; - }; - max: { - x: number; - y: number; - }; - handleOffset: { - x: number; - y: number; - }; - handleLength: { - x: number; - y: number; - }; - handleLengthRatio: { - x: number; - y: number; - }; - trackLength: { - x: number; - y: number; - }; - snappedHandleOffset: { - x: number; - y: number; - }; - isRTL: boolean; - isRTLNormalized: boolean; - } - - interface Elements { - target: HTMLElement; - host: HTMLElement; - padding: HTMLElement; - viewport: HTMLElement; - content: HTMLElement; - scrollbarHorizontal: { - scrollbar: HTMLElement; - track: HTMLElement; - handle: HTMLElement; - }; - scrollbarVertical: { - scrollbar: HTMLElement; - track: HTMLElement; - handle: HTMLElement; - }; - scrollbarCorner: HTMLElement; - } - - interface State { - destroyed: boolean; - sleeping: boolean; - autoUpdate: boolean; - widthAuto: boolean; - heightAuto: boolean; - documentMixed: boolean; - padding: { - t: number; - r: number; - b: number; - l: number; - }; - overflowAmount: { - x: number; - y: number; - }; - hideOverflow: { - x: boolean; - y: boolean; - xs: boolean; - ys: boolean; - }; - hasOverflow: { - x: boolean; - y: boolean; - }; - contentScrollSize: { - width: number; - height: number; - }; - viewportSize: { - width: number; - height: number; - }; - hostSize: { - width: number; - height: number; - }; - } - - interface Extension { - contract(global: any): boolean; - - added(options?: {}): void; - - removed(): void; - - on( - callbackName: string, - callbackArgs?: - | UIEvent - | OverflowChangedArgs - | OverflowAmountChangedArgs - | DirectionChangedArgs - | SizeChangedArgs - | UpdatedArgs, - ): void; - } - - interface ExtensionInfo { - name: string; - extensionFactory: ( - this: OverlayScrollbars, - defaultOptions: {}, - compatibility: Compatibility, - framework: any, - ) => Extension; - defaultOptions?: {} | undefined; - } - - interface Globals { - defaultOptions: {}; - autoUpdateLoop: boolean; - autoUpdateRecommended: boolean; - supportMutationObserver: boolean; - supportResizeObserver: boolean; - supportPassiveEvents: boolean; - supportTransform: boolean; - supportTransition: boolean; - restrictedMeasuring: boolean; - nativeScrollbarStyling: boolean; - cssCalc: string | null; - nativeScrollbarSize: { - x: number; - y: number; - }; - nativeScrollbarIsOverlaid: { - x: boolean; - y: boolean; - }; - overlayScrollbarDummySize: { - x: number; - y: number; - }; - rtlScrollBehavior: { - i: boolean; - n: boolean; - }; - } - - interface Compatibility { - wW(): number; - wH(): number; - mO(): any; - rO(): any; - rAF(): (callback: (...args: any[]) => any) => number; - cAF(): (requestID: number) => void; - now(): number; - stpP(event: Event): void; - prvD(event: Event): void; - page(event: MouseEvent): { x: number; y: number }; - mBtn(event: MouseEvent): number; - inA(item: T, array: T[]): number; - isA(obj: any): boolean; - type(obj: any): string; - bind(func: (...args: any[]) => any, thisObj: any, ...args: any[]): any; - } -} - -interface OverlayScrollbars { - options(): OverlayScrollbars.Options; - options(options: OverlayScrollbars.Options): void; - options(optionName: string): any; - options(optionName: string, optionValue: {} | null): void; - - update(force?: boolean): void; - - sleep(): void; - - scroll(): OverlayScrollbars.ScrollInfo; - scroll( - coordinates: OverlayScrollbars.Coordinates, - duration?: number, - easing?: OverlayScrollbars.Easing | { - x?: OverlayScrollbars.Easing | undefined; - y?: OverlayScrollbars.Easing | undefined; - } | [OverlayScrollbars.Easing, OverlayScrollbars.Easing], - complete?: (...args: any[]) => any, - ): void; - scroll(coordinates: OverlayScrollbars.Coordinates, options: {}): void; - - scrollStop(): OverlayScrollbars; - - getElements(): OverlayScrollbars.Elements; - getElements(elementName: string): any; - - getState(): OverlayScrollbars.State; - getState(stateProperty: string): any; - - destroy(): void; - - ext(): {}; - ext(extensionName: string): OverlayScrollbars.Extension; - - addExt(extensionName: string, options: {}): OverlayScrollbars.Extension; - - removeExt(extensionName: string): boolean; -} - -interface OverlayScrollbarsStatic { - ( - element: HTMLElement | Element | JQuery, - options: OverlayScrollbars.Options, - extensions?: OverlayScrollbars.Extensions, - ): OverlayScrollbars; - ( - element: HTMLElement | Element | JQuery | null, - ): OverlayScrollbars | undefined; - - ( - elements: NodeListOf | readonly Element[] | JQuery, - options: OverlayScrollbars.Options, - extensions?: OverlayScrollbars.Extensions, - ): OverlayScrollbars | OverlayScrollbars[] | undefined; - ( - elements: NodeListOf | readonly Element[] | JQuery, - filter?: string | ((element: Element, instance: OverlayScrollbars) => boolean), - ): OverlayScrollbars | OverlayScrollbars[] | undefined; - - globals(): OverlayScrollbars.Globals; - - defaultOptions(): OverlayScrollbars.Options; - defaultOptions(newDefaultOptions: OverlayScrollbars.Options): void; - - extension(): { [index: number]: OverlayScrollbars.ExtensionInfo; length: number }; - extension(extensionName: string): OverlayScrollbars.ExtensionInfo; - extension( - extensionName: string, - extensionFactory: ( - this: OverlayScrollbars, - defaultOptions: {}, - compatibility: OverlayScrollbars.Compatibility, - framework: any, - ) => OverlayScrollbars.Extension, - defaultOptions?: {}, - ): void; - extension(extensionName: string, extensionFactory: null | undefined): void; - - valid(osInstance: any): boolean; -} - -interface JQuery { - overlayScrollbars( - options: OverlayScrollbars.Options, - extensions?: OverlayScrollbars.Extensions, - ): JQuery; - overlayScrollbars( - filter?: string | ((element: Element, instance: OverlayScrollbars) => boolean), - ): OverlayScrollbars | OverlayScrollbars[] | undefined; -} - -export as namespace OverlayScrollbars; -export = OverlayScrollbars; -declare const OverlayScrollbars: OverlayScrollbarsStatic; diff --git a/types/overlayscrollbars/overlayscrollbars-tests.ts b/types/overlayscrollbars/overlayscrollbars-tests.ts deleted file mode 100644 index 49a84bddd94346..00000000000000 --- a/types/overlayscrollbars/overlayscrollbars-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -function test_init() { - // body is guaranteed a single element - const osInstanceBody: OverlayScrollbars = OverlayScrollbars(document.body, {}); - - // elementById is a single element or null - const elementById: HTMLElement | null = document.getElementById("os"); - if (elementById != null) { - // OverlayScrollbars can't be initialized with null as element - const osInstanceId: OverlayScrollbars = OverlayScrollbars(elementById, {}); - } - - // elementsQuerySelector can be a empty-array, a single-item-array or a multi-item-array - const elementsQuerySelector: NodeListOf = document.querySelectorAll(".os"); - if (elementsQuerySelector.length > 0) { - // its up to the user to cast the result properly - if (elementsQuerySelector.length === 1) { - const osInstance: OverlayScrollbars = OverlayScrollbars(elementsQuerySelector, {}); - } else { - const osInstances: OverlayScrollbars[] = OverlayScrollbars(elementsQuerySelector, {}); - } - } -} - -function test_getInstance() { - // body is guaranteed a single element, but the plugin might not be initialized to it - const osInstanceBody: OverlayScrollbars | undefined = OverlayScrollbars(document.body); - - // elementById is a single element or null, but the plugin might not be initialized to it if not null - const osInstanceId: OverlayScrollbars | undefined = OverlayScrollbars(document.getElementById("os")); - - // elementsQuerySelector can be a empty-array, a single-item-array or a multi-item-array - const elementsQuerySelector: NodeListOf = document.querySelectorAll(".os"); - if (elementsQuerySelector.length > 0) { - // its up to the user to cast the result properly - if (elementsQuerySelector.length === 1) { - const osInstance: OverlayScrollbars = OverlayScrollbars(elementsQuerySelector); - } else { - const osInstances: OverlayScrollbars[] = OverlayScrollbars(elementsQuerySelector); - } - } -} diff --git a/types/overlayscrollbars/package.json b/types/overlayscrollbars/package.json deleted file mode 100644 index e3f0d88b7953e0..00000000000000 --- a/types/overlayscrollbars/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/overlayscrollbars", - "version": "1.12.9999", - "projects": [ - "https://kingsora.github.io/OverlayScrollbars" - ], - "devDependencies": { - "@types/overlayscrollbars": "workspace:." - }, - "owners": [ - { - "name": "KingSora", - "githubUsername": "KingSora" - } - ] -} diff --git a/types/overlayscrollbars/tsconfig.json b/types/overlayscrollbars/tsconfig.json deleted file mode 100644 index af74f3f292ab69..00000000000000 --- a/types/overlayscrollbars/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "overlayscrollbars-tests.ts" - ] -} diff --git a/types/promise-pg/package.json b/types/promise-pg/package.json index 99d558fb70f664..45904ed31058ea 100644 --- a/types/promise-pg/package.json +++ b/types/promise-pg/package.json @@ -13,10 +13,5 @@ "devDependencies": { "@types/promise-pg": "workspace:." }, - "owners": [ - { - "name": "Chris Charabaruk", - "githubUsername": "coldacid" - } - ] + "owners": [] } diff --git a/types/qs/index.d.ts b/types/qs/index.d.ts index 972eddac222e9a..b993ed432437b4 100644 --- a/types/qs/index.d.ts +++ b/types/qs/index.d.ts @@ -58,6 +58,7 @@ declare namespace QueryString { allowEmptyArrays?: boolean | undefined; duplicates?: "combine" | "first" | "last" | undefined; strictDepth?: boolean | undefined; + throwOnLimitExceeded?: boolean | undefined; } type IParseDynamicOptions = AllowDots extends true diff --git a/types/qs/package.json b/types/qs/package.json index 6e5c9f64273147..fd2fb44cc0e4c3 100644 --- a/types/qs/package.json +++ b/types/qs/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/qs", - "version": "6.9.9999", + "version": "6.14.9999", "projects": [ "https://github.com/ljharb/qs" ], diff --git a/types/qs/qs-tests.ts b/types/qs/qs-tests.ts index b8589c67848cb6..3c32e1dda03985 100644 --- a/types/qs/qs-tests.ts +++ b/types/qs/qs-tests.ts @@ -411,6 +411,21 @@ qs.parse("a=b&c=d", { delimiter: "&" }); } }); +(() => { + assert.deepEqual(qs.parse("a=1&b=2&c=3", { parameterLimit: 5, throwOnLimitExceeded: true }), { + a: "1", + b: "2", + c: "3", + }); +}); + +(() => { + assert.throws( + () => qs.parse("a=1&b=2&c=3", { parameterLimit: 2, throwOnLimitExceeded: true }), + RangeError, + ); +}); + declare const myQuery: { a: string; b?: string | undefined }; const myQueryCopy: qs.ParsedQs = myQuery; diff --git a/types/react-bootstrap/.eslintrc.json b/types/react-bootstrap/.eslintrc.json deleted file mode 100644 index 7caffad4c91481..00000000000000 --- a/types/react-bootstrap/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "rules": { - "@definitelytyped/no-self-import": "off", - "@definitelytyped/strict-export-declare-modifiers": "off", - "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-wrapper-object-types": "off", - "@definitelytyped/no-duplicate-imports": "off", - "@typescript-eslint/explicit-member-accessibility": "off" - } -} diff --git a/types/react-bootstrap/.npmignore b/types/react-bootstrap/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/react-bootstrap/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/react-bootstrap/README.md b/types/react-bootstrap/README.md deleted file mode 100644 index ec1bfc027ff7b9..00000000000000 --- a/types/react-bootstrap/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# react-bootstrap - -## Intended compatibilty -This library is intended for releases of react-bootstrap prior to `v1.0.0`, e.g. `v0.32.4`. - -The reason is that react-bootstrap `v1.0.0` targets Bootstrap v4, and includes its own -typings. react-bootstrap prior to `v1.0.0` targets Bootstrap v3 and does not include any -typings. - -It does not make sense for everyone to upgrade to Bootstrap v4, therefore these typings -are useful for everyone that wants to stay on Bootstrap v3 and react-bootstrap prior to `v1.0.0`. - -The typings for `v1.0.0` were merged in [this pull request](https://github.com/react-bootstrap/react-bootstrap/commit/2079b2292afb835d036fcceef47e8938c4a8d86a). diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts deleted file mode 100644 index ef0be178bca747..00000000000000 --- a/types/react-bootstrap/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as React from "react"; - -export type Omit = Pick< - T, - ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never; [x: number]: never })[keyof T] ->; - -export type Sizes = "xs" | "xsmall" | "sm" | "small" | "medium" | "lg" | "large"; - -export interface SelectCallback extends React.EventHandler { - (eventKey: any, e: React.SyntheticEvent<{}>): void; - /** - * @deprecated - * This signature is a hack so can still derive from HTMLProps. - * It does not reflect the underlying event and should not be used. - */ - (e: React.MouseEvent<{}>): void; -} - -export interface TransitionCallbacks { - onEnter?(node: HTMLElement): any; - onEntered?(node: HTMLElement): any; - onEntering?(node: HTMLElement): any; - onExit?(node: HTMLElement): any; - onExited?(node: HTMLElement): any; - onExiting?(node: HTMLElement): any; -} - -export * from "./lib"; -export as namespace ReactBootstrap; diff --git a/types/react-bootstrap/lib/Accordion.d.ts b/types/react-bootstrap/lib/Accordion.d.ts deleted file mode 100644 index 6233b18912f559..00000000000000 --- a/types/react-bootstrap/lib/Accordion.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as React from "react"; -import { Sizes } from "react-bootstrap"; - -declare namespace Accordion { - export interface AccordionProps extends React.HTMLProps { - bsSize?: Sizes | undefined; - bsStyle?: string | undefined; - collapsible?: boolean | undefined; - defaultExpanded?: boolean | undefined; - eventKey?: any; - expanded?: boolean | undefined; - footer?: React.ReactNode | undefined; - header?: React.ReactNode | undefined; - } -} -declare class Accordion extends React.Component {} -export = Accordion; diff --git a/types/react-bootstrap/lib/Alert.d.ts b/types/react-bootstrap/lib/Alert.d.ts deleted file mode 100644 index c83526e8b951bc..00000000000000 --- a/types/react-bootstrap/lib/Alert.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as React from "react"; -import { Sizes } from "react-bootstrap"; - -declare namespace Alert { - export interface AlertProps extends React.HTMLProps { - bsSize?: Sizes | undefined; - bsStyle?: string | undefined; - bsClass?: string | undefined; - closeLabel?: string | undefined; - /** @deprecated since v0.29.0 */ dismissAfter?: number | undefined; - // TODO: Add more specific type - onDismiss?: Function | undefined; - } -} -declare class Alert extends React.Component {} -export = Alert; diff --git a/types/react-bootstrap/lib/Badge.d.ts b/types/react-bootstrap/lib/Badge.d.ts deleted file mode 100644 index ad9d534204490a..00000000000000 --- a/types/react-bootstrap/lib/Badge.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as React from "react"; - -declare namespace Badge { - export interface BadgeProps extends React.HTMLProps { - bsClass?: string | undefined; - pullRight?: boolean | undefined; - } -} -declare class Badge extends React.Component {} -export = Badge; diff --git a/types/react-bootstrap/lib/Breadcrumb.d.ts b/types/react-bootstrap/lib/Breadcrumb.d.ts deleted file mode 100644 index e89fcd04fe9114..00000000000000 --- a/types/react-bootstrap/lib/Breadcrumb.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as React from "react"; -import * as BreadcrumbItem from "./BreadcrumbItem"; - -declare namespace Breadcrumb { - interface BreadcrumbProps extends React.HTMLProps { - bsClass?: string | undefined; - } -} -declare class Breadcrumb extends React.Component { - public static Item: typeof BreadcrumbItem; -} -export = Breadcrumb; diff --git a/types/react-bootstrap/lib/BreadcrumbItem.d.ts b/types/react-bootstrap/lib/BreadcrumbItem.d.ts deleted file mode 100644 index 2b97c96a3b87f4..00000000000000 --- a/types/react-bootstrap/lib/BreadcrumbItem.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as React from "react"; - -declare namespace BreadcrumbItem { - export interface BreadcrumbItemProps extends React.RefAttributes { - children?: React.ReactNode; - active?: boolean | undefined; - href?: string | undefined; - title?: React.ReactNode | undefined; - target?: string | undefined; - } -} -declare class BreadcrumbItem extends React.Component {} -export = BreadcrumbItem; diff --git a/types/react-bootstrap/lib/Button.d.ts b/types/react-bootstrap/lib/Button.d.ts deleted file mode 100644 index 9521bee004c80a..00000000000000 --- a/types/react-bootstrap/lib/Button.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as React from "react"; -import { Sizes } from "react-bootstrap"; - -declare namespace Button { - export interface ButtonProps extends React.HTMLProps - - - - - - - - - Item - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - -
-
- -
-
- - Input with success - - Help text with validation state. - - - - Input with warning - - - - - Input with error - - - - - Input with success and feedback icon - - - - - - Input with warning and feedback icon - - - - - - Input with error and feedback icon - - - - - - Input with success and custom feedback icon - - - - - - - - Input group with warning - - @ - - - - - - - - - Input with error - - - - - - - - - - Input group with success - - - - @ - - - - - -
- -
- - Input with warning - - {" "} - - Input group with error{" "} - - @ - - - - -
- - - Checkbox with success - - - Radio with warning - - - Checkbox with error - - - {/* This requires React 15's -less spaces to be exactly correct. */} - - - Checkbox - {" "} - - with - {" "} - - success - - - -
- -
-
- - Control Label - - - Help block message. - - - - 1 2 - {" "} - 3 - - - 1 2{" "} - 3 - -
-
- -
- - - Image - - - Top aligned media -

- Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum - nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus. -

-

- Donec sed odio dui. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis - natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. -

-
-
-
- -
- - - - Checkbox 1 (pre-checked) - - - Checkbox 2 - - - Checkbox 3 (pre-checked) - - - - - - - - Radio 1 (pre-checked) - - - Radio 2 - - - Radio 3 - - - -
- -
- Collapse -
- - ); - } -} diff --git a/types/react-bootstrap/tsconfig.json b/types/react-bootstrap/tsconfig.json deleted file mode 100644 index 2c7465a21aa70a..00000000000000 --- a/types/react-bootstrap/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "jsx": "react", - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "noUnusedLocals": false - }, - "files": [ - "index.d.ts", - "test/react-bootstrap-tests.tsx", - "test/react-bootstrap-individual-components-tests.tsx" - ] -} diff --git a/types/react-router-bootstrap/package.json b/types/react-router-bootstrap/package.json index de24a020470c98..046dd65a6fd444 100644 --- a/types/react-router-bootstrap/package.json +++ b/types/react-router-bootstrap/package.json @@ -9,7 +9,7 @@ "@types/react": "*" }, "devDependencies": { - "@types/react-bootstrap": "*", + "@types/react-bootstrap": "<2", "@types/react-router-bootstrap": "workspace:." }, "owners": [ diff --git a/types/swagger-ui/package.json b/types/swagger-ui/package.json index 2a37b55ce013be..98c68b2941243e 100644 --- a/types/swagger-ui/package.json +++ b/types/swagger-ui/package.json @@ -23,10 +23,6 @@ "@types/swagger-ui": "workspace:." }, "owners": [ - { - "name": "Julian Pfeil", - "githubUsername": "juarrow" - }, { "name": "Piotr Błażejewicz", "githubUsername": "peterblazejewicz"