@uidev1116/acms-js-sdk 0.1.2 → 0.3.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/README.md +256 -7
- package/dist/cjs/acms-js-sdk.cjs +3 -3
- package/dist/cjs/acms-path.cjs +4 -1
- package/dist/cjs/type-guard.cjs +1 -1
- package/dist/es/acms-js-sdk.js +53 -60
- package/dist/es/acms-path.js +2124 -4
- package/dist/es/type-guard.js +2 -3
- package/dist/index-BeSRDPIk.js +15 -0
- package/dist/index-Bm4C_vR2.cjs +1 -0
- package/dist/types/core/AcmsClient.d.ts +3 -2
- package/dist/types/core/AcmsFetchError.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/acmsPath/acmsField.d.ts +13 -0
- package/dist/types/lib/acmsPath/acmsField.test.d.ts +1 -0
- package/dist/types/lib/acmsPath/acmsPath.d.ts +2 -2
- package/dist/types/lib/acmsPath/{defaultOptions.d.ts → defaults.d.ts} +1 -0
- package/dist/types/lib/acmsPath/index.d.ts +1 -0
- package/dist/types/lib/acmsPath/parseAcmsPath.d.ts +1 -1
- package/dist/types/lib/acmsPath/types.d.ts +32 -7
- package/dist/types/lib/acmsPath/utils.d.ts +1 -0
- package/dist/types/lib/acmsPath/utils.test.d.ts +1 -0
- package/dist/types/lib/typeGuard/isAcmsFetchError.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -2
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/mergeConfig.d.ts +10 -0
- package/dist/types/utils/mergeConfig.test.d.ts +1 -0
- package/dist/types/utils/parseFormData.d.ts +7 -0
- package/dist/types/utils/unique.d.ts +1 -0
- package/package.json +28 -27
- package/dist/browser-ponyfill-EPWIFhDK.js +0 -339
- package/dist/browser-ponyfill-r3mBr4hd.cjs +0 -2
- package/dist/index-H2fSgwjT.js +0 -328
- package/dist/index-WFlkDf6U.cjs +0 -1
- package/dist/index-ZZQxXurp.js +0 -19
- package/dist/index-x-5Zn68j.cjs +0 -1
- /package/dist/{typeGuard-eqTQ9U-x.cjs → typeGuard-B-hez9oi.cjs} +0 -0
- /package/dist/{typeGuard-Jsany_41.js → typeGuard-CkfEvQcm.js} +0 -0
package/dist/index-WFlkDf6U.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const $=require("./typeGuard-eqTQ9U-x.cjs");var M=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function S(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P=function(r){return I(r)&&!D(r)};function I(e){return!!e&&typeof e=="object"}function D(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||T(e)}var E=typeof Symbol=="function"&&Symbol.for,N=E?Symbol.for("react.element"):60103;function T(e){return e.$$typeof===N}function U(e){return Array.isArray(e)?[]:{}}function y(e,r){return r.clone!==!1&&r.isMergeableObject(e)?m(U(e),e,r):e}function _(e,r,t){return e.concat(r).map(function(a){return y(a,t)})}function R(e,r){if(!r.customMerge)return m;var t=r.customMerge(e);return typeof t=="function"?t:m}function F(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function h(e){return Object.keys(e).concat(F(e))}function O(e,r){try{return r in e}catch{return!1}}function C(e,r){return O(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function G(e,r,t){var a={};return t.isMergeableObject(e)&&h(e).forEach(function(n){a[n]=y(e[n],t)}),h(r).forEach(function(n){C(e,n)||(O(e,n)&&t.isMergeableObject(r[n])?a[n]=R(n,t)(e[n],r[n],t):a[n]=y(r[n],t))}),a}function m(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||_,t.isMergeableObject=t.isMergeableObject||P,t.cloneUnlessOtherwiseSpecified=y;var a=Array.isArray(r),n=Array.isArray(e),u=a===n;return u?a?t.arrayMerge(e,r,t):G(e,r,t):y(r,t)}m.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(a,n){return m(a,n,t)},{})};var K=m,Y=K;const A=S(Y);function g(e){return encodeURIComponent(e).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16)}`)}function j(e){return!isNaN(Date.parse(e))}const v={bid:"bid",cid:"cid",eid:"eid",uid:"uid",tag:"tag",field:"field",span:"-",page:"page",order:"order",limit:"limit",keyword:"keyword",admin:"admin",tpl:"tpl",api:"api"};function p(e){function r(s){return s<10?"0"+s:s}const t=e.getFullYear(),a=r(e.getMonth()+1),n=r(e.getDate()),u=r(e.getHours()),o=r(e.getMinutes()),c=r(e.getSeconds());return`${t}-${a}-${n} ${u}:${o}:${c}`}const L={segments:v};function q(e,r={}){const t=z(e)?e:H(e),{segments:a}=A(L,r);let n=["blog","admin","category","entry","user","tag","field","span","date","page","order","limit","keyword","tpl","api"].reduce((o,c)=>{const s=t[c];if(s==null)return o;if(c==="blog"){const i=t[c];return $.isNumber(i)?`${o}/${a.bid}/${i}`:`${o}/${i.split("/").map(g).join("/")}`}if(c==="category"){const i=t[c];return $.isNumber(i)?`${o}/${a.cid}/${i}`:Array.isArray(i)?`${o}/${i.map(g).join("/")}`:`${o}/${g(i)}`}if(c==="entry"){const i=t[c];return $.isNumber(i)?`${o}/${a.eid}/${i}`:`${o}/${g(i)}`}if(c==="user"){const i=t[c];return`${o}/${a.uid}/${i}`}if(c==="field"){const i=t[c];return`${o}/${a.field}/${i.split("/").map(g).join("/")}`}if(c==="span"){const{start:i,end:l}={start:"1000-01-01 00:00:00",end:"9999-12-31 23:59:59",...t[c]};if($.isString(i)&&!j(i))throw new Error(`Invalid start date: ${i}`);if($.isString(l)&&!j(l))throw new Error(`Invalid end date: ${l}`);return`${o}/${g(p(new Date(i)))}/${a.span}/${g(p(new Date(l)))}`}if(c==="date"){if(t.span!=null)return o;const{year:i,month:l,day:f}=t[c];return[i,l,f].reduce((d,b)=>b==null?d:`${d}/${b}`,o)}if(c==="page"){const i=t[c];return i===1?o:`${o}/${a.page}/${i}`}if(c==="tpl"){const i=t[c];return`${o}/${a.tpl}/${i.split("/").map(g).join("/")}`}return Array.isArray(s)?s.length>0?`${o}/${a[c]}/${s.map(g).join("/")}`:o:`${o}/${a[c]}/${g(s)}`},"");/\.[^/.]+$/.test(n)||(n+="/");const u=new URLSearchParams(t.searchParams);return u.size>0&&(n+=`?${u.toString()}`),n.startsWith("/")?n.slice(1):n}function z(e){return"blog"in e||"category"in e||"entry"in e||"user"in e||"searchParams"in e}function H(e){return{blog:e.bid,category:e.cid,entry:e.eid,user:e.uid,tag:e.tag,field:e.field,span:e.span,date:e.date,page:e.page,order:e.order,limit:e.limit,keyword:e.keyword,admin:e.admin,tpl:e.tpl,api:e.api}}const V={segments:v};function W(e,r={}){const{segments:t}=A(V,r),a=e.split("/").filter(s=>s),n={},u=[],o=Object.keys(t),c=Object.values(t);for(let s=0;s<a.length;s++){const i=a[s];if(c.includes(i)){const l=o.find(f=>t[f]===i);if(l!==void 0){const f=a[s+1];if(f!==void 0)switch(l){case"bid":case"uid":case"cid":case"eid":case"page":case"limit":n[l]=parseInt(f,10),s++;break;case"admin":case"api":case"keyword":n[l]=f,s++;break;case"tpl":n.tpl=w(a,s+1,c),s+=n.tpl.split("/").length;break;case"field":n.field=w(a,s+1,c),s+=n.field.split("/").length;break;case"tag":n.tag=w(a,s+1,c).split("/").map(d=>d.trim()),s+=n.tag.length;break;case"span":{const[d,b]=B(a[s-1],f);d!==void 0&&b!==void 0&&(n.span={start:d,end:b},u.pop(),s++);break}}}}else u.push(i)}for(let s=0;s<u.length;s++){const i=u[s];if(J(i)){const l=i,f=u[s+1];if(f!==void 0&&Q(f)){const d=u[s+2];if(d!==void 0&&X(d)){n.date={year:parseInt(l,10),month:parseInt(f,10),day:parseInt(d,10)},u.splice(s,3);continue}n.date={year:parseInt(l,10),month:parseInt(f,10)},u.splice(s,2);continue}n.date={year:parseInt(l,10)},u.splice(s,1);continue}}return n.page===void 0&&(n.page=1),n.span===void 0&&(n.span=Z(n)),n.unresolvedPath=u.join("/"),n}function w(e,r,t){const a=[];for(let n=r;n<e.length&&!t.includes(e[n]);n++)a.push(e[n]);return a.join("/")}function B(e,r){const t=j(e)?p(new Date(e)):void 0,a=j(r)?p(new Date(r)):void 0;return[t,a]}function J(e){const r=parseInt(e,10);return r>=1e3&&r<=9999}function Q(e){const r=parseInt(e,10);return r>=1&&r<=12}function X(e){const r=parseInt(e,10);return r>=1&&r<=31}function Z(e){let r=new Date(1e3,0,1,0,0,0),t=new Date(9999,11,31,23,59,59);return e.date!==void 0&&(r=new Date(e.date.year,(e.date.month??1)-1,e.date.day??1),t=new Date(e.date.year,(e.date.month??12)-1,e.date.day??31,23,59,59)),{start:p(r),end:p(t)}}exports.acmsPath=q;exports.commonjsGlobal=M;exports.getDefaultExportFromCjs=S;exports.parseAcmsPath=W;
|
package/dist/index-ZZQxXurp.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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-Jsany_41.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
|
-
};
|
package/dist/index-x-5Zn68j.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
File without changes
|
|
File without changes
|