types-mediawiki
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -0,2 +1,12 @@ | ||
import { | ||
ApiEditPageParams, | ||
ApiParseParams, | ||
ApiQueryAllMessagesParams, | ||
ApiRollbackParams, | ||
ApiUploadParams | ||
} from "../api_params"; | ||
type title = string | mw.Title | ||
type ApiParams = Record<string, string | string[] | boolean | number | number[]> | ||
type ApiResponse = Record<string, any> // it will always be a JSON object, the rest is uncertain ... | ||
@@ -9,3 +19,3 @@ interface ApiOptions { | ||
interface ForeignApiOptions extends ApiOptions { | ||
anonymous: boolean | ||
anonymous?: boolean | ||
} | ||
@@ -20,25 +30,26 @@ | ||
get(parameters: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any> | ||
get(parameters: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse> | ||
post(parameters: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any> | ||
post(parameters: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse> | ||
preprocessParameters(parameters: any, useUS: boolean): void | ||
preprocessParameters(parameters: ApiParams, useUS: boolean): void | ||
// index.js | ||
ajax(parameters: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any> | ||
ajax(parameters: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse> | ||
postWithToken(tokenType: string, params: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any> | ||
postWithToken(tokenType: string, params: ApiParams, ajaxOptions?: JQuery.AjaxSettings) | ||
: JQuery.Promise<ApiResponse> | ||
getToken(type: string, additionalParams?: any): JQuery.Promise<string> | ||
getToken(type: string, additionalParams?: ApiParams): JQuery.Promise<string> | ||
badToken(type: string): void | ||
getErrorMessage(data: any): JQuery | ||
getErrorMessage(data: ApiResponse): JQuery | ||
// edit.js | ||
postWithEditToken(params: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any> | ||
postWithEditToken(params: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse> | ||
getEditToken(): JQuery.Promise<string> | ||
create(title: title, params: any, content: string): JQuery.Promise<any> | ||
create(title: title, params: ApiEditPageParams, content: string): JQuery.Promise<ApiResponse> | ||
@@ -48,5 +59,6 @@ edit(title: title, transform: (data: { | ||
content: string | ||
}) => any): JQuery.Promise<any> | ||
}) => string | ApiEditPageParams): JQuery.Promise<any> | ||
newSection(title: title, header: string, message: string, additionalParams?: any): JQuery.Promise<any> | ||
newSection(title: title, header: string, message: string, additionalParams?: ApiEditPageParams) | ||
: JQuery.Promise<ApiResponse> | ||
@@ -59,3 +71,3 @@ // user.js | ||
assertCurrentUser(query: any): JQuery.Promise<{ | ||
assertCurrentUser(query: ApiParams): JQuery.Promise<{ | ||
assert: 'anon' | 'user' | ||
@@ -66,5 +78,5 @@ assertUser: string | ||
// options.js | ||
saveOption(name: string, value: string): JQuery.Promise<any> | ||
saveOption(name: string, value: string): JQuery.Promise<ApiResponse> | ||
saveOptions(options: { [optionName: string]: string }): JQuery.Promise<any> | ||
saveOptions(options: { [optionName: string]: string }): JQuery.Promise<ApiResponse> | ||
@@ -81,10 +93,10 @@ // watch.js | ||
// parse.js | ||
parse(content: string | mw.Title, additionalParams?: any): JQuery.Promise<any> | ||
parse(content: string | mw.Title, additionalParams?: ApiParseParams): JQuery.Promise<ApiResponse> | ||
// messages.js | ||
getMessages(messages: string[], options?: any): JQuery.Promise<any> | ||
getMessages(messages: string[], options?: ApiQueryAllMessagesParams): JQuery.Promise<ApiResponse> | ||
loadMessages(messages: string[], options?: any): JQuery.Promise<any> | ||
loadMessages(messages: string[], options?: ApiQueryAllMessagesParams): JQuery.Promise<ApiResponse> | ||
loadMessagesIfMissing(messages: string[], options?: any): JQuery.Promise<any> | ||
loadMessagesIfMissing(messages: string[], options?: ApiQueryAllMessagesParams): JQuery.Promise<ApiResponse> | ||
@@ -99,20 +111,22 @@ // category.js | ||
// rollback.js | ||
rollback(page: title, user: string, params?: any): JQuery.Promise<any> | ||
rollback(page: title, user: string, params?: ApiRollbackParams): JQuery.Promise<any> | ||
// upload.js | ||
chunkedUpload(file: File, data: any, chunkSize?: number, chunkRetries?: number): JQuery.Promise<any> | ||
chunkedUpload(file: File, data: ApiUploadParams, chunkSize?: number, chunkRetries?: number) | ||
: JQuery.Promise<ApiResponse> | ||
chunkedUploadToStash(file: File, data?: any, chunkSize?: number, chunkRetries?: number): JQuery.Promise<any> | ||
chunkedUploadToStash(file: File, data?: ApiUploadParams, chunkSize?: number, chunkRetries?: number) | ||
: JQuery.Promise<ApiResponse> | ||
upload(file: File | Blob | HTMLInputElement, data: any): JQuery.Promise<any> | ||
upload(file: File | Blob | HTMLInputElement, data: ApiUploadParams): JQuery.Promise<ApiResponse> | ||
uploadFromStash(filekey: string, data: any): JQuery.Promise<any> | ||
uploadFromStash(filekey: string, data: ApiUploadParams): JQuery.Promise<ApiResponse> | ||
uploadToStash(file: File | HTMLInputElement, data?: any): JQuery.Promise<any> | ||
uploadToStash(file: File | HTMLInputElement, data?: ApiUploadParams): JQuery.Promise<ApiResponse> | ||
// login.js | ||
login(username: string, password: string): JQuery.Promise<any> | ||
login(username: string, password: string): JQuery.Promise<ApiResponse> | ||
} | ||
class ForeignApi extends mw.Api { | ||
constructor(url: string | mw.Uri, options: ForeignApiOptions) | ||
constructor(url: string | mw.Uri, options?: ForeignApiOptions) | ||
@@ -119,0 +133,0 @@ getOrigin(): string | void |
{ | ||
"name": "types-mediawiki", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "TypeScript definitions for MediaWiki JS interface", | ||
@@ -19,3 +19,5 @@ "types": "index.d.ts", | ||
"dependencies": { | ||
"@types/jquery": "^3.5.5", | ||
"@types/jquery": "^3.5.5" | ||
}, | ||
"devDependencies": { | ||
"dtslint": "^4.0.6", | ||
@@ -22,0 +24,0 @@ "typescript": "^4.1.3" |
@@ -0,1 +1,3 @@ | ||
[![NPM version](https://img.shields.io/npm/v/types-mediawiki.svg)](https://www.npmjs.com/package/types-mediawiki) | ||
![Linter](https://github.com/wikimedia-gadgets/types-mediawiki/workflows/Lint/badge.svg) | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) | ||
@@ -18,3 +20,3 @@ | ||
Edit your project's `tsconfig.json` file so that it includes | ||
Edit your project's `tsconfig.json` file so that `compilerOptions` includes | ||
@@ -31,2 +33,12 @@ ``` | ||
### API parameters | ||
This package also provides typings for API parameters for MediaWiki core APIs and the ones added by a number of extensions (the ones enabled on English Wikipedia). These aren't exported to the global scope, however. For usage, you need to import them. For example: | ||
```ts | ||
import type {ApiEditPageParams, ApiParseParams} from "types-mediawiki/api_params"; | ||
``` | ||
Since it is just a type import, it doesn't generate any JavaScript. Hence, such imports can also be used in non-modular applications. | ||
---- | ||
@@ -33,0 +45,0 @@ |
{ | ||
"extends": "dtslint/dtslint.json", | ||
"linterOptions": { | ||
"exclude": [ | ||
"api_params/index.d.ts" | ||
] | ||
}, | ||
"rules": { | ||
"semicolon": false, | ||
"indent": [true, "tabs"], | ||
"no-padding": false, | ||
"no-unnecessary-qualifier": false, | ||
@@ -7,0 +13,0 @@ "unified-signatures": false |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117782
1
23
2687
47
2
1
- Removeddtslint@^4.0.6
- Removedtypescript@^4.1.3
- Removed@definitelytyped/header-parser@0.2.15(transitive)
- Removed@definitelytyped/typescript-versions@0.1.5(transitive)
- Removed@definitelytyped/utils@0.1.8(transitive)
- Removed@qiwi/npm-registry-client@8.9.1(transitive)
- Removed@types/node@18.19.64(transitive)
- Removedajv@6.12.6(transitive)
- Removedansi-regex@2.1.15.0.1(transitive)
- Removedansi-styles@2.2.13.2.14.3.0(transitive)
- Removedaproba@1.2.0(transitive)
- Removedare-we-there-yet@1.1.7(transitive)
- Removedargparse@1.0.10(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedb4a@1.6.7(transitive)
- Removedbabel-code-frame@6.26.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbare-events@2.5.0(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbrace-expansion@1.1.112.0.1(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedbuiltin-modules@1.1.1(transitive)
- Removedbuiltins@1.0.3(transitive)
- Removedcachedir@2.4.0(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedchalk@1.1.32.4.2(transitive)
- Removedcharm@1.0.2(transitive)
- Removedchownr@2.0.0(transitive)
- Removedcliui@6.0.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcolor-convert@1.9.32.0.1(transitive)
- Removedcolor-name@1.1.31.1.4(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcommand-exists@1.2.9(transitive)
- Removedcommander@2.20.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconcat-stream@2.0.0(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removedcore-util-is@1.0.21.0.3(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddiff@3.5.0(transitive)
- Removeddts-critic@3.3.11(transitive)
- Removeddtslint@4.2.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesprima@4.0.1(transitive)
- Removedesutils@2.0.3(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-fifo@1.3.2(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedfs-extra@6.0.1(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedgauge@2.7.4(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedglob@7.2.3(transitive)
- Removedgopd@1.0.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@4.1.0(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-fullwidth-code-point@1.0.03.0.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisarray@1.0.02.0.5(transitive)
- Removedisexe@3.1.1(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjs-tokens@3.0.2(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stable-stringify@1.1.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedjsonify@0.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimatch@3.1.29.0.5(transitive)
- Removedminimist@1.2.8(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@0.5.61.0.4(transitive)
- Removednormalize-package-data@3.0.3(transitive)
- Removednpm-package-arg@8.1.5(transitive)
- Removednpmlog@4.1.2(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedqueue-tick@1.0.1(transitive)
- Removedreadable-stream@2.3.83.6.2(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedresolve@1.22.8(transitive)
- Removedretry@0.12.0(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsemver@5.7.26.3.17.6.3(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedslide@1.1.6(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedssri@8.0.1(transitive)
- Removedstreamx@2.20.2(transitive)
- Removedstring-width@1.0.24.2.3(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.16.0.1(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedsupports-color@2.0.05.5.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtar@6.2.1(transitive)
- Removedtar-stream@3.1.7(transitive)
- Removedtext-decoder@1.2.1(transitive)
- Removedtmp@0.2.3(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtslint@5.14.0(transitive)
- Removedtsutils@2.29.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedtypescript@4.9.5(transitive)
- Removedundici-types@5.26.5(transitive)
- Removeduniversalify@0.1.2(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.4.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedvalidate-npm-package-name@3.0.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedwhich@4.0.0(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwrap-ansi@6.2.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyallist@4.0.0(transitive)
- Removedyargs@15.4.1(transitive)
- Removedyargs-parser@18.1.3(transitive)