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
8 changes: 5 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
/types/ajv-async/ @dmitriismitnov
/types/ajv-bsontype/ @adjerbetian
/types/ajv-pack/ @qm3ster @ChristianMurphy
/types/akamai-edgeworkers/ @evan-hughes @wabain @swathimr @ananner @bmatthew
/types/akamai-edgeworkers/ @cdaley-akamai @wabain @yanakad @miliworking @lperra
/types/akumina-core/ @akumina @jasonarden @MarshHawk
/types/akumina-core/v4/ @akumina @jasonarden @MarshHawk
/types/alcides/ @asaidimu
Expand Down Expand Up @@ -5493,7 +5493,7 @@
/types/palx/ @mikefowler
/types/pangu/ @plantain-00 @AH-dark
/types/pannellum/ @zhirzh
/types/papaparse/ @torpedro @rainshen49 @jfloff @johnnyreilly @albertorestifo @jliuhtonen @rbarbazz @peterblazejewicz @emmanuelgautier @OpportunityLiu @matsuby
/types/papaparse/ @torpedro @rainshen49 @jfloff @johnnyreilly @albertorestifo @jliuhtonen @peterblazejewicz @emmanuelgautier @OpportunityLiu @matsuby
/types/parallel-transform/ @djcsdy
/types/paralleljs/ @jbaldwin
/types/parameter/ @zhyupe @Runtu4378
Expand Down Expand Up @@ -7209,6 +7209,8 @@
/types/share-api-polyfill/ @jnv
/types/sharedb/ @soney @ericyhwang @pxpeterxu @alecgibson @pypmannetjies @craigbeck
/types/sharepoint/ @gandjustas @andrei-markeev @teroarvola @dennispg @SPWizard01 @betlgtu
/types/sharetribe-flex-integration-sdk/ @jayenashar @venmartin
/types/sharetribe-flex-sdk/ @jayenashar @venmartin
/types/sharpie/ @peterblazejewicz
/types/shasum/ @TeamworkGuy2
/types/shebang-command/ @BendingBender
Expand Down Expand Up @@ -7968,7 +7970,7 @@
/types/typeof/ @OpenByteDev
/types/typescript-deferred/ @DirtyHairy
/types/typo-js/ @whawker
/types/typography/ @krzysztofzuraw @dominicfallows
/types/typography/ @dominicfallows
/types/typography-breakpoint-constants/ @goblindegook
/types/typopo/ @peterblazejewicz
/types/typpy/ @BendingBender
Expand Down
2 changes: 2 additions & 0 deletions types/google-one-tap/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export interface GsiButtonConfiguration {
logo_alignment?: "left" | "center";
width?: number;
locale?: string;
click_listener?: () => void;
state?: string;
}

export interface CredentialResponse {
Expand Down
2 changes: 2 additions & 0 deletions types/google-one-tap/test/google-one-tap-global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const buttonOptions: google.GsiButtonConfiguration = {
theme: "outline",
size: "large",
text: "continue_with",
click_listener: () => {},
state: "test_state",
};

const button: HTMLElement = new HTMLDivElement();
Expand Down
44 changes: 22 additions & 22 deletions types/mokapi/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,6 @@ export function options(url: string, body?: JSONValue, args?: Args): Response;
*/
export function fetch(url: string, opts?: FetchOptions): Promise<Response>;

/**
* Request arguments.
* Used to add headers to a request.
*/
export interface Args {
/** Request headers. */
headers?: { [name: string]: string };
/**
* The number of redirects to follow for this request.
* @default 5
*/
maxRedirects?: number;
/**
* Maximum time to wait for the request to complete. Default
* timeout is 60 seconds ("60s"). The type can also be a number, in which
* case Mokapi interprets it as milliseconds
* @example
* const res = get(url, { timeout: '5m' })
*/
timeout?: number | string;
}

/**
* Options for the {@link fetch} function.
*/
Expand Down Expand Up @@ -187,6 +165,28 @@ export interface FetchOptions {
timeout?: number | string;
}

/**
* Request arguments.
* Used to add headers to a request.
*/
export interface Args {
/** Request headers. */
headers?: { [name: string]: string };
/**
* The number of redirects to follow for this request.
* @default 5
*/
maxRedirects?: number;
/**
* Maximum time to wait for the request to complete. Default
* timeout is 60 seconds ("60s"). The type can also be a number, in which
* case Mokapi interprets it as milliseconds
* @example
* const res = get(url, { timeout: '5m' })
*/
timeout?: number | string;
}

/**
* Response of an HTTP request
* https://mokapi.io/docs/javascript-api/mokapi-http/httpresponse
Expand Down
19 changes: 14 additions & 5 deletions types/mokapi/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ export interface HttpRequest {

/** OperationId defined in OpenAPI */
readonly operationId: string;

/** Returns a string representing this HttpRequest object. */
toString(): string;
}

/**
Expand All @@ -170,7 +173,7 @@ export interface HttpRequest {
*/
export interface HttpResponse {
/** Object contains header parameters specified by OpenAPI header parameters. */
headers: { [key: string]: string };
headers: { [key: string]: any };

/** Specifies the http status used to select the OpenAPI response definition. */
statusCode: number;
Expand All @@ -192,11 +195,17 @@ export interface Url {
/** URL host. */
readonly host: string;

/** URL port */
readonly port: number;

/** URL path. */
readonly path: string;

/** URL query string. */
readonly query: string;

/** Returns a string representing this Url object. */
toString(): string;
}

/**
Expand Down Expand Up @@ -429,20 +438,20 @@ export type DateLayout =
*/
export interface EventArgs {
/**
* Optional key-value pairs used to label the event in the dashboard.
* Adds or overrides existing tags used to label the event in dashboard
*/
tags?: { [key: string]: string };

/**
* Set to `true` to enable tracking of this event handler in the dashboard.
* If omitted, Mokapi automatically checks whether the response object has
* been modified and tracks the handler only if a change is detected.
* Set to `false` to disable tracking. If omitted, Mokapi checks the response
* object to determine if the handler changed it, and tracks it accordingly.
*/
track?: boolean;
}

/**
* cheduledEventArgs is an object used by every and cron function.
* ScheduledEventHandler is an object used by every and cron function.
* https://mokapi.io/docs/javascript-api/mokapi/eventhandler/scheduledeventargs
* @example
* export default function() {
Expand Down
11 changes: 10 additions & 1 deletion types/mokapi/test/mokapi-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ on("http", async () => {});
on("http", (request) => {
request.querystring;
});
on("http", (request, response) => {
const s = request.toString();
const url = request.url.toString();

response.headers = {
"Content-Type": "application/json",
};
response.headers["Access-Control-Allow-Origin"] = "*";
response.headers["foo"] = { bar: 123 };
});

// @ts-expect-error
every(12, () => {});
Expand Down Expand Up @@ -134,7 +144,6 @@ h = (req: HttpRequest, res: HttpResponse) => {
res.data = 12;
res.data = "foo";
res.data = {};
// @ts-expect-error
res.headers.foo = 12;
res.headers.foo = "bar";
res.headers["Content-Type"] = "application/json";
Expand Down