├── .gitignore ├── LICENSE ├── README.md ├── docs ├── MQClient.html ├── MQConsumer.html ├── MQProducer.html ├── MQTransProducer.html ├── MessageProperties.html ├── classes.list.html ├── client.js.html ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.svg │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.svg │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Italic-webfont.svg │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.svg │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ ├── OpenSans-LightItalic-webfont.svg │ ├── OpenSans-LightItalic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.svg │ ├── OpenSans-Regular-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png ├── index.html ├── quicksearch.html ├── scripts │ ├── docstrap.lib.js │ ├── fulltext-search-ui.js │ ├── fulltext-search.js │ ├── linenumber.js │ ├── lunr.min.js │ ├── prettify │ │ ├── Apache-License-2.0.txt │ │ ├── jquery.min.js │ │ ├── lang-css.js │ │ └── prettify.js │ ├── sunlight.js │ └── toc.js ├── styles │ ├── darkstrap.css │ ├── jsdoc-default.css │ ├── prettify-jsdoc.css │ ├── prettify-tomorrow.css │ ├── site.cerulean.css │ ├── site.cosmo.css │ ├── site.cyborg.css │ ├── site.darkly.css │ ├── site.darkstrap.css │ ├── site.dibs-bootstrap.css │ ├── site.flatly.css │ ├── site.journal.css │ ├── site.lumen.css │ ├── site.paper.css │ ├── site.readable.css │ ├── site.sandstone.css │ ├── site.simplex.css │ ├── site.slate.css │ ├── site.spacelab.css │ ├── site.superhero.css │ ├── site.united.css │ ├── site.yeti.css │ ├── sunlight.dark.css │ └── sunlight.default.css └── vi │ └── @aliyunmq │ └── mq-nodejs-sdk │ └── 1.0.0 │ ├── MQClient.html │ ├── MQProducer.html │ ├── client.js.html │ ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.svg │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.svg │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Italic-webfont.svg │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.svg │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ ├── OpenSans-LightItalic-webfont.svg │ ├── OpenSans-LightItalic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.svg │ └── OpenSans-Regular-webfont.woff │ ├── index.html │ ├── scripts │ ├── linenumber.js │ └── prettify │ │ ├── Apache-License-2.0.txt │ │ ├── lang-css.js │ │ └── prettify.js │ └── styles │ ├── jsdoc-default.css │ ├── prettify-jsdoc.css │ └── prettify-tomorrow.css ├── es5 ├── client.js └── helper.js ├── index.js ├── jsdoc-conf.json ├── lib ├── client.js └── helper.js ├── package.json └── test └── client.test.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | package-lock.json 63 | .DS_Store 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 aliyun.mq 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MQ Nodejs HTTP SDK 2 | 3 | Alyun MQ Documents: http://www.aliyun.com/product/ons 4 | 5 | Aliyun MQ Console: https://ons.console.aliyun.com 6 | 7 | ## Installation 8 | 9 | Add dependency `@aliyunmq/mq-http-sdk`, get the latest version from [npmjs](https://www.npmjs.com/) 10 | ```bash 11 | npm install --save 12 | ``` 13 | *Note: nodejs >= 7.6.0* 14 | ## docs 15 | 16 | [Documents](https://aliyunmq.github.io/mq-http-nodejs-sdk/) 17 | 18 | ## Note 19 | 1. Http consumer only support timer msg (less than 3 days), no matter the msg is produced from http or tcp protocol. 20 | 2. Order is only supported at special server cluster. 21 | 22 | ## Sample (github) 23 | 24 | [Publish Message](https://github.com/aliyunmq/mq-http-samples/blob/master/nodejs/producer.js) 25 | 26 | [Consume Message](https://github.com/aliyunmq/mq-http-samples/blob/master/nodejs/consumer.js) 27 | 28 | [Transaction Message](https://github.com/aliyunmq/mq-http-samples/blob/master/nodejs/trans-producer.js) 29 | 30 | [Publish Order Message](https://github.com/aliyunmq/mq-http-samples/blob/master/nodejs/order-producer.js) 31 | 32 | [Consume Order Message](https://github.com/aliyunmq/mq-http-samples/blob/master/nodejs/order-consumer.js) 33 | 34 | ## Sample (code.aliyun.com) 35 | 36 | [Publish Message](https://code.aliyun.com/aliware_rocketmq/mq-http-samples/blob/master/nodejs/producer.js) 37 | 38 | [Consume Message](https://code.aliyun.com/aliware_rocketmq/mq-http-samples/blob/master/nodejs/consumer.js) 39 | 40 | [Transaction Message](https://code.aliyun.com/aliware_rocketmq/mq-http-samples/blob/master/nodejs/trans-producer.js) 41 | 42 | [Publish Order Message](https://code.aliyun.com/aliware_rocketmq/mq-http-samples/blob/master/nodejs/order-producer.js) 43 | 44 | [Consume Order Message](https://code.aliyun.com/aliware_rocketmq/mq-http-samples/blob/master/nodejs/order-consumer.js) -------------------------------------------------------------------------------- /docs/MQProducer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MQ Nodejs HTTP SDK Documents Class: MQProducer 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 57 | 58 | 59 |
60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 |

Class: MQProducer

69 |
70 | 71 |
72 | 73 |

74 | MQProducer 75 |

76 | 77 |

MQ的消息生产者

78 | 79 | 80 |
81 | 82 | 83 |
84 |
85 | 86 | 87 |
88 |
89 |

new MQProducer(client, instanceId, topic)

90 | 91 | 92 |
93 |
94 | 95 | 96 |
97 |

构造函数

98 |
99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 |
Parameters:
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 |
NameTypeDescription
client 136 | 137 | 138 | MQClient 139 | 140 | 141 | 142 | 143 |

MQ的客户端

instanceId 160 | 161 | 162 | string 163 | 164 | 165 | 166 | 167 |

实例ID

topic 184 | 185 | 186 | string 187 | 188 | 189 | 190 | 191 |

主题名字

203 | 204 | 205 | 206 | 207 |
208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 |
Source:
238 |
239 | 245 |
246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 |
254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 |
Returns:
268 | 269 | 270 | 271 | 272 |
273 |
274 | Type 275 |
276 |
277 | 278 | MQProducer 279 | 280 | 281 | 282 |
283 |
284 | 285 | 286 | 287 | 288 | 289 |
290 | 291 | 292 |
293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 |

Methods

308 | 309 |
310 | 311 |
312 |
313 |

<async> publishMessage(body, tag, msgProps)

314 | 315 | 316 |
317 |
318 | 319 | 320 |
321 |

向主题发送一条消息

322 |
323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 |
Parameters:
332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 |
NameTypeDescription
body 360 | 361 | 362 | string 363 | 364 | 365 | 366 | 367 |

发送的内容

tag 384 | 385 | 386 | string 387 | 388 | 389 | 390 | 391 |

发送消息的标签

msgProps 408 | 409 | 410 | MessageProperties 411 | 412 | 413 | 414 | 415 |

发送消息的属性

427 | 428 | 429 | 430 | 431 |
432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 |
Source:
462 |
463 | 469 |
470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 |
478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 |
Throws:
490 | 491 | 492 | 493 |
494 |
495 |
496 |

err MQ服务端返回的错误或者其它网络异常

497 |
{
498 |  // MQ服务端返回的错误Code,like: TopicNotExist 
499 |  Code:"",
500 |  // 请求ID
501 |  RequestId:""
502 | }
503 | 
504 |
505 |
506 |
507 |
508 |
509 | Type 510 |
511 |
512 | 513 | exception 514 | 515 | 516 | 517 |
518 |
519 |
520 |
521 | 522 | 523 | 524 | 525 | 526 |
Returns:
527 | 528 | 529 |
530 |
{
531 |  // http请求状态码,发送成功就是201,如果发送失败则抛异常
532 |  code: 201,
533 |  // 请求ID
534 |  requestId: "xxxxxxxxxxxxxx",
535 |  // 发送消息的响应内容
536 |  body: {
537 |    // 消息ID
538 |    MessageId: "",
539 |    // 消息体内容的MD5值
540 |    MessageBodyMD5: ""
541 |  }
542 | }
543 | 
544 |
545 | 546 | 547 | 548 |
549 |
550 | Type 551 |
552 |
553 | 554 | object 555 | 556 | 557 | 558 |
559 |
560 | 561 | 562 | 563 | 564 | 565 |
566 | 567 |
568 | 569 | 570 | 571 | 572 | 573 |
574 | 575 |
576 | 577 | 578 | 579 | 580 |
581 |
582 | 583 |
584 | 585 | 586 |
587 | 588 |
589 | 590 | 591 |
592 |
593 | 594 | 595 | 609 | 610 | 611 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 709 | 710 | 711 | 712 | -------------------------------------------------------------------------------- /docs/classes.list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MQ Nodejs HTTP SDK Documents Classes 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 57 | 58 | 59 |
60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 |

Classes

69 |
70 | 71 |
72 | 73 |

74 | 75 |

76 | 77 | 78 |
79 | 80 | 81 |
82 |
83 | 84 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 |
124 | 125 | 126 | 127 | 128 |
129 | 130 | 131 | 132 | 133 | 134 | 135 |

Classes

136 | 137 |
138 |
MessageProperties
139 |
140 | 141 |
MQClient
142 |
143 | 144 |
MQConsumer
145 |
146 | 147 |
MQProducer
148 |
149 | 150 |
MQTransProducer
151 |
152 |
153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 |
167 | 168 |
169 | 170 | 171 | 172 | 173 |
174 |
175 | 176 |
177 | 178 | 179 |
180 | 181 |
182 | 183 | 184 |
185 |
186 | 187 | 188 | 202 | 203 | 204 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 302 | 303 | 304 | 305 | -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /docs/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /docs/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MQ Nodejs HTTP SDK Documents Index 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 57 | 58 | 59 |
60 |
61 | 62 | 63 |
64 | 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
89 |

MQ Nodejs HTTP SDK

90 |

Alyun MQ Documents: http://www.aliyun.com/product/ons

91 |

Aliyun MQ Console: https://ons.console.aliyun.com

92 |

Installation

93 |

Add dependency @aliyunmq/mq-http-sdk, get the latest version from npmjs

94 |
npm install --save
 95 | 
96 |

Note: nodejs >= 7.6.0

97 |

docs

98 |

Documents

99 |

Note

100 |
    101 |
  1. Http consumer only support timer msg (less than 3 days), no matter the msg is produced from http or tcp protocol.
  2. 102 |
  3. Order is only supported at special server cluster.
  4. 103 |
104 |

Sample (github)

105 |

Publish Message

106 |

Consume Message

107 |

Transaction Message

108 |

Publish Order Message

109 |

Consume Order Message

110 |

Sample (code.aliyun.com)

111 |

Publish Message

112 |

Consume Message

113 |

Transaction Message

114 |

Publish Order Message

115 |

Consume Order Message

116 |
117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 |
125 |
126 | 127 |
128 | 129 | 130 |
131 | 132 |
133 | 134 | 135 |
136 |
137 | 138 | 139 | 153 | 154 | 155 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 253 | 254 | 255 | 256 | -------------------------------------------------------------------------------- /docs/scripts/fulltext-search-ui.js: -------------------------------------------------------------------------------- 1 | window.SearcherDisplay = (function($) { 2 | /** 3 | * This class provides support for displaying quick search text results to users. 4 | */ 5 | function SearcherDisplay() { } 6 | 7 | SearcherDisplay.prototype.init = function() { 8 | this._displayQuickSearch(); 9 | }; 10 | 11 | /** 12 | * This method creates the quick text search entry in navigation menu and wires all required events. 13 | */ 14 | SearcherDisplay.prototype._displayQuickSearch = function() { 15 | var quickSearch = $(document.createElement("iframe")), 16 | body = $("body"), 17 | self = this; 18 | 19 | quickSearch.attr("src", "quicksearch.html"); 20 | quickSearch.css("width", "0px"); 21 | quickSearch.css("height", "0px"); 22 | 23 | body.append(quickSearch); 24 | 25 | $(window).on("message", function(msg) { 26 | var msgData = msg.originalEvent.data; 27 | 28 | if (msgData.msgid != "docstrap.quicksearch.done") { 29 | return; 30 | } 31 | 32 | var results = msgData.results || []; 33 | 34 | self._displaySearchResults(results); 35 | }); 36 | 37 | function startSearch() { 38 | var searchTerms = $('#search-input').prop("value"); 39 | if (searchTerms) { 40 | quickSearch[0].contentWindow.postMessage({ 41 | "searchTerms": searchTerms, 42 | "msgid": "docstrap.quicksearch.start" 43 | }, "*"); 44 | } 45 | } 46 | 47 | $('#search-input').on('keyup', function(evt) { 48 | if (evt.keyCode != 13) { 49 | return; 50 | } 51 | startSearch(); 52 | return false; 53 | }); 54 | $('#search-submit').on('click', function() { 55 | startSearch(); 56 | return false; 57 | }); 58 | }; 59 | 60 | /** 61 | * This method displays the quick text search results in a modal dialog. 62 | */ 63 | SearcherDisplay.prototype._displaySearchResults = function(results) { 64 | var resultsHolder = $($("#searchResults").find(".modal-body")), 65 | fragment = document.createDocumentFragment(), 66 | resultsList = document.createElement("ul"); 67 | 68 | resultsHolder.empty(); 69 | 70 | for (var idx = 0; idx < results.length; idx++) { 71 | var result = results[idx], 72 | item = document.createElement("li"), 73 | link = document.createElement("a"); 74 | 75 | link.href = result.id; 76 | link.innerHTML = result.title; 77 | 78 | item.appendChild(link) 79 | resultsList.appendChild(item); 80 | } 81 | 82 | fragment.appendChild(resultsList); 83 | resultsHolder.append(fragment); 84 | 85 | $("#searchResults").modal({"show": true}); 86 | }; 87 | 88 | return new SearcherDisplay(); 89 | })($); 90 | -------------------------------------------------------------------------------- /docs/scripts/fulltext-search.js: -------------------------------------------------------------------------------- 1 | window.Searcher = (function() { 2 | function Searcher() { 3 | this._index = lunr(function () { 4 | this.field('title', {boost: 10}) 5 | this.field('body') 6 | this.ref('id') 7 | }) ; 8 | 9 | this._indexContent = undefined; 10 | } 11 | 12 | Searcher.prototype.init = function() { 13 | var self = this; 14 | 15 | $("script[type='text/x-docstrap-searchdb']").each(function(idx, item) { 16 | self._indexContent = JSON.parse(item.innerHTML); 17 | 18 | for (var entryId in self._indexContent) { 19 | self._index.add(self._indexContent[entryId]); 20 | } 21 | }); 22 | }; 23 | 24 | Searcher.prototype.search = function(searchTerm) { 25 | var results = [], 26 | searchResults = this._index.search(searchTerm); 27 | 28 | for (var idx = 0; idx < searchResults.length; idx++) { 29 | results.push(this._indexContent[searchResults[idx].ref]) 30 | } 31 | 32 | return results; 33 | }; 34 | 35 | return new Searcher(); 36 | })(); -------------------------------------------------------------------------------- /docs/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /docs/scripts/lunr.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.7.1 3 | * Copyright (C) 2016 Oliver Nightingale 4 | * @license MIT 5 | */ 6 | !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.7.1",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.seperator):[]},t.tokenizer.seperator=/[\s\-]+/,t.tokenizer.load=function(t){var e=this.registeredFunctions[t];if(!e)throw new Error("Cannot load un-registered function: "+t);return e},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(en.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone();for(var r=0,o=n.toArray();rp;p++)c[p]===a&&d++;h+=d/f*l.boost}}this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(this.tokenizerFn(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),d=Object.keys(f),p=d.length,v=0;p>v;v++)l.add(f[d[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(u),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),k=new RegExp("^"+r+i+"[^aeiouwxy]$"),x=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,_=/^(.+?)(s|t)(ion)$/,z=/^(.+?)e$/,O=/ll$/,P=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=p,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=g,a=m,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,u=k,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=x,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=F,a=_,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=z,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=P,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=O,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n)/], 11 | ["lit", /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i], 12 | ["lit", /^#[\da-f]{3,6}/i], 13 | ["pln", /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i], 14 | ["pun", /^[^\s\w"']+/] 15 | ]), ["css"]); 16 | PR.registerLangHandler(PR.createSimpleLexer([], [ 17 | ["kwd", /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i] 18 | ]), ["css-kw"]); 19 | PR.registerLangHandler(PR.createSimpleLexer([], [ 20 | ["str", /^[^"')]+/] 21 | ]), ["css-str"]); -------------------------------------------------------------------------------- /docs/scripts/prettify/prettify.js: -------------------------------------------------------------------------------- 1 | var q = null; 2 | window.PR_SHOULD_USE_CONTINUATION = !0; 3 | (function() { 4 | function L(a) { 5 | function m(a) { 6 | var f = a.charCodeAt(0); 7 | if (f !== 92) return f; 8 | var b = a.charAt(1); 9 | return (f = r[b]) ? f : "0" <= b && b <= "7" ? parseInt(a.substring(1), 8) : b === "u" || b === "x" ? parseInt(a.substring(2), 16) : a.charCodeAt(1) 10 | } 11 | 12 | function e(a) { 13 | if (a < 32) return (a < 16 ? "\\x0" : "\\x") + a.toString(16); 14 | a = String.fromCharCode(a); 15 | if (a === "\\" || a === "-" || a === "[" || a === "]") a = "\\" + a; 16 | return a 17 | } 18 | 19 | function h(a) { 20 | for (var f = a.substring(1, a.length - 1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g), a = [], b = [], o = f[0] === "^", c = o ? 1 : 0, i = f.length; c < i; ++c) { 21 | var j = f[c]; 22 | if (/\\[bdsw]/i.test(j)) a.push(j); 23 | else { 24 | var j = m(j), 25 | d; 26 | c + 2 < i && "-" === f[c + 1] ? (d = m(f[c + 2]), c += 2) : d = j; 27 | b.push([j, d]); 28 | d < 65 || j > 122 || (d < 65 || j > 90 || b.push([Math.max(65, j) | 32, Math.min(d, 90) | 32]), d < 97 || j > 122 || b.push([Math.max(97, j) & -33, Math.min(d, 122) & -33])) 29 | } 30 | } 31 | b.sort(function(a, f) { 32 | return a[0] - f[0] || f[1] - a[1] 33 | }); 34 | f = []; 35 | j = [NaN, NaN]; 36 | for (c = 0; c < b.length; ++c) i = b[c], i[0] <= j[1] + 1 ? j[1] = Math.max(j[1], i[1]) : f.push(j = i); 37 | b = ["["]; 38 | o && b.push("^"); 39 | b.push.apply(b, a); 40 | for (c = 0; c < f.length; ++c) i = f[c], b.push(e(i[0])), i[1] > i[0] && (i[1] + 1 > i[0] && b.push("-"), b.push(e(i[1]))); 41 | b.push("]"); 42 | return b.join("") 43 | } 44 | 45 | function y(a) { 46 | for (var f = a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g), b = f.length, d = [], c = 0, i = 0; c < b; ++c) { 47 | var j = f[c]; 48 | j === "(" ? ++i : "\\" === j.charAt(0) && (j = +j.substring(1)) && j <= i && (d[j] = -1) 49 | } 50 | for (c = 1; c < d.length; ++c) - 1 === d[c] && (d[c] = ++t); 51 | for (i = c = 0; c < b; ++c) j = f[c], j === "(" ? (++i, d[i] === void 0 && (f[c] = "(?:")) : "\\" === j.charAt(0) && (j = +j.substring(1)) && j <= i && (f[c] = "\\" + d[i]); 52 | for (i = c = 0; c < b; ++c)"^" === f[c] && "^" !== f[c + 1] && (f[c] = ""); 53 | if (a.ignoreCase && s) for (c = 0; c < b; ++c) j = f[c], a = j.charAt(0), j.length >= 2 && a === "[" ? f[c] = h(j) : a !== "\\" && (f[c] = j.replace(/[A-Za-z]/g, function(a) { 54 | a = a.charCodeAt(0); 55 | return "[" + String.fromCharCode(a & -33, a | 32) + "]" 56 | })); 57 | return f.join("") 58 | } 59 | for (var t = 0, s = !1, l = !1, p = 0, d = a.length; p < d; ++p) { 60 | var g = a[p]; 61 | if (g.ignoreCase) l = !0; 62 | else if (/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi, ""))) { 63 | s = !0; 64 | l = !1; 65 | break 66 | } 67 | } 68 | for (var r = { 69 | b: 8, 70 | t: 9, 71 | n: 10, 72 | v: 11, 73 | f: 12, 74 | r: 13 75 | }, n = [], p = 0, d = a.length; p < d; ++p) { 76 | g = a[p]; 77 | if (g.global || g.multiline) throw Error("" + g); 78 | n.push("(?:" + y(g) + ")") 79 | } 80 | return RegExp(n.join("|"), l ? "gi" : "g") 81 | } 82 | 83 | function M(a) { 84 | function m(a) { 85 | switch (a.nodeType) { 86 | case 1: 87 | if (e.test(a.className)) break; 88 | for (var g = a.firstChild; g; g = g.nextSibling) m(g); 89 | g = a.nodeName; 90 | if ("BR" === g || "LI" === g) h[s] = "\n", t[s << 1] = y++, t[s++ << 1 | 1] = a; 91 | break; 92 | case 3: 93 | case 4: 94 | g = a.nodeValue, g.length && (g = p ? g.replace(/\r\n?/g, "\n") : g.replace(/[\t\n\r ]+/g, " "), h[s] = g, t[s << 1] = y, y += g.length, t[s++ << 1 | 1] = a) 95 | } 96 | } 97 | var e = /(?:^|\s)nocode(?:\s|$)/, 98 | h = [], 99 | y = 0, 100 | t = [], 101 | s = 0, 102 | l; 103 | a.currentStyle ? l = a.currentStyle.whiteSpace : window.getComputedStyle && (l = document.defaultView.getComputedStyle(a, q).getPropertyValue("white-space")); 104 | var p = l && "pre" === l.substring(0, 3); 105 | m(a); 106 | return { 107 | a: h.join("").replace(/\n$/, ""), 108 | c: t 109 | } 110 | } 111 | 112 | function B(a, m, e, h) { 113 | m && (a = { 114 | a: m, 115 | d: a 116 | }, e(a), h.push.apply(h, a.e)) 117 | } 118 | 119 | function x(a, m) { 120 | function e(a) { 121 | for (var l = a.d, p = [l, "pln"], d = 0, g = a.a.match(y) || [], r = {}, n = 0, z = g.length; n < z; ++n) { 122 | var f = g[n], 123 | b = r[f], 124 | o = void 0, 125 | c; 126 | if (typeof b === "string") c = !1; 127 | else { 128 | var i = h[f.charAt(0)]; 129 | if (i) o = f.match(i[1]), b = i[0]; 130 | else { 131 | for (c = 0; c < t; ++c) if (i = m[c], o = f.match(i[1])) { 132 | b = i[0]; 133 | break 134 | } 135 | o || (b = "pln") 136 | } 137 | if ((c = b.length >= 5 && "lang-" === b.substring(0, 5)) && !(o && typeof o[1] === "string")) c = !1, b = "src"; 138 | c || (r[f] = b) 139 | } 140 | i = d; 141 | d += f.length; 142 | if (c) { 143 | c = o[1]; 144 | var j = f.indexOf(c), 145 | k = j + c.length; 146 | o[2] && (k = f.length - o[2].length, j = k - c.length); 147 | b = b.substring(5); 148 | B(l + i, f.substring(0, j), e, p); 149 | B(l + i + j, c, C(b, c), p); 150 | B(l + i + k, f.substring(k), e, p) 151 | } else p.push(l + i, b) 152 | } 153 | a.e = p 154 | } 155 | var h = {}, 156 | y; 157 | (function() { 158 | for (var e = a.concat(m), l = [], p = {}, d = 0, g = e.length; d < g; ++d) { 159 | var r = e[d], 160 | n = r[3]; 161 | if (n) for (var k = n.length; --k >= 0;) h[n.charAt(k)] = r; 162 | r = r[1]; 163 | n = "" + r; 164 | p.hasOwnProperty(n) || (l.push(r), p[n] = q) 165 | } 166 | l.push(/[\S\s]/); 167 | y = L(l) 168 | })(); 169 | var t = m.length; 170 | return e 171 | } 172 | 173 | function u(a) { 174 | var m = [], 175 | e = []; 176 | a.tripleQuotedStrings ? m.push(["str", /^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/, q, "'\""]) : a.multiLineStrings ? m.push(["str", /^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, q, "'\"`"]) : m.push(["str", /^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/, q, "\"'"]); 177 | a.verbatimStrings && e.push(["str", /^@"(?:[^"]|"")*(?:"|$)/, q]); 178 | var h = a.hashComments; 179 | h && (a.cStyleComments ? (h > 1 ? m.push(["com", /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, q, "#"]) : m.push(["com", /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/, q, "#"]), e.push(["str", /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, q])) : m.push(["com", /^#[^\n\r]*/, q, "#"])); 180 | a.cStyleComments && (e.push(["com", /^\/\/[^\n\r]*/, q]), e.push(["com", /^\/\*[\S\s]*?(?:\*\/|$)/, q])); 181 | a.regexLiterals && e.push(["lang-regex", /^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]); 182 | (h = a.types) && e.push(["typ", h]); 183 | a = ("" + a.keywords).replace(/^ | $/g, ""); 184 | a.length && e.push(["kwd", RegExp("^(?:" + a.replace(/[\s,]+/g, "|") + ")\\b"), q]); 185 | m.push(["pln", /^\s+/, q, " \r\n\t\xa0"]); 186 | e.push(["lit", /^@[$_a-z][\w$@]*/i, q], ["typ", /^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/, q], ["pln", /^[$_a-z][\w$@]*/i, q], ["lit", /^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i, q, "0123456789"], ["pln", /^\\[\S\s]?/, q], ["pun", /^.[^\s\w"-$'./@\\`]*/, q]); 187 | return x(m, e) 188 | } 189 | 190 | function D(a, m) { 191 | function e(a) { 192 | switch (a.nodeType) { 193 | case 1: 194 | if (k.test(a.className)) break; 195 | if ("BR" === a.nodeName) h(a), a.parentNode && a.parentNode.removeChild(a); 196 | else for (a = a.firstChild; a; a = a.nextSibling) e(a); 197 | break; 198 | case 3: 199 | case 4: 200 | if (p) { 201 | var b = a.nodeValue, 202 | d = b.match(t); 203 | if (d) { 204 | var c = b.substring(0, d.index); 205 | a.nodeValue = c; 206 | (b = b.substring(d.index + d[0].length)) && a.parentNode.insertBefore(s.createTextNode(b), a.nextSibling); 207 | h(a); 208 | c || a.parentNode.removeChild(a) 209 | } 210 | } 211 | } 212 | } 213 | 214 | function h(a) { 215 | function b(a, d) { 216 | var e = d ? a.cloneNode(!1) : a, 217 | f = a.parentNode; 218 | if (f) { 219 | var f = b(f, 1), 220 | g = a.nextSibling; 221 | f.appendChild(e); 222 | for (var h = g; h; h = g) g = h.nextSibling, f.appendChild(h) 223 | } 224 | return e 225 | } 226 | for (; !a.nextSibling;) if (a = a.parentNode, !a) return; 227 | for (var a = b(a.nextSibling, 0), e; 228 | (e = a.parentNode) && e.nodeType === 1;) a = e; 229 | d.push(a) 230 | } 231 | var k = /(?:^|\s)nocode(?:\s|$)/, 232 | t = /\r\n?|\n/, 233 | s = a.ownerDocument, 234 | l; 235 | a.currentStyle ? l = a.currentStyle.whiteSpace : window.getComputedStyle && (l = s.defaultView.getComputedStyle(a, q).getPropertyValue("white-space")); 236 | var p = l && "pre" === l.substring(0, 3); 237 | for (l = s.createElement("LI"); a.firstChild;) l.appendChild(a.firstChild); 238 | for (var d = [l], g = 0; g < d.length; ++g) e(d[g]); 239 | m === (m | 0) && d[0].setAttribute("value", m); 240 | var r = s.createElement("OL"); 241 | r.className = "linenums"; 242 | for (var n = Math.max(0, m - 1 | 0) || 0, g = 0, z = d.length; g < z; ++g) l = d[g], l.className = "L" + (g + n) % 10, l.firstChild || l.appendChild(s.createTextNode("\xa0")), r.appendChild(l); 243 | a.appendChild(r) 244 | } 245 | 246 | function k(a, m) { 247 | for (var e = m.length; --e >= 0;) { 248 | var h = m[e]; 249 | A.hasOwnProperty(h) ? window.console && console.warn("cannot override language handler %s", h) : A[h] = a 250 | } 251 | } 252 | 253 | function C(a, m) { 254 | if (!a || !A.hasOwnProperty(a)) a = /^\s*= o && (h += 2); 309 | e >= c && (a += 2) 310 | } 311 | } catch (w) { 312 | "console" in window && console.log(w && w.stack ? w.stack : w) 313 | } 314 | } 315 | var v = ["break,continue,do,else,for,if,return,while"], 316 | w = [ 317 | [v, "auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"], 318 | F = [w, "alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"], 319 | G = [w, "abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], 320 | H = [G, "as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"], 321 | w = [w, "debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"], 322 | I = [v, "and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], 323 | J = [v, "alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"], 324 | v = [v, "case,done,elif,esac,eval,fi,function,in,local,set,then,until"], 325 | K = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/, 326 | N = /\S/, 327 | O = u({ 328 | keywords: [F, H, w, "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END" + I, J, v], 329 | hashComments: !0, 330 | cStyleComments: !0, 331 | multiLineStrings: !0, 332 | regexLiterals: !0 333 | }), 334 | A = {}; 335 | k(O, ["default-code"]); 336 | k(x([], [ 337 | ["pln", /^[^]*(?:>|$)/], 339 | ["com", /^<\!--[\S\s]*?(?:--\>|$)/], 340 | ["lang-", /^<\?([\S\s]+?)(?:\?>|$)/], 341 | ["lang-", /^<%([\S\s]+?)(?:%>|$)/], 342 | ["pun", /^(?:<[%?]|[%?]>)/], 343 | ["lang-", /^]*>([\S\s]+?)<\/xmp\b[^>]*>/i], 344 | ["lang-js", /^]*>([\S\s]*?)(<\/script\b[^>]*>)/i], 345 | ["lang-css", /^]*>([\S\s]*?)(<\/style\b[^>]*>)/i], 346 | ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i] 347 | ]), ["default-markup", "htm", "html", "mxml", "xhtml", "xml", "xsl"]); 348 | k(x([ 349 | ["pln", /^\s+/, q, " \t\r\n"], 350 | ["atv", /^(?:"[^"]*"?|'[^']*'?)/, q, "\"'"] 351 | ], [ 352 | ["tag", /^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i], 353 | ["atn", /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i], 354 | ["lang-uq.val", /^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/], 355 | ["pun", /^[/<->]+/], 356 | ["lang-js", /^on\w+\s*=\s*"([^"]+)"/i], 357 | ["lang-js", /^on\w+\s*=\s*'([^']+)'/i], 358 | ["lang-js", /^on\w+\s*=\s*([^\s"'>]+)/i], 359 | ["lang-css", /^style\s*=\s*"([^"]+)"/i], 360 | ["lang-css", /^style\s*=\s*'([^']+)'/i], 361 | ["lang-css", /^style\s*=\s*([^\s"'>]+)/i] 362 | ]), ["in.tag"]); 363 | k(x([], [ 364 | ["atv", /^[\S\s]+/] 365 | ]), ["uq.val"]); 366 | k(u({ 367 | keywords: F, 368 | hashComments: !0, 369 | cStyleComments: !0, 370 | types: K 371 | }), ["c", "cc", "cpp", "cxx", "cyc", "m"]); 372 | k(u({ 373 | keywords: "null,true,false" 374 | }), ["json"]); 375 | k(u({ 376 | keywords: H, 377 | hashComments: !0, 378 | cStyleComments: !0, 379 | verbatimStrings: !0, 380 | types: K 381 | }), ["cs"]); 382 | k(u({ 383 | keywords: G, 384 | cStyleComments: !0 385 | }), ["java"]); 386 | k(u({ 387 | keywords: v, 388 | hashComments: !0, 389 | multiLineStrings: !0 390 | }), ["bsh", "csh", "sh"]); 391 | k(u({ 392 | keywords: I, 393 | hashComments: !0, 394 | multiLineStrings: !0, 395 | tripleQuotedStrings: !0 396 | }), ["cv", "py"]); 397 | k(u({ 398 | keywords: "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END", 399 | hashComments: !0, 400 | multiLineStrings: !0, 401 | regexLiterals: !0 402 | }), ["perl", "pl", "pm"]); 403 | k(u({ 404 | keywords: J, 405 | hashComments: !0, 406 | multiLineStrings: !0, 407 | regexLiterals: !0 408 | }), ["rb"]); 409 | k(u({ 410 | keywords: w, 411 | cStyleComments: !0, 412 | regexLiterals: !0 413 | }), ["js"]); 414 | k(u({ 415 | keywords: "all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", 416 | hashComments: 3, 417 | cStyleComments: !0, 418 | multilineStrings: !0, 419 | tripleQuotedStrings: !0, 420 | regexLiterals: !0 421 | }), ["coffee"]); 422 | k(x([], [ 423 | ["str", /^[\S\s]+/] 424 | ]), ["regex"]); 425 | window.prettyPrintOne = function(a, m, e) { 426 | var h = document.createElement("PRE"); 427 | h.innerHTML = a; 428 | e && D(h, e); 429 | E({ 430 | g: m, 431 | i: e, 432 | h: h 433 | }); 434 | return h.innerHTML 435 | }; 436 | window.prettyPrint = function(a) { 437 | function m() { 438 | for (var e = window.PR_SHOULD_USE_CONTINUATION ? l.now() + 250 : Infinity; p < h.length && l.now() < e; p++) { 439 | var n = h[p], 440 | k = n.className; 441 | if (k.indexOf("prettyprint") >= 0) { 442 | var k = k.match(g), 443 | f, b; 444 | if (b = !k) { 445 | b = n; 446 | for (var o = void 0, c = b.firstChild; c; c = c.nextSibling) var i = c.nodeType, 447 | o = i === 1 ? o ? b : c : i === 3 ? N.test(c.nodeValue) ? b : o : o; 448 | b = (f = o === b ? void 0 : o) && "CODE" === f.tagName 449 | } 450 | b && (k = f.className.match(g)); 451 | k && (k = k[1]); 452 | b = !1; 453 | for (o = n.parentNode; o; o = o.parentNode) if ((o.tagName === "pre" || o.tagName === "code" || o.tagName === "xmp") && o.className && o.className.indexOf("prettyprint") >= 0) { 454 | b = !0; 455 | break 456 | } 457 | b || ((b = (b = n.className.match(/\blinenums\b(?::(\d+))?/)) ? b[1] && b[1].length ? +b[1] : !0 : !1) && D(n, b), d = { 458 | g: k, 459 | h: n, 460 | i: b 461 | }, E(d)) 462 | } 463 | } 464 | p < h.length ? setTimeout(m, 250) : a && a() 465 | } 466 | for (var e = [document.getElementsByTagName("pre"), document.getElementsByTagName("code"), document.getElementsByTagName("xmp")], h = [], k = 0; k < e.length; ++k) for (var t = 0, s = e[k].length; t < s; ++t) h.push(e[k][t]); 467 | var e = q, 468 | l = Date; 469 | l.now || (l = { 470 | now: function() { 471 | return +new Date 472 | } 473 | }); 474 | var p = 0, 475 | d, g = /\blang(?:uage)?-([\w.]+)(?!\S)/; 476 | m() 477 | }; 478 | window.PR = { 479 | createSimpleLexer: x, 480 | registerLangHandler: k, 481 | sourceDecorator: u, 482 | PR_ATTRIB_NAME: "atn", 483 | PR_ATTRIB_VALUE: "atv", 484 | PR_COMMENT: "com", 485 | PR_DECLARATION: "dec", 486 | PR_KEYWORD: "kwd", 487 | PR_LITERAL: "lit", 488 | PR_NOCODE: "nocode", 489 | PR_PLAIN: "pln", 490 | PR_PUNCTUATION: "pun", 491 | PR_SOURCE: "src", 492 | PR_STRING: "str", 493 | PR_TAG: "tag", 494 | PR_TYPE: "typ" 495 | } 496 | })(); -------------------------------------------------------------------------------- /docs/scripts/toc.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | var navbarHeight; 3 | var initialised = false; 4 | var navbarOffset; 5 | 6 | function elOffset($el) { 7 | return $el.offset().top - (navbarHeight + navbarOffset); 8 | } 9 | 10 | function scrollToHash(duringPageLoad) { 11 | var elScrollToId = location.hash.replace(/^#/, ''); 12 | var $el; 13 | 14 | function doScroll() { 15 | var offsetTop = elOffset($el); 16 | window.scrollTo(window.pageXOffset || window.scrollX, offsetTop); 17 | } 18 | 19 | if (elScrollToId) { 20 | $el = $(document.getElementById(elScrollToId)); 21 | 22 | if (!$el.length) { 23 | $el = $(document.getElementsByName(elScrollToId)); 24 | } 25 | 26 | if ($el.length) { 27 | if (duringPageLoad) { 28 | $(window).one('scroll', function() { 29 | setTimeout(doScroll, 100); 30 | }); 31 | } else { 32 | setTimeout(doScroll, 0); 33 | } 34 | } 35 | } 36 | } 37 | 38 | function init(opts) { 39 | if (initialised) { 40 | return; 41 | } 42 | initialised = true; 43 | navbarHeight = $('.navbar').height(); 44 | navbarOffset = opts.navbarOffset; 45 | 46 | // some browsers move the offset after changing location. 47 | // also catch external links coming in 48 | $(window).on("hashchange", scrollToHash.bind(null, false)); 49 | $(scrollToHash.bind(null, true)); 50 | } 51 | 52 | $.catchAnchorLinks = function(options) { 53 | var opts = $.extend({}, jQuery.fn.toc.defaults, options); 54 | init(opts); 55 | }; 56 | 57 | $.fn.toc = function(options) { 58 | var self = this; 59 | var opts = $.extend({}, jQuery.fn.toc.defaults, options); 60 | 61 | var container = $(opts.container); 62 | var tocs = []; 63 | var headings = $(opts.selectors, container); 64 | var headingOffsets = []; 65 | var activeClassName = 'active'; 66 | var ANCHOR_PREFIX = "__anchor"; 67 | var maxScrollTo; 68 | var visibleHeight; 69 | var headerHeight = 10; // so if the header is readable, its counted as shown 70 | init(); 71 | 72 | var scrollTo = function(e) { 73 | e.preventDefault(); 74 | var target = $(e.target); 75 | if (target.prop('tagName').toLowerCase() !== "a") { 76 | target = target.parent(); 77 | } 78 | var elScrollToId = target.attr('href').replace(/^#/, '') + ANCHOR_PREFIX; 79 | var $el = $(document.getElementById(elScrollToId)); 80 | 81 | var offsetTop = Math.min(maxScrollTo, elOffset($el)); 82 | 83 | $('body,html').animate({ scrollTop: offsetTop }, 400, 'swing', function() { 84 | location.hash = '#' + elScrollToId; 85 | }); 86 | 87 | $('a', self).removeClass(activeClassName); 88 | target.addClass(activeClassName); 89 | }; 90 | 91 | var calcHadingOffsets = function() { 92 | maxScrollTo = $("body").height() - $(window).height(); 93 | visibleHeight = $(window).height() - navbarHeight; 94 | headingOffsets = []; 95 | headings.each(function(i, heading) { 96 | var anchorSpan = $(heading).prev("span"); 97 | var top = 0; 98 | if (anchorSpan.length) { 99 | top = elOffset(anchorSpan); 100 | } 101 | headingOffsets.push(top > 0 ? top : 0); 102 | }); 103 | } 104 | 105 | //highlight on scroll 106 | var timeout; 107 | var highlightOnScroll = function(e) { 108 | if (!tocs.length) { 109 | return; 110 | } 111 | if (timeout) { 112 | clearTimeout(timeout); 113 | } 114 | timeout = setTimeout(function() { 115 | var top = $(window).scrollTop(), 116 | highlighted; 117 | for (var i = headingOffsets.length - 1; i >= 0; i--) { 118 | var isActive = tocs[i].hasClass(activeClassName); 119 | // at the end of the page, allow any shown header 120 | if (isActive && headingOffsets[i] >= maxScrollTo && top >= maxScrollTo) { 121 | return; 122 | } 123 | // if we have got to the first heading or the heading is the first one visible 124 | if (i === 0 || (headingOffsets[i] + headerHeight >= top && (headingOffsets[i - 1] + headerHeight <= top))) { 125 | // in the case that a heading takes up more than the visible height e.g. we are showing 126 | // only the one above, highlight the one above 127 | if (i > 0 && headingOffsets[i] - visibleHeight >= top) { 128 | i--; 129 | } 130 | $('a', self).removeClass(activeClassName); 131 | if (i >= 0) { 132 | highlighted = tocs[i].addClass(activeClassName); 133 | opts.onHighlight(highlighted); 134 | } 135 | break; 136 | } 137 | } 138 | }, 50); 139 | }; 140 | if (opts.highlightOnScroll) { 141 | $(window).bind('scroll', highlightOnScroll); 142 | $(window).bind('load resize', function() { 143 | calcHadingOffsets(); 144 | highlightOnScroll(); 145 | }); 146 | } 147 | 148 | return this.each(function() { 149 | //build TOC 150 | var el = $(this); 151 | var ul = $('
'); 152 | 153 | headings.each(function(i, heading) { 154 | var $h = $(heading); 155 | 156 | var anchor = $('').attr('id', opts.anchorName(i, heading, opts.prefix) + ANCHOR_PREFIX).insertBefore($h); 157 | 158 | var span = $('') 159 | .text(opts.headerText(i, heading, $h)); 160 | 161 | //build TOC item 162 | var a = $('') 163 | .append(span) 164 | .attr('href', '#' + opts.anchorName(i, heading, opts.prefix)) 165 | .bind('click', function(e) { 166 | scrollTo(e); 167 | el.trigger('selected', $(this).attr('href')); 168 | }); 169 | 170 | span.addClass(opts.itemClass(i, heading, $h, opts.prefix)); 171 | 172 | tocs.push(a); 173 | 174 | ul.append(a); 175 | }); 176 | el.html(ul); 177 | 178 | calcHadingOffsets(); 179 | }); 180 | }; 181 | 182 | 183 | jQuery.fn.toc.defaults = { 184 | container: 'body', 185 | selectors: 'h1,h2,h3', 186 | smoothScrolling: true, 187 | prefix: 'toc', 188 | onHighlight: function() {}, 189 | highlightOnScroll: true, 190 | navbarOffset: 0, 191 | anchorName: function(i, heading, prefix) { 192 | return prefix+i; 193 | }, 194 | headerText: function(i, heading, $heading) { 195 | return $heading.text(); 196 | }, 197 | itemClass: function(i, heading, $heading, prefix) { 198 | return prefix + '-' + $heading[0].tagName.toLowerCase(); 199 | } 200 | 201 | }; 202 | 203 | })(jQuery); 204 | -------------------------------------------------------------------------------- /docs/styles/jsdoc-default.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-weight: normal; 4 | font-style: normal; 5 | src: url('../fonts/OpenSans-Regular-webfont.eot'); 6 | src: 7 | local('Open Sans'), 8 | local('OpenSans'), 9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), 10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), 11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); 12 | } 13 | 14 | @font-face { 15 | font-family: 'Open Sans Light'; 16 | font-weight: normal; 17 | font-style: normal; 18 | src: url('../fonts/OpenSans-Light-webfont.eot'); 19 | src: 20 | local('Open Sans Light'), 21 | local('OpenSans Light'), 22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), 23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'), 24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); 25 | } 26 | 27 | html 28 | { 29 | overflow: auto; 30 | background-color: #fff; 31 | font-size: 14px; 32 | } 33 | 34 | body 35 | { 36 | font-family: 'Open Sans', sans-serif; 37 | line-height: 1.5; 38 | color: #4d4e53; 39 | background-color: white; 40 | } 41 | 42 | a, a:visited, a:active { 43 | color: #0095dd; 44 | text-decoration: none; 45 | } 46 | 47 | a:hover { 48 | text-decoration: underline; 49 | } 50 | 51 | header 52 | { 53 | display: block; 54 | padding: 0px 4px; 55 | } 56 | 57 | tt, code, kbd, samp { 58 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 59 | } 60 | 61 | .class-description { 62 | font-size: 130%; 63 | line-height: 140%; 64 | margin-bottom: 1em; 65 | margin-top: 1em; 66 | } 67 | 68 | .class-description:empty { 69 | margin: 0; 70 | } 71 | 72 | #main { 73 | float: left; 74 | width: 70%; 75 | } 76 | 77 | article dl { 78 | margin-bottom: 40px; 79 | } 80 | 81 | article img { 82 | max-width: 100%; 83 | } 84 | 85 | section 86 | { 87 | display: block; 88 | background-color: #fff; 89 | padding: 12px 24px; 90 | border-bottom: 1px solid #ccc; 91 | margin-right: 30px; 92 | } 93 | 94 | .variation { 95 | display: none; 96 | } 97 | 98 | .signature-attributes { 99 | font-size: 60%; 100 | color: #aaa; 101 | font-style: italic; 102 | font-weight: lighter; 103 | } 104 | 105 | nav 106 | { 107 | display: block; 108 | float: right; 109 | margin-top: 28px; 110 | width: 30%; 111 | box-sizing: border-box; 112 | border-left: 1px solid #ccc; 113 | padding-left: 16px; 114 | } 115 | 116 | nav ul { 117 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; 118 | font-size: 100%; 119 | line-height: 17px; 120 | padding: 0; 121 | margin: 0; 122 | list-style-type: none; 123 | } 124 | 125 | nav ul a, nav ul a:visited, nav ul a:active { 126 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 127 | line-height: 18px; 128 | color: #4D4E53; 129 | } 130 | 131 | nav h3 { 132 | margin-top: 12px; 133 | } 134 | 135 | nav li { 136 | margin-top: 6px; 137 | } 138 | 139 | footer { 140 | display: block; 141 | padding: 6px; 142 | margin-top: 12px; 143 | font-style: italic; 144 | font-size: 90%; 145 | } 146 | 147 | h1, h2, h3, h4 { 148 | font-weight: 200; 149 | margin: 0; 150 | } 151 | 152 | h1 153 | { 154 | font-family: 'Open Sans Light', sans-serif; 155 | font-size: 48px; 156 | letter-spacing: -2px; 157 | margin: 12px 24px 20px; 158 | } 159 | 160 | h2, h3.subsection-title 161 | { 162 | font-size: 30px; 163 | font-weight: 700; 164 | letter-spacing: -1px; 165 | margin-bottom: 12px; 166 | } 167 | 168 | h3 169 | { 170 | font-size: 24px; 171 | letter-spacing: -0.5px; 172 | margin-bottom: 12px; 173 | } 174 | 175 | h4 176 | { 177 | font-size: 18px; 178 | letter-spacing: -0.33px; 179 | margin-bottom: 12px; 180 | color: #4d4e53; 181 | } 182 | 183 | h5, .container-overview .subsection-title 184 | { 185 | font-size: 120%; 186 | font-weight: bold; 187 | letter-spacing: -0.01em; 188 | margin: 8px 0 3px 0; 189 | } 190 | 191 | h6 192 | { 193 | font-size: 100%; 194 | letter-spacing: -0.01em; 195 | margin: 6px 0 3px 0; 196 | font-style: italic; 197 | } 198 | 199 | table 200 | { 201 | border-spacing: 0; 202 | border: 0; 203 | border-collapse: collapse; 204 | } 205 | 206 | td, th 207 | { 208 | border: 1px solid #ddd; 209 | margin: 0px; 210 | text-align: left; 211 | vertical-align: top; 212 | padding: 4px 6px; 213 | display: table-cell; 214 | } 215 | 216 | thead tr 217 | { 218 | background-color: #ddd; 219 | font-weight: bold; 220 | } 221 | 222 | th { border-right: 1px solid #aaa; } 223 | tr > th:last-child { border-right: 1px solid #ddd; } 224 | 225 | .ancestors, .attribs { color: #999; } 226 | .ancestors a, .attribs a 227 | { 228 | color: #999 !important; 229 | text-decoration: none; 230 | } 231 | 232 | .clear 233 | { 234 | clear: both; 235 | } 236 | 237 | .important 238 | { 239 | font-weight: bold; 240 | color: #950B02; 241 | } 242 | 243 | .yes-def { 244 | text-indent: -1000px; 245 | } 246 | 247 | .type-signature { 248 | color: #aaa; 249 | } 250 | 251 | .name, .signature { 252 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 253 | } 254 | 255 | .details { margin-top: 14px; border-left: 2px solid #DDD; } 256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } 257 | .details dd { margin-left: 70px; } 258 | .details ul { margin: 0; } 259 | .details ul { list-style-type: none; } 260 | .details li { margin-left: 30px; padding-top: 6px; } 261 | .details pre.prettyprint { margin: 0 } 262 | .details .object-value { padding-top: 0; } 263 | 264 | .description { 265 | margin-bottom: 1em; 266 | margin-top: 1em; 267 | } 268 | 269 | .code-caption 270 | { 271 | font-style: italic; 272 | font-size: 107%; 273 | margin: 0; 274 | } 275 | 276 | .prettyprint 277 | { 278 | border: 1px solid #ddd; 279 | width: 80%; 280 | overflow: auto; 281 | } 282 | 283 | .prettyprint.source { 284 | width: inherit; 285 | } 286 | 287 | .prettyprint code 288 | { 289 | font-size: 100%; 290 | line-height: 18px; 291 | display: block; 292 | padding: 4px 12px; 293 | margin: 0; 294 | background-color: #fff; 295 | color: #4D4E53; 296 | } 297 | 298 | .prettyprint code span.line 299 | { 300 | display: inline-block; 301 | } 302 | 303 | .prettyprint.linenums 304 | { 305 | padding-left: 70px; 306 | -webkit-user-select: none; 307 | -moz-user-select: none; 308 | -ms-user-select: none; 309 | user-select: none; 310 | } 311 | 312 | .prettyprint.linenums ol 313 | { 314 | padding-left: 0; 315 | } 316 | 317 | .prettyprint.linenums li 318 | { 319 | border-left: 3px #ddd solid; 320 | } 321 | 322 | .prettyprint.linenums li.selected, 323 | .prettyprint.linenums li.selected * 324 | { 325 | background-color: lightyellow; 326 | } 327 | 328 | .prettyprint.linenums li * 329 | { 330 | -webkit-user-select: text; 331 | -moz-user-select: text; 332 | -ms-user-select: text; 333 | user-select: text; 334 | } 335 | 336 | .params .name, .props .name, .name code { 337 | color: #4D4E53; 338 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 339 | font-size: 100%; 340 | } 341 | 342 | .params td.description > p:first-child, 343 | .props td.description > p:first-child 344 | { 345 | margin-top: 0; 346 | padding-top: 0; 347 | } 348 | 349 | .params td.description > p:last-child, 350 | .props td.description > p:last-child 351 | { 352 | margin-bottom: 0; 353 | padding-bottom: 0; 354 | } 355 | 356 | .disabled { 357 | color: #454545; 358 | } 359 | -------------------------------------------------------------------------------- /docs/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /docs/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Menlo, Monaco, Consolas, monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /docs/styles/sunlight.dark.css: -------------------------------------------------------------------------------- 1 | /* global styles */ 2 | .sunlight-container { 3 | clear: both !important; 4 | position: relative !important; 5 | margin: 10px 0 !important; 6 | } 7 | .sunlight-code-container { 8 | clear: both !important; 9 | position: relative !important; 10 | border: none; 11 | border-color: #626262 !important; 12 | background-color: #262626 !important; 13 | } 14 | .sunlight-highlighted, .sunlight-container, .sunlight-container textarea { 15 | font-family: Consolas, Inconsolata, Monaco, "Courier New" !important; 16 | font-size: 12px !important; 17 | line-height: 15px !important; 18 | } 19 | .sunlight-highlighted, .sunlight-container textarea { 20 | color: #FFFFFF !important; 21 | margin: 0 !important; 22 | } 23 | .sunlight-container textarea { 24 | padding-left: 0 !important; 25 | margin-left: 0 !important; 26 | margin-right: 0 !important; 27 | padding-right: 0 !important; 28 | } 29 | .sunlight-code-container > .sunlight-highlighted { 30 | white-space: pre; 31 | overflow-x: auto; 32 | overflow-y: hidden; /* ie requires this wtf? */ 33 | } 34 | .sunlight-highlighted { 35 | z-index: 1; 36 | position: relative; 37 | } 38 | .sunlight-highlighted * { 39 | background: transparent; 40 | } 41 | .sunlight-line-number-margin { 42 | float: left !important; 43 | margin-right: 5px !important; 44 | margin-top: 0 !important; 45 | margin-bottom: 0 !important; 46 | padding: 0 !important; 47 | padding-right: 4px !important; 48 | padding-left: 4px !important; 49 | border-right: 1px solid #9A9A9A !important; 50 | background-color: #3E3E3E !important; 51 | color: #9A9A9A !important; 52 | text-align: right !important; 53 | position: relative; 54 | z-index: 3; 55 | } 56 | .sunlight-highlighted a, .sunlight-line-number-margin a { 57 | border: none !important; 58 | text-decoration: none !important; 59 | font-style: normal !important; 60 | padding: 0 !important; 61 | } 62 | .sunlight-line-number-margin a { 63 | color: inherit !important; 64 | } 65 | .sunlight-line-highlight-overlay { 66 | position: absolute; 67 | top: 0; 68 | left: 0; 69 | width: 100%; 70 | z-index: 0; 71 | } 72 | .sunlight-line-highlight-overlay div { 73 | height: 15px; 74 | width: 100%; 75 | } 76 | .sunlight-line-highlight-overlay .sunlight-line-highlight-active { 77 | background-color: #4B4B4B; 78 | } 79 | 80 | /* menu */ 81 | .sunlight-menu { 82 | background-color: #FFFFCC; 83 | color: #000000; 84 | } 85 | .sunlight-menu ul { 86 | margin: 0 !important; 87 | padding: 0 !important; 88 | list-style-type: none !important; 89 | } 90 | .sunlight-menu li { 91 | float: right !important; 92 | margin-left: 5px !important; 93 | } 94 | .sunlight-menu a, .sunlight-menu img { 95 | color: #000099 !important; 96 | text-decoration: none !important; 97 | border: none !important; 98 | } 99 | 100 | 101 | 102 | 103 | .sunlight-string, 104 | .sunlight-char, 105 | .sunlight-heredoc, 106 | .sunlight-heredocDeclaration, 107 | .sunlight-nowdoc, 108 | .sunlight-longString, 109 | .sunlight-rawString, 110 | .sunlight-binaryString, 111 | .sunlight-verbatimString, 112 | .sunlight-rawLongString, 113 | .sunlight-binaryLongString, 114 | .sunlight-diff .sunlight-added { 115 | color: #55EB54 !important; 116 | } 117 | .sunlight-operator, 118 | .sunlight-punctuation, 119 | .sunlight-delimiter { 120 | color: #B1EDEC !important; 121 | } 122 | .sunlight-ident, 123 | .sunlight-diff .sunlight-unchanged { 124 | color: #E0E0E0 !important; 125 | font-weight: bold !important; 126 | } 127 | .sunlight-comment, 128 | .sunlight-xmlDocCommentContent, 129 | .sunlight-nginx .sunlight-ssiCommand, 130 | .sunlight-sln .sunlight-formatDeclaration, 131 | .sunlight-diff .sunlight-mergeHeader, 132 | .sunlight-diff .sunlight-noNewLine { 133 | color: #787D31 !important; 134 | } 135 | .sunlight-number, 136 | .sunlight-cdata, 137 | .sunlight-guid, 138 | .sunlight-diff .sunlight-modified { 139 | color: #F7BA7E !important; 140 | font-weight: bold !important; 141 | } 142 | .sunlight-named-ident, 143 | .sunlight-xml .sunlight-attribute, 144 | .sunlight-constant, 145 | .sunlight-javascript .sunlight-globalVariable, 146 | .sunlight-globalObject, 147 | .sunlight-css .sunlight-id, 148 | .sunlight-python .sunlight-attribute, 149 | .sunlight-nginx .sunlight-context, 150 | .sunlight-httpd .sunlight-context, 151 | .sunlight-lisp .sunlight-declarationSpecifier, 152 | .sunlight-erlang .sunlight-userDefinedFunction, 153 | .sunlight-diff .sunlight-removed { 154 | color: #FBBDEE !important; 155 | font-weight: bold !important; 156 | } 157 | .sunlight-keyword, 158 | .sunlight-languageConstruct, 159 | .sunlight-specialOperator, 160 | .sunlight-xml .sunlight-tagName, 161 | .sunlight-xml .sunlight-operator, 162 | .sunlight-bash .sunlight-command, 163 | .sunlight-erlang .sunlight-moduleAttribute { 164 | color: #A3CCF7 !important; 165 | font-weight: bold !important; 166 | } 167 | .sunlight-shortOpenTag, 168 | .sunlight-openTag, 169 | .sunlight-closeTag, 170 | .sunlight-xmlOpenTag, 171 | .sunlight-xmlCloseTag, 172 | .sunlight-aspOpenTag, 173 | .sunlight-aspCloseTag, 174 | .sunlight-label, 175 | .sunlight-css .sunlight-importantFlag { 176 | background-color: #7373C1 !important; 177 | } 178 | .sunlight-content { 179 | color: #FFFFFF !important; 180 | font-weight: bold !important; 181 | } 182 | .sunlight-function, 183 | .sunlight-globalFunction, 184 | .sunlight-objective-c .sunlight-messageDestination, 185 | .sunlight-ruby .sunlight-specialFunction, 186 | .sunlight-6502asm .sunlight-illegalOpcode, 187 | .sunlight-powershell .sunlight-switch, 188 | .sunlight-lisp .sunlight-macro, 189 | .sunlight-lisp .sunlight-specialForm, 190 | .sunlight-lisp .sunlight-type, 191 | .sunlight-sln .sunlight-sectionName, 192 | .sunlight-diff .sunlight-header { 193 | color: #C8BBF1 !important; 194 | font-weight: bold !important; 195 | } 196 | .sunlight-variable, 197 | .sunlight-environmentVariable, 198 | .sunlight-specialVariable, 199 | .sunlight-objective-c .sunlight-messageArgumentName, 200 | .sunlight-lisp .sunlight-globalVariable, 201 | .sunlight-ruby .sunlight-globalVariable, 202 | .sunlight-ruby .sunlight-instanceVariable { 203 | color: #F5E5B0 !important; 204 | font-weight: bold !important; 205 | } 206 | .sunlight-regexLiteral, 207 | .sunlight-lisp .sunlight-operator, 208 | .sunlight-6502asm .sunlight-pseudoOp, 209 | .sunlight-erlang .sunlight-macro, 210 | .sunlight-diff .sunlight-rangeInfo { 211 | color: #E0F16A !important; 212 | } 213 | .sunlight-specialVariable { 214 | font-style: italic !important; 215 | font-weight: bold !important; 216 | } 217 | .sunlight-csharp .sunlight-pragma, 218 | .sunlight-preprocessorDirective, 219 | .sunlight-vb .sunlight-compilerDirective { 220 | color: #666363 !important; 221 | font-style: italic !important; 222 | } 223 | .sunlight-xmlDocCommentMeta, 224 | .sunlight-java .sunlight-annotation, 225 | .sunlight-scala .sunlight-annotation, 226 | .sunlight-docComment { 227 | color: #666363 !important; 228 | } 229 | .sunlight-quotedIdent, 230 | .sunlight-ruby .sunlight-subshellCommand, 231 | .sunlight-lisp .sunlight-keywordArgument, 232 | .sunlight-haskell .sunlight-infixOperator, 233 | .sunlight-erlang .sunlight-quotedAtom { 234 | color: #F8CA16 !important; 235 | } 236 | 237 | 238 | 239 | 240 | /* html/xml */ 241 | .sunlight-xml .sunlight-tagName, 242 | .sunlight-xml .sunlight-operator, 243 | .sunlight-xml .sunlight-attribute { 244 | font-weight: normal !important; 245 | } 246 | .sunlight-doctype { 247 | color: #DEB9B2 !important; 248 | font-style: italic !important; 249 | } 250 | .sunlight-xml .sunlight-entity { 251 | background-color: #E6E585 !important; 252 | color: #000000 !important; 253 | } 254 | 255 | /* javascript */ 256 | .sunlight-javascript .sunlight-reservedWord { 257 | font-style: italic !important; 258 | } 259 | 260 | /* css */ 261 | .sunlight-css .sunlight-element { 262 | color: #E9EE97 !important; 263 | } 264 | .sunlight-css .sunlight-microsoftFilterPrefix { 265 | color: #C9FF9F !important; 266 | } 267 | .sunlight-css .sunlight-rule { 268 | color: #0099FF !important; 269 | } 270 | .sunlight-css .sunlight-class { 271 | color: #E78282 !important; 272 | } 273 | .sunlight-css .sunlight-pseudoClass, .sunlight-css .sunlight-pseudoElement { 274 | color: #73D693 !important; 275 | } 276 | 277 | /* bash */ 278 | .sunlight-bash .sunlight-hashBang { 279 | color: #FFFF00 !important; 280 | } 281 | 282 | .sunlight-bash .sunlight-verbatimCommand { 283 | color: #BBA4EE !important; 284 | } 285 | .sunlight-bash .sunlight-variable, 286 | .sunlight-bash .sunlight-specialVariable { 287 | color: #ED8585 !important; 288 | } 289 | 290 | /* python */ 291 | .sunlight-python .sunlight-specialMethod { 292 | font-weight: bold !important; 293 | color: #B0A3C2; 294 | } 295 | 296 | /* ruby */ 297 | .sunlight-ruby .sunlight-symbol { 298 | font-weight: bold !important; 299 | color: #90EEA2 !important; 300 | } 301 | 302 | /* brainfuck */ 303 | .sunlight-brainfuck { 304 | font-weight: bold !important; 305 | color: #000000 !important; 306 | } 307 | .sunlight-brainfuck .sunlight-increment { 308 | background-color: #FF9900 !important; 309 | } 310 | .sunlight-brainfuck .sunlight-decrement { 311 | background-color: #FF99FF !important; 312 | } 313 | .sunlight-brainfuck .sunlight-incrementPointer { 314 | background-color: #FFFF99 !important; 315 | } 316 | .sunlight-brainfuck .sunlight-decrementPointer { 317 | background-color: #66CCFF !important; 318 | } 319 | .sunlight-brainfuck .sunlight-read { 320 | background-color: #FFFFFF !important; 321 | } 322 | .sunlight-brainfuck .sunlight-write { 323 | background-color: #99FF99 !important; 324 | } 325 | .sunlight-brainfuck .sunlight-openLoop, .sunlight-brainfuck .sunlight-closeLoop { 326 | background-color: #FFFFFF !important; 327 | } 328 | 329 | /* 6502 asm */ 330 | .sunlight-6502asm .sunlight-label { 331 | background: none !important; 332 | color: #FFFFFF !important; 333 | text-decoration: underline !important; 334 | } 335 | 336 | /* lisp */ 337 | .sunlight-lisp .sunlight-macro { 338 | font-style: italic !important; 339 | } 340 | 341 | /* erlang */ 342 | .sunlight-erlang .sunlight-atom { 343 | color: #FFFFFF !important; 344 | font-weight: bold !important; 345 | } -------------------------------------------------------------------------------- /docs/styles/sunlight.default.css: -------------------------------------------------------------------------------- 1 | /* global styles */ 2 | .sunlight-container { 3 | clear: both !important; 4 | position: relative !important; 5 | margin: 10px 0 !important; 6 | } 7 | .sunlight-code-container { 8 | clear: both !important; 9 | position: relative !important; 10 | border: none; 11 | border-color: #969696 !important; 12 | background-color: #FFFFFF !important; 13 | } 14 | .sunlight-highlighted, .sunlight-container, .sunlight-container textarea { 15 | font-family: Consolas, Inconsolata, Monaco, "Courier New" !important; 16 | font-size: 12px !important; 17 | line-height: 15px !important; 18 | } 19 | .sunlight-highlighted, .sunlight-container textarea { 20 | color: #000000 !important; 21 | margin: 0 !important; 22 | } 23 | .sunlight-container textarea { 24 | padding-left: 0 !important; 25 | margin-left: 0 !important; 26 | margin-right: 0 !important; 27 | padding-right: 0 !important; 28 | } 29 | .sunlight-code-container > .sunlight-highlighted { 30 | white-space: pre; 31 | overflow-x: auto; 32 | overflow-y: hidden; /* ie requires this wtf? */ 33 | } 34 | .sunlight-highlighted { 35 | z-index: 1; 36 | position: relative; 37 | } 38 | .sunlight-highlighted * { 39 | background: transparent; 40 | } 41 | .sunlight-line-number-margin { 42 | float: left !important; 43 | margin-right: 5px !important; 44 | margin-top: 0 !important; 45 | margin-bottom: 0 !important; 46 | padding: 0 !important; 47 | padding-right: 4px !important; 48 | padding-left: 4px !important; 49 | border-right: 1px solid #CCCCCC !important; 50 | background-color: #EEEEEE !important; 51 | color: #848484 !important; 52 | text-align: right !important; 53 | position: relative; 54 | z-index: 3; 55 | } 56 | .sunlight-highlighted a, .sunlight-line-number-margin a { 57 | border: none !important; 58 | text-decoration: none !important; 59 | font-weight: normal !important; 60 | font-style: normal !important; 61 | padding: 0 !important; 62 | } 63 | .sunlight-line-number-margin a { 64 | color: inherit !important; 65 | } 66 | .sunlight-line-highlight-overlay { 67 | position: absolute; 68 | top: 0; 69 | left: 0; 70 | width: 100%; 71 | z-index: 0; 72 | } 73 | .sunlight-line-highlight-overlay div { 74 | height: 15px; 75 | width: 100%; 76 | } 77 | .sunlight-line-highlight-overlay .sunlight-line-highlight-active { 78 | background-color: #E7FCFA; 79 | } 80 | 81 | /* menu */ 82 | .sunlight-menu { 83 | background-color: #FFFFCC; 84 | color: #000000; 85 | } 86 | .sunlight-menu ul { 87 | margin: 0 !important; 88 | padding: 0 !important; 89 | list-style-type: none !important; 90 | } 91 | .sunlight-menu li { 92 | float: right !important; 93 | margin-left: 5px !important; 94 | } 95 | .sunlight-menu a, .sunlight-menu img { 96 | color: #000099 !important; 97 | text-decoration: none !important; 98 | border: none !important; 99 | } 100 | 101 | 102 | 103 | 104 | .sunlight-string, 105 | .sunlight-char, 106 | .sunlight-heredoc, 107 | .sunlight-heredocDeclaration, 108 | .sunlight-nowdoc, 109 | .sunlight-longString, 110 | .sunlight-rawString, 111 | .sunlight-binaryString, 112 | .sunlight-rawLongString, 113 | .sunlight-binaryLongString, 114 | .sunlight-verbatimString, 115 | .sunlight-diff .sunlight-removed { 116 | color: #990000 !important; 117 | } 118 | 119 | .sunlight-ident, 120 | .sunlight-operator, 121 | .sunlight-punctuation, 122 | .sunlight-delimiter, 123 | .sunlight-diff .sunlight-unchanged { 124 | color: #000000 !important; 125 | } 126 | 127 | .sunlight-comment, 128 | .sunlight-xmlDocCommentContent, 129 | .sunlight-nginx .sunlight-ssiCommand, 130 | .sunlight-sln .sunlight-formatDeclaration, 131 | .sunlight-diff .sunlight-added { 132 | color: #009900 !important; 133 | } 134 | .sunlight-number, 135 | .sunlight-guid, 136 | .sunlight-cdata { 137 | color: #CC6600 !important; 138 | } 139 | 140 | .sunlight-named-ident, 141 | .sunlight-constant, 142 | .sunlight-javascript .sunlight-globalVariable, 143 | .sunlight-globalObject, 144 | .sunlight-python .sunlight-attribute, 145 | .sunlight-nginx .sunlight-context, 146 | .sunlight-httpd .sunlight-context, 147 | .sunlight-haskell .sunlight-class, 148 | .sunlight-haskell .sunlight-type, 149 | .sunlight-lisp .sunlight-declarationSpecifier, 150 | .sunlight-erlang .sunlight-userDefinedFunction, 151 | .sunlight-diff .sunlight-header { 152 | color: #2B91AF !important; 153 | } 154 | .sunlight-keyword, 155 | .sunlight-languageConstruct, 156 | .sunlight-css 157 | .sunlight-element, 158 | .sunlight-bash .sunlight-command, 159 | .sunlight-specialOperator, 160 | .sunlight-erlang .sunlight-moduleAttribute, 161 | .sunlight-xml .sunlight-tagName, 162 | .sunlight-xml .sunlight-operator, 163 | .sunlight-diff .sunlight-modified { 164 | color: #0000FF !important; 165 | } 166 | .sunlight-shortOpenTag, 167 | .sunlight-openTag, 168 | .sunlight-closeTag, 169 | .sunlight-xmlOpenTag, 170 | .sunlight-xmlCloseTag, 171 | .sunlight-aspOpenTag, 172 | .sunlight-aspCloseTag, 173 | .sunlight-label, 174 | .sunlight-css .sunlight-importantFlag { 175 | background-color: #FFFF99 !important; 176 | color: #000000 !important; 177 | } 178 | .sunlight-function, 179 | .sunlight-globalFunction, 180 | .sunlight-ruby .sunlight-specialFunction, 181 | .sunlight-objective-c .sunlight-messageDestination, 182 | .sunlight-6502asm .sunlight-illegalOpcode, 183 | .sunlight-powershell .sunlight-switch, 184 | .sunlight-lisp .sunlight-macro, 185 | .sunlight-lisp .sunlight-specialForm, 186 | .sunlight-lisp .sunlight-type, 187 | .sunlight-sln .sunlight-sectionName, 188 | .sunlight-diff .sunlight-rangeInfo { 189 | color: #B069AF !important; 190 | } 191 | 192 | .sunlight-variable, 193 | .sunlight-specialVariable, 194 | .sunlight-environmentVariable, 195 | .sunlight-objective-c .sunlight-messageArgumentName, 196 | .sunlight-lisp .sunlight-globalVariable, 197 | .sunlight-ruby .sunlight-globalVariable, 198 | .sunlight-ruby .sunlight-instanceVariable, 199 | .sunlight-sln .sunlight-operator { 200 | color: #325484 !important; 201 | } 202 | .sunlight-regexLiteral, 203 | .sunlight-lisp .sunlight-operator, 204 | .sunlight-6502asm .sunlight-pseudoOp, 205 | .sunlight-erlang .sunlight-macro { 206 | color: #FF00B2 !important; 207 | } 208 | .sunlight-specialVariable { 209 | font-style: italic !important; 210 | font-weight: bold !important; 211 | } 212 | .sunlight-csharp .sunlight-pragma, 213 | .sunlight-preprocessorDirective, 214 | .sunlight-vb .sunlight-compilerDirective, 215 | .sunlight-diff .sunlight-mergeHeader, 216 | .sunlight-diff .sunlight-noNewLine { 217 | color: #999999 !important; 218 | font-style: italic !important; 219 | } 220 | .sunlight-xmlDocCommentMeta, 221 | .sunlight-java .sunlight-annotation, 222 | .sunlight-scala .sunlight-annotation, 223 | .sunlight-docComment { 224 | color: #808080 !important; 225 | } 226 | .sunlight-quotedIdent, 227 | .sunlight-ruby .sunlight-subshellCommand, 228 | .sunlight-lisp .sunlight-keywordArgument, 229 | .sunlight-haskell .sunlight-infixOperator, 230 | .sunlight-erlang .sunlight-quotedAtom { 231 | color: #999900 !important; 232 | } 233 | 234 | 235 | 236 | /* xml */ 237 | .sunlight-xml .sunlight-string { 238 | color: #990099 !important; 239 | } 240 | .sunlight-xml .sunlight-attribute { 241 | color: #FF0000 !important; 242 | } 243 | .sunlight-xml .sunlight-entity { 244 | background-color: #EEEEEE !important; 245 | color: #000000 !important; 246 | border: 1px solid #000000 !important; 247 | } 248 | .sunlight-xml .sunlight-doctype { 249 | color: #2B91AF !important; 250 | } 251 | 252 | /* javascript */ 253 | .sunlight-javascript .sunlight-reservedWord { 254 | font-style: italic !important; 255 | } 256 | 257 | /* css */ 258 | .sunlight-css .sunlight-microsoftFilterPrefix { 259 | color: #FF00FF !important; 260 | } 261 | .sunlight-css .sunlight-rule { 262 | color: #0099FF !important; 263 | } 264 | .sunlight-css .sunlight-keyword { 265 | color: #4E65B8 !important; 266 | } 267 | .sunlight-css .sunlight-class { 268 | color: #FF0000 !important; 269 | } 270 | .sunlight-css .sunlight-id { 271 | color: #8A8E13 !important; 272 | } 273 | .sunlight-css .sunlight-pseudoClass, 274 | .sunlight-css .sunlight-pseudoElement { 275 | color: #368B87 !important; 276 | } 277 | 278 | /* bash */ 279 | .sunlight-bash .sunlight-hashBang { 280 | color: #3D97F5 !important; 281 | } 282 | .sunlight-bash .sunlight-verbatimCommand { 283 | color: #999900 !important; 284 | } 285 | .sunlight-bash .sunlight-variable, 286 | .sunlight-bash .sunlight-specialVariable { 287 | color: #FF0000 !important; 288 | } 289 | 290 | /* python */ 291 | .sunlight-python .sunlight-specialMethod { 292 | font-weight: bold !important; 293 | color: #A07DD3; 294 | } 295 | 296 | /* ruby */ 297 | .sunlight-ruby .sunlight-symbol { 298 | font-weight: bold !important; 299 | color: #ED7272 !important; 300 | } 301 | 302 | /* brainfuck */ 303 | .sunlight-brainfuck { 304 | font-weight: bold !important; 305 | color: #000000 !important; 306 | } 307 | .sunlight-brainfuck .sunlight-increment { 308 | background-color: #FF9900 !important; 309 | } 310 | .sunlight-brainfuck .sunlight-decrement { 311 | background-color: #FF99FF !important; 312 | } 313 | .sunlight-brainfuck .sunlight-incrementPointer { 314 | background-color: #FFFF99 !important; 315 | } 316 | .sunlight-brainfuck .sunlight-decrementPointer { 317 | background-color: #66CCFF !important; 318 | } 319 | .sunlight-brainfuck .sunlight-read { 320 | background-color: #FFFFFF !important; 321 | } 322 | .sunlight-brainfuck .sunlight-write { 323 | background-color: #99FF99 !important; 324 | } 325 | .sunlight-brainfuck .sunlight-openLoop, .sunlight-brainfuck .sunlight-closeLoop { 326 | background-color: #FFFFFF !important; 327 | } 328 | 329 | /* 6502 asm */ 330 | .sunlight-6502asm .sunlight-label { 331 | font-weight: bold !important; 332 | color: #000000 !important; 333 | background: none !important; 334 | } 335 | 336 | /* lisp */ 337 | .sunlight-lisp .sunlight-macro { 338 | font-style: italic !important; 339 | } 340 | 341 | /* erlang */ 342 | .sunlight-erlang .sunlight-atom { 343 | font-weight: bold !important; 344 | } -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/MQProducer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: MQProducer 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: MQProducer

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

MQProducer(client, topic)

32 | 33 |
MQ的消息生产者
34 | 35 | 36 |
37 | 38 |
39 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 |

Methods

219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 |

publishMessage(body, tag) → {object}

227 | 228 | 229 | 230 | 231 | 232 | 233 |
234 | 向主题发送一条消息 235 |
236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 |
Parameters:
246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 |
NameTypeDescription
body 274 | 275 | 276 | string 277 | 278 | 279 | 280 | 发送的内容
tag 297 | 298 | 299 | string 300 | 301 | 302 | 303 | 发送消息的标签
315 | 316 | 317 | 318 | 319 | 320 | 321 |
322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 |
Source:
349 |
352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 |
360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 |
Throws:
372 | 373 | 374 | 375 |
376 | 377 | 378 | exception 379 | 380 | 381 | 382 |
383 | 384 | 385 | 386 | 387 | 388 |
Returns:
389 | 390 | 391 |
392 |
393 | {
394 |  code: 201,
395 |  requestId: "xxxxxxxxxxxxxx",
396 |  body: {
397 |    MesasgeId: "",
398 |    MesasgeBodyMD5: ""
399 |  }
400 | }
401 | 
402 |
403 | 404 | 405 | 406 |
407 |
408 | Type 409 |
410 |
411 | 412 | object 413 | 414 | 415 |
416 |
417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 |
431 | 432 |
433 | 434 | 435 | 436 | 437 |
438 | 439 | 442 | 443 |
444 | 445 |
446 | Documentation generated by JSDoc 3.5.5 on Wed Nov 14 2018 17:53:32 GMT+0800 (GMT+08:00) 447 |
448 | 449 | 450 | 451 | 452 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/client.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: client.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: client.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
 30 | 
 31 | const assert = require('assert');
 32 | 
 33 | const debug = require('debug')('mq:client');
 34 | const httpx = require('httpx');
 35 | const kitx = require('kitx');
 36 | 
 37 | const {
 38 |   toXMLBuffer,
 39 |   parseXML,
 40 |   extract,
 41 |   getCanonicalizedMQHeaders
 42 | } = require('./helper');
 43 | 
 44 | /**
 45 |  * MQ的client,用于保存aliyun账号消息,以及发送http请求
 46 |  */
 47 | class MQClient {
 48 |   /**
 49 |    * MQClient构造函数
 50 |    * @param {string}  endpoint  MQ的HTTP接入地址
 51 |    * @param {string}  accessKeyId 阿里云账号的AK
 52 |    * @param {string}  accessKeySecret 阿里云账号的SK 
 53 |    * @param {string}  securityToken 阿里云RAM授权的STS TOKEN,可空
 54 |    *
 55 |    * @returns {MQClient}
 56 |    */
 57 |   constructor(endpoint, accessKeyId, accessKeySecret, securityToken) {
 58 |     assert(endpoint, '"endpoint" must be passed in');
 59 |     this.endpoint = endpoint;
 60 |     assert(accessKeyId, 'must pass in "accessKeyId"');
 61 |     this.accessKeyId = accessKeyId;
 62 |     assert(accessKeySecret, 'must pass in "accessKeySecret"');
 63 |     this.accessKeySecret = accessKeySecret;
 64 |     // security token
 65 |     this.securityToken = securityToken;
 66 |   }
 67 | 
 68 |   /**
 69 |    * 发送http请求
 70 |    * @param {string}  method HTTP的请求方法GET/PUT/POST/DELETE...
 71 |    * @param {string}  resource  HTTP请求URL的path
 72 |    * @param {string}  type  解析XML响应内容的元素名字
 73 |    * @param {string}  requestBody 请求的body
 74 |    * @param {object}  opts  额外请求的参数
 75 |    *
 76 |    * @returns {object}  
 77 |    * <pre>
 78 |    * {
 79 |    *  code: 200,
 80 |    *  requestId: "xxxxxxxxxxxxxx",
 81 |    *  body: {A:1,B:2,C:3}
 82 |    * }
 83 |    * </pre>
 84 |    */
 85 |   async request(method, resource, type, requestBody,  opts = {}) {
 86 |     const url = `${this.endpoint}${resource}`;
 87 |     debug('url: %s', url);
 88 |     debug('method: %s', method);
 89 |     const headers = this.buildHeaders(method, requestBody, resource, opts.headers);
 90 |     debug('request headers: %j', headers);
 91 |     debug('request body: %s', requestBody.toString());
 92 |     const response = await httpx.request(url, Object.assign(opts, {
 93 |       method: method,
 94 |       headers: headers,
 95 |       data: requestBody
 96 |     }));
 97 | 
 98 |     debug('statusCode %s', response.statusCode);
 99 |     debug('response headers: %j', response.headers);
100 |     const code = response.statusCode;
101 | 
102 |     const contentType = response.headers['content-type'] || '';
103 |     const responseBody = await httpx.read(response, 'utf8');
104 |     debug('response body: %s', responseBody);
105 | 
106 |     var body;
107 |     if (responseBody && (contentType.startsWith('text/xml') || contentType.startsWith('application/xml'))) {
108 |       const responseData = await parseXML(responseBody);
109 | 
110 |       if (responseData.Error) {
111 |         const e = responseData.Error;
112 |         const message = extract(e.Message);
113 |         const requestid = extract(e.RequestId);
114 |         const hostid = extract(e.HostId);
115 |         const err = new Error(`${method} ${url} failed with ${code}. ` +
116 |           `requestid: ${requestid}, hostid: ${hostid}, message: ${message}`);
117 |         err.name = 'mq-nodejs:' + extract(e.Code) + " " + err.name;
118 |         throw err;
119 |       }
120 | 
121 |       body = {};
122 |       Object.keys(responseData[type]).forEach((key) => {
123 |         if (key !== '$') {
124 |           body[key] = extract(responseData[type][key]);
125 |         }
126 |       });
127 |     }
128 | 
129 |     return {
130 |       code,
131 |       requestId: response.headers['x-mq-request-id'],
132 |       body: body
133 |     };
134 |   }
135 | 
136 |   /**
137 |    * 发送HTTP GET请求
138 |    *
139 |    * @param {string}  resource  HTTP请求URL的path
140 |    * @param {string}  type  解析XML响应内容的元素名字
141 |    * @param {object}  opts  额外请求的参数
142 |    *
143 |    * @returns {object}  
144 |    * <pre>
145 |    * {
146 |    *  code: 200,
147 |    *  requestId: "xxxxxxxxxxxxxx",
148 |    *  body: {A:1,B:2,C:3}
149 |    * }
150 |    * </pre>
151 |    */
152 |   get(resource, type, opts) {
153 |     return this.request('GET', resource, type, '', opts);
154 |   }
155 | 
156 |   /**
157 |    * 发送HTTP POST请求
158 |    *
159 |    * @param {string}  resource  HTTP请求URL的path
160 |    * @param {string}  type  解析XML响应内容的元素名字
161 |    * @param {string}  requestBody 请求的body
162 |    * @returns {object}  
163 |    * <pre>
164 |    * {
165 |    *  code: 200,
166 |    *  requestId: "xxxxxxxxxxxxxx",
167 |    *  body: {A:1,B:2,C:3}
168 |    * }
169 |    * </pre>
170 |    */
171 |   post(resource, type, body) {
172 |     return this.request('POST', resource, type, body);
173 |   }
174 | 
175 |   /**
176 |    * 发送HTTP DELETE请求
177 |    *
178 |    * @param {string}  resource  HTTP请求URL的path
179 |    * @param {string}  type  解析XML响应内容的元素名字
180 |    * @param {string}  requestBody 请求的body
181 |    * @returns {object}  
182 |    * <pre>
183 |    * {
184 |    *  code: 200,
185 |    *  requestId: "xxxxxxxxxxxxxx",
186 |    *  body: {A:1,B:2,C:3}
187 |    * }
188 |    * </pre>
189 |    */
190 |   delete(resource, type, body) {
191 |     return this.request('DELETE', resource, type, body);
192 |   }
193 | 
194 |   /**
195 |    * 对请求的内容按照MQ的HTTP协议签名,sha1+base64
196 |    * @param {string}  method  请求方法 
197 |    * @param {object}  headers 请求头
198 |    * @param {string}  resource  HTTP请求URL的path
199 |    *
200 |    * @returns {string} 签名
201 |    */
202 |   sign(method, headers, resource) {
203 |     const canonicalizedMQHeaders = getCanonicalizedMQHeaders(headers);
204 |     const md5 = headers['content-md5'] || '';
205 |     const date = headers['date'];
206 |     const type = headers['content-type'] || '';
207 | 
208 |     var toSignString = `${method}\n${md5}\n${type}\n${date}\n${canonicalizedMQHeaders}${resource}`;
209 |     var buff = Buffer.from(toSignString, 'utf8');
210 |     const degist = kitx.sha1(buff, this.accessKeySecret, 'binary');
211 |     return Buffer.from(degist, 'binary').toString('base64');
212 |   }
213 | 
214 |   /**
215 |    * 组装请求MQ需要的请求头
216 |    * @param {string}  method  请求方法
217 |    * @param {string}  body  请求内容
218 |    * @param {string}  resource  HTTP请求URL的path
219 |    *
220 |    * @returns {object} headers
221 |    */
222 |   buildHeaders(method, body, resource) {
223 |     const date = new Date().toGMTString();
224 | 
225 |     const headers = {
226 |       'date': date,
227 |       'x-mq-version': '2015-06-06',
228 |       'content-type': 'text/xml;charset=utf-8'
229 |     };
230 | 
231 |     if (method !== 'GET' && method !== 'HEAD') {
232 |       const digest = kitx.md5(body, 'hex');
233 |       const md5 = Buffer.from(digest, 'utf8').toString('base64');
234 |       Object.assign(headers, {
235 |         'content-length': body.length,
236 |         'content-md5': md5
237 |       });
238 |     }
239 | 
240 |     const signature = this.sign(method, headers, resource);
241 | 
242 |     headers['authorization'] = `MQ ${this.accessKeyId}:${signature}`;
243 | 
244 |     if (this.securityToken) {
245 |       headers['security-token'] = this.securityToken;
246 |     }
247 | 
248 |     return headers;
249 |   }
250 | 
251 |   /**
252 |    * 构造一个MQ的消费者
253 |    * @param {string}  topic 主题名字
254 |    * @param {string}  consumer  消费者名字
255 |    * @param {string}  messageTag  消费的过滤标签,可空
256 |    *
257 |    * @returns {MQConsumer}
258 |    */
259 |   getConsumer(topic, consumer, messageTag) {
260 |     return new MQConsumer(this, topic, consumer, messageTag);
261 |   }
262 | 
263 |   /**
264 |    * 构造一个MQ的生产者
265 |    * @param {string}  topic 主题名字
266 |    *
267 |    * @returns {MQProducer}
268 |    */
269 |   getProducer(topic) {
270 |     return new MQProducer(this, topic);
271 |   }
272 | }
273 | 
274 | /**
275 |  * MQ的消息生产者
276 |  */
277 | class MQProducer {
278 |   /**
279 |    * 构造函数
280 |    * @param {MQClient}  client  MQ的客户端
281 |    * @param {string}  topic 主题名字
282 |    *
283 |    * @returns {MQProducer}
284 |    */
285 |   constructor(client, topic) {
286 |     assert(client, '"client" must be passed in');
287 |     assert(topic, '"topic" must be passed in');
288 |     this.client = client;
289 |     this.topic = topic;
290 |     this.path = `/topics/${topic}/messages`;
291 |   }
292 | 
293 |   /**
294 |    * 向主题发送一条消息
295 |    * @param {string}  body  发送的内容
296 |    * @param {string}  tag   发送消息的标签
297 |    *
298 |    * @returns {object} 
299 |    * <pre>
300 |    * {
301 |    *  code: 201,
302 |    *  requestId: "xxxxxxxxxxxxxx",
303 |    *  body: {
304 |    *    MesasgeId: "",
305 |    *    MesasgeBodyMD5: ""
306 |    *  }
307 |    * }
308 |    * </pre>
309 |    * @throws {exception}
310 |    */
311 |   publishMessage(body, tag) {
312 |     var body;
313 |     if (tag) {
314 |       body = toXMLBuffer('Message', {MessageBody: body, MessageTag: tag});
315 |     } else {
316 |       body = toXMLBuffer('Message', {MessageBody: body});
317 |     }
318 |     var response = this.client.post(this.path, 'Message', body);
319 |     return response;
320 |   }
321 | 
322 | }
323 | 
324 | class MQConsumer {
325 |   constructor(client, topic, consumer, messageTag) {
326 |     assert(client, '"client" must be passed in');
327 |     assert(topic, '"topic" must be passed in');
328 |     assert(consumer, '"consumer" must be passed in');
329 |     this.client = client;
330 |     this.topic = topic;
331 |     this.consumer = consumer;
332 |     this.messageTag = messageTag;
333 |     if (messageTag) {
334 |       this.path = `/topics/${topic}/messages?consumer=${consumer}&tag=${messageTag}`;
335 |     } else {
336 |       this.path = `/topics/${topic}/messages?consumer=${consumer}`;
337 |     }
338 |     this.ackPath = `/topics/${topic}/messages?consumer=${consumer}`;
339 |   }
340 | 
341 |   async consumeMessage(numOfMessages, waitSeconds) {
342 |     var url = this.path + `&numOfMessages=${numOfMessages}`;
343 |     if (waitSeconds) {
344 |       url += `&waitseconds=${waitSeconds}`;
345 |     }
346 | 
347 |     const subType = 'Message';
348 |     var response = await this.client.get(url, 'Messages', {timeout: 33000});
349 |     response.body = response.body[subType];
350 |     return response;
351 |   }
352 | 
353 |   async ackMessage(receiptHandles) {
354 |     const body = toXMLBuffer('ReceiptHandles', receiptHandles, 'ReceiptHandle');
355 |     const response = await this.client.delete(this.ackPath, 'Errors', body);
356 |     // 3种情况,普通失败,部分失败,全部成功
357 |     if (response.body) {
358 |       const subType = 'Error';
359 |       // 部分失败
360 |       response.body = response.body[subType];
361 |     }
362 |     return response;
363 |   }
364 | 
365 | }
366 | 
367 | module.exports = {
368 |   MQClient,
369 |   MQConsumer,
370 |   MQProducer
371 | };
372 | 
373 |
374 |
375 | 376 | 377 | 378 | 379 |
380 | 381 | 384 | 385 |
386 | 387 |
388 | Documentation generated by JSDoc 3.5.5 on Wed Nov 14 2018 17:53:32 GMT+0800 (GMT+08:00) 389 |
390 | 391 | 392 | 393 | 394 | 395 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunmq/mq-http-nodejs-sdk/009cf9aa69a6ed858c1b35f39314e1484f993b50/docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Home 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Home

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

@aliyunmq/mq-nodejs-sdk 1.0.0

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 | 52 | 55 | 56 |
57 | 58 |
59 | Documentation generated by JSDoc 3.5.5 on Wed Nov 14 2018 17:53:32 GMT+0800 (GMT+08:00) 60 |
61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/scripts/prettify/Apache-License-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/scripts/prettify/prettify.js: -------------------------------------------------------------------------------- 1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; 2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= 3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), 9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, 10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, 11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, 12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), 13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} 14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], 18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], 19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], 20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ 21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), 22 | ["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", 23 | /^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), 24 | ["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", 25 | hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= 26 | !k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p th:last-child { border-right: 1px solid #ddd; } 224 | 225 | .ancestors, .attribs { color: #999; } 226 | .ancestors a, .attribs a 227 | { 228 | color: #999 !important; 229 | text-decoration: none; 230 | } 231 | 232 | .clear 233 | { 234 | clear: both; 235 | } 236 | 237 | .important 238 | { 239 | font-weight: bold; 240 | color: #950B02; 241 | } 242 | 243 | .yes-def { 244 | text-indent: -1000px; 245 | } 246 | 247 | .type-signature { 248 | color: #aaa; 249 | } 250 | 251 | .name, .signature { 252 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 253 | } 254 | 255 | .details { margin-top: 14px; border-left: 2px solid #DDD; } 256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } 257 | .details dd { margin-left: 70px; } 258 | .details ul { margin: 0; } 259 | .details ul { list-style-type: none; } 260 | .details li { margin-left: 30px; padding-top: 6px; } 261 | .details pre.prettyprint { margin: 0 } 262 | .details .object-value { padding-top: 0; } 263 | 264 | .description { 265 | margin-bottom: 1em; 266 | margin-top: 1em; 267 | } 268 | 269 | .code-caption 270 | { 271 | font-style: italic; 272 | font-size: 107%; 273 | margin: 0; 274 | } 275 | 276 | .prettyprint 277 | { 278 | border: 1px solid #ddd; 279 | width: 80%; 280 | overflow: auto; 281 | } 282 | 283 | .prettyprint.source { 284 | width: inherit; 285 | } 286 | 287 | .prettyprint code 288 | { 289 | font-size: 100%; 290 | line-height: 18px; 291 | display: block; 292 | padding: 4px 12px; 293 | margin: 0; 294 | background-color: #fff; 295 | color: #4D4E53; 296 | } 297 | 298 | .prettyprint code span.line 299 | { 300 | display: inline-block; 301 | } 302 | 303 | .prettyprint.linenums 304 | { 305 | padding-left: 70px; 306 | -webkit-user-select: none; 307 | -moz-user-select: none; 308 | -ms-user-select: none; 309 | user-select: none; 310 | } 311 | 312 | .prettyprint.linenums ol 313 | { 314 | padding-left: 0; 315 | } 316 | 317 | .prettyprint.linenums li 318 | { 319 | border-left: 3px #ddd solid; 320 | } 321 | 322 | .prettyprint.linenums li.selected, 323 | .prettyprint.linenums li.selected * 324 | { 325 | background-color: lightyellow; 326 | } 327 | 328 | .prettyprint.linenums li * 329 | { 330 | -webkit-user-select: text; 331 | -moz-user-select: text; 332 | -ms-user-select: text; 333 | user-select: text; 334 | } 335 | 336 | .params .name, .props .name, .name code { 337 | color: #4D4E53; 338 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 339 | font-size: 100%; 340 | } 341 | 342 | .params td.description > p:first-child, 343 | .props td.description > p:first-child 344 | { 345 | margin-top: 0; 346 | padding-top: 0; 347 | } 348 | 349 | .params td.description > p:last-child, 350 | .props td.description > p:last-child 351 | { 352 | margin-bottom: 0; 353 | padding-bottom: 0; 354 | } 355 | 356 | .disabled { 357 | color: #454545; 358 | } 359 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /docs/vi/@aliyunmq/mq-nodejs-sdk/1.0.0/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /es5/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const xml2js = require('xml2js'); 4 | 5 | exports.parseXML = function (input) { 6 | return new Promise((resolve, reject) => { 7 | xml2js.parseString(input, (err, obj) => { 8 | if (err) { 9 | return reject(err); 10 | } 11 | resolve(obj); 12 | }); 13 | }); 14 | }; 15 | 16 | exports.extract = function extract(arr) { 17 | if (arr && arr.length === 1 && typeof arr[0] === 'string') { 18 | return arr[0]; 19 | } 20 | 21 | arr.forEach(item => { 22 | Object.keys(item).forEach(key => { 23 | item[key] = extract(item[key]); 24 | }); 25 | }); 26 | 27 | return arr; 28 | }; 29 | 30 | function format(params) { 31 | if (typeof params === 'string') { 32 | return ``; 33 | } 34 | 35 | var xml = ''; 36 | Object.keys(params).forEach(key => { 37 | const value = params[key]; 38 | if (typeof value === 'object') { 39 | xml += `<${key}>${format(value)}`; 40 | } else { 41 | xml += `<${key}>`; 42 | } 43 | }); 44 | return xml; 45 | } 46 | 47 | exports.toXMLBuffer = function (entityType, params, subType) { 48 | var xml = ''; 49 | xml += `<${entityType} xmlns="http://mq.aliyuncs.com/doc/v1/">`; 50 | if (Array.isArray(params)) { 51 | params.forEach(item => { 52 | xml += `<${subType}>`; 53 | xml += format(item); 54 | xml += ``; 55 | }); 56 | } else { 57 | xml += format(params); 58 | } 59 | xml += ``; 60 | return Buffer.from(xml, 'utf8'); 61 | }; 62 | 63 | exports.getCanonicalizedMQHeaders = function (headers) { 64 | return Object.keys(headers).filter(key => key.startsWith('x-mq-')).sort().map(key => `${key}:${headers[key]}\n`).join(''); 65 | }; 66 | 67 | exports.processMsgProperties = function (msg) { 68 | var props = {}; 69 | if (msg.Properties) { 70 | var props = {}; 71 | var kvArray = msg.Properties.split('|'); 72 | for (var i = 0; i < kvArray.length; i++) { 73 | if (kvArray[i] == '') { 74 | continue; 75 | } 76 | var kAndV = kvArray[i].split(':'); 77 | if (kAndV.length != 2 || kAndV[0] == '' || kAndV[1] == '') { 78 | continue; 79 | } 80 | props[kAndV[0]] = kAndV[1]; 81 | } 82 | if (props['KEYS']) { 83 | msg.MessageKey = props['KEYS']; 84 | delete props['KEYS']; 85 | } 86 | if (props['__STARTDELIVERTIME']) { 87 | msg.StartDeliverTime = parseInt(props['__STARTDELIVERTIME']); 88 | delete props['__STARTDELIVERTIME']; 89 | } 90 | if (props['__TransCheckT']) { 91 | msg.StartDeliverTime = parseInt(props['__TransCheckT']); 92 | delete props['__TransCheckT']; 93 | } 94 | if (props['__SHARDINGKEY']) { 95 | msg.ShardingKey = props['__SHARDINGKEY']; 96 | delete props['__SHARDINGKEY']; 97 | } 98 | } 99 | msg.Properties = props; 100 | }; -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | function supportAsyncFunctions() { 3 | try { 4 | new Function('(async function () {})()'); 5 | return true; 6 | } catch (ex) { 7 | return false; 8 | } 9 | } 10 | module.exports = supportAsyncFunctions() ? 11 | require('./lib/client.js') : require('./es5/client.js'); 12 | -------------------------------------------------------------------------------- /jsdoc-conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": true 4 | }, 5 | "plugins": ["plugins/markdown"], 6 | "templates": { 7 | //"logoFile": "", 8 | "cleverLinks": false, 9 | "monospaceLinks": false, 10 | "dateFormat": "ddd MMM Do YYYY", 11 | "outputSourceFiles": true, 12 | "outputSourcePath": true, 13 | "systemName": "MQ Nodejs HTTP SDK Documents", 14 | //"footer": "", 15 | "copyright": "MIT", 16 | "navType": "vertical", 17 | "theme": "cosmo", 18 | "linenums": true, 19 | "collapseSymbols": false, 20 | "inverseNav": true, 21 | "protocol": "html://", 22 | "methodHeadingReturns": false 23 | }, 24 | "markdown": { 25 | "parser": "gfm", 26 | "hardwrap": true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const xml2js = require('xml2js'); 4 | 5 | exports.parseXML = function (input) { 6 | return new Promise((resolve, reject) => { 7 | xml2js.parseString(input, (err, obj) => { 8 | if (err) { 9 | return reject(err); 10 | } 11 | resolve(obj); 12 | }); 13 | }); 14 | }; 15 | 16 | exports.extract = function extract (arr) { 17 | if (arr && arr.length === 1 && typeof arr[0] === 'string') { 18 | return arr[0]; 19 | } 20 | 21 | arr.forEach((item) => { 22 | Object.keys(item).forEach((key) => { 23 | item[key] = extract(item[key]); 24 | }); 25 | }); 26 | 27 | return arr; 28 | }; 29 | 30 | function format (params) { 31 | if (typeof params === 'string') { 32 | return ``; 33 | } 34 | 35 | var xml = ''; 36 | Object.keys(params).forEach((key) => { 37 | const value = params[key]; 38 | if (typeof value === 'object') { 39 | xml += `<${key}>${format(value)}`; 40 | } else { 41 | xml += `<${key}>`; 42 | } 43 | }); 44 | return xml; 45 | } 46 | 47 | exports.toXMLBuffer = function (entityType, params, subType) { 48 | var xml = ''; 49 | xml += `<${entityType} xmlns="http://mq.aliyuncs.com/doc/v1/">`; 50 | if (Array.isArray(params)) { 51 | params.forEach((item) => { 52 | xml += `<${subType}>`; 53 | xml += format(item); 54 | xml += ``; 55 | }); 56 | } else { 57 | xml += format(params); 58 | } 59 | xml += ``; 60 | return Buffer.from(xml, 'utf8'); 61 | }; 62 | 63 | exports.getCanonicalizedMQHeaders = function (headers) { 64 | return Object.keys(headers) 65 | .filter((key) => key.startsWith('x-mq-')) 66 | .sort() 67 | .map((key) => `${key}:${headers[key]}\n`) 68 | .join(''); 69 | }; 70 | 71 | exports.processMsgProperties = function (msg) { 72 | var props = {}; 73 | if (msg.Properties) { 74 | var props = {}; 75 | var kvArray = msg.Properties.split('|'); 76 | for (var i=0; i < kvArray.length; i++) { 77 | if (kvArray[i] == '') { 78 | continue; 79 | } 80 | var kAndV = kvArray[i].split(':'); 81 | if (kAndV.length != 2 || kAndV[0] == '' || kAndV[1] == '') { 82 | continue; 83 | } 84 | props[kAndV[0]] = kAndV[1]; 85 | } 86 | if (props['KEYS']) { 87 | msg.MessageKey = props['KEYS']; 88 | delete props['KEYS']; 89 | } 90 | if (props['__STARTDELIVERTIME']) { 91 | msg.StartDeliverTime = parseInt(props['__STARTDELIVERTIME']); 92 | delete props['__STARTDELIVERTIME']; 93 | } 94 | if (props['__TransCheckT']) { 95 | msg.StartDeliverTime = parseInt(props['__TransCheckT']); 96 | delete props['__TransCheckT']; 97 | } 98 | if (props['__SHARDINGKEY']) { 99 | msg.ShardingKey = props['__SHARDINGKEY']; 100 | delete props['__SHARDINGKEY']; 101 | } 102 | } 103 | msg.Properties = props; 104 | }; 105 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@aliyunmq/mq-http-sdk", 3 | "version": "1.0.4", 4 | "description": "Aliyun Message Queue(MQ) Nodejs Http SDK", 5 | "main": "index.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/aliyunmq/mq-http-nodejs-sdk" 12 | }, 13 | "scripts": { 14 | "test": "mocha -t 20000 -R spec test/*.test.js", 15 | "lint": "eslint --fix lib index.js test", 16 | "build-es5": "babel lib/ -d es5/", 17 | "docs": "jsdoc -c jsdoc-conf.json -R README.md -t ./node_modules/ink-docstrap/template lib/* -d docs/" 18 | }, 19 | "author": "aliyunmq", 20 | "license": "MIT", 21 | "dependencies": { 22 | "debug": "^2.6.3", 23 | "httpx": "^2.1.1", 24 | "kitx": "^1.2.0", 25 | "xml2js": "^0.4.17" 26 | }, 27 | "files": [ 28 | "lib", 29 | "es5", 30 | "index.js" 31 | ], 32 | "devDependencies": { 33 | "babel-cli": "^6.26.0", 34 | "babel-plugin-transform-runtime": "^6.23.0", 35 | "babel-preset-env": "^1.7.0", 36 | "babel-register": "^6.24.1", 37 | "eslint": "^5.8.0", 38 | "expect.js": "^0.3.1", 39 | "mocha": "^5.2.0", 40 | "nyc": "^13.1.0", 41 | "jsdoc": "^3.5.2", 42 | "ink-docstrap": "^1.3.2" 43 | }, 44 | "keywords": [ 45 | "MQ", 46 | "Message Queue", 47 | "Aliyun", 48 | "Alicloud" 49 | ], 50 | "bugs": { 51 | "url": "https://github.com/aliyunmq/mq-http-nodejs-sdk/issues" 52 | }, 53 | "homepage": "https://www.aliyun.com/product/ons" 54 | } 55 | -------------------------------------------------------------------------------- /test/client.test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const expect = require('expect.js'); 4 | 5 | const { 6 | MQClient, 7 | MessageProperties 8 | } = require('../'); 9 | 10 | const ENDPOINT = process.env.ENDPOINT || 'endpoint'; 11 | const ACCESS_KEY_ID = process.env.ACCESS_KEY_ID || 'accessKeyId'; 12 | const ACCESS_KEY_SECRET = process.env.ACCESS_KEY_SECRET || 'accessKeySecret'; 13 | 14 | console.log('%s %s %s', ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET); 15 | 16 | describe('mq client test', function () { 17 | it('constructor', function () { 18 | expect(() => { 19 | new MQClient(); 20 | }).to.throwException(/"endpoint" must be passed in/); 21 | 22 | expect(() => { 23 | new MQClient('endpoint'); 24 | }).to.throwException(/must pass in "accessKeyId"/); 25 | 26 | expect(() => { 27 | new MQClient('endpoint', 'accessKeyId'); 28 | }).to.throwException(/must pass in "accessKeySecret"/); 29 | }); 30 | 31 | 32 | it('sign', function() { 33 | const client = new MQClient('endpoint', 'ACCESS_KEY_ID', 'ACCESS_KEY_SECRET'); 34 | var sign = client.sign('PUT', { 35 | 'content-md5': '574683b3684e3cff610afa155cc2506d', 36 | 'date': 'Tue, 11 Apr 2017 10:09:19 GMT', 37 | 'content-type': 'text/xml', 38 | 'x-mq-version': '2015-06-06' 39 | }, '/'); 40 | expect(sign).to.be('G7NRBqmP9XfhTJ/pV3AgYQtXaaU='); 41 | }); 42 | 43 | describe('API should ok', function () { 44 | const groupId = 'GID-xigu-abc2'; 45 | const topicName = 'xigu-abc2'; 46 | const instanceId = 'MQ_INST_1973281269661160_Ba2DmovE'; 47 | 48 | const client = new MQClient(ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET); 49 | const producer = client.getProducer(instanceId, topicName); 50 | const transProducer = client.getTransProducer(instanceId, topicName, groupId); 51 | const consumer = client.getConsumer(instanceId, topicName, groupId); 52 | 53 | it('message property invalid, key contains \'', function() { 54 | var msgProps = new MessageProperties(); 55 | expect(() => { 56 | msgProps.putProperty("abc\'", "123"); 57 | }).to.throwException(); 58 | }); 59 | 60 | it('message property invalid, key contains \"', function() { 61 | var msgProps = new MessageProperties(); 62 | expect(() => { 63 | msgProps.putProperty("abc\"", "123"); 64 | }).to.throwException(); 65 | }); 66 | 67 | it('message property invalid, key contains <', function() { 68 | var msgProps = new MessageProperties(); 69 | expect(() => { 70 | msgProps.putProperty("abc<", "123"); 71 | }).to.throwException(); 72 | }); 73 | 74 | it('message property invalid, value contains <', function() { 75 | var msgProps = new MessageProperties(); 76 | expect(() => { 77 | msgProps.putProperty("abc", "123<"); 78 | }).to.throwException(); 79 | }); 80 | 81 | it('message property invalid, value contains \'', function() { 82 | var msgProps = new MessageProperties(); 83 | expect(() => { 84 | msgProps.putProperty("abc", "123'"); 85 | }).to.throwException(); 86 | }); 87 | it('message property invalid, value contains "', function() { 88 | var msgProps = new MessageProperties(); 89 | expect(() => { 90 | msgProps.putProperty("abc", "123\""); 91 | }).to.throwException(); 92 | }); 93 | 94 | it('publishMessage should ok', async function() { 95 | const response = await producer.publishMessage('test message'); 96 | expect(response).to.be.ok(); 97 | expect(response.code).to.be(201); 98 | const message = response.body; 99 | expect(message).to.have.property('MessageId'); 100 | expect(message).to.have.property('MessageBodyMD5'); 101 | }); 102 | 103 | it('publishMessage should ok', async function() { 104 | const response = await producer.publishMessage('test message'); 105 | expect(response).to.be.ok(); 106 | expect(response.code).to.be(201); 107 | const message = response.body; 108 | expect(message).to.have.property('MessageId'); 109 | expect(message).to.have.property('MessageBodyMD5'); 110 | }); 111 | 112 | it('publishMessage with properties should ok', async function() { 113 | var msgProperties = new MessageProperties(); 114 | msgProperties.putProperty("nodejs", "true"); 115 | msgProperties.messageKey("I_AM_Message_KEY"); 116 | const response = await producer.publishMessage('test message, properties', '', msgProperties); 117 | expect(response).to.be.ok(); 118 | expect(response.code).to.be(201); 119 | const message = response.body; 120 | expect(message).to.have.property('MessageId'); 121 | expect(message).to.have.property('MessageBodyMD5'); 122 | }); 123 | 124 | it('publishMessage timer should ok', async function() { 125 | var msgProperties = new MessageProperties(); 126 | msgProperties.putProperty("nodejs", "true"); 127 | msgProperties.startDeliverTime(Date.now() + 10 * 1000); 128 | const response = await producer.publishMessage('test message, timer+properties', '', msgProperties); 129 | expect(response).to.be.ok(); 130 | expect(response.code).to.be(201); 131 | const message = response.body; 132 | expect(message).to.have.property('MessageId'); 133 | expect(message).to.have.property('MessageBodyMD5'); 134 | }); 135 | 136 | it('consumeMessage&ackMessage shoule ok', async function() { 137 | const recived = await consumer.consumeMessage(2, 3); 138 | expect(recived).to.be.ok(); 139 | expect(recived.code).to.be(200); 140 | const receiptHandles = recived.body.map((item) => { 141 | expect(item).to.have.property('MessageId'); 142 | expect(item).to.have.property('MessageBodyMD5'); 143 | expect(item).to.have.property('MessageBody'); 144 | expect(item).to.have.property('ReceiptHandle'); 145 | expect(item).to.have.property('PublishTime'); 146 | expect(item).to.have.property('FirstConsumeTime'); 147 | expect(item).to.have.property('NextConsumeTime'); 148 | expect(item).to.have.property('ConsumedTimes'); 149 | return item.ReceiptHandle; 150 | }); 151 | const res = await consumer.ackMessage(receiptHandles); 152 | expect(res).to.be.ok(); 153 | expect(res.code).to.be(204); 154 | }); 155 | 156 | it('ackMessage handle is illegal should ok', async function() { 157 | const handles = ['adfadfadfadf', 'xxxxx']; 158 | const res = await consumer.ackMessage(handles); 159 | expect(res).to.be.ok(); 160 | expect(res.code).to.be(404); 161 | res.body.map((item) => { 162 | expect(item).to.have.property('ErrorCode'); 163 | expect(item).to.have.property('ErrorMessage'); 164 | expect(item).to.have.property('ReceiptHandle'); 165 | expect(item.ErrorCode).to.be('ReceiptHandleError'); 166 | }); 167 | }); 168 | 169 | it('publish transaction msg & commit it', async function() { 170 | var msgProperties = new MessageProperties(); 171 | msgProperties.putProperty("nodejs", "true"); 172 | msgProperties.transCheckImmunityTime(10); 173 | const response = await transProducer.publishMessage('test message, transaction+properties', '', msgProperties); 174 | expect(response).to.be.ok(); 175 | expect(response.code).to.be(201); 176 | const message = response.body; 177 | expect(message).to.have.property('MessageId'); 178 | expect(message).to.have.property('MessageBodyMD5'); 179 | expect(message).to.have.property('ReceiptHandle'); 180 | const ackresp = await transProducer.commit(message.ReceiptHandle); 181 | expect(ackresp.code).to.be(204); 182 | }); 183 | 184 | it('publishMessage with & should ok', async function() { 185 | var msgProperties = new MessageProperties(); 186 | const response = await producer.publishMessage('test message with &', '', msgProperties); 187 | expect(response).to.be.ok(); 188 | expect(response.code).to.be(201); 189 | const message = response.body; 190 | expect(message).to.have.property('MessageId'); 191 | expect(message).to.have.property('MessageBodyMD5'); 192 | }); 193 | }); 194 | }); 195 | --------------------------------------------------------------------------------