diff --git a/types/ali-oss/ali-oss-tests.ts b/types/ali-oss/ali-oss-tests.ts index 7cc0abb7f94db1..f5139c08ae7dec 100644 --- a/types/ali-oss/ali-oss-tests.ts +++ b/types/ali-oss/ali-oss-tests.ts @@ -5,6 +5,7 @@ const ossOptions: OSS.Options = { accessKeySecret: "your access secret", bucket: "your bucket name", region: "oss-cn-hangzhou", + authorizationV4: true, }; const client = new OSS(ossOptions); @@ -15,6 +16,43 @@ client.copy("newfile.png", "sourcefile.png", { timeout: 1000 }); client.copy("newfile.png", "sourcefile.png", "sourceBucket"); client.copy("newfile.png", "sourcefile.png", "sourceBucket", { timeout: 1000 }); +// $ExpectType Promise +client.signatureUrlV4("GET", 60, undefined, "your object name"); + +// $ExpectType Promise +client.signatureUrlV4( + "GET", + 60, + { + headers: { + "Cache-Control": "no-cache", + }, + queries: { + versionId: "version ID of your object", + }, + }, + "your object name", + ["Cache-Control"], +); + +// $ExpectType Promise +client.signatureUrlV4("PUT", 60, undefined, "your object name"); + +// $ExpectType Promise +client.signatureUrlV4( + "PUT", + 60, + { + headers: { + "Content-Type": "text/plain", + "Content-MD5": "xxx", + "Content-Length": 1, + }, + }, + "your object name", + ["Content-Length"], +); + const clusterOptions: OSS.ClusterOptions = { clusters: [], }; diff --git a/types/ali-oss/index.d.ts b/types/ali-oss/index.d.ts index 927f2f628e7aa2..38c7b68ba2bb0d 100644 --- a/types/ali-oss/index.d.ts +++ b/types/ali-oss/index.d.ts @@ -27,6 +27,8 @@ declare namespace OSS { refreshSTSTokenInterval?: number; /** used by auto set stsToken、accessKeyId、accessKeySecret when sts info expires. return value must be object contains stsToken、accessKeyId、accessKeySecret */ refreshSTSToken?: () => Promise<{ accessKeyId: string; accessKeySecret: string; stsToken: string }>; + /** Use V4 signature. Default is false. */ + authorizationV4?: boolean | undefined; } /** @@ -698,11 +700,11 @@ declare namespace OSS { signatureUrlV4( method: HTTPMethods, expires: number, - request?: { + request: { headers?: object | undefined; queries?: object | undefined; - }, - objectName?: string, + } | undefined, + objectName: string, additionalHeaders?: string[], ): Promise; @@ -1083,6 +1085,20 @@ declare class OSS { */ signatureUrl(name: string, options?: OSS.SignatureUrlOptions): string; + /** + * Generate a signed URL for V4 of an OSS resource and share the URL to allow authorized third-party users to access the resource. + */ + signatureUrlV4( + method: OSS.HTTPMethods, + expires: number, + request: { + headers?: object | undefined; + queries?: object | undefined; + } | undefined, + objectName: string, + additionalHeaders?: string[], + ): Promise; + /** * Basically the same as signatureUrl, if refreshSTSToken is configured asyncSignatureUrl will refresh stsToken */ diff --git a/types/ali-oss/package.json b/types/ali-oss/package.json index 1df1bb56693c13..ef5113085d6b16 100644 --- a/types/ali-oss/package.json +++ b/types/ali-oss/package.json @@ -1,9 +1,9 @@ { "private": true, "name": "@types/ali-oss", - "version": "6.16.9999", + "version": "6.23.9999", "projects": [ - "https://github.com/aliyun/oss-nodejs-sdk" + "https://github.com/ali-sdk/ali-oss" ], "devDependencies": { "@types/ali-oss": "workspace:." @@ -16,6 +16,10 @@ { "name": "StarHeart", "githubUsername": "StarHeartHunt" + }, + { + "name": "cnjsstong", + "githubUsername": "cnjsstong" } ] } diff --git a/types/k6/browser/index.d.ts b/types/k6/browser/index.d.ts index 0bd90326c4fc8e..eaad25e6abaa13 100644 --- a/types/k6/browser/index.d.ts +++ b/types/k6/browser/index.d.ts @@ -3231,6 +3231,29 @@ export interface Locator { */ press(key: string, options?: KeyboardPressOptions): Promise; + /** + * Focuses the element and then sends a `keydown`, `keypress`/`input`, and + * `keyup` event for each character in the text. + * + * This method is useful for simulating real user typing behavior when the page + * has special keyboard event handling, such as input validation or autocomplete. + * For simple text input without special keyboard handling, use {@link fill | fill()} + * instead as it's faster and more reliable. + * + * @example + * ```js + * // Type text instantly + * await locator.pressSequentially('Hello World'); + * + * // Type text with delay between keypresses (like a real user) + * await locator.pressSequentially('Hello World', { delay: 100 }); + * ``` + * + * @param text Text to type into the focused element character by character. + * @param options Typing options. + */ + pressSequentially(text: string, options?: KeyboardPressOptions): Promise; + /** * Type a text into the input field. * @param text Text to type into the input field. @@ -5693,6 +5716,120 @@ export interface Page { }, ): Promise; + /** + * Waits for the specified event to be emitted. + * + * This method blocks until the event is captured or the timeout is reached. + * Supported event types are `console`, `request`, or `response`. + * + * @example + * ```js + * // Wait for a console message containing 'hello' + * const msgPromise = page.waitForEvent('console', msg => msg.text().includes('hello')); + * await page.evaluate(() => console.log('hello world')); + * const msg = await msgPromise; + * ``` + * + * @param event Event name to wait for: `'console'`. + * @param optionsOrPredicate Either a predicate function or an options object. + */ + waitForEvent( + event: "console", + optionsOrPredicate?: + | ((msg: ConsoleMessage) => boolean) + | { + /** + * Predicate function that returns `true` when the expected event is received. + */ + predicate?: (msg: ConsoleMessage) => boolean; + /** + * Maximum time to wait in milliseconds. Defaults to `30` seconds. + * The default value can be changed via the + * browserContext.setDefaultTimeout(timeout) or + * page.setDefaultTimeout(timeout) methods. + * + * Setting the value to `0` will disable the timeout. + */ + timeout?: number; + }, + ): Promise; + + /** + * Waits for the specified event to be emitted. + * + * This method blocks until the event is captured or the timeout is reached. + * It can wait for any page event such as `console`, `request`, or `response`. + * + * @example + * ```js + * // Wait for a request to a specific URL + * const reqPromise = page.waitForEvent('request', req => req.url().includes('/api')); + * await page.click('button'); + * const req = await reqPromise; + * ``` + * + * @param event Event name to wait for: `'request'`. + * @param optionsOrPredicate Either a predicate function or an options object. + */ + waitForEvent( + event: "request", + optionsOrPredicate?: + | ((req: Request) => boolean) + | { + /** + * Predicate function that returns `true` when the expected event is received. + */ + predicate?: (req: Request) => boolean; + /** + * Maximum time to wait in milliseconds. Defaults to `30` seconds. + * The default value can be changed via the + * browserContext.setDefaultTimeout(timeout) or + * page.setDefaultTimeout(timeout) methods. + * + * Setting the value to `0` will disable the timeout. + */ + timeout?: number; + }, + ): Promise; + + /** + * Waits for the specified event to be emitted. + * + * This method blocks until the event is captured or the timeout is reached. + * It can wait for any page event such as `console`, `request`, or `response`. + * + * @example + * ```js + * // Wait for a response from a specific URL + * const resPromise = page.waitForEvent('response', res => res.url().includes('/api')); + * await page.click('button'); + * const res = await resPromise; + * ``` + * + * @param event Event name to wait for: `'response'`. + * @param optionsOrPredicate Either a predicate function or an options object. + */ + waitForEvent( + event: "response", + optionsOrPredicate?: + | ((res: Response) => boolean) + | { + /** + * Predicate function that returns `true` when the expected event is received. + */ + predicate?: (res: Response) => boolean; + /** + * Maximum time to wait in milliseconds. Defaults to `30` seconds. + * The default value can be changed via the + * browserContext.setDefaultTimeout(timeout) or + * page.setDefaultTimeout(timeout) methods. + * + * Setting the value to `0` will disable the timeout. + */ + timeout?: number; + }, + ): Promise; + /** * **NOTE** Use web assertions that assert visibility or a locator-based * locator.waitFor([options]) instead. diff --git a/types/k6/package.json b/types/k6/package.json index abda55ebde008b..8ea5bc79f0429c 100644 --- a/types/k6/package.json +++ b/types/k6/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/k6", - "version": "1.4.9999", + "version": "1.5.9999", "type": "module", "projects": [ "https://grafana.com/docs/k6/latest/" diff --git a/types/k6/test/browser.ts b/types/k6/test/browser.ts index e8a7c25a58613d..bbd4efbdb677fc 100644 --- a/types/k6/test/browser.ts +++ b/types/k6/test/browser.ts @@ -1054,6 +1054,31 @@ async function test() { // $ExpectType Promise page.waitForRequest("https://example.com", { timeout: 10000 }); + // @ts-expect-error + page.waitForEvent(); + // $ExpectType Promise + page.waitForEvent("console"); + // $ExpectType Promise + page.waitForEvent("console", (msg) => msg.text().includes("hello")); + // $ExpectType Promise + page.waitForEvent("console", { predicate: (msg) => msg.text().includes("hello") }); + // $ExpectType Promise + page.waitForEvent("console", { timeout: 10000 }); + // $ExpectType Promise + page.waitForEvent("console", { predicate: (msg) => msg.text().includes("hello"), timeout: 10000 }); + // $ExpectType Promise + page.waitForEvent("request"); + // $ExpectType Promise + page.waitForEvent("request", (req) => req.url().includes("/api")); + // $ExpectType Promise + page.waitForEvent("request", { predicate: (req) => req.url().includes("/api"), timeout: 10000 }); + // $ExpectType Promise + page.waitForEvent("response"); + // $ExpectType Promise + page.waitForEvent("response", (res) => res.url().includes("/api")); + // $ExpectType Promise + page.waitForEvent("response", { predicate: (res) => res.url().includes("/api"), timeout: 10000 }); + // @ts-expect-error page.waitForSelector(); // $ExpectType Promise @@ -1434,6 +1459,19 @@ async function test() { // $ExpectType Promise locator.setChecked(true, { position: { x: 0, y: 0 } }); + // @ts-expect-error + locator.pressSequentially(); + // @ts-expect-error + locator.pressSequentially({ timeout: 10000 }); + // $ExpectType Promise + locator.pressSequentially("text"); + // $ExpectType Promise + locator.pressSequentially("text", { delay: 100 }); + // $ExpectType Promise + locator.pressSequentially("text", { noWaitAfter: true }); + // $ExpectType Promise + locator.pressSequentially("text", { timeout: 10000 }); + // @ts-expect-error locator.type(); // @ts-expect-error