narou 0.5.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +30 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +119 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.common.d.ts +8 -0
- package/dist/index.common.d.ts.map +1 -0
- package/dist/index.common.js +17 -0
- package/dist/index.common.js.map +1 -0
- package/dist/index.d.ts +30 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +120 -113
- package/dist/index.js.map +1 -1
- package/dist/narou-fetch.d.ts +13 -0
- package/dist/narou-fetch.d.ts.map +1 -0
- package/dist/narou-fetch.js +130 -0
- package/dist/narou-fetch.js.map +1 -0
- package/dist/narou-jsonp.d.ts +10 -0
- package/dist/narou-jsonp.d.ts.map +1 -0
- package/dist/narou-jsonp.js +102 -0
- package/dist/narou-jsonp.js.map +1 -0
- package/dist/narou-ranking-results.d.ts +8 -8
- package/dist/narou-ranking-results.js +2 -2
- package/dist/narou-search-results.d.ts +90 -89
- package/dist/narou-search-results.d.ts.map +1 -1
- package/dist/narou-search-results.js +51 -51
- package/dist/narou-search-results.js.map +1 -1
- package/dist/narou.d.ts +24 -25
- package/dist/narou.d.ts.map +1 -1
- package/dist/narou.js +104 -142
- package/dist/narou.js.map +1 -1
- package/dist/params.d.ts +230 -230
- package/dist/params.js +173 -173
- package/dist/ranking-history.d.ts +13 -13
- package/dist/ranking-history.js +13 -13
- package/dist/ranking-history.js.map +1 -1
- package/dist/ranking.d.ts +47 -45
- package/dist/ranking.d.ts.map +1 -1
- package/dist/ranking.js +167 -165
- package/dist/ranking.js.map +1 -1
- package/dist/search-builder-r18.d.ts +21 -21
- package/dist/search-builder-r18.d.ts.map +1 -1
- package/dist/search-builder-r18.js +64 -63
- package/dist/search-builder-r18.js.map +1 -1
- package/dist/search-builder.d.ts +228 -226
- package/dist/search-builder.d.ts.map +1 -1
- package/dist/search-builder.js +412 -412
- package/dist/search-builder.js.map +1 -1
- package/dist/util/jsonp.d.ts +14 -0
- package/dist/util/jsonp.d.ts.map +1 -0
- package/dist/util/jsonp.js +48 -0
- package/dist/util/jsonp.js.map +1 -0
- package/dist/util/unzipp.d.ts +3 -3
- package/dist/util/unzipp.js +56 -56
- package/dist/util/unzipp.js.map +1 -1
- package/dist/util/url.d.ts +10 -0
- package/dist/util/url.d.ts.map +1 -0
- package/dist/util/url.js +9 -0
- package/dist/util/url.js.map +1 -0
- package/dist.es2015/index.browser.js +50 -0
- package/dist.es2015/index.browser.js.map +1 -0
- package/dist.es2015/index.common.js +5 -0
- package/dist.es2015/index.common.js.map +1 -0
- package/dist.es2015/index.js +50 -49
- package/dist.es2015/index.js.map +1 -1
- package/dist.es2015/narou-fetch.js +44 -0
- package/dist.es2015/narou-fetch.js.map +1 -0
- package/dist.es2015/narou-jsonp.js +22 -0
- package/dist.es2015/narou-jsonp.js.map +1 -0
- package/dist.es2015/narou-ranking-results.js +1 -1
- package/dist.es2015/narou-search-results.js +46 -46
- package/dist.es2015/narou-search-results.js.map +1 -1
- package/dist.es2015/narou.js +23 -60
- package/dist.es2015/narou.js.map +1 -1
- package/dist.es2015/params.js +170 -170
- package/dist.es2015/ranking-history.js +9 -9
- package/dist.es2015/ranking.js +90 -90
- package/dist.es2015/ranking.js.map +1 -1
- package/dist.es2015/search-builder-r18.js +41 -42
- package/dist.es2015/search-builder-r18.js.map +1 -1
- package/dist.es2015/search-builder.js +383 -383
- package/dist.es2015/search-builder.js.map +1 -1
- package/dist.es2015/util/jsonp.js +43 -0
- package/dist.es2015/util/jsonp.js.map +1 -0
- package/dist.es2015/util/unzipp.js +7 -7
- package/dist.es2015/util/url.js +7 -0
- package/dist.es2015/util/url.js.map +1 -0
- package/dist.esm/index.browser.js +102 -0
- package/dist.esm/index.browser.js.map +1 -0
- package/dist.esm/index.common.js +5 -0
- package/dist.esm/index.common.js.map +1 -0
- package/dist.esm/index.js +102 -97
- package/dist.esm/index.js.map +1 -1
- package/dist.esm/narou-fetch.js +128 -0
- package/dist.esm/narou-fetch.js.map +1 -0
- package/dist.esm/narou-jsonp.js +100 -0
- package/dist.esm/narou-jsonp.js.map +1 -0
- package/dist.esm/narou-ranking-results.js +1 -1
- package/dist.esm/narou-search-results.js +49 -49
- package/dist.esm/narou-search-results.js.map +1 -1
- package/dist.esm/narou.js +102 -140
- package/dist.esm/narou.js.map +1 -1
- package/dist.esm/params.js +170 -170
- package/dist.esm/ranking-history.js +9 -9
- package/dist.esm/ranking.js +164 -162
- package/dist.esm/ranking.js.map +1 -1
- package/dist.esm/search-builder-r18.js +62 -61
- package/dist.esm/search-builder-r18.js.map +1 -1
- package/dist.esm/search-builder.js +410 -410
- package/dist.esm/search-builder.js.map +1 -1
- package/dist.esm/util/jsonp.js +44 -0
- package/dist.esm/util/jsonp.js.map +1 -0
- package/dist.esm/util/unzipp.js +52 -52
- package/dist.esm/util/url.js +7 -0
- package/dist.esm/util/url.js.map +1 -0
- package/package-lock.json +3328 -4289
- package/package.json +8 -9
- package/src/index.browser.ts +63 -0
- package/src/index.common.ts +17 -0
- package/src/index.ts +22 -23
- package/src/narou-fetch.ts +51 -0
- package/src/narou-jsonp.ts +29 -0
- package/src/narou-ranking-results.ts +9 -9
- package/src/narou-search-results.ts +11 -10
- package/src/narou.ts +21 -49
- package/src/params.ts +280 -280
- package/src/ranking.ts +111 -107
- package/src/search-builder-r18.ts +1 -2
- package/src/search-builder.ts +5 -3
- package/src/util/jsonp.ts +66 -0
- package/src/util/unzipp.ts +9 -9
- package/src/util/url.ts +7 -0
package/dist/search-builder.js
CHANGED
|
@@ -1,413 +1,413 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* a
|
|
30
|
-
* @return {SearchBuilder} this
|
|
31
|
-
*/
|
|
32
|
-
SearchBuilder.prototype.word = function (word) {
|
|
33
|
-
this.set({ word: word });
|
|
34
|
-
return this;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @return {SearchBuilder} this
|
|
39
|
-
*/
|
|
40
|
-
SearchBuilder.prototype.notWord = function (word) {
|
|
41
|
-
this.set({ notword: word });
|
|
42
|
-
return this;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* @return {SearchBuilder} this
|
|
47
|
-
*/
|
|
48
|
-
SearchBuilder.prototype.byTitle = function (bool) {
|
|
49
|
-
if (bool === void 0) { bool = true; }
|
|
50
|
-
this.set({ title: bool ? 1 : 0 });
|
|
51
|
-
return this;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @return {SearchBuilder} this
|
|
56
|
-
*/
|
|
57
|
-
SearchBuilder.prototype.byOutline = function (bool) {
|
|
58
|
-
if (bool === void 0) { bool = true; }
|
|
59
|
-
this.set({ ex: bool ? 1 : 0 });
|
|
60
|
-
return this;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @return {SearchBuilder} this
|
|
65
|
-
*/
|
|
66
|
-
SearchBuilder.prototype.byKeyword = function (bool) {
|
|
67
|
-
if (bool === void 0) { bool = true; }
|
|
68
|
-
this.set({ keyword: bool ? 1 : 0 });
|
|
69
|
-
return this;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
* @return {SearchBuilder} this
|
|
74
|
-
*/
|
|
75
|
-
SearchBuilder.prototype.byAuthor = function (bool) {
|
|
76
|
-
if (bool === void 0) { bool = true; }
|
|
77
|
-
this.set({ wname: bool ? 1 : 0 });
|
|
78
|
-
return this;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
* @return {SearchBuilder} this
|
|
83
|
-
*/
|
|
84
|
-
SearchBuilder.prototype.bigGenre = function (genre) {
|
|
85
|
-
this.set({ biggenre: array2string(genre) });
|
|
86
|
-
return this;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* @return {SearchBuilder} this
|
|
91
|
-
*/
|
|
92
|
-
SearchBuilder.prototype.notBigGenre = function (genre) {
|
|
93
|
-
this.set({ notbiggenre: array2string(genre) });
|
|
94
|
-
return this;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @return {SearchBuilder} this
|
|
99
|
-
*/
|
|
100
|
-
SearchBuilder.prototype.genre = function (genre) {
|
|
101
|
-
this.set({ genre: array2string(genre) });
|
|
102
|
-
return this;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* @return {SearchBuilder} this
|
|
107
|
-
*/
|
|
108
|
-
SearchBuilder.prototype.notGenre = function (genre) {
|
|
109
|
-
this.set({ notgenre: array2string(genre) });
|
|
110
|
-
return this;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
* @return {SearchBuilder} this
|
|
115
|
-
*/
|
|
116
|
-
SearchBuilder.prototype.userId = function (ids) {
|
|
117
|
-
this.set({ userid: array2string(ids) });
|
|
118
|
-
return this;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
* @return {SearchBuilder} this
|
|
123
|
-
*/
|
|
124
|
-
SearchBuilder.prototype.isR15 = function (bool) {
|
|
125
|
-
if (bool === void 0) { bool = true; }
|
|
126
|
-
if (bool) {
|
|
127
|
-
this.set({ isr15: 1 });
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this.set({ notr15: 1 });
|
|
131
|
-
}
|
|
132
|
-
return this;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* @return {SearchBuilder} this
|
|
137
|
-
*/
|
|
138
|
-
SearchBuilder.prototype.isBL = function (bool) {
|
|
139
|
-
if (bool === void 0) { bool = true; }
|
|
140
|
-
if (bool) {
|
|
141
|
-
this.set({ isbl: 1 });
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.set({ notbl: 1 });
|
|
145
|
-
}
|
|
146
|
-
return this;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
*
|
|
150
|
-
* @return {SearchBuilder} this
|
|
151
|
-
*/
|
|
152
|
-
SearchBuilder.prototype.isGL = function (bool) {
|
|
153
|
-
if (bool === void 0) { bool = true; }
|
|
154
|
-
if (bool) {
|
|
155
|
-
this.set({ isgl: 1 });
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.set({ notgl: 1 });
|
|
159
|
-
}
|
|
160
|
-
return this;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
*
|
|
164
|
-
* @return {SearchBuilder} this
|
|
165
|
-
*/
|
|
166
|
-
SearchBuilder.prototype.isZankoku = function (bool) {
|
|
167
|
-
if (bool === void 0) { bool = true; }
|
|
168
|
-
if (bool) {
|
|
169
|
-
this.set({ iszankoku: 1 });
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
this.set({ notzankoku: 1 });
|
|
173
|
-
}
|
|
174
|
-
return this;
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
178
|
-
* @return {SearchBuilder} this
|
|
179
|
-
*/
|
|
180
|
-
SearchBuilder.prototype.isTensei = function (bool) {
|
|
181
|
-
if (bool === void 0) { bool = true; }
|
|
182
|
-
if (bool) {
|
|
183
|
-
this.set({ istensei: 1 });
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
this.set({ nottensei: 1 });
|
|
187
|
-
}
|
|
188
|
-
return this;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
*
|
|
192
|
-
* @return {SearchBuilder} this
|
|
193
|
-
*/
|
|
194
|
-
SearchBuilder.prototype.isTenni = function (bool) {
|
|
195
|
-
if (bool === void 0) { bool = true; }
|
|
196
|
-
if (bool) {
|
|
197
|
-
this.set({ istenni: 1 });
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
this.set({ nottenni: 1 });
|
|
201
|
-
}
|
|
202
|
-
return this;
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
*
|
|
206
|
-
* @return {SearchBuilder} this
|
|
207
|
-
*/
|
|
208
|
-
SearchBuilder.prototype.isTT = function () {
|
|
209
|
-
this.set({ istt: 1 });
|
|
210
|
-
return this;
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
214
|
-
* @return {SearchBuilder} this
|
|
215
|
-
*/
|
|
216
|
-
SearchBuilder.prototype.length = function (length) {
|
|
217
|
-
this.set({ length: array2string(length) });
|
|
218
|
-
return this;
|
|
219
|
-
};
|
|
220
|
-
SearchBuilder.prototype.kaiwaritu = function (min, max) {
|
|
221
|
-
var n;
|
|
222
|
-
if (max != null) {
|
|
223
|
-
n = min + "-" + max;
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
n = min;
|
|
227
|
-
}
|
|
228
|
-
this.set({ kaiwaritu: n });
|
|
229
|
-
return this;
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
*
|
|
233
|
-
* @return {SearchBuilder} this
|
|
234
|
-
*/
|
|
235
|
-
SearchBuilder.prototype.sasie = function (num) {
|
|
236
|
-
this.set({ sasie: array2string(num) });
|
|
237
|
-
return this;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
*
|
|
241
|
-
* @return {SearchBuilder} this
|
|
242
|
-
*/
|
|
243
|
-
SearchBuilder.prototype.time = function (num) {
|
|
244
|
-
this.set({ time: array2string(num) });
|
|
245
|
-
return this;
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
*
|
|
249
|
-
* @return {SearchBuilder} this
|
|
250
|
-
*/
|
|
251
|
-
SearchBuilder.prototype.ncode = function (ncodes) {
|
|
252
|
-
this.set({ ncode: array2string(ncodes) });
|
|
253
|
-
return this;
|
|
254
|
-
};
|
|
255
|
-
/**
|
|
256
|
-
*
|
|
257
|
-
* @return {SearchBuilder} this
|
|
258
|
-
*/
|
|
259
|
-
SearchBuilder.prototype.type = function (type) {
|
|
260
|
-
this.set({ type: type });
|
|
261
|
-
return this;
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
*
|
|
265
|
-
* @return {SearchBuilder} this
|
|
266
|
-
*/
|
|
267
|
-
SearchBuilder.prototype.buntai = function (buntai) {
|
|
268
|
-
this.set({ buntai: array2string(buntai) });
|
|
269
|
-
return this;
|
|
270
|
-
};
|
|
271
|
-
/**
|
|
272
|
-
*
|
|
273
|
-
* @return {SearchBuilder} this
|
|
274
|
-
*/
|
|
275
|
-
SearchBuilder.prototype.isStop = function (bool) {
|
|
276
|
-
if (bool === void 0) { bool = true; }
|
|
277
|
-
this.set({ stop: bool ? 1 : 0 });
|
|
278
|
-
return this;
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
*
|
|
282
|
-
* @return {SearchBuilder} this
|
|
283
|
-
*/
|
|
284
|
-
SearchBuilder.prototype.isPickup = function (bool) {
|
|
285
|
-
if (bool === void 0) { bool = true; }
|
|
286
|
-
this.set({ ispickup: bool ? 1 : 0 });
|
|
287
|
-
return this;
|
|
288
|
-
};
|
|
289
|
-
SearchBuilder.prototype.lastUpdate = function (x, y) {
|
|
290
|
-
var date;
|
|
291
|
-
if (typeof x == "string") {
|
|
292
|
-
date = x;
|
|
293
|
-
}
|
|
294
|
-
else if (x instanceof Date && y instanceof Date) {
|
|
295
|
-
date = Math.floor(x.getTime() / 1000) + "-" + Math.floor(x.getTime() / 1000);
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
date = x + "-" + y;
|
|
299
|
-
}
|
|
300
|
-
this.set({ lastup: date });
|
|
301
|
-
return this;
|
|
302
|
-
};
|
|
303
|
-
/**
|
|
304
|
-
*
|
|
305
|
-
* @return {SearchBuilder} this
|
|
306
|
-
*/
|
|
307
|
-
SearchBuilder.prototype.fields = function (fields) {
|
|
308
|
-
this.set({ of: array2string(fields) });
|
|
309
|
-
return this;
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
*
|
|
313
|
-
* @return {SearchBuilder} this
|
|
314
|
-
*/
|
|
315
|
-
SearchBuilder.prototype.limit = function (num) {
|
|
316
|
-
this.set({ lim: num });
|
|
317
|
-
return this;
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
*
|
|
321
|
-
* @return {SearchBuilder} this
|
|
322
|
-
*/
|
|
323
|
-
SearchBuilder.prototype.start = function (num) {
|
|
324
|
-
this.set({ st: num });
|
|
325
|
-
return this;
|
|
326
|
-
};
|
|
327
|
-
/**
|
|
328
|
-
*
|
|
329
|
-
* @return {SearchBuilder} this
|
|
330
|
-
*/
|
|
331
|
-
SearchBuilder.prototype.page = function (no, count) {
|
|
332
|
-
if (count === void 0) { count = 20; }
|
|
333
|
-
return this.limit(count).start(no * count);
|
|
334
|
-
};
|
|
335
|
-
SearchBuilder.prototype.opt = function (option) {
|
|
336
|
-
return this.set({ opt: option });
|
|
337
|
-
};
|
|
338
|
-
/**
|
|
339
|
-
* 出力順序を指定する。指定しない場合は新着順となります。
|
|
340
|
-
*
|
|
341
|
-
* @description
|
|
342
|
-
* allunique 閲覧者の多い順(未実装)
|
|
343
|
-
* favnovelcnt ブックマーク数の多い順
|
|
344
|
-
* reviewcnt レビュー数の多い順
|
|
345
|
-
* hyoka 総合評価の高い順
|
|
346
|
-
* hyokaasc 総合評価の低い順
|
|
347
|
-
* impressioncnt 感想の多い順
|
|
348
|
-
* hyokacnt 評価者数の多い順
|
|
349
|
-
* hyokacntasc 評価者数の少ない順
|
|
350
|
-
* weekly 週間ユニークユーザの多い順 毎週火曜日早朝リセット
|
|
351
|
-
* (前週の日曜日から土曜日分)
|
|
352
|
-
* lengthdesc 小説本文の文字数が多い順
|
|
353
|
-
* lengthasc 小説本文の文字数が少ない順
|
|
354
|
-
* ncodedesc Nコードが新しい順
|
|
355
|
-
* old 古い順
|
|
356
|
-
* @param {Order} order 出力順序
|
|
357
|
-
* @return {SearchBuilder} this
|
|
358
|
-
*/
|
|
359
|
-
SearchBuilder.prototype.order = function (order) {
|
|
360
|
-
this.set({ order: order });
|
|
361
|
-
return this;
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* gzip圧縮する。
|
|
365
|
-
*
|
|
366
|
-
* 転送量上限を減らすためにも推奨
|
|
367
|
-
* @param {GzipLevel} level gzip圧縮レベル(1~5)
|
|
368
|
-
* @return {SearchBuilder} this
|
|
369
|
-
*/
|
|
370
|
-
SearchBuilder.prototype.gzip = function (level) {
|
|
371
|
-
this.set({ gzip: level });
|
|
372
|
-
return this;
|
|
373
|
-
};
|
|
374
|
-
/**
|
|
375
|
-
* クエリパラメータをセットする
|
|
376
|
-
* @private
|
|
377
|
-
* @return {SearchBuilder} this
|
|
378
|
-
*/
|
|
379
|
-
SearchBuilder.prototype.set = function (obj) {
|
|
380
|
-
this.params = __assign(__assign({}, this.params), obj);
|
|
381
|
-
return this;
|
|
382
|
-
};
|
|
383
|
-
/**
|
|
384
|
-
* クエリパラメータを削除する
|
|
385
|
-
* @private
|
|
386
|
-
* @return {SearchBuilder} this
|
|
387
|
-
*/
|
|
388
|
-
SearchBuilder.prototype.unset = function (key) {
|
|
389
|
-
delete this.params[key];
|
|
390
|
-
return this;
|
|
391
|
-
};
|
|
392
|
-
/**
|
|
393
|
-
* なろう小説APIへの検索リクエストを実行する
|
|
394
|
-
* @returns {Promise<NarouSearchResults>} 検索結果
|
|
395
|
-
*/
|
|
396
|
-
SearchBuilder.prototype.execute = function () {
|
|
397
|
-
return
|
|
398
|
-
};
|
|
399
|
-
return SearchBuilder;
|
|
400
|
-
}());
|
|
401
|
-
exports.default = SearchBuilder;
|
|
402
|
-
function distinct(array) {
|
|
403
|
-
return Array.from(new Set(array));
|
|
404
|
-
}
|
|
405
|
-
function array2string(n) {
|
|
406
|
-
if (Array.isArray(n)) {
|
|
407
|
-
return distinct(n).join("-");
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
return n.toString();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
/**
|
|
15
|
+
* 検索ヘルパー
|
|
16
|
+
* @class SearchBuilder
|
|
17
|
+
*/
|
|
18
|
+
var SearchBuilder = /** @class */ (function () {
|
|
19
|
+
/**
|
|
20
|
+
* constructor
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
function SearchBuilder(params, api) {
|
|
24
|
+
if (params === void 0) { params = {}; }
|
|
25
|
+
this.params = params;
|
|
26
|
+
this.api = api;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* a
|
|
30
|
+
* @return {SearchBuilder} this
|
|
31
|
+
*/
|
|
32
|
+
SearchBuilder.prototype.word = function (word) {
|
|
33
|
+
this.set({ word: word });
|
|
34
|
+
return this;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @return {SearchBuilder} this
|
|
39
|
+
*/
|
|
40
|
+
SearchBuilder.prototype.notWord = function (word) {
|
|
41
|
+
this.set({ notword: word });
|
|
42
|
+
return this;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @return {SearchBuilder} this
|
|
47
|
+
*/
|
|
48
|
+
SearchBuilder.prototype.byTitle = function (bool) {
|
|
49
|
+
if (bool === void 0) { bool = true; }
|
|
50
|
+
this.set({ title: bool ? 1 : 0 });
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @return {SearchBuilder} this
|
|
56
|
+
*/
|
|
57
|
+
SearchBuilder.prototype.byOutline = function (bool) {
|
|
58
|
+
if (bool === void 0) { bool = true; }
|
|
59
|
+
this.set({ ex: bool ? 1 : 0 });
|
|
60
|
+
return this;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @return {SearchBuilder} this
|
|
65
|
+
*/
|
|
66
|
+
SearchBuilder.prototype.byKeyword = function (bool) {
|
|
67
|
+
if (bool === void 0) { bool = true; }
|
|
68
|
+
this.set({ keyword: bool ? 1 : 0 });
|
|
69
|
+
return this;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @return {SearchBuilder} this
|
|
74
|
+
*/
|
|
75
|
+
SearchBuilder.prototype.byAuthor = function (bool) {
|
|
76
|
+
if (bool === void 0) { bool = true; }
|
|
77
|
+
this.set({ wname: bool ? 1 : 0 });
|
|
78
|
+
return this;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @return {SearchBuilder} this
|
|
83
|
+
*/
|
|
84
|
+
SearchBuilder.prototype.bigGenre = function (genre) {
|
|
85
|
+
this.set({ biggenre: array2string(genre) });
|
|
86
|
+
return this;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @return {SearchBuilder} this
|
|
91
|
+
*/
|
|
92
|
+
SearchBuilder.prototype.notBigGenre = function (genre) {
|
|
93
|
+
this.set({ notbiggenre: array2string(genre) });
|
|
94
|
+
return this;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @return {SearchBuilder} this
|
|
99
|
+
*/
|
|
100
|
+
SearchBuilder.prototype.genre = function (genre) {
|
|
101
|
+
this.set({ genre: array2string(genre) });
|
|
102
|
+
return this;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @return {SearchBuilder} this
|
|
107
|
+
*/
|
|
108
|
+
SearchBuilder.prototype.notGenre = function (genre) {
|
|
109
|
+
this.set({ notgenre: array2string(genre) });
|
|
110
|
+
return this;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* @return {SearchBuilder} this
|
|
115
|
+
*/
|
|
116
|
+
SearchBuilder.prototype.userId = function (ids) {
|
|
117
|
+
this.set({ userid: array2string(ids) });
|
|
118
|
+
return this;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @return {SearchBuilder} this
|
|
123
|
+
*/
|
|
124
|
+
SearchBuilder.prototype.isR15 = function (bool) {
|
|
125
|
+
if (bool === void 0) { bool = true; }
|
|
126
|
+
if (bool) {
|
|
127
|
+
this.set({ isr15: 1 });
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.set({ notr15: 1 });
|
|
131
|
+
}
|
|
132
|
+
return this;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @return {SearchBuilder} this
|
|
137
|
+
*/
|
|
138
|
+
SearchBuilder.prototype.isBL = function (bool) {
|
|
139
|
+
if (bool === void 0) { bool = true; }
|
|
140
|
+
if (bool) {
|
|
141
|
+
this.set({ isbl: 1 });
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.set({ notbl: 1 });
|
|
145
|
+
}
|
|
146
|
+
return this;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @return {SearchBuilder} this
|
|
151
|
+
*/
|
|
152
|
+
SearchBuilder.prototype.isGL = function (bool) {
|
|
153
|
+
if (bool === void 0) { bool = true; }
|
|
154
|
+
if (bool) {
|
|
155
|
+
this.set({ isgl: 1 });
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this.set({ notgl: 1 });
|
|
159
|
+
}
|
|
160
|
+
return this;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
* @return {SearchBuilder} this
|
|
165
|
+
*/
|
|
166
|
+
SearchBuilder.prototype.isZankoku = function (bool) {
|
|
167
|
+
if (bool === void 0) { bool = true; }
|
|
168
|
+
if (bool) {
|
|
169
|
+
this.set({ iszankoku: 1 });
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.set({ notzankoku: 1 });
|
|
173
|
+
}
|
|
174
|
+
return this;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
*
|
|
178
|
+
* @return {SearchBuilder} this
|
|
179
|
+
*/
|
|
180
|
+
SearchBuilder.prototype.isTensei = function (bool) {
|
|
181
|
+
if (bool === void 0) { bool = true; }
|
|
182
|
+
if (bool) {
|
|
183
|
+
this.set({ istensei: 1 });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
this.set({ nottensei: 1 });
|
|
187
|
+
}
|
|
188
|
+
return this;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
*
|
|
192
|
+
* @return {SearchBuilder} this
|
|
193
|
+
*/
|
|
194
|
+
SearchBuilder.prototype.isTenni = function (bool) {
|
|
195
|
+
if (bool === void 0) { bool = true; }
|
|
196
|
+
if (bool) {
|
|
197
|
+
this.set({ istenni: 1 });
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
this.set({ nottenni: 1 });
|
|
201
|
+
}
|
|
202
|
+
return this;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
*
|
|
206
|
+
* @return {SearchBuilder} this
|
|
207
|
+
*/
|
|
208
|
+
SearchBuilder.prototype.isTT = function () {
|
|
209
|
+
this.set({ istt: 1 });
|
|
210
|
+
return this;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
*
|
|
214
|
+
* @return {SearchBuilder} this
|
|
215
|
+
*/
|
|
216
|
+
SearchBuilder.prototype.length = function (length) {
|
|
217
|
+
this.set({ length: array2string(length) });
|
|
218
|
+
return this;
|
|
219
|
+
};
|
|
220
|
+
SearchBuilder.prototype.kaiwaritu = function (min, max) {
|
|
221
|
+
var n;
|
|
222
|
+
if (max != null) {
|
|
223
|
+
n = min + "-" + max;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
n = min;
|
|
227
|
+
}
|
|
228
|
+
this.set({ kaiwaritu: n });
|
|
229
|
+
return this;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
*
|
|
233
|
+
* @return {SearchBuilder} this
|
|
234
|
+
*/
|
|
235
|
+
SearchBuilder.prototype.sasie = function (num) {
|
|
236
|
+
this.set({ sasie: array2string(num) });
|
|
237
|
+
return this;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
*
|
|
241
|
+
* @return {SearchBuilder} this
|
|
242
|
+
*/
|
|
243
|
+
SearchBuilder.prototype.time = function (num) {
|
|
244
|
+
this.set({ time: array2string(num) });
|
|
245
|
+
return this;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
*
|
|
249
|
+
* @return {SearchBuilder} this
|
|
250
|
+
*/
|
|
251
|
+
SearchBuilder.prototype.ncode = function (ncodes) {
|
|
252
|
+
this.set({ ncode: array2string(ncodes) });
|
|
253
|
+
return this;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
*
|
|
257
|
+
* @return {SearchBuilder} this
|
|
258
|
+
*/
|
|
259
|
+
SearchBuilder.prototype.type = function (type) {
|
|
260
|
+
this.set({ type: type });
|
|
261
|
+
return this;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
*
|
|
265
|
+
* @return {SearchBuilder} this
|
|
266
|
+
*/
|
|
267
|
+
SearchBuilder.prototype.buntai = function (buntai) {
|
|
268
|
+
this.set({ buntai: array2string(buntai) });
|
|
269
|
+
return this;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
*
|
|
273
|
+
* @return {SearchBuilder} this
|
|
274
|
+
*/
|
|
275
|
+
SearchBuilder.prototype.isStop = function (bool) {
|
|
276
|
+
if (bool === void 0) { bool = true; }
|
|
277
|
+
this.set({ stop: bool ? 1 : 0 });
|
|
278
|
+
return this;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
*
|
|
282
|
+
* @return {SearchBuilder} this
|
|
283
|
+
*/
|
|
284
|
+
SearchBuilder.prototype.isPickup = function (bool) {
|
|
285
|
+
if (bool === void 0) { bool = true; }
|
|
286
|
+
this.set({ ispickup: bool ? 1 : 0 });
|
|
287
|
+
return this;
|
|
288
|
+
};
|
|
289
|
+
SearchBuilder.prototype.lastUpdate = function (x, y) {
|
|
290
|
+
var date;
|
|
291
|
+
if (typeof x == "string") {
|
|
292
|
+
date = x;
|
|
293
|
+
}
|
|
294
|
+
else if (x instanceof Date && y instanceof Date) {
|
|
295
|
+
date = Math.floor(x.getTime() / 1000) + "-" + Math.floor(x.getTime() / 1000);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
date = x + "-" + y;
|
|
299
|
+
}
|
|
300
|
+
this.set({ lastup: date });
|
|
301
|
+
return this;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
*
|
|
305
|
+
* @return {SearchBuilder} this
|
|
306
|
+
*/
|
|
307
|
+
SearchBuilder.prototype.fields = function (fields) {
|
|
308
|
+
this.set({ of: array2string(fields) });
|
|
309
|
+
return this;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
*
|
|
313
|
+
* @return {SearchBuilder} this
|
|
314
|
+
*/
|
|
315
|
+
SearchBuilder.prototype.limit = function (num) {
|
|
316
|
+
this.set({ lim: num });
|
|
317
|
+
return this;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
*
|
|
321
|
+
* @return {SearchBuilder} this
|
|
322
|
+
*/
|
|
323
|
+
SearchBuilder.prototype.start = function (num) {
|
|
324
|
+
this.set({ st: num });
|
|
325
|
+
return this;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
*
|
|
329
|
+
* @return {SearchBuilder} this
|
|
330
|
+
*/
|
|
331
|
+
SearchBuilder.prototype.page = function (no, count) {
|
|
332
|
+
if (count === void 0) { count = 20; }
|
|
333
|
+
return this.limit(count).start(no * count);
|
|
334
|
+
};
|
|
335
|
+
SearchBuilder.prototype.opt = function (option) {
|
|
336
|
+
return this.set({ opt: option });
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* 出力順序を指定する。指定しない場合は新着順となります。
|
|
340
|
+
*
|
|
341
|
+
* @description
|
|
342
|
+
* allunique 閲覧者の多い順(未実装)
|
|
343
|
+
* favnovelcnt ブックマーク数の多い順
|
|
344
|
+
* reviewcnt レビュー数の多い順
|
|
345
|
+
* hyoka 総合評価の高い順
|
|
346
|
+
* hyokaasc 総合評価の低い順
|
|
347
|
+
* impressioncnt 感想の多い順
|
|
348
|
+
* hyokacnt 評価者数の多い順
|
|
349
|
+
* hyokacntasc 評価者数の少ない順
|
|
350
|
+
* weekly 週間ユニークユーザの多い順 毎週火曜日早朝リセット
|
|
351
|
+
* (前週の日曜日から土曜日分)
|
|
352
|
+
* lengthdesc 小説本文の文字数が多い順
|
|
353
|
+
* lengthasc 小説本文の文字数が少ない順
|
|
354
|
+
* ncodedesc Nコードが新しい順
|
|
355
|
+
* old 古い順
|
|
356
|
+
* @param {Order} order 出力順序
|
|
357
|
+
* @return {SearchBuilder} this
|
|
358
|
+
*/
|
|
359
|
+
SearchBuilder.prototype.order = function (order) {
|
|
360
|
+
this.set({ order: order });
|
|
361
|
+
return this;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* gzip圧縮する。
|
|
365
|
+
*
|
|
366
|
+
* 転送量上限を減らすためにも推奨
|
|
367
|
+
* @param {GzipLevel} level gzip圧縮レベル(1~5)
|
|
368
|
+
* @return {SearchBuilder} this
|
|
369
|
+
*/
|
|
370
|
+
SearchBuilder.prototype.gzip = function (level) {
|
|
371
|
+
this.set({ gzip: level });
|
|
372
|
+
return this;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* クエリパラメータをセットする
|
|
376
|
+
* @private
|
|
377
|
+
* @return {SearchBuilder} this
|
|
378
|
+
*/
|
|
379
|
+
SearchBuilder.prototype.set = function (obj) {
|
|
380
|
+
this.params = __assign(__assign({}, this.params), obj);
|
|
381
|
+
return this;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* クエリパラメータを削除する
|
|
385
|
+
* @private
|
|
386
|
+
* @return {SearchBuilder} this
|
|
387
|
+
*/
|
|
388
|
+
SearchBuilder.prototype.unset = function (key) {
|
|
389
|
+
delete this.params[key];
|
|
390
|
+
return this;
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* なろう小説APIへの検索リクエストを実行する
|
|
394
|
+
* @returns {Promise<NarouSearchResults>} 検索結果
|
|
395
|
+
*/
|
|
396
|
+
SearchBuilder.prototype.execute = function () {
|
|
397
|
+
return this.api.executeNovel(this.params);
|
|
398
|
+
};
|
|
399
|
+
return SearchBuilder;
|
|
400
|
+
}());
|
|
401
|
+
exports.default = SearchBuilder;
|
|
402
|
+
function distinct(array) {
|
|
403
|
+
return Array.from(new Set(array));
|
|
404
|
+
}
|
|
405
|
+
function array2string(n) {
|
|
406
|
+
if (Array.isArray(n)) {
|
|
407
|
+
return distinct(n).join("-");
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
return n.toString();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
413
|
//# sourceMappingURL=search-builder.js.map
|