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
38 changes: 38 additions & 0 deletions types/ali-oss/ali-oss-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<string>
client.signatureUrlV4("GET", 60, undefined, "your object name");

// $ExpectType Promise<string>
client.signatureUrlV4(
"GET",
60,
{
headers: {
"Cache-Control": "no-cache",
},
queries: {
versionId: "version ID of your object",
},
},
"your object name",
["Cache-Control"],
);

// $ExpectType Promise<string>
client.signatureUrlV4("PUT", 60, undefined, "your object name");

// $ExpectType Promise<string>
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: [],
};
Expand Down
22 changes: 19 additions & 3 deletions types/ali-oss/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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<string>;

Expand Down Expand Up @@ -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<string>;

/**
* Basically the same as signatureUrl, if refreshSTSToken is configured asyncSignatureUrl will refresh stsToken
*/
Expand Down
8 changes: 6 additions & 2 deletions types/ali-oss/package.json
Original file line number Diff line number Diff line change
@@ -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:."
Expand All @@ -16,6 +16,10 @@
{
"name": "StarHeart",
"githubUsername": "StarHeartHunt"
},
{
"name": "cnjsstong",
"githubUsername": "cnjsstong"
}
]
}
137 changes: 137 additions & 0 deletions types/k6/browser/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3231,6 +3231,29 @@ export interface Locator {
*/
press(key: string, options?: KeyboardPressOptions): Promise<void>;

/**
* 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<void>;

/**
* Type a text into the input field.
* @param text Text to type into the input field.
Expand Down Expand Up @@ -5693,6 +5716,120 @@ export interface Page {
},
): Promise<Request | null>;

/**
* 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<ConsoleMessage>;

/**
* 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<Request>;

/**
* 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<Response>;

/**
* **NOTE** Use web assertions that assert visibility or a locator-based
* locator.waitFor([options]) instead.
Expand Down
2 changes: 1 addition & 1 deletion types/k6/package.json
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
38 changes: 38 additions & 0 deletions types/k6/test/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,31 @@ async function test() {
// $ExpectType Promise<Request | null>
page.waitForRequest("https://example.com", { timeout: 10000 });

// @ts-expect-error
page.waitForEvent();
// $ExpectType Promise<ConsoleMessage>
page.waitForEvent("console");
// $ExpectType Promise<ConsoleMessage>
page.waitForEvent("console", (msg) => msg.text().includes("hello"));
// $ExpectType Promise<ConsoleMessage>
page.waitForEvent("console", { predicate: (msg) => msg.text().includes("hello") });
// $ExpectType Promise<ConsoleMessage>
page.waitForEvent("console", { timeout: 10000 });
// $ExpectType Promise<ConsoleMessage>
page.waitForEvent("console", { predicate: (msg) => msg.text().includes("hello"), timeout: 10000 });
// $ExpectType Promise<Request>
page.waitForEvent("request");
// $ExpectType Promise<Request>
page.waitForEvent("request", (req) => req.url().includes("/api"));
// $ExpectType Promise<Request>
page.waitForEvent("request", { predicate: (req) => req.url().includes("/api"), timeout: 10000 });
// $ExpectType Promise<Response>
page.waitForEvent("response");
// $ExpectType Promise<Response>
page.waitForEvent("response", (res) => res.url().includes("/api"));
// $ExpectType Promise<Response>
page.waitForEvent("response", { predicate: (res) => res.url().includes("/api"), timeout: 10000 });

// @ts-expect-error
page.waitForSelector();
// $ExpectType Promise<ElementHandle>
Expand Down Expand Up @@ -1434,6 +1459,19 @@ async function test() {
// $ExpectType Promise<void>
locator.setChecked(true, { position: { x: 0, y: 0 } });

// @ts-expect-error
locator.pressSequentially();
// @ts-expect-error
locator.pressSequentially({ timeout: 10000 });
// $ExpectType Promise<void>
locator.pressSequentially("text");
// $ExpectType Promise<void>
locator.pressSequentially("text", { delay: 100 });
// $ExpectType Promise<void>
locator.pressSequentially("text", { noWaitAfter: true });
// $ExpectType Promise<void>
locator.pressSequentially("text", { timeout: 10000 });

// @ts-expect-error
locator.type();
// @ts-expect-error
Expand Down