Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions types/aws-lambda/trigger/sns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export interface SNSMessage {
SignatureVersion: string;
Timestamp: string;
Signature: string;
SigningCertUrl: string;
SigningCertUrl: string; // Not SigningCertURL; see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73817#issuecomment-3367340170
MessageId: string;
Message: string;
MessageAttributes: SNSMessageAttributes;
Type: string;
UnsubscribeUrl: string;
UnsubscribeUrl: string; // Not UnsubscribeURL; see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73817#issuecomment-3367340170
TopicArn: string;
Subject?: string;
Token?: string;
Expand Down
77 changes: 41 additions & 36 deletions types/chrome/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10156,69 +10156,74 @@ declare namespace chrome {
* Permissions: "system.storage"
*/
export namespace system.storage {
export enum EjectDeviceResultCode {
/** The ejection command is successful -- the application can prompt the user to remove the device. */
SUCCESS = "success",
/** The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device. */
IN_USE = "in_use",
/** There is no such device known. */
NO_SUCH_DEVICE = "no_such_device",
/** The ejection command failed. */
FAILURE = "failure",
}

export interface StorageUnitInfo {
/** The transient ID that uniquely identifies the storage device. This ID will be persistent within the same run of a single application. It will not be a persistent identifier between different runs of an application, or between different applications. */
id: string;
/** The name of the storage unit. */
name: string;
/**
* The media type of the storage unit.
* fixed: The storage has fixed media, e.g. hard disk or SSD.
* removable: The storage is removable, e.g. USB flash drive.
* unknown: The storage type is unknown.
*/
type: string;
/** The media type of the storage unit. */
type: `${StorageUnitType}`;
/** The total amount of the storage space, in bytes. */
capacity: number;
}

export interface StorageCapacityInfo {
/** A copied |id| of getAvailableCapacity function parameter |id|. */
export enum StorageUnitType {
/** The storage has fixed media, e.g. hard disk or SSD. */
FIXED = "fixed",
/** The storage is removable, e.g. USB flash drive. */
REMOVABLE = "removable",
/** The storage type is unknown. */
UNKNOWN = "unknown",
}

export interface StorageAvailableCapacityInfo {
/** A copied `id` of getAvailableCapacity function parameter `id`. */
id: string;
/** The available capacity of the storage device, in bytes. */
availableCapacity: number;
}

export interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {}

export interface SystemStorageDetachedEvent extends chrome.events.Event<(id: string) => void> {}

/** Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. */
export function getInfo(callback: (info: StorageUnitInfo[]) => void): void;
/**
* Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects.
* @return The `getInfo` method provides its result via callback or returned as a `Promise` (MV3 only).
*
* Can return its result via Promise in Manifest V3 or later since Chrome 91.
*/
export function getInfo(): Promise<StorageUnitInfo[]>;
export function getInfo(callback: (info: StorageUnitInfo[]) => void): void;

/**
* Ejects a removable storage device.
* @param callback
* Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed.
*/
export function ejectDevice(id: string, callback: (result: string) => void): void;
/**
* Ejects a removable storage device.
* @param callback
* Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed.
* @return The `ejectDevice` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function ejectDevice(id: string): Promise<string>;
/**
* Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo.
* @since Dev channel only.
*
* Can return its result via Promise in Manifest V3 or later since Chrome 91.
*/
export function getAvailableCapacity(id: string, callback: (info: StorageCapacityInfo) => void): void;
export function ejectDevice(id: string): Promise<`${EjectDeviceResultCode}`>;
export function ejectDevice(id: string, callback: (result: `${EjectDeviceResultCode}`) => void): void;

/**
* Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo.
* Get the available capacity of a specified `id` storage device. The `id` is the transient device ID from StorageUnitInfo.
*
* Can return its result via Promise in Manifest V3.
* @since Dev channel only.
* @return The `getAvailableCapacity` method provides its result via callback or returned as a `Promise` (MV3 only).
*/
export function getAvailableCapacity(id: string): Promise<StorageCapacityInfo>;
export function getAvailableCapacity(id: string): Promise<StorageAvailableCapacityInfo>;
export function getAvailableCapacity(id: string, callback: (info: StorageAvailableCapacityInfo) => void): void;

/** Fired when a new removable storage is attached to the system. */
export var onAttached: SystemStorageAttachedEvent;
export const onAttached: events.Event<(info: StorageUnitInfo) => void>;

/** Fired when a removable storage is detached from the system. */
export var onDetached: SystemStorageDetachedEvent;
export const onDetached: events.Event<(id: string) => void>;
}

////////////////////
Expand Down
49 changes: 44 additions & 5 deletions types/chrome/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2863,11 +2863,50 @@ async function testSystemCpu() {
chrome.system.cpu.getInfo(() => {}).then(() => {});
}

// https://developer.chrome.com/docs/extensions/reference/system_storage
async function testSystemStorageForPromise() {
await chrome.system.storage.getInfo();
await chrome.system.storage.ejectDevice("id1");
await chrome.system.storage.getAvailableCapacity("id1");
// https://developer.chrome.com/docs/extensions/reference/api/system/storage
async function testSystemStorage() {
chrome.system.storage.EjectDeviceResultCode.FAILURE === "failure";
chrome.system.storage.EjectDeviceResultCode.IN_USE === "in_use";
chrome.system.storage.EjectDeviceResultCode.NO_SUCH_DEVICE === "no_such_device";
chrome.system.storage.EjectDeviceResultCode.SUCCESS === "success";

chrome.system.storage.StorageUnitType.FIXED === "fixed";
chrome.system.storage.StorageUnitType.REMOVABLE === "removable";
chrome.system.storage.StorageUnitType.UNKNOWN === "unknown";

const id = "id";
chrome.system.storage.ejectDevice(id); // $ExpectType Promise<"success" | "in_use" | "no_such_device" | "failure">
chrome.system.storage.ejectDevice(id, (result) => { // $ExpectType void
result; // $ExpectType "success" | "in_use" | "no_such_device" | "failure"
});
// @ts-expect-error
chrome.system.storage.ejectDevice(id, () => {}).then(() => {});

chrome.system.storage.getAvailableCapacity(id); // $ExpectType Promise<StorageAvailableCapacityInfo>
chrome.system.storage.getAvailableCapacity(id, (info) => { // $ExpectType void
info.availableCapacity; // $ExpectType number
info.id; // $ExpectType string
});
// @ts-expect-error
chrome.system.storage.getAvailableCapacity(id, () => {}).then(() => {});

chrome.system.storage.getInfo(); // $ExpectType Promise<StorageUnitInfo[]>
chrome.system.storage.getInfo((units) => { // $ExpectType void
units; // $ExpectType StorageUnitInfo[]
});
// @ts-expect-error
chrome.system.storage.getInfo(() => {}).then(() => {});

checkChromeEvent(chrome.system.storage.onAttached, (info) => {
info.capacity; // $ExpectType number
info.id; // $ExpectType string
info.name; // $ExpectType string
info.type; // $ExpectType "fixed" | "removable" | "unknown"
});

checkChromeEvent(chrome.system.storage.onDetached, (id) => {
id; // $ExpectType string
});
}

// https://developer.chrome.com/docs/extensions/reference/api/system/display
Expand Down
7 changes: 0 additions & 7 deletions types/dhtmlxscheduler/.eslintrc.json

This file was deleted.

43 changes: 0 additions & 43 deletions types/dhtmlxscheduler/dhtmlxscheduler-tests.ts

This file was deleted.

Loading