From 526f8997cc14d668029b1f7ea37d753cf50cfd29 Mon Sep 17 00:00:00 2001 From: sophiebremer <44302338+sophiebremer@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:11:01 +0100 Subject: [PATCH 1/5] Fix #32; array serialization not overloading form data --- lib/Utilities.d.ts | 6 ++--- lib/Utilities.js | 46 +++++++++++++++++++++++++++------ lib/Utilities.js.map | 2 +- src/Utilities.ts | 53 ++++++++++++++++++++++++++++++++------ tst/Utilities.test.ts | 60 +++++++++++++++++++++++++++---------------- 5 files changed, 125 insertions(+), 42 deletions(-) diff --git a/lib/Utilities.d.ts b/lib/Utilities.d.ts index 5cd3640..de5bf27 100644 --- a/lib/Utilities.d.ts +++ b/lib/Utilities.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ export declare namespace Utilities { diff --git a/lib/Utilities.js b/lib/Utilities.js index abde9c8..b8d1d85 100644 --- a/lib/Utilities.js +++ b/lib/Utilities.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ /* * @@ -93,12 +93,27 @@ export var Utilities; value === null) { continue; } - if (value instanceof Bridge.Blob && + if (Array.isArray(value)) { + if (target instanceof URLSearchParams) { + key += '[]'; + } + for (const v of value) { + target.append(key, v); + } + } + else if (value instanceof Bridge.Blob && target instanceof Bridge.FormData) { target.append(key, value); } else if (typeof value === 'object') { - target.append(key, JSON.stringify(value)); + if (target instanceof URLSearchParams) { + for (const k in value) { + target.append(`${key}[${k}]`, `${value[k]}`); + } + } + else { + target.append(key, JSON.stringify(value)); + } } else { target.append(key, `${value}`); @@ -106,18 +121,33 @@ export var Utilities; } } else { - for (const key in params) { + for (let key in params) { value = params[key]; if (typeof value === 'undefined' || value === null) { continue; } - if (value instanceof Bridge.Blob && + if (Array.isArray(value)) { + if (target instanceof URLSearchParams) { + key += '[]'; + } + for (const v of value) { + target.append(key, v); + } + } + else if (value instanceof Bridge.Blob && target instanceof Bridge.FormData) { target.append(key, value); } else if (typeof value === 'object') { - target.append(key, JSON.stringify(value)); + if (target instanceof URLSearchParams) { + for (const k in value) { + target.append(`${key}[${k}]`, `${value[k]}`); + } + } + else { + target.append(key, JSON.stringify(value)); + } } else { target.append(key, `${value}`); diff --git a/lib/Utilities.js.map b/lib/Utilities.js.map index cceda39..5c919dc 100644 --- a/lib/Utilities.js.map +++ b/lib/Utilities.js.map @@ -1 +1 @@ -{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../src/Utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E;;;;KAIK;AAEL,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;;;KAIK;AAEL,MAAM,KAAW,SAAS,CA2JzB;AA3JD,WAAiB,SAAS;IAEtB;;;;SAIK;IAOL;;;;SAIK;IAEL,SAAgB,aAAa,CACzB,MAAe,EACf,SAAmB,IAAI,MAAM,CAAC,QAAQ,EAAE;QAGxC,IAAK,MAAM,EAAG;YACV,cAAc,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;SACpC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAVe,uBAAa,gBAU5B,CAAA;IAED,SAAgB,YAAY,CACxB,MAAe,EACf,SAAkB,IAAI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,EAAE,GAAG,KAAK,EAAE,CAAE,CAAC;iBACpC;aACJ;SACJ;IACL,CAAC;IAhGe,wBAAc,iBAgG7B,CAAA;AAEL,CAAC,EAhMgB,SAAS,GAAT,SAAS,KAAT,SAAS,QAgMzB;AAED;;;;KAIK;AAEL,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/src/Utilities.ts b/src/Utilities.ts index c616229..0fe429a 100644 --- a/src/Utilities.ts +++ b/src/Utilities.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ @@ -139,21 +139,39 @@ export namespace Utilities { continue; } - if ( + if ( Array.isArray( value ) ) { + if ( target instanceof URLSearchParams ) { + key += '[]'; + } + for ( const v of value ) { + target.append( key, v ); + } + } + else if ( value instanceof Bridge.Blob && target instanceof Bridge.FormData ) { target.append( key, value ); } else if ( typeof value === 'object' ) { - target.append( key, JSON.stringify( value ) ); + if ( target instanceof URLSearchParams ) { + for ( const k in value ) { + target.append( + `${key}[${k}]`, + `${( value as Record )[k]}` + ); + } + } + else { + target.append( key, JSON.stringify( value ) ); + } } else { target.append( key, `${value}` ); } } } else { - for ( const key in params ) { + for ( let key in params ) { value = params[key]; @@ -163,14 +181,33 @@ export namespace Utilities { ) { continue; } - if ( + + if ( Array.isArray( value ) ) { + if ( target instanceof URLSearchParams ) { + key += '[]'; + } + for ( const v of value ) { + target.append( key, v ); + } + } + else if ( value instanceof Bridge.Blob && target instanceof Bridge.FormData ) { target.append( key, value ); } else if ( typeof value === 'object' ) { - target.append( key, JSON.stringify( value ) ); + if ( target instanceof URLSearchParams ) { + for ( const k in value ) { + target.append( + `${key}[${k}]`, + `${( value as Record )[k]}` + ); + } + } + else { + target.append( key, JSON.stringify( value ) ); + } } else { target.append( key, `${value}` ); diff --git a/tst/Utilities.test.ts b/tst/Utilities.test.ts index fde7aeb..d75cf31 100644 --- a/tst/Utilities.test.ts +++ b/tst/Utilities.test.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ @@ -73,7 +73,9 @@ test( 'Test Utilities.buildFormData - Array', ( assert: test.Assert ) => { ['some_string', '123'], ['some_number', '234'], ['some_object', '{"a":"1","b":2}'], - ['some_array', '["x","y","z"]'] + ['some_array', 'x'], + ['some_array', 'y'], + ['some_array', 'z'] ] ); const target = new Mastodon.Bridge.FormData(); @@ -92,7 +94,9 @@ test( 'Test Utilities.buildFormData - Array', ( assert: test.Assert ) => { ['some_string', '123'], ['some_number', '234'], ['some_object', '{"a":"1","b":2}'], - ['some_array', '["x","y","z"]'] + ['some_array', 'x'], + ['some_array', 'y'], + ['some_array', 'z'] ] ); } ); @@ -105,7 +109,7 @@ test( 'Test Utilities.buildHeaders - Array', ( assert: test.Assert ) => { let result = Mastodon.Utilities.buildHeaders( params ); assert.deepEqual( Array.from( result ), [ - ['some_array', '["x","y","z"]'], + ['some_array', 'x, y, z'], ['some_number', '234'], ['some_object', '{"a":"1","b":2}'], ['some_string', '123'] @@ -129,7 +133,7 @@ test( 'Test Utilities.buildHeaders - Record', ( assert: test.Assert ) => { result = Mastodon.Utilities.buildHeaders( params, headers ); assert.deepEqual( Array.from( result ), [ ['other', 'bar'], - ['some_array', '["x","y","z"]'], + ['some_array', 'x, y, z'], ['some_number', '234'], ['some_object', '{"a":"1","b":2}'], ['some_string', 'foo, 123'] @@ -145,17 +149,23 @@ test( 'Test Utilities.buildURL - ParamList', ( assert: test.Assert ) => { assert.deepEqual( types, ['mention', 'follow', 'reblog'] ); assert.equal( urlSearchParams.get( 'some_string' ), '123' ); assert.equal( urlSearchParams.get( 'some_number' ), '234' ); - assert.equal( urlSearchParams.get( 'some_object' ), '{"a":"1","b":2}' ); - assert.equal( urlSearchParams.get( 'some_array' ), '["x","y","z"]' ); + assert.equal( urlSearchParams.get( 'some_object[a]' ), '1' ); + assert.deepEqual( urlSearchParams.getAll( 'some_array[]' ), ['x', 'y', 'z'] ); - assert.equal( url.href, 'https://domain.example/foo?' + + assert.equal( + url.href, + 'https://domain.example/foo?' + 'types%5B%5D=mention&' + 'types%5B%5D=follow&' + 'types%5B%5D=reblog&' + 'some_string=123&' + 'some_number=234&' + - 'some_object=%7B%22a%22%3A%221%22%2C%22b%22%3A2%7D&' + - 'some_array=%5B%22x%22%2C%22y%22%2C%22z%22%5D' ); + 'some_object%5Ba%5D=1&' + + 'some_object%5Bb%5D=2&' + + 'some_array%5B%5D=x&' + + 'some_array%5B%5D=y&' + + 'some_array%5B%5D=z' + ); } ); test( 'Test Utilities.buildURL - ParamSet', ( assert: test.Assert ) => { @@ -166,14 +176,20 @@ test( 'Test Utilities.buildURL - ParamSet', ( assert: test.Assert ) => { assert.equal( urlSearchParams.get( 'types[]' ), 'mention' ); assert.equal( urlSearchParams.get( 'some_string' ), '123' ); assert.equal( urlSearchParams.get( 'some_number' ), '234' ); - assert.equal( urlSearchParams.get( 'some_object' ), '{"a":"1","b":2}' ); - assert.equal( urlSearchParams.get( 'some_array' ), '["x","y","z"]' ); - assert.equal( url.href, 'https://domain.example/foo?' + + assert.strictEqual( urlSearchParams.get( 'some_object[b]' ), '2' ); + assert.deepEqual( urlSearchParams.getAll( 'some_array[]' ), ['x', 'y', 'z'] ); + assert.equal( + url.href, + 'https://domain.example/foo?' + 'types%5B%5D=mention&' + 'some_string=123&' + 'some_number=234&' + - 'some_object=%7B%22a%22%3A%221%22%2C%22b%22%3A2%7D&' + - 'some_array=%5B%22x%22%2C%22y%22%2C%22z%22%5D' ); + 'some_object%5Ba%5D=1&' + + 'some_object%5Bb%5D=2&' + + 'some_array%5B%5D=x&' + + 'some_array%5B%5D=y&' + + 'some_array%5B%5D=z' + ); } ); test( 'Test Utilities.buildURLSearchParams - ParamList', ( assert: test.Assert ) => { @@ -184,8 +200,8 @@ test( 'Test Utilities.buildURLSearchParams - ParamList', ( assert: test.Assert ) assert.deepEqual( types, ['mention', 'follow', 'reblog'] ); assert.equal( urlSearchParams.get( 'some_string' ), '123' ); assert.equal( urlSearchParams.get( 'some_number' ), '234' ); - assert.equal( urlSearchParams.get( 'some_object' ), '{"a":"1","b":2}' ); - assert.equal( urlSearchParams.get( 'some_array' ), '["x","y","z"]' ); + assert.equal( urlSearchParams.get( 'some_object[a]' ), '1' ); + assert.deepEqual( urlSearchParams.getAll( 'some_array[]' ), ['x', 'y', 'z'] ); } ); test( 'Test Utilities.buildURLSearchParams - ParamSet', ( assert: test.Assert ) => { @@ -195,8 +211,8 @@ test( 'Test Utilities.buildURLSearchParams - ParamSet', ( assert: test.Assert ) assert.equal( urlSearchParams.get( 'types[]' ), 'mention' ); assert.equal( urlSearchParams.get( 'some_string' ), '123' ); assert.equal( urlSearchParams.get( 'some_number' ), '234' ); - assert.equal( urlSearchParams.get( 'some_object' ), '{"a":"1","b":2}' ); - assert.equal( urlSearchParams.get( 'some_array' ), '["x","y","z"]' ); + assert.equal( urlSearchParams.get( 'some_object[b]' ), '2' ); + assert.deepEqual( urlSearchParams.getAll( 'some_array[]' ), ['x', 'y', 'z'] ); } ); test( 'Test Utilities.transferParams', ( assert: test.Assert ) => { @@ -219,7 +235,7 @@ test( 'Test Utilities.transferParams', ( assert: test.Assert ) => { assert.equal( target.get( 'undefined' ), null ); assert.equal( target.get( 'hello' ), 'hello' ); assert.equal( target.get( 'ab' ), '{"a":1,"b":"2"}' ); - assert.equal( target.get( 'xy' ), '["x","y"]' ); + assert.deepEqual( target.getAll( 'xy' ), ['x', 'y'] ); assert.ok( // return type differs between Node.js v16 (File) and v18 (Blob) target.get( 'blob' ) instanceof Mastodon.Bridge.Blob From 782e24d748505adcfe95a2ce3d39d1a630fe5fb6 Mon Sep 17 00:00:00 2001 From: sophiebremer <44302338+sophiebremer@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:08:31 +0100 Subject: [PATCH 2/5] Update package.json --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5054603..b6f7fd1 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "clean": "rm -rf lib tst-run", "server:start": "cd tst-data && python3 -m http.server 8000 &", "server:stop": "kill $(lsof -t -i:8000)", - "test": "npm run server:start ; npm run build && tst --reset --verbose tst/ && npm run server:stop", + "test": "npm run server:start ; npm run test:all ; npm run server:stop", + "test:all": "npm run build && tst --reset --verbose tst/", "test:ci": "tst --reset --verbose tst/", "watch": "npm run build -- --watch" } From 78576bf1811abd5f0ddc249435bbad8b5a326a32 Mon Sep 17 00:00:00 2001 From: sophiebremer <44302338+sophiebremer@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:31:14 +0100 Subject: [PATCH 3/5] Fix file attachment to form data --- lib/Utilities.js | 10 ++++++---- lib/Utilities.js.map | 2 +- src/Utilities.ts | 14 ++++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/Utilities.js b/lib/Utilities.js index b8d1d85..24c557e 100644 --- a/lib/Utilities.js +++ b/lib/Utilities.js @@ -101,8 +101,9 @@ export var Utilities; target.append(key, v); } } - else if (value instanceof Bridge.Blob && - target instanceof Bridge.FormData) { + else if (target instanceof Bridge.FormData && + (value instanceof Bridge.Blob || + value instanceof Bridge.File)) { target.append(key, value); } else if (typeof value === 'object') { @@ -135,8 +136,9 @@ export var Utilities; target.append(key, v); } } - else if (value instanceof Bridge.Blob && - target instanceof Bridge.FormData) { + else if (target instanceof Bridge.FormData && + (value instanceof Bridge.Blob || + value instanceof Bridge.File)) { target.append(key, value); } else if (typeof value === 'object') { diff --git a/lib/Utilities.js.map b/lib/Utilities.js.map index 5c919dc..90c9c53 100644 --- a/lib/Utilities.js.map +++ b/lib/Utilities.js.map @@ -1 +1 @@ -{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../src/Utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E;;;;KAIK;AAEL,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;;;KAIK;AAEL,MAAM,KAAW,SAAS,CAgMzB;AAhMD,WAAiB,SAAS;IAEtB;;;;SAIK;IAOL;;;;SAIK;IAEL,SAAgB,aAAa,CACzB,MAAe,EACf,SAAmB,IAAI,MAAM,CAAC,QAAQ,EAAE;QAGxC,IAAK,MAAM,EAAG;YACV,cAAc,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;SACpC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAVe,uBAAa,gBAU5B,CAAA;IAED,SAAgB,YAAY,CACxB,MAAe,EACf,SAAkB,IAAI,MAAM,CAAC,OAAO,EAAE;QAGtC,IAAK,MAAM,EAAG;YACV,cAAc,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;SACpC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAVe,sBAAY,eAU3B,CAAA;IAED,SAAgB,QAAQ,CACpB,IAAY,EACZ,OAAe,GAAG,EAClB,MAAe;QAEf,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,CAAE,IAAI,EAAE,IAAI,CAAE,CAAC;QAEzC,IAAK,MAAM,EAAG;YACV,oBAAoB,CAAE,MAAM,EAAE,GAAG,CAAC,YAAY,CAAE,CAAC;SACpD;QAED,OAAO,GAAG,CAAC;IACf,CAAC;IAZe,kBAAQ,WAYvB,CAAA;IAED,SAAgB,oBAAoB,CAChC,MAAe,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,MAAM,CAAC,IAAI;wBAC5B,KAAK,YAAY,MAAM,CAAC,IAAI,CAC/B,EACH;oBACE,MAAM,CAAC,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,CAAC;iBAC/B;qBACI,IAAK,OAAO,KAAK,KAAK,QAAQ,EAAG;oBAClC,IAAK,MAAM,YAAY,eAAe,EAAG;wBACrC,KAAM,MAAM,CAAC,IAAI,KAAK,EAAG;4BACrB,MAAM,CAAC,MAAM,CACT,GAAG,GAAG,IAAI,CAAC,GAAG,EACd,GAAK,KAAkC,CAAC,CAAC,CAAC,EAAE,CAC/C,CAAC;yBACL;qBACJ;yBACI;wBACD,MAAM,CAAC,MAAM,CAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAE,KAAK,CAAE,CAAE,CAAC;qBACjD;iBACJ;qBACI;oBACD,MAAM,CAAC,MAAM,CAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAE,CAAC;iBACpC;aACJ;SACJ;IACL,CAAC;IAtGe,wBAAc,iBAsG7B,CAAA;AAEL,CAAC,EAtMgB,SAAS,GAAT,SAAS,KAAT,SAAS,QAsMzB;AAED;;;;KAIK;AAEL,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/src/Utilities.ts b/src/Utilities.ts index 0fe429a..2edef1b 100644 --- a/src/Utilities.ts +++ b/src/Utilities.ts @@ -148,8 +148,11 @@ export namespace Utilities { } } else if ( - value instanceof Bridge.Blob && - target instanceof Bridge.FormData + target instanceof Bridge.FormData && + ( + value instanceof Bridge.Blob || + value instanceof Bridge.File + ) ) { target.append( key, value ); } @@ -191,8 +194,11 @@ export namespace Utilities { } } else if ( - value instanceof Bridge.Blob && - target instanceof Bridge.FormData + target instanceof Bridge.FormData && + ( + value instanceof Bridge.Blob || + value instanceof Bridge.File + ) ) { target.append( key, value ); } From 8434133e96e6bfb3ff7e4cd8cc3291abe7bf1a72 Mon Sep 17 00:00:00 2001 From: sophiebremer <44302338+sophiebremer@users.noreply.github.com> Date: Sat, 24 Feb 2024 17:15:43 +0100 Subject: [PATCH 4/5] Fix query structure for array parameter --- lib/API.d.ts | 9 ++-- lib/API.js | 7 ++-- lib/API.js.map | 2 +- lib/Bridge.d.ts | 6 +-- lib/Bridge.js | 6 +-- lib/Bridge.js.map | 2 +- lib/OAuth.d.ts | 6 +-- lib/OAuth.js | 6 +-- lib/OAuth.js.map | 2 +- lib/REST.d.ts | 6 +-- lib/REST.js | 10 +++-- lib/REST.js.map | 2 +- lib/StreamAPI.d.ts | 6 +-- lib/StreamAPI.js | 6 +-- lib/StreamAPI.js.map | 2 +- lib/Utilities.js | 12 ++++-- lib/Utilities.js.map | 2 +- lib/index.d.ts | 6 +-- lib/index.js | 6 +-- lib/index.js.map | 2 +- src/API.ts | 96 ++++++++++++++++++++++++++++++++++++++++--- src/Bridge.ts | 20 +++++++-- src/OAuth.ts | 8 ++-- src/REST.ts | 54 ++++++++++++++++++++++-- src/StreamAPI.ts | 38 +++++++++++++++-- src/Types.d.ts | 25 +++++++++-- src/Utilities.ts | 72 ++++++++++++++++++++++++++++++-- src/index.ts | 10 +++-- tst/Utilities.test.ts | 66 ++++++++++++++++++++--------- 29 files changed, 398 insertions(+), 97 deletions(-) diff --git a/lib/API.d.ts b/lib/API.d.ts index db4a8ca..5e7d6bf 100644 --- a/lib/API.d.ts +++ b/lib/API.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ import * as JSON from './JSON/index.js'; @@ -416,6 +416,9 @@ export declare namespace API { with_dismissed?: boolean; } interface Config extends REST.Config { + /** + * API version to distinguish between multiple instances of the API. + */ api_version?: number; } interface NotificationParams extends QueryParams { diff --git a/lib/API.js b/lib/API.js index 17be310..ac6b0d5 100644 --- a/lib/API.js +++ b/lib/API.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ /* * @@ -183,7 +183,6 @@ export class API { return parseInt(value); } } - ; async fetch(method, path, params) { const rest = this.rest; const result = await rest.fetch(method, path, params); diff --git a/lib/API.js.map b/lib/API.js.map index 24b42f0..402472e 100644 --- a/lib/API.js.map +++ b/lib/API.js.map @@ -1 +1 @@ -{"version":3,"file":"API.js","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E;;;;KAIK;AAEL,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;KAIK;AAEL;;;;GAIG;AACH,MAAM,OAAO,GAAG;IAEZ;;;;SAIK;IAEL;;;OAGG;IACH,YACI,MAAkB;QAElB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAE,MAAM,CAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,CACX,MAAM,CAAC,WAAW;YAClB,QAAQ,CAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAE,aAAa,CAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAE,CAChE,CAAC;IACN,CAAC;IAED;;;;SAIK;IAEL;;OAEG;IACI,SAAS,CAAS;IAEzB;;OAEG;IACa,IAAI,CAAO;IAE3B;;;;OA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,OAAO,OAAO,CAAC,MAAM,CAAE,MAAM,CAAE,CAAC;SACnC;QAED,OAAO,MAAyB,CAAC;IACrC,CAAC;IAGD;;;;;;;;;;OAUG;IACI,KAAK,CAAC,MAAM,CACf,MAAmB;QAEnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAE,QAAQ,EAAE,MAAM,CAAE,CAAC;QAElD,IACI,MAAM,CAAC,MAAM;YACb,MAAM,CAAC,MAAM,KAAK,GAAG;YACrB,CAAC,IAAI,CAAC,eAAe,CAAE,MAAM,CAAC,IAAI,CAAE,EACtC;YACE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;YACrB,OAAO,OAAO,CAAC,MAAM,CAAE,MAAM,CAAE,CAAC;SACnC;QAED,OAAO,MAAyC,CAAC;IACrD,CAAC;CAGJ;AAsJD;;;;KAIK;AAGL,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/lib/Bridge.d.ts b/lib/Bridge.d.ts index 3a2cfe2..74634c0 100644 --- a/lib/Bridge.d.ts +++ b/lib/Bridge.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ export declare const Bridge: { diff --git a/lib/Bridge.js b/lib/Bridge.js index 6644475..ed1e39b 100644 --- a/lib/Bridge.js +++ b/lib/Bridge.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ /* * diff --git a/lib/Bridge.js.map b/lib/Bridge.js.map index 7a056b9..b462878 100644 --- a/lib/Bridge.js.map +++ b/lib/Bridge.js.map @@ -1 +1 @@ -{"version":3,"file":"Bridge.js","sourceRoot":"","sources":["../src/Bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E;;;;KAIK;AAEL,MAAM,MAAM,GAAG,CACX,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC;IAC3B,UAAU,CAAC,CAAC;IACZ,MAAM,CACb,CAAC;AAEF,MAAM,KAAK,GAAG,CACV,MAAM,CAAC,KAAK;IACZ,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,OAAO,CAC3C,CAAC;AAEF,MAAM,IAAI,GAAG,CACT,MAAM,CAAC,IAAI;IACX,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,IAAI,CACxC,CAAC;AAEF,MAAM,IAAI,GAAG,CACT,MAAM,CAAC,IAAI;IACX,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,IAAI,CACxC,CAAC;AAEF,MAAM,QAAQ,GAAG,CACb,MAAM,CAAC,QAAQ;IACf,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,QAAQ,CAC5C,CAAC;AAEF,MAAM,OAAO,GAAG,CACZ,MAAM,CAAC,OAAO;IACd,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,OAAO,CAC3C,CAAC;AAEF,MAAM,QAAQ,GAAG,CACb,MAAM,CAAC,QAAQ;IACf,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,QAAQ,CAC5C,CAAC;AAEF,MAAM,GAAG,GAAG,CACR,MAAM,CAAC,GAAG;IACV,CAAE,MAAM,MAAM,CAAE,K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AAC,OAAO;IACd,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,OAAO,CAC3C,CAAC;AAGF,MAAM,QAAQ,GAAG,CACb,MAAM,CAAC,QAAQ;IACf,CAAE,MAAM,MAAM,CAAE,YAAY,CAAE,CAAE,CAAC,QAAQ,CAC5C,CAAC;AAGF,MAAM,GAAG,GAAG,CACR,MAAM,CAAC,GAAG;IACV,CAAE,MAAM,MAAM,CAAE,KAAK,CAAE,CAAE,CAAC,GAAG,CAChC,CAAC;AAGF,MAAM,eAAe,GAAG,CACpB,MAAM,CAAC,eAAe;IACtB,CAAE,MAAM,MAAM,CAAE,KAAK,CAAE,CAAE,CAAC,eAAe,CAC5C,CAAC;AAGF,MAAM,SAAS,GAAG,CACd,MAAM,CAAC,SAAS;IAChB,CAAE,MAAM,MAAM,CAAE,IAAI,CAAE,CAAE,CAAC,SAAS,CACrC,CAAC;AAGF;;;;KAIK;AAGL,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,GAAG;IACH,eAAe;IACf,SAAS;CACZ,CAAC;AAGF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/lib/OAuth.d.ts b/lib/OAuth.d.ts index c12dd37..bbdc12c 100644 --- a/lib/OAuth.d.ts +++ b/lib/OAuth.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ export declare namespace OAuth { diff --git a/lib/OAuth.js b/lib/OAuth.js index cb5cfb8..50acbbe 100644 --- a/lib/OAuth.js +++ b/lib/OAuth.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ /* * diff --git a/lib/OAuth.js.map b/lib/OAuth.js.map index f5cef6a..f955edf 100644 --- a/lib/OAuth.js.map +++ b/lib/OAuth.js.map @@ -1 +1 @@ -{"version":3,"file":"OAuth.js","sourceRoot":"","sources":["../src/OAuth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAG/E;;;;KAIK;AAGL,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC;;;;KAIK;AAGL,MAAM,KAAW,KAAK,CAkJrB;AAlJD,WAAiB,KAAK;IAGlB;;;;SAIK;IAUL;;;;SAIK;IAGL;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACI,KAAK,UAAU,SAAS,CAC3B,MAAc,EACd,OAAe,EACf,WAAW,GAAG,2BAA2B,EACzC,MAAM,GAAG,mBAAmB,EAC5B,UAAmB;QAEnB,MAAM,IAAI,GAA6B,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE7D,IAAI,CAAC,MAAM,CAAE,aAAa,EAAE,OAAO,CAAE,CAAC;QACtC,IAAI,CAAC,MAAM,CAAE,eAAe,EAAE,WAAW,CAAE,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAE,QAAQ,EAAE,MAAM,CAAE,CAAC;QAEhC,IAAK,UAAU,EAAG;YACd,IAAI,CAAC,MAAM,CAAE,SAAS,EAAE,UAAU,CAAE,CAAC;SACxC;QAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAC/B,GAAG,MA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,EAnJgB,KAAK,GAAL,KAAK,KAAL,KAAK,QAmJrB;AAGD;;;;KAIK;AAGL,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/lib/REST.d.ts b/lib/REST.d.ts index 4c737c0..02beba1 100644 --- a/lib/REST.d.ts +++ b/lib/REST.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ declare global { diff --git a/lib/REST.js b/lib/REST.js index 8d67192..9131500 100644 --- a/lib/REST.js +++ b/lib/REST.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ /* * @@ -151,7 +151,9 @@ export class REST { if (!params) { return; } - const pairs = (Array.isArray(params) ? params : Object.entries(params)); + const pairs = (Array.isArray(params) ? + params : + Object.entries(params)); let pair; for (let i = 0, iEnd = pairs.length; i < iEnd; ++i) { pair = pairs[i]; diff --git a/lib/REST.js.map b/lib/REST.js.map index 3e5efc1..1688cba 100644 --- a/lib/REST.js.map +++ b/lib/REST.js.map @@ -1 +1 @@ -{"version":3,"file":"REST.js","sourceRoot":"","sources":["../src/REST.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E;;;;KAIK;AAEL,OAAO,MAAM,MAAM,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,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAG;YAClD,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEhB,IAAK,KAAK,CAAC,OAAO,CAAE,IAAI,CAAC,CAAC,CAAC,CAAE,EAAG;gBAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEvB,KAAM,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAG;oBACnD,KAAK,CAAC,IAAI,CAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;iBAClC;aACJ;iBACI;gBACD,KAAK,CAAC,IAAI,CAAE,IAAI,CAAE,CAAC;aACtB;SACJ;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAlCe,iBAAY,eAkC3B,CAAA;AAGL,CAAC,EArIgB,IAAI,GAAJ,IAAI,KAAJ,IAAI,QAqIpB;AAGD;;;;KAIK;AAGL,eAAe,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/StreamAPI.d.ts b/lib/StreamAPI.d.ts index db1892b..ae64494 100644 --- a/lib/StreamAPI.d.ts +++ b/lib/StreamAPI.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ import * as JSON from './JSON/index.js'; diff --git a/lib/StreamAPI.js b/lib/StreamAPI.js index 946a79a..29f2231 100644 --- a/lib/StreamAPI.js +++ b/lib/StreamAPI.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ /* * diff --git a/lib/StreamAPI.js.map b/lib/StreamAPI.js.map index d4a6f2f..2abf6f6 100644 --- a/lib/StreamAPI.js.map +++ b/lib/StreamAPI.js.map @@ -1 +1 @@ -{"version":3,"file":"StreamAPI.js","sourceRoot":"","sources":["../src/StreamAPI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E;;;;KAIK;AAEL,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC;;;;KAIK;AAEL;;GAEG;AACH,MAAM,OAAO,SAAS;IAElB;;;;SAIK;IAEL;;;OAGG;IACH,YACI,MAAwB;QAGxB,IAAK,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAE,aAAa,CAAE,EAAG;YAC7C,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAE,MAAM,CAAC,OAAO,EAAE,WAAW,CAAE,CAAC,IAAI,CAAC;SAC3E;QAED,IAAI,CAAC,SAAS,GAAG;YACb,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,EAAE;SACd,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;SAIK;IAEW,SAAS,CAAkC;IAE3C,MAAM,CAAmB;IAElC,SAAS,C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C;IAGM,KAAK,CAAC,UAAU,CACnB,UAA2B,EAC3B,YAAgC,EAChC,aAAqD;QAErD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAEvD,SAAS,CAAC,IAAI,CAAE,IAAI,CAAC,SAAS,CAAE;YAC5B,GAAG,YAAY;YACf,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,UAAU;SACrB,CAAE,CAAE,CAAC;QAEN,IAAK,aAAa,EAAG;YACjB,IAAI,CAAC,GAAG,CAAE,SAAS,EAAE,aAAa,CAAE,CAAC;SACxC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CAGJ;AAuCD;;;;KAIK;AAGL,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/lib/Utilities.js b/lib/Utilities.js index 24c557e..1638955 100644 --- a/lib/Utilities.js +++ b/lib/Utilities.js @@ -94,7 +94,8 @@ export var Utilities; continue; } if (Array.isArray(value)) { - if (target instanceof URLSearchParams) { + // Add brackets for query structures + if (!(target instanceof Headers)) { key += '[]'; } for (const v of value) { @@ -107,7 +108,8 @@ export var Utilities; target.append(key, value); } else if (typeof value === 'object') { - if (target instanceof URLSearchParams) { + // Add brackets for query structures + if (!(target instanceof Headers)) { for (const k in value) { target.append(`${key}[${k}]`, `${value[k]}`); } @@ -129,7 +131,8 @@ export var Utilities; continue; } if (Array.isArray(value)) { - if (target instanceof URLSearchParams) { + // Add brackets for query structures + if (!(target instanceof Headers)) { key += '[]'; } for (const v of value) { @@ -142,7 +145,8 @@ export var Utilities; target.append(key, value); } else if (typeof value === 'object') { - if (target instanceof URLSearchParams) { + // Add brackets for query structures + if (!(target instanceof Headers)) { for (const k in value) { target.append(`${key}[${k}]`, `${value[k]}`); } diff --git a/lib/Utilities.js.map b/lib/Utilities.js.map index 90c9c53..7e51a2c 100644 --- a/lib/Utilities.js.map +++ b/lib/Utilities.js.map @@ -1 +1 @@ -{"version":3,"file":"Utilities.js","source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AAY,MAAM,CAAC,IAAI,CAC/B,EACH;oBAEE,MAAM,CAAC,MAAM,CAAE,GAAG,EAAE,KAAK,CAAE,CAAC;iBAE/B;qBACI,IAAK,OAAO,KAAK,KAAK,QAAQ,EAAG;oBAElC,oCAAoC;oBACpC,IAAK,CAAC,CAAE,MAAM,YAAY,OAAO,CAAE,EAAG;wBAElC,KAAM,MAAM,CAAC,IAAI,KAAK,EAAG;4BAErB,MAAM,CAAC,MAAM,CACT,GAAG,GAAG,IAAI,CAAC,GAAG,EACd,GAAK,KAAkC,CAAC,CAAC,CAAC,EAAE,CAC/C,CAAC;yBAEL;qBAEJ;yBACI;wBAED,MAAM,CAAC,MAAM,CAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAE,KAAK,CAAE,CAAE,CAAC;qBAEjD;iBAEJ;qBACI;oBAED,MAAM,CAAC,MAAM,CAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAE,CAAC;iBAEpC;aAEJ;SAEJ;IAEL,CAAC;IAtJe,wBAAc,iBAsJ7B,CAAA;AAGL,CAAC,EAhQgB,SAAS,GAAT,SAAS,KAAT,SAAS,QAgQzB;AAGD;;;;KAIK;AAGL,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts index 0c2c2c8..51f073d 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ export * as JSON from './JSON/index.js'; diff --git a/lib/index.js b/lib/index.js index e5aaf92..c55516d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ export * as JSON from './JSON/index.js'; diff --git a/lib/index.js.map b/lib/index.js.map index 857b301..e233134 100644 --- a/lib/index.js.map +++ b/lib/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;+EAU+E;AAE/E,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,cAAc,UAAU,CAAC;AAEzB,cAAc,aAAa,CAAC;AAE5B,cAAc,WAAW,CAAC;AAE1B,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/src/API.ts b/src/API.ts index 73793cd..5cb4a02 100644 --- a/src/API.ts +++ b/src/API.ts @@ -4,27 +4,32 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Imports * * */ + import * as JSON from './JSON/index.js'; + import REST from './REST.js'; + /* * * * Class * * */ + /** * Mastodon API to fetch, create, and delete content. * @@ -32,12 +37,14 @@ import REST from './REST.js'; */ export class API { + /* * * * Constructor * * */ + /** * @param config * Configuration with access token and URL to the Mastodon server. @@ -53,22 +60,26 @@ export class API { ); } + /* * * * Properties * * */ + /** * Expected communication delay by the Mastodon server. */ public nextDelay: number; + /** * Underlying REST API of this instance. */ public readonly rest: REST; + /** * Version from extracted from `config.api_version` or `config.api_url`. * @@ -76,12 +87,14 @@ export class API { */ public readonly version: number; + /* * * * Functions * * */ + /** * Delays a async promise by the expected amount of time, which the Mastodon * server send during the last communication. @@ -93,6 +106,7 @@ export class API { return new Promise( resolve => setTimeout( resolve, this.nextDelay ) ); } + /** * Deletes a path. * @@ -112,6 +126,7 @@ export class API { return this.fetch( 'DELETE', path, params ); } + /** * Deletes a list of accounts. * @@ -138,6 +153,7 @@ export class API { return result as API.Success; } + /** * Deletes a list of accounts. * @@ -168,6 +184,7 @@ export class API { return result as API.Success; } + /** * Deletes reaction from an announcement. * @@ -198,6 +215,7 @@ export class API { return result as API.Success<{}>; } + /** * Deletes a status. * @@ -224,6 +242,7 @@ export class API { return result as API.Success; } + protected extractRateLimit ( headers: Headers ): ( number | undefined ) { @@ -238,7 +257,9 @@ export class API { if ( typeof value === 'string' ) { return parseInt( value ); } - }; + + } + protected async fetch ( method: ( 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT' ), @@ -258,6 +279,7 @@ export class API { return result; } + /** * Get a result from a path. * @@ -277,6 +299,7 @@ export class API { return this.fetch( 'GET', path, params ); } + /** * Gets the connected account. * @@ -298,6 +321,7 @@ export class API { return result as API.Success; } + /** * Gets the connected account. * @@ -321,6 +345,7 @@ export class API { return result as API.Success>; } + /** * Gets a list. * @@ -347,6 +372,7 @@ export class API { return result as API.Success; } + /** * Gets the accounts of a list. * @@ -377,6 +403,7 @@ export class API { return result as API.Success; } + /** * Gets lists. * @@ -403,6 +430,7 @@ export class API { return result as API.Success>; } + /** * Gets a media attachment. * @@ -456,6 +484,7 @@ export class API { return result as API.Success>; } + /** * Gets a status. * @@ -482,6 +511,7 @@ export class API { return result as API.Success; } + /** * Gets the context of a status with ancestors and descendants. * @@ -508,6 +538,7 @@ export class API { return result as API.Success; } + /** * Gets statuses of an account. * @@ -538,6 +569,7 @@ export class API { return result as API.Success>; } + /** * Gets statuses from the personal timeline. * @@ -564,6 +596,7 @@ export class API { return result as API.Success>; } + /** * Gets statuses from a list of accounts. * @@ -594,6 +627,7 @@ export class API { return result as API.Success>; } + /** * Gets statuses from the public timeline. * @@ -620,6 +654,7 @@ export class API { return result as API.Success>; } + /** * Gets statuses for a tag. * @@ -650,6 +685,7 @@ export class API { return result as API.Success>; } + /** * Post parameters to a path. * @@ -669,6 +705,7 @@ export class API { return this.fetch( 'POST', path, params ); } + /** * Dismisses all notifications. * @@ -690,6 +727,7 @@ export class API { return result as API.Success<{}>; } + /** * Dismisses an announcement. * @@ -716,6 +754,7 @@ export class API { return result as API.Success<{}>; } + /** * Dismisses a single notification. * @@ -742,6 +781,7 @@ export class API { return result as API.Success<{}>; } + /** * Posts a new list or updates an existing list. * @@ -768,6 +808,7 @@ export class API { return result as API.Success; } + /** * Posts a new list or updates an existing list. * @@ -798,6 +839,7 @@ export class API { return result as API.Success; } + /** * Posts a new media attachment. * @@ -827,6 +869,7 @@ export class API { return result as API.Success; } + /** * Posts a poll vote. * @@ -857,6 +900,7 @@ export class API { return result as API.Success; } + /** * Posts a new status or updates an existing status. * @@ -889,6 +933,7 @@ export class API { return result as API.Success<( JSON.Status | JSON.StatusSchedule )>; } + /** * Put parameters to a path. * @@ -908,6 +953,7 @@ export class API { return this.fetch( 'PUT', path, params ); } + /** * Put a new reaction to an announcement. * @@ -938,6 +984,7 @@ export class API { return result as API.Success<{}>; } + /** * Search for accounts, hashtags, and statuses. Requires a `v2` API URL. * @@ -966,123 +1013,162 @@ export class API { return result as API.Success; } + } + /* * * * Namespace * * */ + /** * @namespace * @name API */ export namespace API { + /* * * * Declarations * * */ + /** * Query parameters to retrieve announcements. */ export interface AnnouncementsParams { + /** * If true, response will include announcements dismissed by the user. */ with_dismissed?: boolean; + } + export interface Config extends REST.Config { + + /** + * API version to distinguish between multiple instances of the API. + */ api_version?: number; + } + export interface NotificationParams extends QueryParams { + /** * Get only notifications received from the specified account. */ account_id?: string; + /** * An array of notification types to filter out. (See * {@link JSON.NotificationType}.) */ - 'exclude_types[]'?: Array, + 'exclude_types[]'?: Array; + /** * An array to filter notifications by type. (See * {@link JSON.NotificationType}.) */ 'types[]'?: Array; + } + export interface QueryParams extends REST.ParamRecord { + /** * Maximum number of results to return. Server defaults to 20 statuses. * Server maximum is 40 statuses. */ limit?: number; + /** * Return results older than ID. */ max_id?: string; + /** * Return results newer than ID. */ min_id?: string; + /** * Return newest results newer than ID. */ since_id?: string; + } + export interface Result extends REST.Result { rateLimit?: number; } + export interface Success extends Result { failed: false; json: T; status: ( 200 | 202 | 206 ); } + export interface StatusesOfPublicParams extends QueryParams { + /** * Get only local statuses. */ local?: boolean; + /** * Get only statuses with media attachment. */ only_media?: boolean; + /** * Get only remote statuses. */ remote?: boolean; + } + export interface StatusesOfTagParams extends StatusesOfPublicParams { + /** * Get statuses with all of these tags. */ 'all[]'?: Array; + /** * Get statuses with any of these tags. */ 'any[]'?: Array; + /** * Do not get statuses with any of these tags. */ 'none[]'?: Array; + } + } + /* * * * Default Export * * */ + export default API; diff --git a/src/Bridge.ts b/src/Bridge.ts index 596a2dc..a424909 100644 --- a/src/Bridge.ts +++ b/src/Bridge.ts @@ -4,75 +4,88 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Constants * * */ + const global = ( typeof window === 'undefined' ? globalThis : window ); + const fetch = ( global.fetch || ( await import( 'node-fetch' ) ).default ); + const Blob = ( global.Blob || ( await import( 'node-fetch' ) ).Blob ); + const File = ( global.File || ( await import( 'node-fetch' ) ).File ); + const FormData = ( global.FormData || ( await import( 'node-fetch' ) ).FormData ); + const Headers = ( global.Headers || ( await import( 'node-fetch' ) ).Headers ); + const Response = ( global.Response || ( await import( 'node-fetch' ) ).Response ); + const URL = ( global.URL || ( await import( 'url' ) ).URL ); + const URLSearchParams = ( global.URLSearchParams || ( await import( 'url' ) ).URLSearchParams ); + const WebSocket = ( global.WebSocket || ( await import( 'ws' ) ).WebSocket ); + /* * * * Default Export * * */ + export const Bridge = { global, fetch, @@ -86,4 +99,5 @@ export const Bridge = { WebSocket }; + export default Bridge; diff --git a/src/OAuth.ts b/src/OAuth.ts index 71893d6..7eef6c7 100644 --- a/src/OAuth.ts +++ b/src/OAuth.ts @@ -4,9 +4,9 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ @@ -174,6 +174,7 @@ export namespace OAuth { } ); } + } @@ -183,4 +184,5 @@ export namespace OAuth { * * */ + export default OAuth; diff --git a/src/REST.ts b/src/REST.ts index 5b2f0c1..6c50213 100644 --- a/src/REST.ts +++ b/src/REST.ts @@ -4,50 +4,64 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Imports * * */ + import Bridge from './Bridge.js'; + import Utilities from './Utilities.js'; + /* * * * Declarations * * */ + declare global { + + interface RequestInit { follow?: number; } + + } + /* * * * Class * * */ + export class REST { + /* * * * Constructor * * */ + public constructor ( config: REST.Config ) { + this.apiURL = config.api_url; config.timeout_ms = ( @@ -57,24 +71,30 @@ export class REST { ); this.config = config as Required; + } + /* * * * Properties * * */ + public readonly apiURL: string; + public readonly config: Required; + /* * * * Functions * * */ + public delete ( path: string, params?: REST.Params @@ -82,6 +102,7 @@ export class REST { return this.fetch( 'DELETE', path, params ); } + public async fetch ( method: REST.Method, path: string, @@ -169,6 +190,7 @@ export class REST { } } + public get ( path: string, params?: REST.Params @@ -176,6 +198,7 @@ export class REST { return this.fetch( 'GET', path, params ); } + public patch ( path: string, params?: REST.Params @@ -183,6 +206,7 @@ export class REST { return this.fetch( 'PATCH', path, params ); } + public post ( path: string, params?: REST.Params @@ -190,6 +214,7 @@ export class REST { return this.fetch( 'POST', path, params ); } + public put ( path: string, params?: REST.Params @@ -197,22 +222,27 @@ export class REST { return this.fetch( 'PUT', path, params ); } + } + /* * * * Namespace * * */ + export namespace REST { + /* * * * Declarations * * */ + export interface Config { access_token: string; api_url: string; @@ -221,6 +251,7 @@ export namespace REST { user_agent?: string; } + export type Method = ( | 'DELETE' | 'GET' @@ -229,12 +260,16 @@ export namespace REST { | 'PUT' ); + export type ParamArray = Array<[string, unknown]>; + export type ParamRecord = Record; + export type Params = ( ParamArray | ParamRecord ); + export interface Result { failed: boolean; json: any; @@ -243,18 +278,21 @@ export namespace REST { status: number; } + export interface Success extends Result { failed: false; json: T; status: 200; } + /* * * * Functions * * */ + export function isParamArray ( params?: Params ): params is ParamArray { @@ -267,6 +305,7 @@ export namespace REST { ); } + /** * Converts a Params structure into a ParamArray structure. Value arrays of * params will be split into multiple pairs of the ParamArray. If no special @@ -299,7 +338,11 @@ export namespace REST { return; } - const pairs = ( Array.isArray( params ) ? params : Object.entries( params ) ); + const pairs = ( + Array.isArray( params ) ? + params : + Object.entries( params ) + ); let pair: [string, unknown]; @@ -322,12 +365,15 @@ export namespace REST { return array; } + } + /* * * * Default Export * * */ + export default REST; diff --git a/src/StreamAPI.ts b/src/StreamAPI.ts index 81e9e0d..8115ab5 100644 --- a/src/StreamAPI.ts +++ b/src/StreamAPI.ts @@ -4,39 +4,47 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Imports * * */ + import Bridge from './Bridge.js'; + import * as JSON from './JSON/index.js'; + import Utilities from './Utilities.js'; + /* * * * Class * * */ + /** * Mastodon streaming API to listen to new content. */ export class StreamAPI { + /* * * * Constructor * * */ + /** * @param config * Configuration with URL to the Mastodon server. @@ -54,27 +62,35 @@ export class StreamAPI { error: [], message: [] }; + this.config = config; + } + /* * * * Properties * * */ + public readonly listeners: Record>; + public readonly config: StreamAPI.Config; + public webSocket?: WebSocket; + /* * * * Functions * * */ + protected dispatch ( eventType: K, e: StreamAPI.EventMap[K] @@ -92,8 +108,10 @@ export class StreamAPI { for ( let i = 0, iEnd = listeners.length; i < iEnd; ++i ) { listeners[i].call( this, e ); } + } + public off ( eventType: K, eventListener: ( e: StreamAPI.EventMap[K] ) => void @@ -108,6 +126,7 @@ export class StreamAPI { return this; } + public on ( eventType: K, eventListener: ( e: StreamAPI.EventMap[K] ) => void @@ -118,6 +137,7 @@ export class StreamAPI { return this; } + protected async setup (): Promise { const config = this.config; const health = await Bridge.fetch( Utilities.buildURL( config.api_url, 'health' ) ); @@ -152,6 +172,7 @@ export class StreamAPI { } ); } + public async subscribe ( streamType: JSON.StreamType, streamParams?: JSON.StreamParams, @@ -172,6 +193,7 @@ export class StreamAPI { return this; } + public async unsubsribe ( streamType: JSON.StreamType, streamParams?: JSON.StreamParams, @@ -192,41 +214,51 @@ export class StreamAPI { return this; } + } + /* * * * Class Namespace * * */ + export namespace StreamAPI { + /* * * * Declarations * * */ + export interface Config { access_token: string; api_url: string; } + export interface EventMap { close: CloseEvent; error: Event; message: MessageEvent; } + export type MessageEvent = globalThis.MessageEvent; + } + /* * * * Default Export * * */ + export default StreamAPI; diff --git a/src/Types.d.ts b/src/Types.d.ts index bf98eff..1f19337 100644 --- a/src/Types.d.ts +++ b/src/Types.d.ts @@ -4,26 +4,30 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Declarations * * */ + declare module 'oauth' { + /* * * * Declarations * * */ + export type GetOAuthAccessTokenCallback = ( err: GetOAuthAccessTokenError, accessToken: string, @@ -31,25 +35,30 @@ declare module 'oauth' { result: unknown ) => unknown; + export interface GetOAuthAccessTokenError { statusCode: number; data?: unknown; } + /* * * * Class * * */ + export class OAuth2 { + /* * * * Constructor * * */ + constructor ( clientId: string, clientSecret: string, @@ -58,33 +67,43 @@ declare module 'oauth' { accessTokenPath?: string ); + /* * * * Functions * * */ + public getAuthorizeUrl ( params?: unknown ): string; + public getOAuthAccessToken ( code: string, params: unknown, callback: GetOAuthAccessTokenCallback ): void; + } + + } + declare module 'ws' { + /* * * * Constants * * */ + export const WebSocket = globalThis.WebSocket; + } diff --git a/src/Utilities.ts b/src/Utilities.ts index 2edef1b..3b2497a 100644 --- a/src/Utilities.ts +++ b/src/Utilities.ts @@ -10,39 +10,47 @@ \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Imports * * */ + import Bridge from './Bridge.js'; + /* * * * Namespace * * */ + export namespace Utilities { + /* * * * Declarations * * */ + export type Params = ( | Array<[string, unknown]> | Record ); + /* * * * Functions * * */ + export function buildFormData ( params?: Params, target: FormData = new Bridge.FormData() @@ -55,6 +63,7 @@ export namespace Utilities { return target; } + export function buildHeaders ( params?: Params, target: Headers = new Bridge.Headers() @@ -67,6 +76,7 @@ export namespace Utilities { return target; } + export function buildURL ( base: string, path: string = '.', @@ -81,6 +91,7 @@ export namespace Utilities { return url; } + export function buildURLSearchParams ( params?: Params, target: URLSearchParams = new Bridge.URLSearchParams() @@ -93,6 +104,7 @@ export namespace Utilities { return target; } + /** * Loads a file from a path. * @@ -118,6 +130,7 @@ export namespace Utilities { return await fileFrom( filePath, mimeType ); } + export function transferParams ( params: Params, target: ( FormData | Headers | URLSearchParams ) @@ -140,12 +153,20 @@ export namespace Utilities { } if ( Array.isArray( value ) ) { - if ( target instanceof URLSearchParams ) { + + // Add brackets for query structures + if ( !( target instanceof Headers ) ) { + key += '[]'; + } + for ( const v of value ) { + target.append( key, v ); + } + } else if ( target instanceof Bridge.FormData && @@ -154,26 +175,42 @@ export namespace Utilities { value instanceof Bridge.File ) ) { + target.append( key, value ); + } else if ( typeof value === 'object' ) { - if ( target instanceof URLSearchParams ) { + + // Add brackets for query structures + if ( !( target instanceof Headers ) ) { + for ( const k in value ) { + target.append( `${key}[${k}]`, `${( value as Record )[k]}` ); + } + } else { + target.append( key, JSON.stringify( value ) ); + } + } else { + target.append( key, `${value}` ); + } + } + } else { + for ( let key in params ) { value = params[key]; @@ -186,12 +223,20 @@ export namespace Utilities { } if ( Array.isArray( value ) ) { - if ( target instanceof URLSearchParams ) { + + // Add brackets for query structures + if ( !( target instanceof Headers ) ) { + key += '[]'; + } + for ( const v of value ) { + target.append( key, v ); + } + } else if ( target instanceof Bridge.FormData && @@ -200,34 +245,53 @@ export namespace Utilities { value instanceof Bridge.File ) ) { + target.append( key, value ); + } else if ( typeof value === 'object' ) { - if ( target instanceof URLSearchParams ) { + + // Add brackets for query structures + if ( !( target instanceof Headers ) ) { + for ( const k in value ) { + target.append( `${key}[${k}]`, `${( value as Record )[k]}` ); + } + } else { + target.append( key, JSON.stringify( value ) ); + } + } else { + target.append( key, `${value}` ); + } + } + } + } + } + /* * * * Default Export * * */ + export default Utilities; diff --git a/src/index.ts b/src/index.ts index 042e4e8..af59b65 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,14 +4,18 @@ Copyright (c) TypeScriptLibs and Contributors - Licensed under the MIT License; you may not use this file except in - compliance with the License. You may obtain a copy of the MIT License at - https://typescriptlibs.org/LICENSE.txt + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ export * as JSON from './JSON/index.js'; + export * from './API.js'; + export * from './Bridge.js'; + export * from './REST.js'; + export * from './Utilities.js'; diff --git a/tst/Utilities.test.ts b/tst/Utilities.test.ts index d75cf31..49d3441 100644 --- a/tst/Utilities.test.ts +++ b/tst/Utilities.test.ts @@ -10,21 +10,26 @@ \*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + /* * * * Imports * * */ + import * as Mastodon from 'tsl-mastodon-api'; + import test from '@typescriptlibs/tst'; + /* * * * Preperations * * */ + const basePath = '/foo'; const baseURL = 'https://domain.example'; @@ -53,37 +58,46 @@ const paramRecord: Mastodon.REST.ParamRecord = { 'some_array': ['x', 'y', 'z'] }; + /* * * * Tests * * */ -test( 'Test Utilities.buildFormData - Array', ( assert: test.Assert ) => { +test( 'Test Utilities.buildFormData - Array', ( assert: test.Assert ) => { let result = Mastodon.Utilities.buildFormData( undefined ); + assert.deepEqual( result, new Mastodon.Bridge.FormData() ); result = Mastodon.Utilities.buildFormData( paramArray ); + let entries = [...result.entries()]; + assert.deepEqual( entries, [ ['types[]', 'mention'], ['types[]', 'follow'], ['types[]', 'reblog'], ['some_string', '123'], ['some_number', '234'], - ['some_object', '{"a":"1","b":2}'], - ['some_array', 'x'], - ['some_array', 'y'], - ['some_array', 'z'] + ['some_object[a]', '1'], + ['some_object[b]', '2'], + ['some_array[]', 'x'], + ['some_array[]', 'y'], + ['some_array[]', 'z'] ] ); const target = new Mastodon.Bridge.FormData(); + target.append( 'some_string', 'xyz' ); target.append( 'some_number', '000' ); target.append( 'other', 'hello' ); + result = Mastodon.Utilities.buildFormData( paramArray, target ); + entries = [...result.entries()]; + assert.deepEqual( entries, [ ['some_string', 'xyz'], ['some_number', '000'], @@ -93,44 +107,51 @@ test( 'Test Utilities.buildFormData - Array', ( assert: test.Assert ) => { ['types[]', 'reblog'], ['some_string', '123'], ['some_number', '234'], - ['some_object', '{"a":"1","b":2}'], - ['some_array', 'x'], - ['some_array', 'y'], - ['some_array', 'z'] + ['some_object[a]', '1'], + ['some_object[b]', '2'], + ['some_array[]', 'x'], + ['some_array[]', 'y'], + ['some_array[]', 'z'] ] ); + } ); -test( 'Test Utilities.buildHeaders - Array', ( assert: test.Assert ) => { +test( 'Test Utilities.buildHeaders - Array', ( assert: test.Assert ) => { const params = paramArray.filter( // skip invalid key of paramRecord ( pair ) => !pair[0].endsWith( '[]' ) ); let result = Mastodon.Utilities.buildHeaders( params ); + assert.deepEqual( Array.from( result ), [ ['some_array', 'x, y, z'], ['some_number', '234'], ['some_object', '{"a":"1","b":2}'], ['some_string', '123'] ] ); + } ); -test( 'Test Utilities.buildHeaders - Record', ( assert: test.Assert ) => { +test( 'Test Utilities.buildHeaders - Record', ( assert: test.Assert ) => { const params = { ...paramRecord, 'types[]': undefined // skip invalid key of paramRecord }; let result = Mastodon.Utilities.buildHeaders( undefined ); + assert.deepEqual( Array.from( result ), [] ); const headers = new Mastodon.Bridge.Headers( [ ['some_string', 'foo'], ['other', 'bar'] ] ); + result = Mastodon.Utilities.buildHeaders( params, headers ); + assert.deepEqual( Array.from( result ), [ ['other', 'bar'], ['some_array', 'x, y, z'], @@ -138,14 +159,15 @@ test( 'Test Utilities.buildHeaders - Record', ( assert: test.Assert ) => { ['some_object', '{"a":"1","b":2}'], ['some_string', 'foo, 123'] ] ); + } ); -test( 'Test Utilities.buildURL - ParamList', ( assert: test.Assert ) => { +test( 'Test Utilities.buildURL - ParamList', ( assert: test.Assert ) => { const url = Mastodon.Utilities.buildURL( baseURL, basePath, paramArray ); const urlSearchParams = url.searchParams; - const types = urlSearchParams.getAll( 'types[]' ); + assert.deepEqual( types, ['mention', 'follow', 'reblog'] ); assert.equal( urlSearchParams.get( 'some_string' ), '123' ); assert.equal( urlSearchParams.get( 'some_number' ), '234' ); @@ -166,10 +188,11 @@ test( 'Test Utilities.buildURL - ParamList', ( assert: test.Assert ) => { 'some_array%5B%5D=y&' + 'some_array%5B%5D=z' ); + } ); -test( 'Test Utilities.buildURL - ParamSet', ( assert: test.Assert ) => { +test( 'Test Utilities.buildURL - ParamSet', ( assert: test.Assert ) => { const url = Mastodon.Utilities.buildURL( baseURL, basePath, paramRecord ); const urlSearchParams = url.searchParams; @@ -190,22 +213,24 @@ test( 'Test Utilities.buildURL - ParamSet', ( assert: test.Assert ) => { 'some_array%5B%5D=y&' + 'some_array%5B%5D=z' ); + } ); -test( 'Test Utilities.buildURLSearchParams - ParamList', ( assert: test.Assert ) => { +test( 'Test Utilities.buildURLSearchParams - ParamList', ( assert: test.Assert ) => { const urlSearchParams = Mastodon.Utilities.buildURLSearchParams( paramArray ); - const types = urlSearchParams.getAll( 'types[]' ); + assert.deepEqual( types, ['mention', 'follow', 'reblog'] ); assert.equal( urlSearchParams.get( 'some_string' ), '123' ); assert.equal( urlSearchParams.get( 'some_number' ), '234' ); assert.equal( urlSearchParams.get( 'some_object[a]' ), '1' ); assert.deepEqual( urlSearchParams.getAll( 'some_array[]' ), ['x', 'y', 'z'] ); + } ); -test( 'Test Utilities.buildURLSearchParams - ParamSet', ( assert: test.Assert ) => { +test( 'Test Utilities.buildURLSearchParams - ParamSet', ( assert: test.Assert ) => { const urlSearchParams = Mastodon.Utilities.buildURLSearchParams( paramRecord ); assert.equal( urlSearchParams.get( 'types[]' ), 'mention' ); @@ -213,10 +238,11 @@ test( 'Test Utilities.buildURLSearchParams - ParamSet', ( assert: test.Assert ) assert.equal( urlSearchParams.get( 'some_number' ), '234' ); assert.equal( urlSearchParams.get( 'some_object[b]' ), '2' ); assert.deepEqual( urlSearchParams.getAll( 'some_array[]' ), ['x', 'y', 'z'] ); + } ); -test( 'Test Utilities.transferParams', ( assert: test.Assert ) => { +test( 'Test Utilities.transferParams', ( assert: test.Assert ) => { const target = new Mastodon.Bridge.FormData(); Mastodon.Utilities.transferParams( @@ -234,8 +260,8 @@ test( 'Test Utilities.transferParams', ( assert: test.Assert ) => { assert.equal( target.get( 'null' ), null ); assert.equal( target.get( 'undefined' ), null ); assert.equal( target.get( 'hello' ), 'hello' ); - assert.equal( target.get( 'ab' ), '{"a":1,"b":"2"}' ); - assert.deepEqual( target.getAll( 'xy' ), ['x', 'y'] ); + assert.equal( target.get( 'ab[b]' ), '2' ); + assert.deepEqual( target.getAll( 'xy[]' ), ['x', 'y'] ); assert.ok( // return type differs between Node.js v16 (File) and v18 (Blob) target.get( 'blob' ) instanceof Mastodon.Bridge.Blob From 0387afc8358b494f007d4d0bf13d6ccc5533348b Mon Sep 17 00:00:00 2001 From: sophiebremer <44302338+sophiebremer@users.noreply.github.com> Date: Sat, 24 Feb 2024 17:29:02 +0100 Subject: [PATCH 5/5] Add CLI to debug API --- bin/tsl-mastodon.js | 245 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100755 bin/tsl-mastodon.js diff --git a/bin/tsl-mastodon.js b/bin/tsl-mastodon.js new file mode 100755 index 0000000..481ee98 --- /dev/null +++ b/bin/tsl-mastodon.js @@ -0,0 +1,245 @@ +#!/usr/bin/env node +/*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*\ + + TypeScript Library for the Mastodon API + + Copyright (c) TypeScriptLibs and Contributors + + Licensed under the MIT License. + You may not use this file except in compliance with the License. + You can get a copy of the License at https://typescriptlibs.org/LICENSE.txt + +\*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*/ + + +/* * + * + * Imports + * + * */ + + +import * as FS from 'node:fs/promises'; + +import * as Mastodon from '../lib/index.js'; + + +/* * + * + * Constants + * + * */ + + +const HELP = [ + 'tsl-mastodon [COMMAND] [OPTIONS]', + '', + 'COMMANDS:', + ' post Post a status in the timeline.', + '', + 'OPTIONS:', + ' --api [str] API address of the Mastodon server.', + ' --api2 [str] API v2 address of the Mastodon server.', + ' --help -h Show this help.', + ' --image [str] Image path.', + ' --text [str] Text string.', + ' --token [hex] API token.', + ' --version -v Show the version of tsl-mastodon.' +].join( '\n' ); + + +/* * + * + * Functions + * + * */ + + +/** + * @param {string} [commandKey] + * @return {Record)>} + */ +function argv ( + commandKey = '' +) { + const argv = {}; + + let lastKey = commandKey; + let lastValue; + + for ( const arg of process.argv.slice( process.argv0 === 'node' ? 2 : 0 ) ) { + + if ( arg[0] === '-' ) { + + lastKey = arg.replace( /^-+/gu, '' ); + lastValue = argv[lastKey]; + + if ( lastValue instanceof Array ) { + lastValue.push( true ); + } + else if ( typeof lastValue !== 'undefined' ) { + argv[lastKey] = [lastValue, true]; + } + else { + argv[lastKey] = true; + } + + } + else { + + lastValue = argv[lastKey]; + + if ( lastValue instanceof Array ) { + if ( typeof lastValue[lastValue.length - 1] === 'boolean' ) { + lastValue[lastValue.length - 1] = arg; + } + else { + lastValue.push( arg ); + } + } + else if ( typeof lastValue === 'string' ) { + argv[lastKey] = [lastValue, arg]; + } + else { + argv[lastKey] = arg; + } + + } + + } + + return argv; +} + + +/** + * @param {object} obj + * @return {string} + */ +function json ( + obj +) { + return JSON.stringify( obj, null, ' ' ); +} + + +/** + * @param {Record)>} args + * @param {Mastodon.API} api + * @param {Mastodon.API} api2 + * @return {Promise} + */ +async function post ( + args, + api, + api2 +) { + /** @type {Mastodon.JSON.StatusPost} */ + let status; + + if ( args.image ) { + const images = ( + args.image instanceof Array ? + args.image : + [args.image] + ); + /** @type {Mastodon.JSON.MediaStatusPost} */ + const post = { + media_ids: [] + }; + + for ( const image of images ) { + const file = await Mastodon.Utilities.fileFrom( '' + image ); + + console.log( file.name, file.size + ' bytes' ); + + let attachment = await api2.postMediaAttachment( { + file + } ); + + if ( !attachment.json ) { + throw attachment; + } + + post.media_ids.push( attachment.json.id ); + } + + if ( args.text ) { + post.status = '' + args.text; + } + + status = post; + } + else { + /** @type {Mastodon.JSON.TextStatusPost} */ + const post = { + status: '' + args.text + }; + + status = post; + } + + console.log( 'REQUEST:', json( status ) ); + console.log( 'RESPONSE:', json( await api.postStatus( status ) ) ); + +} + + +async function main () { + const args = argv( 'command' ); + + if ( args.h || args.help ) { + console.log( HELP ); + return; + } + + if ( args.v || args.version ) { + console.log( + JSON.parse( + await FS.readFile( + new URL( '../package.json', import.meta.url ) + .href.substring( 7 ) + ) + ).version + ); + return; + } + + console.log( 'INPUT:', json( args ) ); + + const api = new Mastodon.API( { + access_token: '' + args.token, + api_url: '' + ( args.api || args.api2 ) + } ); + const api2 = new Mastodon.API( { + access_token: '' + args.token, + api_url: '' + ( args.api2 || args.api ) + } ); + + switch ( args.command ) { + case 'post': + try { + post( args, api, api2 ); + } + catch ( error ) { + console.error( 'ERROR:', json( error ) ); + process.exit( 1 ); + } + + break; + default: + console.error( 'Unknown command' ); + break; + } + +} + + +/* * + * + * CLI + * + * */ + + +main();