New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clhs-api/core

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clhs-api/core - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

dist/newsContentQuery/types.d.ts

30

dist/core.cjs.development.js

@@ -921,4 +921,8 @@ 'use strict';

var newsContentQuery = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id, cb) {
function newsContentQuery(_x, _x2) {
return _newsContentQuery.apply(this, arguments);
}
function _newsContentQuery() {
_newsContentQuery = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id, cb) {
var uid, _yield$axios$get, _yield$axios$get$data, data, _, errMsg, content;

@@ -997,8 +1001,5 @@

}));
return _newsContentQuery.apply(this, arguments);
}
return function newsContentQuery(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
var flockParser = function flockParser(_attr, _unit) {

@@ -1034,4 +1035,8 @@ var attr = _attr ? Options.ATTR[_attr] : null;

var newsListQuery = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(queryInput, cb) {
function newsListQuery(_x, _x2) {
return _newsListQuery.apply(this, arguments);
}
function _newsListQuery() {
_newsListQuery = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(queryInput, cb) {
var params, _yield$axios$post, queryResult, errMsg, queryMeta, newsList, result;

@@ -1089,8 +1094,5 @@

}));
return _newsListQuery.apply(this, arguments);
}
return function newsListQuery(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
exports.Options = Options;

@@ -1097,0 +1099,0 @@ exports.newsContentQuery = newsContentQuery;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=(t=require("axios"))&&"object"==typeof t&&"default"in t?t.default:t,r=require("url");function n(t,e,r,n,i,o,a){try{var u=t[o](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,i)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function u(t){n(a,i,o,u,c,"next",t)}function c(t){n(a,i,o,u,c,"throw",t)}u(void 0)}))}}function o(t,e){return t(e={exports:{}},e.exports),e.exports}var a=o((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=Object.create((e&&e.prototype instanceof h?e:h).prototype),o=new L(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=m(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,o),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function l(){}function d(){}var p={};u(p,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(E([])));v&&v!==e&&r.call(v,i)&&(p=v);var y=d.prototype=h.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){var n;this._invoke=function(i,o){function a(){return new e((function(n,a){!function n(i,o,a,u){var c=s(t[i],t,o);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(h).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function m(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,m(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function E(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}return l.prototype=d,u(y,"constructor",d),u(d,"constructor",l),l.displayName=u(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,a,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},w(g.prototype),u(g.prototype,o,(function(){return this})),t.AsyncIterator=g,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new g(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(y),u(y,a,"Generator"),u(y,i,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),u=function(t,e){return e?"https://www.clhs.tyc.edu.tw/ischool/widget/site_news/news_query_json_content.php?nid="+t+"&dir=0&uid="+e:"https://www.clhs.tyc.edu.tw/ischool/public/news_view/show.php?nid="+t},c={UID:{"首頁":"WID_549_2_3e2e399a2649fb6ba9918090490f4741fd4453bf","升學資訊":"WID_549_2_13cfc702096566ef38571aebe89498c49f56f236","法令公告":"WID_549_2_09b16f4944d742185cf599bb45ca292da6547c9e","校內競賽":"WID_549_2_c0df1de1135dbf425a0f988515224a49c98ad257","校外競賽":"WID_549_2_5d8f79c34d01e52061f469da52357fe253c45db9","新生專區":"WID_284_2_74ade31d9f46e4440ca9b60301b5f651004cec49","衛生保健":"WID_549_2_5cd5617d2dd2bc130e7f76c333f2d442dffd0681","營隊研習":"WID_549_2_0470a8e2b5755791156cb8f5d9af5e1b81db7168","壢中新聞":"WID_549_29_6b87c0e5ed0f8ecb2694390de5e69cc1d48ef84"},ATTR:{"全部":"","公告":"attr_1","通知":"attr_2","最新消息":"attr_3","緊急":"attr_4","校內競賽":"attr_5","校外競賽":"attr_6","獎助學金":"attr_7","榮譽榜":"attr_8","":"attr_9","研習營隊":"attr_10","衛生保健":"attr_11","升學資訊":"attr_12","法令公告":"attr_13"},UNIT:{"設備組官網":"unit_27","資訊媒體組":"unit_29","活動組官網":"unit_31","主計室官網":"unit_32","教學組官網":"unit_33","註冊組官網":"unit_34","試務組官網":"unit_35","訓育組官網":"unit_38","文書組":"unit_41","出納組":"unit_42","庶務組官網":"unit_43","人事室官網":"unit_44","教務處官網":"unit_50","學務處官網":"unit_53","學務處官網_duplicated1":"unit_54","舊輔導室官網":"unit_55","學務處官網_duplicated2":"unit_56","特教組官網":"unit_57","衛生組官網":"unit_61","生輔組官網":"unit_62","秘書室官網":"unit_63","中壢中學校友會":"unit_64","學務處官網_duplicated3":"unit_65","學務處官網_duplicated4":"unit_66","學務處官網_duplicated5":"unit_67","學務處官網_duplicated6":"unit_68","總務處官網":"unit_69","總務處官網_duplicated_1":"unit_70","總務處官網_duplicated_2":"unit_71","健康中心官網":"unit_75","家長會官網":"unit_79","教師甄選":"unit_91","輔導室官網":"unit_104","生輔組-防制學生藥物濫用":"unit_117","總務處官網_duplicated":"unit_137","十二年國教":"unit_140","翻轉與突破優質化計畫":"unit_153","校園食品安全專區":"unit_154","學習中心":"unit_155","新生專區":"unit_156","圖書館官網":"unit_399","壢崗文教基金會":"unit_403","athletic meet":"unit_405","自主學習":"unit_409","108選課輔導手冊":"unit_413","108年專業群科評鑑":"unit_414","110教師甄試網站":"unit_422","教師甄選成績查詢":"unit_423","109選課輔導手冊":"unit_424","中大壢中新首頁":"unit_425","數理資優班":"unit_430"}},s=function(){var t=i(a.mark((function t(r){var n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.get(u(r));case 2:if("Invalid nid!"!==(n=t.sent.data)){t.next=6;break}throw r+" is an invalid news id.";case 6:if(i=n.match(/var g_news_unique_id = "(\w+)"/)){t.next=9;break}throw"cannot find an uid for news id:"+r;case 9:return t.abrupt("return",i[1]);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),f=function(){var t=i(a.mark((function t(r,n){var i,o,c,f,h;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,s(r);case 3:i=t.sent,t.next=11;break;case 6:if(t.prev=6,t.t0=t.catch(0),!n){t.next=10;break}return t.abrupt("return",n({},t.t0));case 10:throw t.t0;case 11:return t.next=13,e.get(u(r,i));case 13:if(c=(o=t.sent.data)[0],o.slice(1),c){t.next=22;break}if(f="there's no data in the response object.",!n){t.next=21;break}return t.abrupt("return",n({},f));case 21:throw f;case 22:h=c.content;try{c.content=h?decodeURIComponent(h):h}catch(t){}return t.abrupt("return",n?n(c):c);case 25:case"end":return t.stop()}}),t,null,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}(),h=function(t){var e,r,n,i,o=t.where;return{auth_type:"user",field:"time",flock:(e=t.attr,r=t.unit,n=e?c.ATTR[e]:null,i=r?c.UNIT[r]:null,(i||"")+(i&&n?"-":"")+(n||"")||null),keyword:t.keyword||"",maxRows:t.itemsPerPage||20,order:t.orderBy||"DESC",pageNum:t.page||0,tf:1,uid:o?c.UID[o]:c.UID.首頁,use_cache:t.useCache?1:0}},l=function(){var t=i(a.mark((function t(n,i){var o,u,c,s,f,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h(n||{}),t.next=3,e.post("https://www.clhs.tyc.edu.tw/ischool/widget/site_news/news_query_json.php",new r.URLSearchParams(o).toString(),{headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"}});case 3:if("string"!=typeof(u=t.sent.data)){t.next=10;break}if(c="error from clhs api(might be wrong input type). error message: "+u,!i){t.next=9;break}return t.abrupt("return",i({},c));case 9:throw c;case 10:return s=u[0],f=u.slice(1),s.params=o,l={queryMeta:s,newsList:f},t.abrupt("return",i?i(l):l);case 14:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}();exports.Options=c,exports.newsContentQuery=f,exports.newsListQuery=l;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=(t=require("axios"))&&"object"==typeof t&&"default"in t?t.default:t,r=require("url");function n(t,e,r,n,i,o,a){try{var u=t[o](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,i)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function u(t){n(a,i,o,u,c,"next",t)}function c(t){n(a,i,o,u,c,"throw",t)}u(void 0)}))}}function o(t,e){return t(e={exports:{}},e.exports),e.exports}var a=o((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=Object.create((e&&e.prototype instanceof h?e:h).prototype),o=new L(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=m(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,o),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function l(){}function p(){}var d={};u(d,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(E([])));v&&v!==e&&r.call(v,i)&&(d=v);var y=p.prototype=h.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){var n;this._invoke=function(i,o){function a(){return new e((function(n,a){!function n(i,o,a,u){var c=s(t[i],t,o);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(h).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function m(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,m(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function E(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}return l.prototype=p,u(y,"constructor",p),u(p,"constructor",l),l.displayName=u(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,a,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},w(g.prototype),u(g.prototype,o,(function(){return this})),t.AsyncIterator=g,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new g(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(y),u(y,a,"Generator"),u(y,i,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),u="https://www.clhs.tyc.edu.tw/ischool/widget/site_news/news_query_json.php",c=function(t,e){return e?"https://www.clhs.tyc.edu.tw/ischool/widget/site_news/news_query_json_content.php?nid="+t+"&dir=0&uid="+e:"https://www.clhs.tyc.edu.tw/ischool/public/news_view/show.php?nid="+t},s={UID:{"首頁":"WID_549_2_3e2e399a2649fb6ba9918090490f4741fd4453bf","升學資訊":"WID_549_2_13cfc702096566ef38571aebe89498c49f56f236","法令公告":"WID_549_2_09b16f4944d742185cf599bb45ca292da6547c9e","校內競賽":"WID_549_2_c0df1de1135dbf425a0f988515224a49c98ad257","校外競賽":"WID_549_2_5d8f79c34d01e52061f469da52357fe253c45db9","新生專區":"WID_284_2_74ade31d9f46e4440ca9b60301b5f651004cec49","衛生保健":"WID_549_2_5cd5617d2dd2bc130e7f76c333f2d442dffd0681","營隊研習":"WID_549_2_0470a8e2b5755791156cb8f5d9af5e1b81db7168","壢中新聞":"WID_549_29_6b87c0e5ed0f8ecb2694390de5e69cc1d48ef84"},ATTR:{"全部":"","公告":"attr_1","通知":"attr_2","最新消息":"attr_3","緊急":"attr_4","校內競賽":"attr_5","校外競賽":"attr_6","獎助學金":"attr_7","榮譽榜":"attr_8","":"attr_9","研習營隊":"attr_10","衛生保健":"attr_11","升學資訊":"attr_12","法令公告":"attr_13"},UNIT:{"設備組官網":"unit_27","資訊媒體組":"unit_29","活動組官網":"unit_31","主計室官網":"unit_32","教學組官網":"unit_33","註冊組官網":"unit_34","試務組官網":"unit_35","訓育組官網":"unit_38","文書組":"unit_41","出納組":"unit_42","庶務組官網":"unit_43","人事室官網":"unit_44","教務處官網":"unit_50","學務處官網":"unit_53","學務處官網_duplicated1":"unit_54","舊輔導室官網":"unit_55","學務處官網_duplicated2":"unit_56","特教組官網":"unit_57","衛生組官網":"unit_61","生輔組官網":"unit_62","秘書室官網":"unit_63","中壢中學校友會":"unit_64","學務處官網_duplicated3":"unit_65","學務處官網_duplicated4":"unit_66","學務處官網_duplicated5":"unit_67","學務處官網_duplicated6":"unit_68","總務處官網":"unit_69","總務處官網_duplicated_1":"unit_70","總務處官網_duplicated_2":"unit_71","健康中心官網":"unit_75","家長會官網":"unit_79","教師甄選":"unit_91","輔導室官網":"unit_104","生輔組-防制學生藥物濫用":"unit_117","總務處官網_duplicated":"unit_137","十二年國教":"unit_140","翻轉與突破優質化計畫":"unit_153","校園食品安全專區":"unit_154","學習中心":"unit_155","新生專區":"unit_156","圖書館官網":"unit_399","壢崗文教基金會":"unit_403","athletic meet":"unit_405","自主學習":"unit_409","108選課輔導手冊":"unit_413","108年專業群科評鑑":"unit_414","110教師甄試網站":"unit_422","教師甄選成績查詢":"unit_423","109選課輔導手冊":"unit_424","中大壢中新首頁":"unit_425","數理資優班":"unit_430"}},f=function(){var t=i(a.mark((function t(r){var n,i;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.get(c(r));case 2:if("Invalid nid!"!==(n=t.sent.data)){t.next=6;break}throw r+" is an invalid news id.";case 6:if(i=n.match(/var g_news_unique_id = "(\w+)"/)){t.next=9;break}throw"cannot find an uid for news id:"+r;case 9:return t.abrupt("return",i[1]);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();function h(){return(h=i(a.mark((function t(r,n){var i,o,u,s,h;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,f(r);case 3:i=t.sent,t.next=11;break;case 6:if(t.prev=6,t.t0=t.catch(0),!n){t.next=10;break}return t.abrupt("return",n({},t.t0));case 10:throw t.t0;case 11:return t.next=13,e.get(c(r,i));case 13:if(u=(o=t.sent.data)[0],o.slice(1),u){t.next=22;break}if(s="there's no data in the response object.",!n){t.next=21;break}return t.abrupt("return",n({},s));case 21:throw s;case 22:h=u.content;try{u.content=h?decodeURIComponent(h):h}catch(t){}return t.abrupt("return",n?n(u):u);case 25:case"end":return t.stop()}}),t,null,[[0,6]])})))).apply(this,arguments)}var l=function(t){var e,r,n,i,o=t.where;return{auth_type:"user",field:"time",flock:(e=t.attr,r=t.unit,n=e?s.ATTR[e]:null,i=r?s.UNIT[r]:null,(i||"")+(i&&n?"-":"")+(n||"")||null),keyword:t.keyword||"",maxRows:t.itemsPerPage||20,order:t.orderBy||"DESC",pageNum:t.page||0,tf:1,uid:o?s.UID[o]:s.UID.首頁,use_cache:t.useCache?1:0}};function p(){return(p=i(a.mark((function t(n,i){var o,c,s,f,h,p;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l(n||{}),t.next=3,e.post(u,new r.URLSearchParams(o).toString(),{headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8"}});case 3:if("string"!=typeof(c=t.sent.data)){t.next=10;break}if(s="error from clhs api(might be wrong input type). error message: "+c,!i){t.next=9;break}return t.abrupt("return",i({},s));case 9:throw s;case 10:return f=c[0],h=c.slice(1),f.params=o,p={queryMeta:f,newsList:h},t.abrupt("return",i?i(p):p);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}exports.Options=s,exports.newsContentQuery=function(t,e){return h.apply(this,arguments)},exports.newsListQuery=function(t,e){return p.apply(this,arguments)};
//# sourceMappingURL=core.cjs.production.min.js.map

@@ -915,4 +915,8 @@ import axios from 'axios';

var newsContentQuery = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id, cb) {
function newsContentQuery(_x, _x2) {
return _newsContentQuery.apply(this, arguments);
}
function _newsContentQuery() {
_newsContentQuery = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id, cb) {
var uid, _yield$axios$get, _yield$axios$get$data, data, _, errMsg, content;

@@ -991,8 +995,5 @@

}));
return _newsContentQuery.apply(this, arguments);
}
return function newsContentQuery(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
var flockParser = function flockParser(_attr, _unit) {

@@ -1028,4 +1029,8 @@ var attr = _attr ? Options.ATTR[_attr] : null;

var newsListQuery = /*#__PURE__*/function () {
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(queryInput, cb) {
function newsListQuery(_x, _x2) {
return _newsListQuery.apply(this, arguments);
}
function _newsListQuery() {
_newsListQuery = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(queryInput, cb) {
var params, _yield$axios$post, queryResult, errMsg, queryMeta, newsList, result;

@@ -1083,9 +1088,6 @@

}));
return _newsListQuery.apply(this, arguments);
}
return function newsListQuery(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
export { Options, newsContentQuery, newsListQuery };
//# sourceMappingURL=core.esm.js.map
import { NewsContent } from "../types";
export declare const newsContentQuery: (id: string, cb?: ((data: NewsContent, error?: string | undefined) => void) | undefined) => Promise<void | NewsContent>;
import { NewsContentQueryCB } from "./types";
/**
* 取得指定`id`的新聞內容
*/
export declare function newsContentQuery(id: string): Promise<NewsContent>;
export declare function newsContentQuery(id: string, cb: NewsContentQueryCB): Promise<void>;

@@ -1,9 +0,7 @@

import { News } from "../types";
import { QueryInput, QueryResultMeta } from "./types";
export declare const newsListQuery: (queryInput: QueryInput, cb?: ((data: {
queryMeta: QueryResultMeta;
newsList: News[];
}, error?: string | undefined) => void) | undefined) => Promise<void | {
queryMeta: QueryResultMeta;
newsList: News[];
}>;
import { NewsListQueryCB, NewsListQueryResult, QueryInput } from "./types";
/**
* 取得新聞列表
* @param queryInput 預設為`首頁`的前`20`則新聞
*/
export declare function newsListQuery(queryInput?: QueryInput): Promise<NewsListQueryResult>;
export declare function newsListQuery(queryInput: QueryInput, cb: NewsListQueryCB): Promise<void>;

@@ -31,1 +31,9 @@ import { ATTR_Name, News, UID_Id, UID_Name, UNIT_Name } from "../types";

};
export declare type NewsListQueryResult = {
queryMeta: QueryResultMeta;
newsList: News[];
};
export declare type NewsListQueryCB = (data: {
queryMeta: QueryResultMeta;
newsList: News[];
}, error?: string) => void;

@@ -10,3 +10,3 @@ {

"typings": "dist/index.d.ts",
"version": "0.0.7",
"version": "0.0.8",
"bugs": {

@@ -13,0 +13,0 @@ "url": "https://github.com/BWsix/CLHS-api.git/issues"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc