Skip to content

Commit 00e362f

Browse files
committed
adds support for custom URL lists crawls (InterroBot 2.10+)
1 parent 0fef28b commit 00e362f

38 files changed

+968
-604
lines changed

dist/js/commonjs/core/api.d.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ interface SearchResultJson {
3737
interface CrawlParams {
3838
id: number;
3939
project: number;
40-
created: Date;
41-
modified: Date;
40+
created?: Date;
41+
modified?: Date;
4242
complete?: boolean;
4343
time?: number;
4444
report?: any;
4545
}
4646
interface ProjectParams {
4747
id: number;
48-
created: Date;
49-
modified: Date;
5048
name?: string;
49+
type?: string;
50+
created?: Date;
51+
modified?: Date;
5152
url?: string;
5253
urls?: string[];
5354
imageDataUri?: string;
@@ -70,7 +71,7 @@ declare class PluginData {
7071
private project;
7172
/**
7273
* Creates an instance of PluginData.
73-
* @param params - PluginDataParams, collection of arguments.
74+
* @param params - The plugin data parameters.
7475
*/
7576
constructor(params: PluginDataParams);
7677
/**
@@ -123,7 +124,7 @@ declare class SearchQuery {
123124
readonly perPage: number;
124125
/**
125126
* Creates an instance of SearchQuery.
126-
* @param params - SearchQueryParams, collection of arguments.
127+
* @param params - The search query parameters.
127128
*/
128129
constructor(params: SearchQueryParams);
129130
/**
@@ -232,15 +233,15 @@ declare class SearchResult {
232233
*/
233234
declare class Crawl {
234235
id: number;
235-
created: Date;
236-
modified: Date;
237236
project: number;
238237
complete: boolean;
239-
time: number;
240-
report: any;
238+
created?: Date;
239+
modified?: Date;
240+
time?: number;
241+
report?: any;
241242
/**
242243
* Creates an instance of Crawl.
243-
* @param params - CrawlParams, collection of arguments.
244+
* @param params - The crawl parameters.
244245
*/
245246
constructor(params: CrawlParams);
246247
/**
@@ -265,16 +266,17 @@ declare class Crawl {
265266
*/
266267
declare class Project {
267268
id: number;
268-
created: Date;
269-
modified: Date;
269+
created?: Date;
270+
modified?: Date;
270271
name?: string;
272+
type?: string;
271273
url?: string;
272274
urls?: string[];
273275
imageDataUri?: string;
274276
static readonly urlDeprectionWarning: string;
275277
/**
276278
* Creates an instance of Project.
277-
* @param params - ProjectParams, collection of arguments.
279+
* @param params - The project parameters.
278280
*/
279281
constructor(params: ProjectParams);
280282
/**
@@ -301,4 +303,4 @@ declare class Project {
301303
*/
302304
static getApiCrawls(project: number): Promise<Crawl[]>;
303305
}
304-
export { Project, Crawl, SearchQueryType, SearchQuery, Search, SearchResult, PluginData };
306+
export { Project, Crawl, SearchQueryType, SearchQuery, Search, SearchResult, SearchResultJson, PluginData };

dist/js/commonjs/core/api.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var SearchQuerySortDirection;
3333
class PluginData {
3434
/**
3535
* Creates an instance of PluginData.
36-
* @param params - PluginDataParams, collection of arguments.
36+
* @param params - The plugin data parameters.
3737
*/
3838
constructor(params) {
3939
var _a;
@@ -378,7 +378,7 @@ exports.PluginData = PluginData;
378378
class SearchQuery {
379379
/**
380380
* Creates an instance of SearchQuery.
381-
* @param params - SearchQueryParams, collection of arguments.
381+
* @param params - The search query parameters.
382382
*/
383383
constructor(params) {
384384
var _a, _b, _c;
@@ -633,13 +633,13 @@ SearchResult.wordWhitespaceRe = /\s+/g;
633633
class Crawl {
634634
/**
635635
* Creates an instance of Crawl.
636-
* @param params - CrawlParams, collection of arguments.
636+
* @param params - The crawl parameters.
637637
*/
638638
constructor(params) {
639639
this.id = -1;
640+
this.project = -1;
640641
this.created = null;
641642
this.modified = null;
642-
this.project = -1;
643643
this.time = -1;
644644
this.report = null;
645645
this.id = params.id;
@@ -690,21 +690,24 @@ exports.Crawl = Crawl;
690690
class Project {
691691
/**
692692
* Creates an instance of Project.
693-
* @param params - ProjectParams, collection of arguments.
693+
* @param params - The project parameters.
694694
*/
695695
constructor(params) {
696696
this.id = -1;
697697
this.created = null;
698698
this.modified = null;
699699
this.name = null; // name to required when url shut down
700+
this.type = null; // name to required when url shut down
700701
this.url = null; // deprecated
701-
this.urls = [];
702+
this.urls = null;
702703
this.imageDataUri = null;
703704
this.id = params.id;
705+
this.name = params.name;
706+
this.type = params.type;
704707
this.created = params.created;
705708
this.modified = params.modified;
706709
this.url = params.url;
707-
this.name = params.name;
710+
this.urls = params.urls;
708711
this.imageDataUri = params.imageDataUri;
709712
}
710713
/**
@@ -753,7 +756,7 @@ class Project {
753756
static async getApiProject(id) {
754757
const kwargs = {
755758
"projects": [id],
756-
"fields": ["image", "created", "modified"],
759+
"fields": ["image", "created", "modified", "urls"],
757760
};
758761
const projects = await plugin_js_1.Plugin.postApiRequest("GetProjects", kwargs);
759762
const results = projects.results;
@@ -765,13 +768,15 @@ class Project {
765768
const modified = new Date(project.modified);
766769
const name = project.name || project.url; // url is deprecated
767770
const imageDataUri = project.image;
771+
const urls = project.urls || null;
768772
// return new Project(id, created, modified, url, imageDataUri);
769773
return new Project({
770774
id: id,
771775
created: created,
772776
modified: modified,
773777
name: name,
774-
imageDataUri: imageDataUri
778+
imageDataUri: imageDataUri,
779+
urls: urls
775780
});
776781
}
777782
}

dist/js/commonjs/core/plugin.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ declare class Plugin {
8686
* Logs warning information to the console.
8787
* @param msg - The message to log.
8888
*/
89-
static logWarning(msg: string): void;
89+
static logWarning(msg: string, ex?: Error): void;
9090
/**
9191
* Routes a message to the parent frame.
9292
* @param msg - The message to route.

dist/js/commonjs/core/plugin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ class Plugin {
221221
* Logs warning information to the console.
222222
* @param msg - The message to log.
223223
*/
224-
static logWarning(msg) {
225-
console.warn(`🤖 ${msg}`);
224+
static logWarning(msg, ex = null) {
225+
const newlinedError = ex ? `\n${ex}` : "";
226+
console.warn(`🤖 ${msg}${newlinedError}`);
226227
}
227228
/**
228229
* Routes a message to the parent frame.

dist/js/commonjs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
// this distribution is intended to be used with standard imports
3-
// exporting into a second namespace, for the sake of satisfying the index.js
3+
// exporting into a second namespace, for the sake of satisfying the index.js
44
// gods will lead to needless confusion. namespacing can be done with a wrapper.
55
// see examples/vanillats/interrobot-plugin.ts for a classic recipe
66
Object.defineProperty(exports, "__esModule", { value: true });

dist/js/es6/core/api.d.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ interface SearchResultJson {
3737
interface CrawlParams {
3838
id: number;
3939
project: number;
40-
created: Date;
41-
modified: Date;
40+
created?: Date;
41+
modified?: Date;
4242
complete?: boolean;
4343
time?: number;
4444
report?: any;
4545
}
4646
interface ProjectParams {
4747
id: number;
48-
created: Date;
49-
modified: Date;
5048
name?: string;
49+
type?: string;
50+
created?: Date;
51+
modified?: Date;
5152
url?: string;
5253
urls?: string[];
5354
imageDataUri?: string;
@@ -70,7 +71,7 @@ declare class PluginData {
7071
private project;
7172
/**
7273
* Creates an instance of PluginData.
73-
* @param params - PluginDataParams, collection of arguments.
74+
* @param params - The plugin data parameters.
7475
*/
7576
constructor(params: PluginDataParams);
7677
/**
@@ -123,7 +124,7 @@ declare class SearchQuery {
123124
readonly perPage: number;
124125
/**
125126
* Creates an instance of SearchQuery.
126-
* @param params - SearchQueryParams, collection of arguments.
127+
* @param params - The search query parameters.
127128
*/
128129
constructor(params: SearchQueryParams);
129130
/**
@@ -232,15 +233,15 @@ declare class SearchResult {
232233
*/
233234
declare class Crawl {
234235
id: number;
235-
created: Date;
236-
modified: Date;
237236
project: number;
238237
complete: boolean;
239-
time: number;
240-
report: any;
238+
created?: Date;
239+
modified?: Date;
240+
time?: number;
241+
report?: any;
241242
/**
242243
* Creates an instance of Crawl.
243-
* @param params - CrawlParams, collection of arguments.
244+
* @param params - The crawl parameters.
244245
*/
245246
constructor(params: CrawlParams);
246247
/**
@@ -265,16 +266,17 @@ declare class Crawl {
265266
*/
266267
declare class Project {
267268
id: number;
268-
created: Date;
269-
modified: Date;
269+
created?: Date;
270+
modified?: Date;
270271
name?: string;
272+
type?: string;
271273
url?: string;
272274
urls?: string[];
273275
imageDataUri?: string;
274276
static readonly urlDeprectionWarning: string;
275277
/**
276278
* Creates an instance of Project.
277-
* @param params - ProjectParams, collection of arguments.
279+
* @param params - The project parameters.
278280
*/
279281
constructor(params: ProjectParams);
280282
/**
@@ -301,4 +303,4 @@ declare class Project {
301303
*/
302304
static getApiCrawls(project: number): Promise<Crawl[]>;
303305
}
304-
export { Project, Crawl, SearchQueryType, SearchQuery, Search, SearchResult, PluginData };
306+
export { Project, Crawl, SearchQueryType, SearchQuery, Search, SearchResult, SearchResultJson, PluginData };

dist/js/es6/core/api.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var SearchQuerySortDirection;
2929
class PluginData {
3030
/**
3131
* Creates an instance of PluginData.
32-
* @param params - PluginDataParams, collection of arguments.
32+
* @param params - The plugin data parameters.
3333
*/
3434
constructor(params) {
3535
var _a;
@@ -373,7 +373,7 @@ class PluginData {
373373
class SearchQuery {
374374
/**
375375
* Creates an instance of SearchQuery.
376-
* @param params - SearchQueryParams, collection of arguments.
376+
* @param params - The search query parameters.
377377
*/
378378
constructor(params) {
379379
var _a, _b, _c;
@@ -625,13 +625,13 @@ SearchResult.wordWhitespaceRe = /\s+/g;
625625
class Crawl {
626626
/**
627627
* Creates an instance of Crawl.
628-
* @param params - CrawlParams, collection of arguments.
628+
* @param params - The crawl parameters.
629629
*/
630630
constructor(params) {
631631
this.id = -1;
632+
this.project = -1;
632633
this.created = null;
633634
this.modified = null;
634-
this.project = -1;
635635
this.time = -1;
636636
this.report = null;
637637
this.id = params.id;
@@ -681,21 +681,24 @@ class Crawl {
681681
class Project {
682682
/**
683683
* Creates an instance of Project.
684-
* @param params - ProjectParams, collection of arguments.
684+
* @param params - The project parameters.
685685
*/
686686
constructor(params) {
687687
this.id = -1;
688688
this.created = null;
689689
this.modified = null;
690690
this.name = null; // name to required when url shut down
691+
this.type = null; // name to required when url shut down
691692
this.url = null; // deprecated
692-
this.urls = [];
693+
this.urls = null;
693694
this.imageDataUri = null;
694695
this.id = params.id;
696+
this.name = params.name;
697+
this.type = params.type;
695698
this.created = params.created;
696699
this.modified = params.modified;
697700
this.url = params.url;
698-
this.name = params.name;
701+
this.urls = params.urls;
699702
this.imageDataUri = params.imageDataUri;
700703
}
701704
/**
@@ -744,7 +747,7 @@ class Project {
744747
static async getApiProject(id) {
745748
const kwargs = {
746749
"projects": [id],
747-
"fields": ["image", "created", "modified"],
750+
"fields": ["image", "created", "modified", "urls"],
748751
};
749752
const projects = await Plugin.postApiRequest("GetProjects", kwargs);
750753
const results = projects.results;
@@ -756,13 +759,15 @@ class Project {
756759
const modified = new Date(project.modified);
757760
const name = project.name || project.url; // url is deprecated
758761
const imageDataUri = project.image;
762+
const urls = project.urls || null;
759763
// return new Project(id, created, modified, url, imageDataUri);
760764
return new Project({
761765
id: id,
762766
created: created,
763767
modified: modified,
764768
name: name,
765-
imageDataUri: imageDataUri
769+
imageDataUri: imageDataUri,
770+
urls: urls
766771
});
767772
}
768773
}

dist/js/es6/core/plugin.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ declare class Plugin {
8686
* Logs warning information to the console.
8787
* @param msg - The message to log.
8888
*/
89-
static logWarning(msg: string): void;
89+
static logWarning(msg: string, ex?: Error): void;
9090
/**
9191
* Routes a message to the parent frame.
9292
* @param msg - The message to route.

0 commit comments

Comments
 (0)