@types/chrome 0.0.277 → 0.0.279

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +283 -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, 21 Oct 2024 17:07:38 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,289 @@ 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
+
7082
+ ////////////////////
7083
+ // Printing Metrics
7084
+ ////////////////////
7085
+ /**
7086
+ * Use the chrome.printingMetrics API to fetch data about printing usage.
7087
+ *
7088
+ * Permissions: "printingMetrics"
7089
+ *
7090
+ * Note: This API is only for extensions pre-installed by policy.
7091
+ * @platform ChromeOS only
7092
+ * @since Chrome 79
7093
+ */
7094
+ declare namespace chrome.printingMetrics {
7095
+ export enum ColorMode {
7096
+ /** Specifies that black and white mode was used. */
7097
+ BLACK_AND_WHITE = "BLACK_AND_WHITE",
7098
+ /** Specifies that color mode was used. */
7099
+ COLOR = "COLOR",
7100
+ }
7101
+
7102
+ export enum DuplexMode {
7103
+ /** Specifies that one-sided printing was used. */
7104
+ ONE_SIDED = "ONE_SIDED",
7105
+ /** Specifies that two-sided printing was used, flipping on long edge. */
7106
+ TWO_SIDED_LONG_EDGE = "TWO_SIDED_LONG_EDGE",
7107
+ /** Specifies that two-sided printing was used, flipping on short edge. */
7108
+ TWO_SIDED_SHORT_EDGE = "TWO_SIDED_SHORT_EDGE",
7109
+ }
7110
+
7111
+ export interface MediaSize {
7112
+ /** Height (in micrometers) of the media used for printing. */
7113
+ height: number;
7114
+ /**
7115
+ * Vendor-provided ID, e.g. "iso_a3_297x420mm" or "na_index-3x5_3x5in".
7116
+ * Possible values are values of "media" IPP attribute and can be found on [IANA page](https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xhtml).
7117
+ */
7118
+ vendorId: string;
7119
+ /** Width (in micrometers) of the media used for printing. */
7120
+ width: number;
7121
+ }
7122
+
7123
+ export interface Printer {
7124
+ /** Displayed name of the printer. */
7125
+ name: string;
7126
+ /** The source of the printer. */
7127
+ source: PrinterSource;
7128
+ /** The full path for the printer. Contains protocol, hostname, port, and queue. */
7129
+ uri: string;
7130
+ }
7131
+
7132
+ /** The source of the printer. */
7133
+ export enum PrinterSource {
7134
+ /** Specifies that the printer was added by user. */
7135
+ USER = "USER",
7136
+ /** Specifies that the printer was added via policy. */
7137
+ POLICY = "POLICY",
7138
+ }
7139
+
7140
+ export interface PrintJobInfo {
7141
+ /** The job completion time (in milliseconds past the Unix epoch). */
7142
+ completionTime: number;
7143
+ /** The job creation time (in milliseconds past the Unix epoch). */
7144
+ creationTime: number;
7145
+ /** The ID of the job. */
7146
+ id: string;
7147
+ /** The number of pages in the document. */
7148
+ numberOfPages: number;
7149
+ /** The info about the printer which printed the document. */
7150
+ printer: Printer;
7151
+ /**
7152
+ * The status of the printer.
7153
+ * @since Chrome 85
7154
+ */
7155
+ printer_status: chrome.printing.PrinterStatus;
7156
+ /** The settings of the print job. */
7157
+ settings: PrintSettings;
7158
+ /** Source showing who initiated the print job. */
7159
+ source: PrintJobSource;
7160
+ /** ID of source. Null if source is PRINT_PREVIEW or ANDROID_APP. */
7161
+ sourceId: string | null;
7162
+ /** The final status of the job. */
7163
+ status: PrintJobStatus;
7164
+ /** The title of the document which was printed. */
7165
+ title: string;
7166
+ }
7167
+
7168
+ /** The source of the print job. */
7169
+ export enum PrintJobSource {
7170
+ /** Specifies that the job was created from the Print Preview page initiated by the user. */
7171
+ PRINT_PREVIEW = "PRINT_PREVIEW",
7172
+ /** Specifies that the job was created from an Android App. */
7173
+ ANDROID_APP = "ANDROID_APP",
7174
+ /** Specifies that the job was created by extension via Chrome API. */
7175
+ EXTENSION = "EXTENSION",
7176
+ /** Specifies that the job was created by an Isolated Web App via API. */
7177
+ ISOLATED_WEB_APP = "ISOLATED_WEB_APP",
7178
+ }
7179
+
7180
+ /** Specifies the final status of the print job. */
7181
+ export enum PrintJobStatus {
7182
+ /** Specifies that the print job was interrupted due to some error. */
7183
+ FAILED = "FAILED",
7184
+ /** Specifies that the print job was canceled by the user or via API. */
7185
+ CANCELED = "CANCELED",
7186
+ /** Specifies that the print job was printed without any errors. */
7187
+ PRINTED = "PRINTED",
7188
+ }
7189
+
7190
+ export interface PrintSettings {
7191
+ /** The requested color mode. */
7192
+ color: ColorMode;
7193
+ /** The requested number of copies. */
7194
+ copies: number;
7195
+ /** The requested duplex mode. */
7196
+ duplex: DuplexMode;
7197
+ /** The requested media size. */
7198
+ mediaSize: MediaSize;
7199
+ }
7200
+
7201
+ /**
7202
+ * Returns the list of the finished print jobs.
7203
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
7204
+ */
7205
+ export function getPrintJobs(): Promise<PrintJobInfo[]>;
7206
+ export function getPrintJobs(callback: (jobs: PrintJobInfo[]) => void): void;
7207
+
7208
+ /** Event fired when the print job is finished. This includes any of termination statuses: FAILED, CANCELED and PRINTED. */
7209
+ export const onPrintJobFinished: chrome.events.Event<(jobInfo: PrintJobInfo) => void>;
7210
+ }
7211
+
6929
7212
  ////////////////////
6930
7213
  // Privacy
6931
7214
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.277",
3
+ "version": "0.0.279",
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": "62a9f28fa3e7418551081670e460c63ed76a152fb2be41dd694950f4d3cd006c",
97
97
  "typeScriptVersion": "4.8"
98
98
  }