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
9 changes: 3 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@
/types/array.prototype.flat/ @kylejlin @ljharb
/types/array.prototype.flatmap/ @hallettj @ljharb
/types/arrive/ @vijaypemmaraju
/types/artillery/ @BendingBender
/types/asana/ @tkqubo @tasyp @filipposarzana @szlori @apiology
/types/asap/ @fpascutti
/types/ascii-art/ @lukaselmer
Expand Down Expand Up @@ -1349,6 +1348,7 @@
/types/d3-shape/v1/ @tomwanzek @gustavderdrache @borisyankov @denisname @Methuselah96
/types/d3-shape/v2/ @tomwanzek @gustavderdrache @borisyankov @denisname @Methuselah96
/types/d3-simple-slider/ @johnwalley
/types/d3-tile/ @NaciriMouad
/types/d3-time/ @tomwanzek @gustavderdrache @borisyankov @denisname @Methuselah96
/types/d3-time/v1/ @tomwanzek @gustavderdrache @borisyankov @denisname @Methuselah96
/types/d3-time/v2/ @tomwanzek @gustavderdrache @borisyankov @denisname @Methuselah96
Expand Down Expand Up @@ -1855,7 +1855,6 @@
/types/eslint-plugin-jsx-a11y/ @eagerestwolf @ljharb
/types/eslint-plugin-markdown/ @JounQin
/types/eslint-plugin-mobx/ @MysteryBlokHed
/types/eslint-plugin-mocha/ @rhysd
/types/eslint-plugin-prettier/ @ikatyang @JounQin
/types/eslint-plugin-security/ @rhysd @porada
/types/eslint-plugin-tailwindcss/ @eagerestwolf
Expand Down Expand Up @@ -2087,7 +2086,6 @@
/types/fibjs/ @richardo2016
/types/field/ @aleung
/types/figma/ @rudi-c
/types/file-entry-cache/ @peterblazejewicz
/types/file-exists/ @BendingBender
/types/file-fetch/ @tpluscode
/types/file-loader/ @g-rath
Expand Down Expand Up @@ -4696,7 +4694,6 @@
/types/mapbox__mapbox-gl-geocoder/ @Nosfit @dmytro-gokun
/types/mapbox__mapbox-gl-traffic/ @niekvb
/types/mapbox__mapbox-sdk/ @jeffbdye @mikeomeara1 @chachan @techieshark @rroohhh
/types/mapbox__point-geometry/ @webberig @HarelM
/types/mapbox__polyline/ @Kern0 @mklopets
/types/mapbox__rehype-prism/ @remcohaszing
/types/mapbox__s3urls/ @sebastianvera
Expand Down Expand Up @@ -4799,6 +4796,7 @@
/types/memory-fs/ @e-cloud
/types/memory-pager/ @BendingBender
/types/memory-usage/ @BendingBender
/types/memorystorage/ @Zephyr-Blessed
/types/memorystream/ @bangbang93 @geniou
/types/memwatch-next/ @cyrilschumacher
/types/mercadopago/ @danieldspx
Expand Down Expand Up @@ -7725,7 +7723,6 @@
/types/tape-async/ @ExE-Boss
/types/tape-catch/ @ExE-Boss
/types/tape-promise/ @ExE-Boss @ljharb
/types/tar/ @SomaticIT @connor4312
/types/tar-fs/ @Umoxfo @chriswiggins
/types/tar-js/ @Narazaka
/types/tar-stream/ @glicht @peterblazejewicz @kevin-lindsay-1 @screendriver
Expand Down Expand Up @@ -8246,7 +8243,6 @@
/types/vue-scroll-up/ @slaweet
/types/vue-select/ @silh @FloEdelmann
/types/vue-splitpane/ @noonhorse
/types/vue-tel-input/ @suryadana
/types/vue-template-es2015-compiler/ @iam-medvedev
/types/vue-the-mask/ @domschmidt
/types/vue2-datepicker/ @ChrisStornowski
Expand Down Expand Up @@ -8467,6 +8463,7 @@
/types/wordpress__blocks/ @dsifford @sirreal @dmsnell @tomasztunik @sunyatasattva @bastolen @joshualip-plaudit
/types/wordpress__customize-browser/ @marekdedic
/types/wordpress__edit-post/ @dsifford
/types/wordpress__server-side-render/ @rafaucau
/types/wordpress__viewport/ @dsifford
/types/wordpress__wordcount/ @dsifford
/types/words-to-time-converter/ @peterblazejewicz
Expand Down
50 changes: 50 additions & 0 deletions types/mokapi/file.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Reads the contents of a file and returns it as a string.
*
* If the path is relative, it is resolved relative to the entry script file.
*
* @param path - Path to the file to read.
* @returns The contents of the file.
*
* @example
* export default function() {
* const data = read('data.json')
* console.log(data)
* }
*/
export function read(path: string): string;

/**
* Writes a string to a file at the given path.
*
* If the path is relative, it is resolved relative to the entry script file.
* If the file does not exist, it will be created.
* If the file exists, it will be overwritten.
*
* @param path - Path to the file to write.
* @param s - The string content to write.
*
* @example
* export default function() {
* writeString('data.json', 'Hello World')
* }
*/
export function writeString(path: string, s: string): void;

/**
* Appends a string to a file at the given path.
*
* If the path is relative, it is resolved relative to the entry script file.
* If the file does not exist, it will be created.
* If the file exists, the string will be appended.
*
* @param path - Path to the file to append to.
* @param s - The string content to append.
*
* @example
* export default function() {
* writeString('data.json', 'Hello')
* appendString('data.json', ' World')
* }
*/
export function appendString(path: string, s: string): void;
52 changes: 45 additions & 7 deletions types/mokapi/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Mokapi JavaScript API
* https://mokapi.io/docs/guides/welcome
* https://mokapi.io/docs/welcome
*/

import "./faker";
Expand All @@ -10,6 +10,7 @@ import "./mustache";
import "./yaml";
import "./encoding";
import "./mail";
import "./file";

/**
* Attaches an event handler for the given event.
Expand Down Expand Up @@ -157,6 +158,9 @@ export interface HttpRequest {
/** Object contains querystring parameters specified by OpenAPI querystring parameters. */
readonly querystring: any;

/** Name of the API, as defined in the OpenAPI `info.title` field */
readonly api: string;

/** Path value specified by the OpenAPI path */
readonly key: string;

Expand All @@ -183,6 +187,23 @@ export interface HttpResponse {

/** Data will be encoded with the OpenAPI response definition. */
data: any;

/**
* Rebuilds the entire HTTP response using the OpenAPI response definition for the given status code and content type
* @example
* import { on } from 'mokapi'
*
* export default function() {
* on('http', (request, response) => {
* if (request.path.petId === 10) {
* // Switch to a different OpenAPI response.
* response.rebuild(404, 'application/json')
* response.data.message = 'Pet not found'
* }
* })
* }
*/
rebuild: (statusCode?: number, contentType?: string) => void;
}

/**
Expand Down Expand Up @@ -421,10 +442,11 @@ export type DateLayout =
| "RFC3339Nano";

/**
* EventArgs object contains additional arguments for an event handler.
* EventArgs provides optional configuration for an event handler.
* https://mokapi.io/docs/javascript-api/mokapi/on
*
* Use this to customize how the event appears in the dashboard or to control tracking.
* Use this object to control how the event is tracked, labeled,
* and ordered in the execution pipeline.
*
* @example
* export default function() {
Expand All @@ -438,16 +460,32 @@ export type DateLayout =
*/
export interface EventArgs {
/**
* Adds or overrides existing tags used to label the event in dashboard
* Adds or overrides tags used to label this event in the dashboard.
* Tags can be used for filtering, grouping, or ownership attribution.
*/
tags?: { [key: string]: string };

/**
* Set to `true` to enable tracking of this event handler in the dashboard.
* Set to `false` to disable tracking. If omitted, Mokapi checks the response
* object to determine if the handler changed it, and tracks it accordingly.
* Controls whether this event handler is tracked in the dashboard.
*
* - true: always track this handler
* - false: never track this handler
* - undefined: Mokapi determines tracking automatically based on
* whether the response object was modified by the handler
*/
track?: boolean;

/**
* Defines the execution order of the event handler.
*
* Handlers with higher priority values run first.
* Handlers with lower priority values run later.
*
* Use negative priorities (e.g. -1) to run a handler after
* the response has been fully populated by other handlers,
* such as for logging or recording purposes.
*/
priority?: number;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion types/mokapi/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/mokapi",
"version": "0.29.9999",
"version": "0.34.9999",
"nonNpm": true,
"nonNpmDescription": "Mokapi",
"projects": [
Expand Down
16 changes: 16 additions & 0 deletions types/mokapi/test/file-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { appendString, read, writeString } from "mokapi/file";

// @ts-expect-error
read(123);
read("data.json");
// @ts-expect-error
const i: number = read("data.json");
const s: string = read("data.json");

writeString("data.txt", "Hello World");
// @ts-expect-error
writeString("data.txt", 123);

appendString("data.txt", "Hello Again");
// @ts-expect-error
appendString("data.txt", 123);
10 changes: 10 additions & 0 deletions types/mokapi/test/mokapi-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,29 @@ on("http", handler, "");
on("http", handler, {});
on("http", handler, { tags: { foo: "bar" } });
on("http", handler, { track: true });
on("http", handler, { priority: 12 });
// @ts-expect-error
on("http", handler, { priority: true });
on("http", async () => {});
on("http", (request) => {
request.querystring;
});
on("http", (request, response) => {
const s = request.toString();
const url = request.url.toString();
const api: string = request.api;

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

response.rebuild(200, "application/json");
// @ts-expect-error
response.rebuild("200", "application/json");
// @ts-expect-error
response.rebuild(200, {});
});

// @ts-expect-error
Expand Down
18 changes: 16 additions & 2 deletions types/wordpress__block-editor/components/inner-blocks.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TemplateArray } from "@wordpress/blocks";
import { BlockAttributes, TemplateArray } from "@wordpress/blocks";
import { ComponentType, JSX, ReactElement, Ref } from "react";

import { EditorTemplateLock } from "../";
Expand All @@ -7,7 +7,7 @@ import { Merged, Reserved } from "./use-block-props";

declare namespace InnerBlocks {
interface Props {
allowedBlocks?: string[] | undefined;
allowedBlocks?: string[] | boolean | undefined;
/**
* A 'render prop' function that can be used to customize the block's appender.
*/
Expand Down Expand Up @@ -56,6 +56,20 @@ declare namespace InnerBlocks {
* `prioritizedInserterBlocks` takes an array of the form {blockName}/{variationName}, where {variationName} is optional.
*/
prioritizedInserterBlocks?: string[] | undefined;

/**
* Determines which block type should be inserted by default and any attributes that should be set by default when the block is inserted.
* Takes an object in the form of `{ name: blockname, attributes: {blockAttributes} }`.
*/
defaultBlock?: {
name: string;
attributes?: BlockAttributes;
} | undefined;

/**
* Determines whether the default block should be inserted directly into the InnerBlocks area by the block appender.
*/
directInsert?: boolean | undefined;
}
}
declare const InnerBlocks: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,15 @@ be.withFontSizes("fontSize")(() => <h1>Hello World</h1>);
// inner-blocks
//
<be.InnerBlocks />;
<be.InnerBlocks allowedBlocks={false} />;
<be.InnerBlocks renderAppender={be.InnerBlocks.ButtonBlockAppender} />;
<be.InnerBlocks.Content />;
<be.InnerBlocks.DefaultBlockAppender />;
<be.InnerBlocks orientation="vertical" />;
<be.InnerBlocks prioritizedInserterBlocks={["core/navigation-link/page"]} />;
<be.InnerBlocks templateLock="all" />;
<be.InnerBlocks defaultBlock={{ name: "core/paragraph", attributes: { content: "Default content" } }} />;
<be.InnerBlocks directInsert={true} />;

//
// inserter
Expand Down