@uidev1116/acms-js-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ui
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.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # acms-js-sdk
2
+
3
+ a-blog cms JavaScript SDK
@@ -0,0 +1,5 @@
1
+ "use strict";var K=Object.defineProperty;var Y=(f,r,o)=>r in f?K(f,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):f[r]=o;var P=(f,r,o)=>(Y(f,typeof r!="symbol"?r+"":r,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./acms-path.cjs"),U=require("../typeGuard-eqTQ9U-x.cjs"),j=require("../index-x-5Zn68j.cjs");async function J(f){try{const{message:r}=await f.json();return r??null}catch{return null}}var I=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Q(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var F={exports:{}};(function(f,r){var o=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof I<"u"&&I,p=function(){function m(){this.fetch=!1,this.DOMException=o.DOMException}return m.prototype=o,new m}();(function(m){(function(l){var a=typeof m<"u"&&m||typeof self<"u"&&self||typeof a<"u"&&a,h={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function v(e){return e&&DataView.prototype.isPrototypeOf(e)}if(h.arrayBuffer)var T=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],O=ArrayBuffer.isView||function(e){return e&&T.indexOf(Object.prototype.toString.call(e))>-1};function E(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function g(e){return typeof e!="string"&&(e=String(e)),e}function A(e){var t={next:function(){var n=e.shift();return{done:n===void 0,value:n}}};return h.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach(function(t,n){this.append(n,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}c.prototype.append=function(e,t){e=E(e),t=g(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},c.prototype.delete=function(e){delete this.map[E(e)]},c.prototype.get=function(e){return e=E(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(E(e))},c.prototype.set=function(e,t){this.map[E(e)]=g(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),A(e)},c.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),A(e)},c.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),A(e)},h.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);function D(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function x(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function L(e){var t=new FileReader,n=x(t);return t.readAsArrayBuffer(e),n}function k(e){var t=new FileReader,n=x(t);return t.readAsText(e),n}function C(e){for(var t=new Uint8Array(e),n=new Array(t.length),i=0;i<t.length;i++)n[i]=String.fromCharCode(t[i]);return n.join("")}function q(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:h.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:h.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:h.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():h.arrayBuffer&&h.blob&&v(e)?(this._bodyArrayBuffer=q(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):h.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||O(e))?this._bodyArrayBuffer=q(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):h.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},h.blob&&(this.blob=function(){var e=D(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=D(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(L)}),this.text=function(){var e=D(this);if(e)return e;if(this._bodyBlob)return k(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},h.formData&&(this.formData=function(){return this.text().then($)}),this.json=function(){return this.text().then(JSON.parse)},this}var G=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function N(e){var t=e.toUpperCase();return G.indexOf(t)>-1?t:e}function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var n=t.body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!n&&e._bodyInit!=null&&(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new c(t.headers)),this.method=N(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+new Date().getTime());else{var u=/\?/;this.url+=(u.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})};function $(e){var t=new FormData;return e.trim().split("&").forEach(function(n){if(n){var i=n.split("="),u=i.shift().replace(/\+/g," "),s=i.join("=").replace(/\+/g," ");t.append(decodeURIComponent(u),decodeURIComponent(s))}}),t}function V(e){var t=new c,n=e.replace(/\r?\n[\t ]+/g," ");return n.split("\r").map(function(i){return i.indexOf(`
2
+ `)===0?i.substr(1,i.length):i}).forEach(function(i){var u=i.split(":"),s=u.shift().trim();if(s){var _=u.join(":").trim();t.append(s,_)}}),t}S.call(w.prototype);function y(e,t){if(!(this instanceof y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}S.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},y.error=function(){var e=new y(null,{status:0,statusText:""});return e.type="error",e};var X=[301,302,303,307,308];y.redirect=function(e,t){if(X.indexOf(t)===-1)throw new RangeError("Invalid status code");return new y(null,{status:t,headers:{location:e}})},l.DOMException=a.DOMException;try{new l.DOMException}catch{l.DOMException=function(t,n){this.message=t,this.name=n;var i=Error(t);this.stack=i.stack},l.DOMException.prototype=Object.create(Error.prototype),l.DOMException.prototype.constructor=l.DOMException}function R(e,t){return new Promise(function(n,i){var u=new w(e,t);if(u.signal&&u.signal.aborted)return i(new l.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function _(){s.abort()}s.onload=function(){var d={status:s.status,statusText:s.statusText,headers:V(s.getAllResponseHeaders()||"")};d.url="responseURL"in s?s.responseURL:d.headers.get("X-Request-URL");var B="response"in s?s.response:s.responseText;setTimeout(function(){n(new y(B,d))},0)},s.onerror=function(){setTimeout(function(){i(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){i(new TypeError("Network request failed"))},0)},s.onabort=function(){setTimeout(function(){i(new l.DOMException("Aborted","AbortError"))},0)};function z(d){try{return d===""&&a.location.href?a.location.href:d}catch{return d}}s.open(u.method,z(u.url),!0),u.credentials==="include"?s.withCredentials=!0:u.credentials==="omit"&&(s.withCredentials=!1),"responseType"in s&&(h.blob?s.responseType="blob":h.arrayBuffer&&u.headers.get("Content-Type")&&u.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(s.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof c)?Object.getOwnPropertyNames(t.headers).forEach(function(d){s.setRequestHeader(d,g(t.headers[d]))}):u.headers.forEach(function(d,B){s.setRequestHeader(B,d)}),u.signal&&(u.signal.addEventListener("abort",_),s.onreadystatechange=function(){s.readyState===4&&u.signal.removeEventListener("abort",_)}),s.send(typeof u._bodyInit>"u"?null:u._bodyInit)})}return R.polyfill=!0,a.fetch||(a.fetch=R,a.Headers=c,a.Request=w,a.Response=y),l.Headers=c,l.Request=w,l.Response=y,l.fetch=R,l})({})})(p),p.fetch.ponyfill=!0,delete p.fetch.polyfill;var b=o.fetch?o:p;r=b.fetch,r.default=b.fetch,r.fetch=b.fetch,r.Headers=b.Headers,r.Request=b.Request,r.Response=b.Response,f.exports=r})(F,F.exports);var M=F.exports;const W=Q(M);function Z(){return typeof fetch>"u"?W:fetch}function ee(...f){return typeof Headers>"u"?new M.Headers(...f):new Headers(...f)}const te={responseType:"json"};class re{constructor({baseUrl:r,apiKey:o,...p}){P(this,"baseUrl");P(this,"apiKey");P(this,"config");if(r==null&&r==="")throw new Error("baseUrl is required.");if(o==null&&o==="")throw new Error("apiKey is required.");if(!U.isString(r))throw new Error("baseUrl must be string.");if(!U.isString(o))throw new Error("apiKey must be string.");this.baseUrl=r,this.apiKey=o,this.config={...te,...p}}async request(r,o={}){const p={...this.config,...o},{requestInit:b,responseType:m}=p,l=Z();try{const a=await l(this.createUrl(r),this.createFetchOptions(b)),{ok:h,status:v,statusText:T,headers:O}=a,g={data:await a[m](),status:v,statusText:T,headers:O};if(!h){const A=await J(a);return await Promise.reject(new j.AcmsFetchError(`fetch API response status: ${v}${A!=null?`
3
+ message is \`${A}\``:""}`,`${v} ${T}`,g))}return g}catch(a){return a instanceof Error?await Promise.reject(new Error(`Network Error.
4
+ Details: ${a.message}`)):await Promise.reject(new Error(`Network Error.
5
+ Details: Unknown Error`))}}createFetchOptions(r){const o=ee(r==null?void 0:r.headers);return o.has("X-API-KEY")||o.set("X-API-KEY",this.apiKey),{...r,headers:o}}createUrl(r){return U.isString(r)?new URL(r,this.baseUrl):r instanceof URL?new URL(r,this.baseUrl):new URL(H({...r}),this.baseUrl)}async get(r,o={}){return await this.request(r,{...o,requestInit:{...o.requestInit,method:"GET"}})}static isAcmsFetchError(r){return j.isAcmsFetchError(r)}}function ne(...f){return new re(...f)}exports.acmsPath=H;exports.isAcmsFetchError=j.isAcmsFetchError;exports.createClient=ne;
@@ -0,0 +1 @@
1
+ "use strict";const f=require("../typeGuard-eqTQ9U-x.cjs");function s(n){return encodeURIComponent(n).replace(/[!'()*]/g,i=>`%${i.charCodeAt(0).toString(16)}`)}function a(n){return!isNaN(Date.parse(n))}function m(n={}){let i=["blog","category","entry","user","tag","field","span","date","page","order","limit","keyword","tpl","api"].reduce((t,e)=>{const o=n[e];if(o==null)return t;if(e==="blog"){const r=n[e];return f.isNumber(r)?`${t}/bid/${r}`:`${t}/${r.split("/").map(s).join("/")}`}if(e==="category"){const r=n[e];return f.isNumber(r)?`${t}/cid/${r}`:Array.isArray(r)?`${t}/${r.map(s).join("/")}`:`${t}/${s(r)}`}if(e==="entry"){const r=n[e];return f.isNumber(r)?`${t}/eid/${r}`:`${t}/${s(r)}`}if(e==="user"){const r=n[e];return`${t}/uid/${r}`}if(e==="field"){const r=n[e];return`${t}/field/${r.split("/").map(s).join("/")}`}if(e==="span"){const{start:r,end:u}={start:"1000-01-01 00:00:00",end:"9999-12-31 23:59:59",...n[e]};if(f.isString(r)&&!a(r))throw new Error(`Invalid start date: ${r}`);if(f.isString(u)&&!a(u))throw new Error(`Invalid end date: ${u}`);return`${t}/${s(d(new Date(r)))}/-/${s(d(new Date(u)))}`}if(e==="date"){if(n.span!=null)return t;const{year:r,month:u,day:$}=n[e];return[r,u,$].reduce((g,l)=>l==null?g:`${g}/${l}`,t)}if(e==="page"){const r=n[e];return r===1?t:`${t}/page/${r}`}if(e==="tpl"){const r=n[e];return`${t}/tpl/${r.split("/").map(s).join("/")}`}return Array.isArray(o)?o.length>0?`${t}/${e}/${o.map(s).join("/")}`:t:`${t}/${e}/${s(o)}`},"");/\.[^/.]+$/.test(i)||(i+="/");const c=new URLSearchParams(n.searchParams);return c.size>0&&(i+=`?${c.toString()}`),i.startsWith("/")?i.slice(1):i}function d(n){function i($){return $<10?"0"+$:$}const c=n.getFullYear(),t=i(n.getMonth()+1),e=i(n.getDate()),o=i(n.getHours()),r=i(n.getMinutes()),u=i(n.getSeconds());return`${c}-${t}-${e} ${o}:${r}:${u}`}module.exports=m;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index-x-5Zn68j.cjs");require("../typeGuard-eqTQ9U-x.cjs");exports.isAcmsFetchError=r.isAcmsFetchError;
@@ -0,0 +1,424 @@
1
+ var X = Object.defineProperty;
2
+ var z = (f, r, s) => r in f ? X(f, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : f[r] = s;
3
+ var P = (f, r, s) => (z(f, typeof r != "symbol" ? r + "" : r, s), s);
4
+ import K from "./acms-path.js";
5
+ import { a as U } from "../typeGuard-30fb1DDr.js";
6
+ import { A as Y, i as J } from "../index-w7KUzF0v.js";
7
+ async function Q(f) {
8
+ try {
9
+ const { message: r } = await f.json();
10
+ return r ?? null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ var q = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
16
+ function W(f) {
17
+ return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
18
+ }
19
+ var j = { exports: {} };
20
+ (function(f, r) {
21
+ var s = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof q < "u" && q, p = function() {
22
+ function m() {
23
+ this.fetch = !1, this.DOMException = s.DOMException;
24
+ }
25
+ return m.prototype = s, new m();
26
+ }();
27
+ (function(m) {
28
+ (function(l) {
29
+ var a = typeof m < "u" && m || typeof self < "u" && self || typeof a < "u" && a, h = {
30
+ searchParams: "URLSearchParams" in a,
31
+ iterable: "Symbol" in a && "iterator" in Symbol,
32
+ blob: "FileReader" in a && "Blob" in a && function() {
33
+ try {
34
+ return new Blob(), !0;
35
+ } catch {
36
+ return !1;
37
+ }
38
+ }(),
39
+ formData: "FormData" in a,
40
+ arrayBuffer: "ArrayBuffer" in a
41
+ };
42
+ function v(e) {
43
+ return e && DataView.prototype.isPrototypeOf(e);
44
+ }
45
+ if (h.arrayBuffer)
46
+ var _ = [
47
+ "[object Int8Array]",
48
+ "[object Uint8Array]",
49
+ "[object Uint8ClampedArray]",
50
+ "[object Int16Array]",
51
+ "[object Uint16Array]",
52
+ "[object Int32Array]",
53
+ "[object Uint32Array]",
54
+ "[object Float32Array]",
55
+ "[object Float64Array]"
56
+ ], O = ArrayBuffer.isView || function(e) {
57
+ return e && _.indexOf(Object.prototype.toString.call(e)) > -1;
58
+ };
59
+ function E(e) {
60
+ if (typeof e != "string" && (e = String(e)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e) || e === "")
61
+ throw new TypeError('Invalid character in header field name: "' + e + '"');
62
+ return e.toLowerCase();
63
+ }
64
+ function g(e) {
65
+ return typeof e != "string" && (e = String(e)), e;
66
+ }
67
+ function A(e) {
68
+ var t = {
69
+ next: function() {
70
+ var n = e.shift();
71
+ return { done: n === void 0, value: n };
72
+ }
73
+ };
74
+ return h.iterable && (t[Symbol.iterator] = function() {
75
+ return t;
76
+ }), t;
77
+ }
78
+ function c(e) {
79
+ this.map = {}, e instanceof c ? e.forEach(function(t, n) {
80
+ this.append(n, t);
81
+ }, this) : Array.isArray(e) ? e.forEach(function(t) {
82
+ this.append(t[0], t[1]);
83
+ }, this) : e && Object.getOwnPropertyNames(e).forEach(function(t) {
84
+ this.append(t, e[t]);
85
+ }, this);
86
+ }
87
+ c.prototype.append = function(e, t) {
88
+ e = E(e), t = g(t);
89
+ var n = this.map[e];
90
+ this.map[e] = n ? n + ", " + t : t;
91
+ }, c.prototype.delete = function(e) {
92
+ delete this.map[E(e)];
93
+ }, c.prototype.get = function(e) {
94
+ return e = E(e), this.has(e) ? this.map[e] : null;
95
+ }, c.prototype.has = function(e) {
96
+ return this.map.hasOwnProperty(E(e));
97
+ }, c.prototype.set = function(e, t) {
98
+ this.map[E(e)] = g(t);
99
+ }, c.prototype.forEach = function(e, t) {
100
+ for (var n in this.map)
101
+ this.map.hasOwnProperty(n) && e.call(t, this.map[n], n, this);
102
+ }, c.prototype.keys = function() {
103
+ var e = [];
104
+ return this.forEach(function(t, n) {
105
+ e.push(n);
106
+ }), A(e);
107
+ }, c.prototype.values = function() {
108
+ var e = [];
109
+ return this.forEach(function(t) {
110
+ e.push(t);
111
+ }), A(e);
112
+ }, c.prototype.entries = function() {
113
+ var e = [];
114
+ return this.forEach(function(t, n) {
115
+ e.push([n, t]);
116
+ }), A(e);
117
+ }, h.iterable && (c.prototype[Symbol.iterator] = c.prototype.entries);
118
+ function D(e) {
119
+ if (e.bodyUsed)
120
+ return Promise.reject(new TypeError("Already read"));
121
+ e.bodyUsed = !0;
122
+ }
123
+ function x(e) {
124
+ return new Promise(function(t, n) {
125
+ e.onload = function() {
126
+ t(e.result);
127
+ }, e.onerror = function() {
128
+ n(e.error);
129
+ };
130
+ });
131
+ }
132
+ function S(e) {
133
+ var t = new FileReader(), n = x(t);
134
+ return t.readAsArrayBuffer(e), n;
135
+ }
136
+ function L(e) {
137
+ var t = new FileReader(), n = x(t);
138
+ return t.readAsText(e), n;
139
+ }
140
+ function M(e) {
141
+ for (var t = new Uint8Array(e), n = new Array(t.length), i = 0; i < t.length; i++)
142
+ n[i] = String.fromCharCode(t[i]);
143
+ return n.join("");
144
+ }
145
+ function F(e) {
146
+ if (e.slice)
147
+ return e.slice(0);
148
+ var t = new Uint8Array(e.byteLength);
149
+ return t.set(new Uint8Array(e)), t.buffer;
150
+ }
151
+ function I() {
152
+ return this.bodyUsed = !1, this._initBody = function(e) {
153
+ this.bodyUsed = this.bodyUsed, this._bodyInit = e, e ? typeof e == "string" ? this._bodyText = e : h.blob && Blob.prototype.isPrototypeOf(e) ? this._bodyBlob = e : h.formData && FormData.prototype.isPrototypeOf(e) ? this._bodyFormData = e : h.searchParams && URLSearchParams.prototype.isPrototypeOf(e) ? this._bodyText = e.toString() : h.arrayBuffer && h.blob && v(e) ? (this._bodyArrayBuffer = F(e.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : h.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(e) || O(e)) ? this._bodyArrayBuffer = F(e) : this._bodyText = e = Object.prototype.toString.call(e) : this._bodyText = "", this.headers.get("content-type") || (typeof e == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : h.searchParams && URLSearchParams.prototype.isPrototypeOf(e) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
154
+ }, h.blob && (this.blob = function() {
155
+ var e = D(this);
156
+ if (e)
157
+ return e;
158
+ if (this._bodyBlob)
159
+ return Promise.resolve(this._bodyBlob);
160
+ if (this._bodyArrayBuffer)
161
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]));
162
+ if (this._bodyFormData)
163
+ throw new Error("could not read FormData body as blob");
164
+ return Promise.resolve(new Blob([this._bodyText]));
165
+ }, this.arrayBuffer = function() {
166
+ if (this._bodyArrayBuffer) {
167
+ var e = D(this);
168
+ return e || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
169
+ this._bodyArrayBuffer.buffer.slice(
170
+ this._bodyArrayBuffer.byteOffset,
171
+ this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
172
+ )
173
+ ) : Promise.resolve(this._bodyArrayBuffer));
174
+ } else
175
+ return this.blob().then(S);
176
+ }), this.text = function() {
177
+ var e = D(this);
178
+ if (e)
179
+ return e;
180
+ if (this._bodyBlob)
181
+ return L(this._bodyBlob);
182
+ if (this._bodyArrayBuffer)
183
+ return Promise.resolve(M(this._bodyArrayBuffer));
184
+ if (this._bodyFormData)
185
+ throw new Error("could not read FormData body as text");
186
+ return Promise.resolve(this._bodyText);
187
+ }, h.formData && (this.formData = function() {
188
+ return this.text().then(N);
189
+ }), this.json = function() {
190
+ return this.text().then(JSON.parse);
191
+ }, this;
192
+ }
193
+ var k = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
194
+ function C(e) {
195
+ var t = e.toUpperCase();
196
+ return k.indexOf(t) > -1 ? t : e;
197
+ }
198
+ function w(e, t) {
199
+ if (!(this instanceof w))
200
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
201
+ t = t || {};
202
+ var n = t.body;
203
+ if (e instanceof w) {
204
+ if (e.bodyUsed)
205
+ throw new TypeError("Already read");
206
+ this.url = e.url, this.credentials = e.credentials, t.headers || (this.headers = new c(e.headers)), this.method = e.method, this.mode = e.mode, this.signal = e.signal, !n && e._bodyInit != null && (n = e._bodyInit, e.bodyUsed = !0);
207
+ } else
208
+ this.url = String(e);
209
+ if (this.credentials = t.credentials || this.credentials || "same-origin", (t.headers || !this.headers) && (this.headers = new c(t.headers)), this.method = C(t.method || this.method || "GET"), this.mode = t.mode || this.mode || null, this.signal = t.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && n)
210
+ throw new TypeError("Body not allowed for GET or HEAD requests");
211
+ if (this._initBody(n), (this.method === "GET" || this.method === "HEAD") && (t.cache === "no-store" || t.cache === "no-cache")) {
212
+ var i = /([?&])_=[^&]*/;
213
+ if (i.test(this.url))
214
+ this.url = this.url.replace(i, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
215
+ else {
216
+ var u = /\?/;
217
+ this.url += (u.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
218
+ }
219
+ }
220
+ }
221
+ w.prototype.clone = function() {
222
+ return new w(this, { body: this._bodyInit });
223
+ };
224
+ function N(e) {
225
+ var t = new FormData();
226
+ return e.trim().split("&").forEach(function(n) {
227
+ if (n) {
228
+ var i = n.split("="), u = i.shift().replace(/\+/g, " "), o = i.join("=").replace(/\+/g, " ");
229
+ t.append(decodeURIComponent(u), decodeURIComponent(o));
230
+ }
231
+ }), t;
232
+ }
233
+ function $(e) {
234
+ var t = new c(), n = e.replace(/\r?\n[\t ]+/g, " ");
235
+ return n.split("\r").map(function(i) {
236
+ return i.indexOf(`
237
+ `) === 0 ? i.substr(1, i.length) : i;
238
+ }).forEach(function(i) {
239
+ var u = i.split(":"), o = u.shift().trim();
240
+ if (o) {
241
+ var T = u.join(":").trim();
242
+ t.append(o, T);
243
+ }
244
+ }), t;
245
+ }
246
+ I.call(w.prototype);
247
+ function y(e, t) {
248
+ if (!(this instanceof y))
249
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
250
+ t || (t = {}), this.type = "default", this.status = t.status === void 0 ? 200 : t.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = t.statusText === void 0 ? "" : "" + t.statusText, this.headers = new c(t.headers), this.url = t.url || "", this._initBody(e);
251
+ }
252
+ I.call(y.prototype), y.prototype.clone = function() {
253
+ return new y(this._bodyInit, {
254
+ status: this.status,
255
+ statusText: this.statusText,
256
+ headers: new c(this.headers),
257
+ url: this.url
258
+ });
259
+ }, y.error = function() {
260
+ var e = new y(null, { status: 0, statusText: "" });
261
+ return e.type = "error", e;
262
+ };
263
+ var G = [301, 302, 303, 307, 308];
264
+ y.redirect = function(e, t) {
265
+ if (G.indexOf(t) === -1)
266
+ throw new RangeError("Invalid status code");
267
+ return new y(null, { status: t, headers: { location: e } });
268
+ }, l.DOMException = a.DOMException;
269
+ try {
270
+ new l.DOMException();
271
+ } catch {
272
+ l.DOMException = function(t, n) {
273
+ this.message = t, this.name = n;
274
+ var i = Error(t);
275
+ this.stack = i.stack;
276
+ }, l.DOMException.prototype = Object.create(Error.prototype), l.DOMException.prototype.constructor = l.DOMException;
277
+ }
278
+ function R(e, t) {
279
+ return new Promise(function(n, i) {
280
+ var u = new w(e, t);
281
+ if (u.signal && u.signal.aborted)
282
+ return i(new l.DOMException("Aborted", "AbortError"));
283
+ var o = new XMLHttpRequest();
284
+ function T() {
285
+ o.abort();
286
+ }
287
+ o.onload = function() {
288
+ var d = {
289
+ status: o.status,
290
+ statusText: o.statusText,
291
+ headers: $(o.getAllResponseHeaders() || "")
292
+ };
293
+ d.url = "responseURL" in o ? o.responseURL : d.headers.get("X-Request-URL");
294
+ var B = "response" in o ? o.response : o.responseText;
295
+ setTimeout(function() {
296
+ n(new y(B, d));
297
+ }, 0);
298
+ }, o.onerror = function() {
299
+ setTimeout(function() {
300
+ i(new TypeError("Network request failed"));
301
+ }, 0);
302
+ }, o.ontimeout = function() {
303
+ setTimeout(function() {
304
+ i(new TypeError("Network request failed"));
305
+ }, 0);
306
+ }, o.onabort = function() {
307
+ setTimeout(function() {
308
+ i(new l.DOMException("Aborted", "AbortError"));
309
+ }, 0);
310
+ };
311
+ function V(d) {
312
+ try {
313
+ return d === "" && a.location.href ? a.location.href : d;
314
+ } catch {
315
+ return d;
316
+ }
317
+ }
318
+ o.open(u.method, V(u.url), !0), u.credentials === "include" ? o.withCredentials = !0 : u.credentials === "omit" && (o.withCredentials = !1), "responseType" in o && (h.blob ? o.responseType = "blob" : h.arrayBuffer && u.headers.get("Content-Type") && u.headers.get("Content-Type").indexOf("application/octet-stream") !== -1 && (o.responseType = "arraybuffer")), t && typeof t.headers == "object" && !(t.headers instanceof c) ? Object.getOwnPropertyNames(t.headers).forEach(function(d) {
319
+ o.setRequestHeader(d, g(t.headers[d]));
320
+ }) : u.headers.forEach(function(d, B) {
321
+ o.setRequestHeader(B, d);
322
+ }), u.signal && (u.signal.addEventListener("abort", T), o.onreadystatechange = function() {
323
+ o.readyState === 4 && u.signal.removeEventListener("abort", T);
324
+ }), o.send(typeof u._bodyInit > "u" ? null : u._bodyInit);
325
+ });
326
+ }
327
+ return R.polyfill = !0, a.fetch || (a.fetch = R, a.Headers = c, a.Request = w, a.Response = y), l.Headers = c, l.Request = w, l.Response = y, l.fetch = R, l;
328
+ })({});
329
+ })(p), p.fetch.ponyfill = !0, delete p.fetch.polyfill;
330
+ var b = s.fetch ? s : p;
331
+ r = b.fetch, r.default = b.fetch, r.fetch = b.fetch, r.Headers = b.Headers, r.Request = b.Request, r.Response = b.Response, f.exports = r;
332
+ })(j, j.exports);
333
+ var H = j.exports;
334
+ const Z = /* @__PURE__ */ W(H);
335
+ function ee() {
336
+ return typeof fetch > "u" ? Z : fetch;
337
+ }
338
+ function te(...f) {
339
+ return typeof Headers > "u" ? new H.Headers(...f) : new Headers(...f);
340
+ }
341
+ const re = {
342
+ responseType: "json"
343
+ };
344
+ class ne {
345
+ constructor({
346
+ baseUrl: r,
347
+ apiKey: s,
348
+ ...p
349
+ }) {
350
+ P(this, "baseUrl");
351
+ P(this, "apiKey");
352
+ P(this, "config");
353
+ if (r == null && r === "")
354
+ throw new Error("baseUrl is required.");
355
+ if (s == null && s === "")
356
+ throw new Error("apiKey is required.");
357
+ if (!U(r))
358
+ throw new Error("baseUrl must be string.");
359
+ if (!U(s))
360
+ throw new Error("apiKey must be string.");
361
+ this.baseUrl = r, this.apiKey = s, this.config = {
362
+ ...re,
363
+ ...p
364
+ };
365
+ }
366
+ async request(r, s = {}) {
367
+ const p = { ...this.config, ...s }, { requestInit: b, responseType: m } = p, l = ee();
368
+ try {
369
+ const a = await l(
370
+ this.createUrl(r),
371
+ this.createFetchOptions(b)
372
+ ), { ok: h, status: v, statusText: _, headers: O } = a, g = {
373
+ data: await a[m](),
374
+ status: v,
375
+ statusText: _,
376
+ headers: O
377
+ };
378
+ if (!h) {
379
+ const A = await Q(a);
380
+ return await Promise.reject(
381
+ new Y(
382
+ `fetch API response status: ${v}${A != null ? `
383
+ message is \`${A}\`` : ""}`,
384
+ `${v} ${_}`,
385
+ g
386
+ )
387
+ );
388
+ }
389
+ return g;
390
+ } catch (a) {
391
+ return a instanceof Error ? await Promise.reject(
392
+ new Error(`Network Error.
393
+ Details: ${a.message}`)
394
+ ) : await Promise.reject(
395
+ new Error(`Network Error.
396
+ Details: Unknown Error`)
397
+ );
398
+ }
399
+ }
400
+ createFetchOptions(r) {
401
+ const s = te(r == null ? void 0 : r.headers);
402
+ return s.has("X-API-KEY") || s.set("X-API-KEY", this.apiKey), { ...r, headers: s };
403
+ }
404
+ createUrl(r) {
405
+ return U(r) ? new URL(r, this.baseUrl) : r instanceof URL ? new URL(r, this.baseUrl) : new URL(K({ ...r }), this.baseUrl);
406
+ }
407
+ async get(r, s = {}) {
408
+ return await this.request(r, {
409
+ ...s,
410
+ requestInit: { ...s.requestInit, method: "GET" }
411
+ });
412
+ }
413
+ static isAcmsFetchError(r) {
414
+ return J(r);
415
+ }
416
+ }
417
+ function fe(...f) {
418
+ return new ne(...f);
419
+ }
420
+ export {
421
+ K as acmsPath,
422
+ fe as createClient,
423
+ J as isAcmsFetchError
424
+ };
@@ -0,0 +1,94 @@
1
+ import { i as g, a as l } from "../typeGuard-30fb1DDr.js";
2
+ function s(n) {
3
+ return encodeURIComponent(n).replace(
4
+ /[!'()*]/g,
5
+ (i) => `%${i.charCodeAt(0).toString(16)}`
6
+ );
7
+ }
8
+ function d(n) {
9
+ return !isNaN(Date.parse(n));
10
+ }
11
+ function D(n = {}) {
12
+ let i = [
13
+ "blog",
14
+ "category",
15
+ "entry",
16
+ "user",
17
+ "tag",
18
+ "field",
19
+ "span",
20
+ "date",
21
+ "page",
22
+ "order",
23
+ "limit",
24
+ "keyword",
25
+ "tpl",
26
+ "api"
27
+ ].reduce((t, e) => {
28
+ const $ = n[e];
29
+ if ($ == null)
30
+ return t;
31
+ if (e === "blog") {
32
+ const r = n[e];
33
+ return g(r) ? `${t}/bid/${r}` : `${t}/${r.split("/").map(s).join("/")}`;
34
+ }
35
+ if (e === "category") {
36
+ const r = n[e];
37
+ return g(r) ? `${t}/cid/${r}` : Array.isArray(r) ? `${t}/${r.map(s).join("/")}` : `${t}/${s(r)}`;
38
+ }
39
+ if (e === "entry") {
40
+ const r = n[e];
41
+ return g(r) ? `${t}/eid/${r}` : `${t}/${s(r)}`;
42
+ }
43
+ if (e === "user") {
44
+ const r = n[e];
45
+ return `${t}/uid/${r}`;
46
+ }
47
+ if (e === "field") {
48
+ const r = n[e];
49
+ return `${t}/field/${r.split("/").map(s).join("/")}`;
50
+ }
51
+ if (e === "span") {
52
+ const { start: r, end: o } = {
53
+ start: "1000-01-01 00:00:00",
54
+ end: "9999-12-31 23:59:59",
55
+ ...n[e]
56
+ };
57
+ if (l(r) && !d(r))
58
+ throw new Error(`Invalid start date: ${r}`);
59
+ if (l(o) && !d(o))
60
+ throw new Error(`Invalid end date: ${o}`);
61
+ return `${t}/${s(m(new Date(r)))}/-/${s(
62
+ m(new Date(o))
63
+ )}`;
64
+ }
65
+ if (e === "date") {
66
+ if (n.span != null)
67
+ return t;
68
+ const { year: r, month: o, day: u } = n[e];
69
+ return [r, o, u].reduce((a, c) => c == null ? a : `${a}/${c}`, t);
70
+ }
71
+ if (e === "page") {
72
+ const r = n[e];
73
+ return r === 1 ? t : `${t}/page/${r}`;
74
+ }
75
+ if (e === "tpl") {
76
+ const r = n[e];
77
+ return `${t}/tpl/${r.split("/").map(s).join("/")}`;
78
+ }
79
+ return Array.isArray($) ? $.length > 0 ? `${t}/${e}/${$.map(s).join("/")}` : t : `${t}/${e}/${s($)}`;
80
+ }, "");
81
+ /\.[^/.]+$/.test(i) || (i += "/");
82
+ const f = new URLSearchParams(n.searchParams);
83
+ return f.size > 0 && (i += `?${f.toString()}`), i.startsWith("/") ? i.slice(1) : i;
84
+ }
85
+ function m(n) {
86
+ function i(u) {
87
+ return u < 10 ? "0" + u : u;
88
+ }
89
+ const f = n.getFullYear(), t = i(n.getMonth() + 1), e = i(n.getDate()), $ = i(n.getHours()), r = i(n.getMinutes()), o = i(n.getSeconds());
90
+ return `${f}-${t}-${e} ${$}:${r}:${o}`;
91
+ }
92
+ export {
93
+ D as default
94
+ };
@@ -0,0 +1,5 @@
1
+ import { i as m } from "../index-w7KUzF0v.js";
2
+ import "../typeGuard-30fb1DDr.js";
3
+ export {
4
+ m as isAcmsFetchError
5
+ };
@@ -0,0 +1,19 @@
1
+ var i = Object.defineProperty;
2
+ var h = (r, s, e) => s in r ? i(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
+ var t = (r, s, e) => (h(r, typeof s != "symbol" ? s + "" : s, e), e);
4
+ import { b as m } from "./typeGuard-30fb1DDr.js";
5
+ class a extends Error {
6
+ constructor(e, c, o, n) {
7
+ super(e, n);
8
+ t(this, "code");
9
+ t(this, "response");
10
+ this.name = "AcmsFetchError", this.code = c, this.response = o;
11
+ }
12
+ }
13
+ function A(r) {
14
+ return m(r) && r instanceof a;
15
+ }
16
+ export {
17
+ a as A,
18
+ A as i
19
+ };
@@ -0,0 +1 @@
1
+ "use strict";var h=Object.defineProperty;var u=(r,s,e)=>s in r?h(r,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[s]=e;var c=(r,s,e)=>(u(r,typeof s!="symbol"?s+"":s,e),e);const m=require("./typeGuard-eqTQ9U-x.cjs");class t extends Error{constructor(e,o,n,i){super(e,i);c(this,"code");c(this,"response");this.name="AcmsFetchError",this.code=o,this.response=n}}function E(r){return m.isObject(r)&&r instanceof t}exports.AcmsFetchError=t;exports.isAcmsFetchError=E;
@@ -0,0 +1,14 @@
1
+ function n(t) {
2
+ return typeof t == "string";
3
+ }
4
+ function r(t) {
5
+ return typeof t == "number";
6
+ }
7
+ function e(t) {
8
+ return typeof t == "object" && t !== null;
9
+ }
10
+ export {
11
+ n as a,
12
+ e as b,
13
+ r as i
14
+ };
@@ -0,0 +1 @@
1
+ "use strict";function n(t){return typeof t=="string"}function i(t){return typeof t=="number"}function r(t){return typeof t=="object"&&t!==null}exports.isNumber=i;exports.isObject=r;exports.isString=n;
@@ -0,0 +1,16 @@
1
+ import { type AcmsContext } from '../lib/acmsPath';
2
+ import { type AcmsClientConfig, type AcmsResponse } from '../types';
3
+ export default class AcmsClient {
4
+ private readonly baseUrl;
5
+ private readonly apiKey;
6
+ private readonly config;
7
+ constructor({ baseUrl, apiKey, ...options }: {
8
+ baseUrl: string;
9
+ apiKey: string;
10
+ } & Partial<AcmsClientConfig>);
11
+ private request;
12
+ private createFetchOptions;
13
+ private createUrl;
14
+ get<T = any>(acmsContextOrUrl: AcmsContext | URL | string, options?: Partial<AcmsClientConfig>): Promise<AcmsResponse<T>>;
15
+ static isAcmsFetchError(payload: any): boolean;
16
+ }
@@ -0,0 +1,6 @@
1
+ import { type AcmsResponse } from '../types';
2
+ export default class AcmsFetchError<T = any> extends Error {
3
+ code: string;
4
+ response: AcmsResponse<T>;
5
+ constructor(message: string, code: string, response: AcmsResponse<T>, options?: ErrorOptions);
6
+ }
@@ -0,0 +1,2 @@
1
+ export { default as AcmsClient } from './AcmsClient';
2
+ export { default as AcmsFetchError } from './AcmsFetchError';
@@ -0,0 +1,2 @@
1
+ import { AcmsClient } from './core';
2
+ export default function createClient(...args: ConstructorParameters<typeof AcmsClient>): AcmsClient;
@@ -0,0 +1,4 @@
1
+ export { default as createClient } from './createClient';
2
+ export { default as acmsPath } from './lib/acmsPath';
3
+ export * from './lib/typeGuard';
4
+ export type * from './types';
@@ -0,0 +1,3 @@
1
+ import { type AcmsContext } from './types';
2
+ export default function acmsPath(acmsContext?: AcmsContext): string;
3
+ export type { AcmsContext };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ export interface AcmsContext {
2
+ blog?: string | number;
3
+ category?: string | string[] | number;
4
+ entry?: string | number;
5
+ user?: number;
6
+ tag?: string[];
7
+ field?: string;
8
+ span?: {
9
+ start?: string | Date;
10
+ end?: string | Date;
11
+ };
12
+ date?: {
13
+ year?: number;
14
+ month?: number;
15
+ day?: number;
16
+ };
17
+ page?: number;
18
+ order?: string;
19
+ limit?: number;
20
+ keyword?: string;
21
+ tpl?: string;
22
+ api?: string;
23
+ searchParams?: ConstructorParameters<typeof URLSearchParams>[0];
24
+ }
@@ -0,0 +1,2 @@
1
+ export default function createFetch(): typeof fetch;
2
+ export declare function createHeaders(...args: ConstructorParameters<typeof Headers>): Headers;
@@ -0,0 +1 @@
1
+ export { default as isAcmsFetchError } from './isAcmsFetchError';
@@ -0,0 +1,9 @@
1
+ import AcmsFetchError from '../../core/AcmsFetchError';
2
+ /**
3
+ * Determines whether the payload is an error thrown by acms-js-sdk
4
+ *
5
+ * @param {*} payload The value to test
6
+ *
7
+ * @returns {boolean} True if the payload is an error thrown by acms-js-sdk, otherwise false
8
+ */
9
+ export default function isAcmsFetchError(payload: any): payload is AcmsFetchError;
@@ -0,0 +1,11 @@
1
+ export interface AcmsResponse<T> {
2
+ data: T;
3
+ status: number;
4
+ statusText: string;
5
+ headers: Headers;
6
+ }
7
+ export type ResponseType = 'arrayBuffer' | 'blob' | 'formData' | 'json' | 'text';
8
+ export interface AcmsClientConfig {
9
+ requestInit?: RequestInit;
10
+ responseType: ResponseType;
11
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * RFC 3986 に基づいてURLエンコードを行う
3
+ * @see https://www.rfc-editor.org/rfc/rfc3986
4
+ */
5
+ export default function encodeUri(str: string | number | boolean): string;
@@ -0,0 +1 @@
1
+ export default function getMessageFromResponse(response: Response): Promise<string | null>;
@@ -0,0 +1,4 @@
1
+ export { default as encodeUri } from './encodeUri';
2
+ export { default as getMessageFromResponse } from './getMessageFromResponse';
3
+ export { default as isDateString } from './isDateString';
4
+ export * from './typeGuard';
@@ -0,0 +1 @@
1
+ export default function isDateString(string: string): boolean;
@@ -0,0 +1,3 @@
1
+ export declare function isString(value: unknown): value is string;
2
+ export declare function isNumber(value: unknown): value is number;
3
+ export declare function isObject(value: unknown): value is object;
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@uidev1116/acms-js-sdk",
3
+ "version": "0.0.1",
4
+ "description": "a-blog cms JavaScript SDK",
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/cjs/acms-js-sdk.cjs",
10
+ "module": "./dist/es/acms-js-sdk.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/types/index.d.ts",
15
+ "import": "./dist/es/acms-js-sdk.js",
16
+ "require": "./dist/cjs/acms-js-sdk.cjs"
17
+ },
18
+ "./acmsPath": {
19
+ "types": "./dist/types/lib/acmsPath/index.d.ts",
20
+ "import": "./dist/es/acms-path.js",
21
+ "require": "./dist/cjs/acms-path.cjs"
22
+ },
23
+ "./typeGuard": {
24
+ "types": "./dist/types/lib/typeGuard/index.d.ts",
25
+ "import": "./dist/es/type-guard.js",
26
+ "require": "./dist/cjs/type-guard.cjs"
27
+ }
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/uidev1116/acms-js-sdk.git"
35
+ },
36
+ "author": "uidev1116",
37
+ "license": "MIT",
38
+ "scripts": {
39
+ "test": "vitest",
40
+ "test:ci": "vitest run",
41
+ "dev": "vite",
42
+ "build": "vite build",
43
+ "check-update": "npx -p npm-check-updates -c ncu",
44
+ "prepare": "husky install",
45
+ "prepack": "npm run test:ci && npm run build"
46
+ },
47
+ "dependencies": {
48
+ "cross-fetch": "^4.0.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^20.10.7",
52
+ "@typescript-eslint/eslint-plugin": "^6.18.0",
53
+ "@typescript-eslint/parser": "^6.18.0",
54
+ "co": "^4.6.0",
55
+ "eslint": "^8.56.0",
56
+ "eslint-config-prettier": "^9.1.0",
57
+ "eslint-config-standard-with-typescript": "^43.0.0",
58
+ "eslint-plugin-import": "^2.29.1",
59
+ "eslint-plugin-n": "^16.6.1",
60
+ "eslint-plugin-promise": "^6.1.1",
61
+ "husky": "^8.0.3",
62
+ "lint-staged": "^15.2.0",
63
+ "node-cmd": "^5.0.0",
64
+ "prettier": "^3.1.1",
65
+ "typescript": "^5.3.3",
66
+ "vite": "^5.0.11",
67
+ "vite-plugin-dts": "^3.7.0",
68
+ "vite-plugin-eslint": "^1.8.1",
69
+ "vitest": "^1.1.3"
70
+ },
71
+ "volta": {
72
+ "node": "20.10.0"
73
+ },
74
+ "lint-staged": {
75
+ "*.{js,ts}": "prettier --write"
76
+ },
77
+ "tags": [
78
+ "a-blog cms"
79
+ ],
80
+ "keywords": [
81
+ "a-blog cms"
82
+ ]
83
+ }