@types/chrome 0.0.277 → 0.0.278

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +153 -0
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (http://developer.chrome.com/e
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 04 Oct 2024 16:42:27 GMT
11
+ * Last updated: Mon, 14 Oct 2024 18:09:31 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -6926,6 +6926,159 @@ declare namespace chrome.printerProvider {
6926
6926
  export var onPrintRequested: PrintRequestedEvent;
6927
6927
  }
6928
6928
 
6929
+ ////////////////////
6930
+ // Printing
6931
+ ////////////////////
6932
+ /**
6933
+ * Use the chrome.printing API to send print jobs to printers installed on Chromebook.
6934
+
6935
+ * Permissions: "printing"
6936
+ * @platform ChromeOS only
6937
+ * @since Chrome 81
6938
+ */
6939
+ declare namespace chrome.printing {
6940
+ export interface GetPrinterInfoResponse {
6941
+ /** Printer capabilities in [CDD format](https://developers.google.com/cloud-print/docs/cdd#cdd-example). The property may be missing. */
6942
+ capabilities?: { [key: string]: unknown };
6943
+ /** The status of the printer. */
6944
+ status: PrinterStatus;
6945
+ }
6946
+
6947
+ /** Status of the print job. */
6948
+ export enum JobStatus {
6949
+ /** Print job is received on Chrome side but was not processed yet. */
6950
+ PENDING = "PENDING",
6951
+ /** Print job is sent for printing. */
6952
+ IN_PROGRESS = "IN_PROGRESS",
6953
+ /** Print job was interrupted due to some error. */
6954
+ FAILED = "FAILED",
6955
+ /** Print job was canceled by the user or via API. */
6956
+ CANCELED = "CANCELED",
6957
+ /** Print job was printed without any errors. */
6958
+ PRINTED = "PRINTED",
6959
+ }
6960
+
6961
+ export interface Printer {
6962
+ /** The human-readable description of the printer. */
6963
+ description: string;
6964
+ /** The printer's identifier; guaranteed to be unique among printers on the device. */
6965
+ id: string;
6966
+ /** The flag which shows whether the printer fits DefaultPrinterSelection rules. Note that several printers could be flagged. */
6967
+ isDefault: boolean;
6968
+ /** The name of the printer. */
6969
+ name: string;
6970
+ /**
6971
+ * The value showing how recent the printer was used for printing from Chrome.
6972
+ * The lower the value is the more recent the printer was used.
6973
+ * The minimum value is 0.
6974
+ * Missing value indicates that the printer wasn't used recently.
6975
+ * This value is guaranteed to be unique amongst printers.
6976
+ */
6977
+ recentlyUsedRank?: number;
6978
+ /** The source of the printer (user or policy configured). */
6979
+ source: PrinterSource;
6980
+ /** The printer URI. This can be used by extensions to choose the printer for the user. */
6981
+ uri: string;
6982
+ }
6983
+
6984
+ /** The source of the printer. */
6985
+ export enum PrinterSource {
6986
+ /** Printer was added by user. */
6987
+ USER = "USER",
6988
+ /** Printer was added via policy. */
6989
+ POLICY = "POLICY",
6990
+ }
6991
+
6992
+ /** The status of the printer. */
6993
+ export enum PrinterStatus {
6994
+ /** The door of the printer is open. Printer still accepts print jobs. */
6995
+ DOOR_OPEN = "DOOR_OPEN",
6996
+ /** The tray of the printer is missing. Printer still accepts print jobs. */
6997
+ TRAY_MISSING = "TRAY_MISSING",
6998
+ /** The printer is out of ink. Printer still accepts print jobs. */
6999
+ OUT_OF_INK = "OUT_OF_INK",
7000
+ /** The printer is out of paper. Printer still accepts print jobs. */
7001
+ OUT_OF_PAPER = "OUT_OF_PAPER",
7002
+ /** The output area of the printer (e.g. tray) is full. Printer still accepts print jobs. */
7003
+ OUTPUT_FULL = "OUTPUT_FULL",
7004
+ /** The printer has a paper jam. Printer still accepts print jobs. */
7005
+ PAPER_JAM = "PAPER_JAM",
7006
+ /** Some generic issue. Printer still accepts print jobs. */
7007
+ GENERIC_ISSUE = "GENERIC_ISSUE",
7008
+ /** The printer is stopped and doesn't print but still accepts print jobs. */
7009
+ STOPPED = "STOPPED",
7010
+ /** The printer is unreachable and doesn't accept print jobs. */
7011
+ UNREACHABLE = "UNREACHABLE",
7012
+ /** The SSL certificate is expired. Printer accepts jobs but they fail. */
7013
+ EXPIRED_CERTIFICATE = "EXPIRED_CERTIFICATE",
7014
+ /** The printer is available. */
7015
+ AVAILABLE = "AVAILABLE",
7016
+ }
7017
+
7018
+ export interface SubmitJobRequest {
7019
+ /**
7020
+ * The print job to be submitted.
7021
+ * The only supported content type is "application/pdf", and the Cloud Job Ticket shouldn't include FitToPageTicketItem, PageRangeTicketItem, ReverseOrderTicketItem and VendorTicketItem fields since they are irrelevant for native printing.
7022
+ * All other fields must be present.
7023
+ */
7024
+ job: chrome.printerProvider.PrintJob;
7025
+ }
7026
+
7027
+ export interface SubmitJobResponse {
7028
+ /** The id of created print job. This is a unique identifier among all print jobs on the device. If status is not OK, jobId will be null. */
7029
+ jobId: string | null;
7030
+ /** The status of the request. */
7031
+ status: SubmitJobStatus;
7032
+ }
7033
+
7034
+ /** The status of submitJob request. */
7035
+ export enum SubmitJobStatus {
7036
+ /** Sent print job request is accepted. */
7037
+ OK = "OK",
7038
+ /** Sent print job request is rejected by the user. */
7039
+ USER_REJECTED = "USER_REJECTED",
7040
+ }
7041
+
7042
+ /** The maximum number of times that getPrinterInfo can be called per minute. */
7043
+ export const MAX_GET_PRINTER_INFO_CALLS_PER_MINUTE: 20;
7044
+
7045
+ /** The maximum number of times that submitJob can be called per minute. */
7046
+ export const MAX_SUBMIT_JOB_CALLS_PER_MINUTE: 40;
7047
+
7048
+ /**
7049
+ * Cancels previously submitted job.
7050
+ * Can return its result via Promise in Manifest V3 or later since Chrome 100.
7051
+ */
7052
+ export function cancelJob(jobId: string): Promise<void>;
7053
+ export function cancelJob(jobId: string, callback: () => void): void;
7054
+
7055
+ /**
7056
+ * Returns the status and capabilities of the printer in CDD format. This call will fail with a runtime error if no printers with given id are installed.
7057
+ * Can return its result via Promise in Manifest V3 or later since Chrome 100.
7058
+ */
7059
+ export function getPrinterInfo(printerId: string): Promise<GetPrinterInfoResponse>;
7060
+ export function getPrinterInfo(printerId: string, callback: (response: GetPrinterInfoResponse) => void): void;
7061
+
7062
+ /**
7063
+ * Returns the list of available printers on the device. This includes manually added, enterprise and discovered printers.
7064
+ * Can return its result via Promise in Manifest V3 or later since Chrome 100.
7065
+ */
7066
+ export function getPrinters(): Promise<Printer[]>;
7067
+ export function getPrinters(callback: (printers: Printer[]) => void): void;
7068
+
7069
+ /**
7070
+ * Submits the job for printing. If the extension is not listed in the PrintingAPIExtensionsAllowlist policy, the user is prompted to accept the print job.
7071
+ * Can return its result via Promise in Manifest V3 or later since Chrome 120.
7072
+ */
7073
+ export function submitJob(request: SubmitJobRequest): Promise<SubmitJobResponse>;
7074
+ export function submitJob(request: SubmitJobRequest, callback: (response: SubmitJobResponse) => void): void;
7075
+
7076
+ /**
7077
+ * Event fired when the status of the job is changed. This is only fired for the jobs created by this extension.
7078
+ */
7079
+ export const onJobStatusChanged: chrome.events.Event<(jobId: string, status: JobStatus) => void>;
7080
+ }
7081
+
6929
7082
  ////////////////////
6930
7083
  // Privacy
6931
7084
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.277",
3
+ "version": "0.0.278",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -93,6 +93,6 @@
93
93
  "@types/filesystem": "*",
94
94
  "@types/har-format": "*"
95
95
  },
96
- "typesPublisherContentHash": "195718df3b8f342b4fc5eb96ad1c9d561e403a64a5ad238d9cad1dc357706603",
96
+ "typesPublisherContentHash": "887e3fa4cc8ffda1e14db7ffcbf365d014000b05fae878791a3ea1b2adbe8a0c",
97
97
  "typeScriptVersion": "4.8"
98
98
  }