@growi/core 2.1.0 → 2.2.0-next.2bfd4eb5495915760b57720099af769843e4415d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consts/index.cjs +1 -1
- package/dist/consts/index.js +6 -5
- package/dist/consts/ydoc-status.cjs +1 -1
- package/dist/consts/ydoc-status.cjs.map +1 -1
- package/dist/consts/ydoc-status.d.ts +4 -0
- package/dist/consts/ydoc-status.js +3 -2
- package/dist/consts/ydoc-status.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +36 -35
- package/dist/swr/with-utils.d.ts +1 -1
- package/dist/utils/is-deep-equals.d.ts +1 -1
- package/dist/utils/page-path-utils/generate-children-regexp.cjs +1 -1
- package/dist/utils/page-path-utils/generate-children-regexp.cjs.map +1 -1
- package/dist/utils/page-path-utils/generate-children-regexp.js +3 -4
- package/dist/utils/page-path-utils/generate-children-regexp.js.map +1 -1
- package/dist/utils/page-path-utils/index.cjs +1 -1
- package/dist/utils/page-path-utils/index.cjs.map +1 -1
- package/dist/utils/page-path-utils/index.js +46 -50
- package/dist/utils/page-path-utils/index.js.map +1 -1
- package/package.json +7 -6
package/dist/consts/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./accepted-upload-file-type.cjs"),t=require("./growi-plugin.cjs"),e=require("./system.cjs"),o=require("./ydoc-status.cjs");exports.AcceptedUploadFileType=i.AcceptedUploadFileType;exports.GrowiPluginType=t.GrowiPluginType;exports.GrowiDeploymentType=e.GrowiDeploymentType;exports.GrowiServiceType=e.GrowiServiceType;exports.YDocStatus=o.YDocStatus;exports.YJS_WEBSOCKET_BASE_PATH=o.YJS_WEBSOCKET_BASE_PATH;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/consts/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AcceptedUploadFileType as r } from "./accepted-upload-file-type.js";
|
|
2
2
|
import { GrowiPluginType as t } from "./growi-plugin.js";
|
|
3
|
-
import { GrowiDeploymentType as
|
|
4
|
-
import { YDocStatus as
|
|
3
|
+
import { GrowiDeploymentType as T, GrowiServiceType as m } from "./system.js";
|
|
4
|
+
import { YDocStatus as S, YJS_WEBSOCKET_BASE_PATH as c } from "./ydoc-status.js";
|
|
5
5
|
export {
|
|
6
6
|
r as AcceptedUploadFileType,
|
|
7
|
-
|
|
7
|
+
T as GrowiDeploymentType,
|
|
8
8
|
t as GrowiPluginType,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
m as GrowiServiceType,
|
|
10
|
+
S as YDocStatus,
|
|
11
|
+
c as YJS_WEBSOCKET_BASE_PATH
|
|
11
12
|
};
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={NEW:"new",SYNCED:"synced",DRAFT:"draft",OUTDATED:"outdated",ISOLATED:"isolated"};exports.YDocStatus=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={NEW:"new",SYNCED:"synced",DRAFT:"draft",OUTDATED:"outdated",ISOLATED:"isolated"},S="/yjs";exports.YDocStatus=t;exports.YJS_WEBSOCKET_BASE_PATH=S;
|
|
2
2
|
//# sourceMappingURL=ydoc-status.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ydoc-status.cjs","sources":["../../src/consts/ydoc-status.ts"],"sourcesContent":["/**\n * NEW: The document is newly created and not yet synced with the latest revision.\n * SYNCED: The document is synced with the latest revision.\n * DRAFT: The document advances as a draft compared to the latest revision\n * OUTDATED: The document is outdated and needs to be synced with the latest revision.\n * ISOLATED: The latest revision does not exist and the document is isolated from the page.\n */\nexport const YDocStatus = {\n NEW: 'new',\n SYNCED: 'synced',\n DRAFT: 'draft',\n OUTDATED: 'outdated',\n ISOLATED: 'isolated',\n} as const;\nexport type YDocStatus = (typeof YDocStatus)[keyof typeof YDocStatus];\n"],"names":["YDocStatus"],"mappings":"gFAOO,MAAMA,EAAa,CACxB,IAAK,MACL,OAAQ,SACR,MAAO,QACP,SAAU,WACV,SAAU,UACZ"}
|
|
1
|
+
{"version":3,"file":"ydoc-status.cjs","sources":["../../src/consts/ydoc-status.ts"],"sourcesContent":["/**\n * NEW: The document is newly created and not yet synced with the latest revision.\n * SYNCED: The document is synced with the latest revision.\n * DRAFT: The document advances as a draft compared to the latest revision\n * OUTDATED: The document is outdated and needs to be synced with the latest revision.\n * ISOLATED: The latest revision does not exist and the document is isolated from the page.\n */\nexport const YDocStatus = {\n NEW: 'new',\n SYNCED: 'synced',\n DRAFT: 'draft',\n OUTDATED: 'outdated',\n ISOLATED: 'isolated',\n} as const;\nexport type YDocStatus = (typeof YDocStatus)[keyof typeof YDocStatus];\n\n/**\n * The base path for Yjs WebSocket connections.\n */\nexport const YJS_WEBSOCKET_BASE_PATH = '/yjs';\n"],"names":["YDocStatus","YJS_WEBSOCKET_BASE_PATH"],"mappings":"gFAOO,MAAMA,EAAa,CACxB,IAAK,MACL,OAAQ,SACR,MAAO,QACP,SAAU,WACV,SAAU,UACZ,EAMaC,EAA0B"}
|
|
@@ -13,3 +13,7 @@ export declare const YDocStatus: {
|
|
|
13
13
|
readonly ISOLATED: "isolated";
|
|
14
14
|
};
|
|
15
15
|
export type YDocStatus = (typeof YDocStatus)[keyof typeof YDocStatus];
|
|
16
|
+
/**
|
|
17
|
+
* The base path for Yjs WebSocket connections.
|
|
18
|
+
*/
|
|
19
|
+
export declare const YJS_WEBSOCKET_BASE_PATH = "/yjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ydoc-status.js","sources":["../../src/consts/ydoc-status.ts"],"sourcesContent":["/**\n * NEW: The document is newly created and not yet synced with the latest revision.\n * SYNCED: The document is synced with the latest revision.\n * DRAFT: The document advances as a draft compared to the latest revision\n * OUTDATED: The document is outdated and needs to be synced with the latest revision.\n * ISOLATED: The latest revision does not exist and the document is isolated from the page.\n */\nexport const YDocStatus = {\n NEW: 'new',\n SYNCED: 'synced',\n DRAFT: 'draft',\n OUTDATED: 'outdated',\n ISOLATED: 'isolated',\n} as const;\nexport type YDocStatus = (typeof YDocStatus)[keyof typeof YDocStatus];\n"],"names":["YDocStatus"],"mappings":"AAOO,MAAMA,IAAa;AAAA,EACxB,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AACZ;"}
|
|
1
|
+
{"version":3,"file":"ydoc-status.js","sources":["../../src/consts/ydoc-status.ts"],"sourcesContent":["/**\n * NEW: The document is newly created and not yet synced with the latest revision.\n * SYNCED: The document is synced with the latest revision.\n * DRAFT: The document advances as a draft compared to the latest revision\n * OUTDATED: The document is outdated and needs to be synced with the latest revision.\n * ISOLATED: The latest revision does not exist and the document is isolated from the page.\n */\nexport const YDocStatus = {\n NEW: 'new',\n SYNCED: 'synced',\n DRAFT: 'draft',\n OUTDATED: 'outdated',\n ISOLATED: 'isolated',\n} as const;\nexport type YDocStatus = (typeof YDocStatus)[keyof typeof YDocStatus];\n\n/**\n * The base path for Yjs WebSocket connections.\n */\nexport const YJS_WEBSOCKET_BASE_PATH = '/yjs';\n"],"names":["YDocStatus","YJS_WEBSOCKET_BASE_PATH"],"mappings":"AAOO,MAAMA,IAAa;AAAA,EACxB,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AACZ,GAMaC,IAA0B;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./consts/accepted-upload-file-type.cjs"),u=require("./consts/growi-plugin.cjs"),r=require("./consts/system.cjs"),t=require("./consts/ydoc-status.cjs"),l=require("./interfaces/color-scheme.cjs"),o=require("./interfaces/common.cjs"),s=require("./interfaces/config-manager.cjs"),y=require("./interfaces/growi-app-info.cjs"),a=require("./interfaces/growi-theme-metadata.cjs"),g=require("./interfaces/lang.cjs"),e=require("./interfaces/page.cjs"),i=require("./interfaces/primitive/string.cjs"),S=require("./interfaces/revision.cjs"),n=require("./interfaces/scope.cjs"),p=require("./interfaces/subscription.cjs"),T=require("./interfaces/user.cjs");exports.AcceptedUploadFileType=c.AcceptedUploadFileType;exports.GrowiPluginType=u.GrowiPluginType;exports.GrowiDeploymentType=r.GrowiDeploymentType;exports.GrowiServiceType=r.GrowiServiceType;exports.YDocStatus=t.YDocStatus;exports.YJS_WEBSOCKET_BASE_PATH=t.YJS_WEBSOCKET_BASE_PATH;exports.ColorScheme=l.ColorScheme;exports.getIdForRef=o.getIdForRef;exports.getIdStringForRef=o.getIdStringForRef;exports.isPopulated=o.isPopulated;exports.isRef=o.isRef;exports.ConfigSource=s.ConfigSource;exports.defineConfig=s.defineConfig;exports.GrowiWikiType=y.GrowiWikiType;exports.GrowiThemeSchemeType=a.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=a.isGrowiThemeMetadata;exports.AllLang=g.AllLang;exports.Lang=g.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfo=e.isIPageInfo;exports.isIPageInfoForEmpty=e.isIPageInfoForEmpty;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.isIPageNotFoundInfo=e.isIPageNotFoundInfo;exports.isNonBlankString=i.isNonBlankString;exports.isNonEmptyString=i.isNonEmptyString;exports.toNonBlankString=i.toNonBlankString;exports.toNonBlankStringOrUndefined=i.toNonBlankStringOrUndefined;exports.toNonEmptyString=i.toNonEmptyString;exports.toNonEmptyStringOrUndefined=i.toNonEmptyStringOrUndefined;exports.Origin=S.Origin;exports.allOrigin=S.allOrigin;exports.ACTION=n.ACTION;exports.ALL_SIGN=n.ALL_SIGN;exports.SCOPE=n.SCOPE;exports.AllSubscriptionStatusType=p.AllSubscriptionStatusType;exports.SubscriptionStatusType=p.SubscriptionStatusType;exports.USER_STATUS=T.USER_STATUS;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
import { AcceptedUploadFileType as r } from "./consts/accepted-upload-file-type.js";
|
|
2
2
|
import { GrowiPluginType as i } from "./consts/growi-plugin.js";
|
|
3
3
|
import { GrowiDeploymentType as p, GrowiServiceType as f } from "./consts/system.js";
|
|
4
|
-
import { YDocStatus as g } from "./consts/ydoc-status.js";
|
|
5
|
-
import { ColorScheme as
|
|
6
|
-
import { getIdForRef as
|
|
7
|
-
import { ConfigSource as
|
|
4
|
+
import { YDocStatus as g, YJS_WEBSOCKET_BASE_PATH as m } from "./consts/ydoc-status.js";
|
|
5
|
+
import { ColorScheme as s } from "./interfaces/color-scheme.js";
|
|
6
|
+
import { getIdForRef as I, getIdStringForRef as T, isPopulated as l, isRef as y } from "./interfaces/common.js";
|
|
7
|
+
import { ConfigSource as P, defineConfig as u } from "./interfaces/config-manager.js";
|
|
8
8
|
import { GrowiWikiType as c } from "./interfaces/growi-app-info.js";
|
|
9
|
-
import { GrowiThemeSchemeType as N, isGrowiThemeMetadata as
|
|
9
|
+
import { GrowiThemeSchemeType as N, isGrowiThemeMetadata as A } from "./interfaces/growi-theme-metadata.js";
|
|
10
10
|
import { AllLang as O, Lang as w } from "./interfaces/lang.js";
|
|
11
|
-
import { GroupType as
|
|
12
|
-
import { isNonBlankString as
|
|
13
|
-
import { Origin as
|
|
14
|
-
import { ACTION as
|
|
15
|
-
import { AllSubscriptionStatusType as
|
|
16
|
-
import { USER_STATUS as
|
|
11
|
+
import { GroupType as B, PageGrant as L, PageStatus as U, isIPageInfo as _, isIPageInfoForEmpty as h, isIPageInfoForEntity as k, isIPageInfoForListing as R, isIPageInfoForOperation as b, isIPageNotFoundInfo as D } from "./interfaces/page.js";
|
|
12
|
+
import { isNonBlankString as Y, isNonEmptyString as v, toNonBlankString as H, toNonBlankStringOrUndefined as J, toNonEmptyString as K, toNonEmptyStringOrUndefined as M } from "./interfaces/primitive/string.js";
|
|
13
|
+
import { Origin as q, allOrigin as z } from "./interfaces/revision.js";
|
|
14
|
+
import { ACTION as V, ALL_SIGN as X, SCOPE as Z } from "./interfaces/scope.js";
|
|
15
|
+
import { AllSubscriptionStatusType as oo, SubscriptionStatusType as eo } from "./interfaces/subscription.js";
|
|
16
|
+
import { USER_STATUS as to } from "./interfaces/user.js";
|
|
17
17
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
V as ACTION,
|
|
19
|
+
X as ALL_SIGN,
|
|
20
20
|
r as AcceptedUploadFileType,
|
|
21
21
|
O as AllLang,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
oo as AllSubscriptionStatusType,
|
|
23
|
+
s as ColorScheme,
|
|
24
|
+
P as ConfigSource,
|
|
25
|
+
B as GroupType,
|
|
26
26
|
p as GrowiDeploymentType,
|
|
27
27
|
i as GrowiPluginType,
|
|
28
28
|
f as GrowiServiceType,
|
|
29
29
|
N as GrowiThemeSchemeType,
|
|
30
30
|
c as GrowiWikiType,
|
|
31
31
|
w as Lang,
|
|
32
|
-
|
|
32
|
+
q as Origin,
|
|
33
33
|
L as PageGrant,
|
|
34
34
|
U as PageStatus,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
Z as SCOPE,
|
|
36
|
+
eo as SubscriptionStatusType,
|
|
37
|
+
to as USER_STATUS,
|
|
38
38
|
g as YDocStatus,
|
|
39
|
-
|
|
39
|
+
m as YJS_WEBSOCKET_BASE_PATH,
|
|
40
|
+
z as allOrigin,
|
|
40
41
|
u as defineConfig,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
I as getIdForRef,
|
|
43
|
+
T as getIdStringForRef,
|
|
44
|
+
A as isGrowiThemeMetadata,
|
|
45
|
+
_ as isIPageInfo,
|
|
46
|
+
h as isIPageInfoForEmpty,
|
|
47
|
+
k as isIPageInfoForEntity,
|
|
48
|
+
R as isIPageInfoForListing,
|
|
48
49
|
b as isIPageInfoForOperation,
|
|
49
50
|
D as isIPageNotFoundInfo,
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
Y as isNonBlankString,
|
|
52
|
+
v as isNonEmptyString,
|
|
52
53
|
l as isPopulated,
|
|
53
54
|
y as isRef,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
H as toNonBlankString,
|
|
56
|
+
J as toNonBlankStringOrUndefined,
|
|
57
|
+
K as toNonEmptyString,
|
|
58
|
+
M as toNonEmptyStringOrUndefined
|
|
58
59
|
};
|
|
59
60
|
//# sourceMappingURL=index.js.map
|
package/dist/swr/with-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SWRResponse } from 'swr';
|
|
2
2
|
|
|
3
3
|
export type SWRResponseWithUtils<U, D = any, E = any> = SWRResponse<D, E> & U;
|
|
4
|
-
export declare const withUtils: <U, D = any, E = any>(response: SWRResponse<D, E
|
|
4
|
+
export declare const withUtils: <U, D = any, E = any>(response: SWRResponse<D, E>, utils: U) => SWRResponseWithUtils<U, D, E>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isDeepEquals: <T extends object>(obj1: T, obj2: T, visited?: WeakMap<
|
|
1
|
+
export declare const isDeepEquals: <T extends object>(obj1: T, obj2: T, visited?: WeakMap<WeakKey, any>) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./is-top-page.cjs"),n=e=>r.isTopPage(e)?new RegExp(/^\/[^/]+$/):new RegExp(`^${RegExp.escape(e)}(\\/[^/]+)\\/?$`);exports.generateChildrenRegExp=n;
|
|
2
2
|
//# sourceMappingURL=generate-children-regexp.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-children-regexp.cjs","sources":["../../../src/utils/page-path-utils/generate-children-regexp.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"generate-children-regexp.cjs","sources":["../../../src/utils/page-path-utils/generate-children-regexp.ts"],"sourcesContent":["import { isTopPage } from './is-top-page';\n\n/**\n * Generate RegExp instance for one level lower path\n */\nexport const generateChildrenRegExp = (path: string): RegExp => {\n // https://regex101.com/r/laJGzj/1\n // ex. /any_level1\n if (isTopPage(path)) return new RegExp(/^\\/[^/]+$/);\n\n // https://regex101.com/r/mrDJrx/1\n // ex. /parent/any_child OR /any_level1\n return new RegExp(`^${RegExp.escape(path)}(\\\\/[^/]+)\\\\/?$`);\n};\n"],"names":["generateChildrenRegExp","path","isTopPage"],"mappings":"qHAKaA,EAA0BC,GAGjCC,YAAUD,CAAI,EAAU,IAAI,OAAO,WAAW,EAI3C,IAAI,OAAO,IAAI,OAAO,OAAOA,CAAI,CAAC,iBAAiB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import r from "
|
|
2
|
-
|
|
3
|
-
const o = (e) => n(e) ? new RegExp(/^\/[^/]+$/) : new RegExp(`^${r(e)}(\\/[^/]+)\\/?$`);
|
|
1
|
+
import { isTopPage as r } from "./is-top-page.js";
|
|
2
|
+
const p = (e) => r(e) ? new RegExp(/^\/[^/]+$/) : new RegExp(`^${RegExp.escape(e)}(\\/[^/]+)\\/?$`);
|
|
4
3
|
export {
|
|
5
|
-
|
|
4
|
+
p as generateChildrenRegExp
|
|
6
5
|
};
|
|
7
6
|
//# sourceMappingURL=generate-children-regexp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-children-regexp.js","sources":["../../../src/utils/page-path-utils/generate-children-regexp.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"generate-children-regexp.js","sources":["../../../src/utils/page-path-utils/generate-children-regexp.ts"],"sourcesContent":["import { isTopPage } from './is-top-page';\n\n/**\n * Generate RegExp instance for one level lower path\n */\nexport const generateChildrenRegExp = (path: string): RegExp => {\n // https://regex101.com/r/laJGzj/1\n // ex. /any_level1\n if (isTopPage(path)) return new RegExp(/^\\/[^/]+$/);\n\n // https://regex101.com/r/mrDJrx/1\n // ex. /parent/any_child OR /any_level1\n return new RegExp(`^${RegExp.escape(path)}(\\\\/[^/]+)\\\\/?$`);\n};\n"],"names":["generateChildrenRegExp","path","isTopPage"],"mappings":";AAKa,MAAAA,IAAyB,CAACC,MAGjCC,EAAUD,CAAI,IAAU,IAAI,OAAO,WAAW,IAI3C,IAAI,OAAO,IAAI,OAAO,OAAOA,CAAI,CAAC,iBAAiB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../objectid-utils.cjs"),n=require("../path-utils.cjs"),P=require("./is-top-page.cjs"),m=require("./generate-children-regexp.cjs"),i=P.isTopPage,o=e=>e==="/user",d=e=>{const t=e.substring(1);return p.isValidObjectId(t)},c=e=>!!e.match(/^\/user\/[^/]+$/),l=e=>o(e)||c(e),f=e=>!i(e)&&!l(e),$=e=>!!e.match(/^\/user\/.*?$/),E=e=>e==="/trash",T=e=>!!e.match(/^\/trash(\/.*)?$/),w=e=>!!e.match(/^\/share(\/.*)?$/),S=[/\^|\$|\*|\+|#|<|>|%|\?/,/^\/-\/.*/,/^\/_r\/.*/,/^\/_apix?(\/.*)?/,/^\/?https?:\/\/.+$/,/\/{2,}/,/\s+\/\s+/,/.+\/edit$/,/.+\.md$/,/^(\.\.)$/,/(\/\.\.)\/?/,/\\/,/^\/(_search|_private-legacy-pages)(\/.*|$)/,/^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/,/^\/user(?:\/[^/]+)?$/,/^(\/.+){130,}$/],u=e=>!S.some(t=>e.match(t)),v=e=>(e==null?void 0:e.username)==null?"":`/user/${e.username}`,x=(e,t,r)=>{if(t==null)throw new Error("Please input the new page path");const a=new RegExp(`^${RegExp.escape(e)}`,"i");return r.replace(a,t)},A=e=>{if(e!=null)return e.replace(/ /g,"%20").replace(/\u3000/g,"%E3%80%80")},R=(...e)=>{const t=[...e].join("/");if(!u(t))throw new Error("Invalid characters on path");try{return`${new URL(t,"https://dummy").pathname}#edit`}catch{throw new Error("Invalid path format")}},b=e=>{const t=Array.from(new Set(e));return t.filter(r=>!(t.filter(s=>new RegExp(`^${s}\\/.+`,"i").test(r)).length>0))},U=e=>e.filter(t=>!e.some(a=>new RegExp(`^${a.path}\\/.+`,"i").test(t.path))),y=(e,t)=>{if(e===t)return!0;const r=n.addTrailingSlash(e),a=n.addTrailingSlash(t),s=new RegExp(`^${RegExp.escape(r)}`,"i"),g=new RegExp(`^${RegExp.escape(a)}`,"i");return!!(s.test(t)||g.test(e))},h=(e,t)=>{if(e===t)return!0;const r=n.addTrailingSlash(e);return!!new RegExp(`^${RegExp.escape(r)}`,"i").test(t)},D=(e,t)=>!h(e,t),O=e=>e.includes("/"),C=e=>{let t=null;const r=e.match(/^\/user\/([^/]+)\/?/);return r&&(t=r[1]),t},j=e=>/^(?:\/[^/*?[\]{}]+)*\/\*$/.test(e);exports.generateChildrenRegExp=m.generateChildrenRegExp;exports.canMoveByPath=D;exports.convertToNewAffiliationPath=x;exports.encodeSpaces=A;exports.generateEditorPath=R;exports.getUsernameByPath=C;exports.hasSlash=O;exports.isCreatablePage=u;exports.isEitherOfPathAreaOverlap=y;exports.isGlobPatternPath=j;exports.isMovablePage=f;exports.isPathAreaOverlap=h;exports.isPermalink=d;exports.isSharedPage=w;exports.isTopPage=i;exports.isTrashPage=T;exports.isTrashTopPage=E;exports.isUserPage=$;exports.isUsersHomepage=c;exports.isUsersProtectedPages=l;exports.isUsersTopPage=o;exports.omitDuplicateAreaPageFromPages=U;exports.omitDuplicateAreaPathFromPaths=b;exports.userHomepagePath=v;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/utils/page-path-utils/index.ts"],"sourcesContent":["import escapeStringRegexp from 'escape-string-regexp';\n\nimport { isValidObjectId } from '../objectid-utils';\nimport { addTrailingSlash } from '../path-utils';\nimport { isTopPage as _isTopPage } from './is-top-page';\n\nexport const isTopPage = _isTopPage;\n\nexport * from './generate-children-regexp';\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isUsersTopPage = (path: string): boolean => {\n return path === '/user';\n};\n\n/**\n * Whether the path is permalink\n * @param path\n */\nexport const isPermalink = (path: string): boolean => {\n const pageIdStr = path.substring(1);\n return isValidObjectId(pageIdStr);\n};\n\n/**\n * Whether path is user's homepage\n * @param path\n */\nexport const isUsersHomepage = (path: string): boolean => {\n // https://regex101.com/r/utVQct/1\n if (path.match(/^\\/user\\/[^/]+$/)) {\n return true;\n }\n return false;\n};\n\n/**\n * Whether path is the protected pages for systems\n * @param path\n */\nexport const isUsersProtectedPages = (path: string): boolean => {\n return isUsersTopPage(path) || isUsersHomepage(path);\n};\n\n/**\n * Whether path is movable\n * @param path\n */\nexport const isMovablePage = (path: string): boolean => {\n return !isTopPage(path) && !isUsersProtectedPages(path);\n};\n\n/**\n * Whether path belongs to the user page\n * @param path\n */\nexport const isUserPage = (path: string): boolean => {\n // https://regex101.com/r/MwifLR/1\n if (path.match(/^\\/user\\/.*?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isTrashTopPage = (path: string): boolean => {\n return path === '/trash';\n};\n\n/**\n * Whether path belongs to the trash page\n * @param path\n */\nexport const isTrashPage = (path: string): boolean => {\n // https://regex101.com/r/BSDdRr/1\n if (path.match(/^\\/trash(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path belongs to the shared page\n * @param path\n */\nexport const isSharedPage = (path: string): boolean => {\n // https://regex101.com/r/ZjdOiB/1\n if (path.match(/^\\/share(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\nconst restrictedPatternsToCreate: Array<RegExp> = [\n /\\^|\\$|\\*|\\+|#|<|>|%|\\?/,\n /^\\/-\\/.*/,\n /^\\/_r\\/.*/,\n /^\\/_apix?(\\/.*)?/,\n /^\\/?https?:\\/\\/.+$/, // avoid miss in renaming\n /\\/{2,}/, // avoid miss in renaming\n /\\s+\\/\\s+/, // avoid miss in renaming\n /.+\\/edit$/,\n /.+\\.md$/,\n /^(\\.\\.)$/, // see: https://github.com/growilabs/growi/issues/3582\n /(\\/\\.\\.)\\/?/, // see: https://github.com/growilabs/growi/issues/3582\n /\\\\/, // see: https://github.com/growilabs/growi/issues/7241\n /^\\/(_search|_private-legacy-pages)(\\/.*|$)/,\n /^\\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\\/.*|$)/,\n /^\\/user(?:\\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1\n /^(\\/.+){130,}$/, // avoid deep layer path. see: https://regex101.com/r/L0kzOD/1\n];\nexport const isCreatablePage = (path: string): boolean => {\n return !restrictedPatternsToCreate.some((pattern) => path.match(pattern));\n};\n\n/**\n * return user's homepage path\n * @param user\n */\nexport const userHomepagePath = (\n user: { username: string } | null | undefined,\n): string => {\n if (user?.username == null) {\n return '';\n }\n return `/user/${user.username}`;\n};\n\n/**\n * return user path\n * @param parentPath\n * @param childPath\n * @param newPath\n */\nexport const convertToNewAffiliationPath = (\n oldPath: string,\n newPath: string,\n childPath: string,\n): string => {\n if (newPath == null) {\n throw new Error('Please input the new page path');\n }\n const pathRegExp = new RegExp(`^${escapeStringRegexp(oldPath)}`, 'i');\n return childPath.replace(pathRegExp, newPath);\n};\n\n/**\n * Encode SPACE and IDEOGRAPHIC SPACE\n * @param {string} path\n * @returns {string}\n */\nexport const encodeSpaces = (path?: string): string | undefined => {\n if (path == null) {\n return undefined;\n }\n\n // Encode SPACE and IDEOGRAPHIC SPACE\n return path.replace(/ /g, '%20').replace(/\\u3000/g, '%E3%80%80');\n};\n\n/**\n * Generate editor path\n * @param {string} paths\n * @returns {string}\n */\nexport const generateEditorPath = (...paths: string[]): string => {\n const joinedPath = [...paths].join('/');\n\n if (!isCreatablePage(joinedPath)) {\n throw new Error('Invalid characters on path');\n }\n\n try {\n const url = new URL(joinedPath, 'https://dummy');\n return `${url.pathname}#edit`;\n } catch {\n throw new Error('Invalid path format');\n }\n};\n\n/**\n * return paths without duplicate area of regexp /^${path}\\/.+/i\n * ex. expect(omitDuplicateAreaPathFromPaths(['/A', '/A/B', '/A/B/C'])).toStrictEqual(['/A'])\n * @param paths paths to be tested\n * @returns omitted paths\n */\nexport const omitDuplicateAreaPathFromPaths = (paths: string[]): string[] => {\n const uniquePaths = Array.from(new Set(paths));\n return uniquePaths.filter((path) => {\n const isDuplicate =\n uniquePaths.filter((p) => new RegExp(`^${p}\\\\/.+`, 'i').test(path))\n .length > 0;\n\n return !isDuplicate;\n });\n};\n\n/**\n * return pages with path without duplicate area of regexp /^${path}\\/.+/i\n * if the pages' path are the same, it will NOT omit any of them since the other attributes will not be the same\n * @param paths paths to be tested\n * @returns omitted paths\n */\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport const omitDuplicateAreaPageFromPages = (pages: any[]): any[] => {\n return pages.filter((page) => {\n const isDuplicate = pages.some((p) =>\n new RegExp(`^${p.path}\\\\/.+`, 'i').test(page.path),\n );\n\n return !isDuplicate;\n });\n};\n\n/**\n * Check if the area of either path1 or path2 includes the area of the other path\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isEitherOfPathAreaOverlap = (\n path1: string,\n path2: string,\n): boolean => {\n if (path1 === path2) {\n return true;\n }\n\n const path1WithSlash = addTrailingSlash(path1);\n const path2WithSlash = addTrailingSlash(path2);\n\n const path1Area = new RegExp(`^${escapeStringRegexp(path1WithSlash)}`, 'i');\n const path2Area = new RegExp(`^${escapeStringRegexp(path2WithSlash)}`, 'i');\n\n if (path1Area.test(path2) || path2Area.test(path1)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Check if the area of pathToTest includes the area of pathToBeTested\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isPathAreaOverlap = (\n pathToTest: string,\n pathToBeTested: string,\n): boolean => {\n if (pathToTest === pathToBeTested) {\n return true;\n }\n\n const pathWithSlash = addTrailingSlash(pathToTest);\n\n const pathAreaToTest = new RegExp(\n `^${escapeStringRegexp(pathWithSlash)}`,\n 'i',\n );\n if (pathAreaToTest.test(pathToBeTested)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Determine whether can move by fromPath and toPath\n * @param fromPath string\n * @param toPath string\n * @returns boolean\n */\nexport const canMoveByPath = (fromPath: string, toPath: string): boolean => {\n return !isPathAreaOverlap(fromPath, toPath);\n};\n\n/**\n * check if string has '/' in it\n */\nexport const hasSlash = (str: string): boolean => {\n return str.includes('/');\n};\n\n/**\n * Get username from user page path\n * @param path string\n * @returns string | null\n */\nexport const getUsernameByPath = (path: string): string | null => {\n let username: string | null = null;\n // https://regex101.com/r/qj4SfD/1\n const match = path.match(/^\\/user\\/([^/]+)\\/?/);\n if (match) {\n username = match[1];\n }\n\n return username;\n};\n\nexport const isGlobPatternPath = (path: string): boolean => {\n // https://regex101.com/r/IBy7HS/1\n const globPattern = /^(?:\\/[^/*?[\\]{}]+)*\\/\\*$/;\n return globPattern.test(path);\n};\n\nexport * from './is-top-page';\n"],"names":["isTopPage","_isTopPage","isUsersTopPage","path","isPermalink","pageIdStr","isValidObjectId","isUsersHomepage","isUsersProtectedPages","isMovablePage","isUserPage","isTrashTopPage","isTrashPage","isSharedPage","restrictedPatternsToCreate","isCreatablePage","pattern","userHomepagePath","user","convertToNewAffiliationPath","oldPath","newPath","childPath","pathRegExp","escapeStringRegexp","encodeSpaces","generateEditorPath","paths","joinedPath","omitDuplicateAreaPathFromPaths","uniquePaths","p","omitDuplicateAreaPageFromPages","pages","page","isEitherOfPathAreaOverlap","path1","path2","path1WithSlash","addTrailingSlash","path2WithSlash","path1Area","path2Area","isPathAreaOverlap","pathToTest","pathToBeTested","pathWithSlash","canMoveByPath","fromPath","toPath","hasSlash","str","getUsernameByPath","username","match","isGlobPatternPath"],"mappings":"qQAMaA,EAAYC,EAAAA,UAQZC,EAAkBC,GACtBA,IAAS,QAOLC,EAAeD,GAA0B,CAC9C,MAAAE,EAAYF,EAAK,UAAU,CAAC,EAClC,OAAOG,EAAAA,gBAAgBD,CAAS,CAClC,EAMaE,EAAmBJ,GAE1B,EAAAA,EAAK,MAAM,iBAAiB,EAUrBK,EAAyBL,GAC7BD,EAAeC,CAAI,GAAKI,EAAgBJ,CAAI,EAOxCM,EAAiBN,GACrB,CAACH,EAAUG,CAAI,GAAK,CAACK,EAAsBL,CAAI,EAO3CO,EAAcP,GAErB,EAAAA,EAAK,MAAM,eAAe,EAWnBQ,EAAkBR,GACtBA,IAAS,SAOLS,EAAeT,GAEtB,EAAAA,EAAK,MAAM,kBAAkB,EAWtBU,EAAgBV,GAEvB,EAAAA,EAAK,MAAM,kBAAkB,EAO7BW,EAA4C,CAChD,yBACA,WACA,YACA,mBACA,qBACA,SACA,WACA,YACA,UACA,WACA,cACA,KACA,6CACA,yGACA,uBACA,gBACF,EACaC,EAAmBZ,GACvB,CAACW,EAA2B,KA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vCI,EAAY,IAAI,OAAO,IAAIjB,EAAmBc,CAAc,CAAC,GAAI,GAAG,EACpEI,EAAY,IAAI,OAAO,IAAIlB,EAAmBgB,CAAc,CAAC,GAAI,GAAG,EAE1E,MAAI,GAAAC,EAAU,KAAKJ,CAAK,GAAKK,EAAU,KAAKN,CAAK,EAKnD,EASaO,EAAoB,CAC/BC,EACAC,IACY,CACZ,GAAID,IAAeC,EACV,MAAA,GAGH,MAAAC,EAAgBP,mBAAiBK,CAAU,EAM7C,MAAA,EAJmB,IAAI,OACzB,IAAIpB,EAAmBsB,CAAa,CAAC,GACrC,GACF,EACmB,KAAKD,CAAc,CAKxC,EAQaE,EAAgB,CAACC,EAAkBC,IACvC,CAACN,EAAkBK,EAAUC,CAAM,EAM/BC,EAAYC,GAChBA,EAAI,SAAS,GAAG,EAQZC,EAAqBjD,GAAgC,CAChE,IAAIkD,EAA0B,KAExB,MAAAC,EAAQnD,EAAK,MAAM,qBAAqB,EAC9C,OAAImD,IACFD,EAAWC,EAAM,CAAC,GAGbD,CACT,EAEaE,EAAqBpD,GAEZ,4BACD,KAAKA,CAAI"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/utils/page-path-utils/index.ts"],"sourcesContent":["import { isValidObjectId } from '../objectid-utils';\nimport { addTrailingSlash } from '../path-utils';\nimport { isTopPage as _isTopPage } from './is-top-page';\n\nexport const isTopPage = _isTopPage;\n\nexport * from './generate-children-regexp';\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isUsersTopPage = (path: string): boolean => {\n return path === '/user';\n};\n\n/**\n * Whether the path is permalink\n * @param path\n */\nexport const isPermalink = (path: string): boolean => {\n const pageIdStr = path.substring(1);\n return isValidObjectId(pageIdStr);\n};\n\n/**\n * Whether path is user's homepage\n * @param path\n */\nexport const isUsersHomepage = (path: string): boolean => {\n // https://regex101.com/r/utVQct/1\n if (path.match(/^\\/user\\/[^/]+$/)) {\n return true;\n }\n return false;\n};\n\n/**\n * Whether path is the protected pages for systems\n * @param path\n */\nexport const isUsersProtectedPages = (path: string): boolean => {\n return isUsersTopPage(path) || isUsersHomepage(path);\n};\n\n/**\n * Whether path is movable\n * @param path\n */\nexport const isMovablePage = (path: string): boolean => {\n return !isTopPage(path) && !isUsersProtectedPages(path);\n};\n\n/**\n * Whether path belongs to the user page\n * @param path\n */\nexport const isUserPage = (path: string): boolean => {\n // https://regex101.com/r/MwifLR/1\n if (path.match(/^\\/user\\/.*?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isTrashTopPage = (path: string): boolean => {\n return path === '/trash';\n};\n\n/**\n * Whether path belongs to the trash page\n * @param path\n */\nexport const isTrashPage = (path: string): boolean => {\n // https://regex101.com/r/BSDdRr/1\n if (path.match(/^\\/trash(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path belongs to the shared page\n * @param path\n */\nexport const isSharedPage = (path: string): boolean => {\n // https://regex101.com/r/ZjdOiB/1\n if (path.match(/^\\/share(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\nconst restrictedPatternsToCreate: Array<RegExp> = [\n /\\^|\\$|\\*|\\+|#|<|>|%|\\?/,\n /^\\/-\\/.*/,\n /^\\/_r\\/.*/,\n /^\\/_apix?(\\/.*)?/,\n /^\\/?https?:\\/\\/.+$/, // avoid miss in renaming\n /\\/{2,}/, // avoid miss in renaming\n /\\s+\\/\\s+/, // avoid miss in renaming\n /.+\\/edit$/,\n /.+\\.md$/,\n /^(\\.\\.)$/, // see: https://github.com/growilabs/growi/issues/3582\n /(\\/\\.\\.)\\/?/, // see: https://github.com/growilabs/growi/issues/3582\n /\\\\/, // see: https://github.com/growilabs/growi/issues/7241\n /^\\/(_search|_private-legacy-pages)(\\/.*|$)/,\n /^\\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\\/.*|$)/,\n /^\\/user(?:\\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1\n /^(\\/.+){130,}$/, // avoid deep layer path. see: https://regex101.com/r/L0kzOD/1\n];\nexport const isCreatablePage = (path: string): boolean => {\n return !restrictedPatternsToCreate.some((pattern) => path.match(pattern));\n};\n\n/**\n * return user's homepage path\n * @param user\n */\nexport const userHomepagePath = (\n user: { username: string } | null | undefined,\n): string => {\n if (user?.username == null) {\n return '';\n }\n return `/user/${user.username}`;\n};\n\n/**\n * return user path\n * @param parentPath\n * @param childPath\n * @param newPath\n */\nexport const convertToNewAffiliationPath = (\n oldPath: string,\n newPath: string,\n childPath: string,\n): string => {\n if (newPath == null) {\n throw new Error('Please input the new page path');\n }\n const pathRegExp = new RegExp(`^${RegExp.escape(oldPath)}`, 'i');\n return childPath.replace(pathRegExp, newPath);\n};\n\n/**\n * Encode SPACE and IDEOGRAPHIC SPACE\n * @param {string} path\n * @returns {string}\n */\nexport const encodeSpaces = (path?: string): string | undefined => {\n if (path == null) {\n return undefined;\n }\n\n // Encode SPACE and IDEOGRAPHIC SPACE\n return path.replace(/ /g, '%20').replace(/\\u3000/g, '%E3%80%80');\n};\n\n/**\n * Generate editor path\n * @param {string} paths\n * @returns {string}\n */\nexport const generateEditorPath = (...paths: string[]): string => {\n const joinedPath = [...paths].join('/');\n\n if (!isCreatablePage(joinedPath)) {\n throw new Error('Invalid characters on path');\n }\n\n try {\n const url = new URL(joinedPath, 'https://dummy');\n return `${url.pathname}#edit`;\n } catch {\n throw new Error('Invalid path format');\n }\n};\n\n/**\n * return paths without duplicate area of regexp /^${path}\\/.+/i\n * ex. expect(omitDuplicateAreaPathFromPaths(['/A', '/A/B', '/A/B/C'])).toStrictEqual(['/A'])\n * @param paths paths to be tested\n * @returns omitted paths\n */\nexport const omitDuplicateAreaPathFromPaths = (paths: string[]): string[] => {\n const uniquePaths = Array.from(new Set(paths));\n return uniquePaths.filter((path) => {\n const isDuplicate =\n uniquePaths.filter((p) => new RegExp(`^${p}\\\\/.+`, 'i').test(path))\n .length > 0;\n\n return !isDuplicate;\n });\n};\n\n/**\n * return pages with path without duplicate area of regexp /^${path}\\/.+/i\n * if the pages' path are the same, it will NOT omit any of them since the other attributes will not be the same\n * @param paths paths to be tested\n * @returns omitted paths\n */\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport const omitDuplicateAreaPageFromPages = (pages: any[]): any[] => {\n return pages.filter((page) => {\n const isDuplicate = pages.some((p) =>\n new RegExp(`^${p.path}\\\\/.+`, 'i').test(page.path),\n );\n\n return !isDuplicate;\n });\n};\n\n/**\n * Check if the area of either path1 or path2 includes the area of the other path\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isEitherOfPathAreaOverlap = (\n path1: string,\n path2: string,\n): boolean => {\n if (path1 === path2) {\n return true;\n }\n\n const path1WithSlash = addTrailingSlash(path1);\n const path2WithSlash = addTrailingSlash(path2);\n\n const path1Area = new RegExp(`^${RegExp.escape(path1WithSlash)}`, 'i');\n const path2Area = new RegExp(`^${RegExp.escape(path2WithSlash)}`, 'i');\n\n if (path1Area.test(path2) || path2Area.test(path1)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Check if the area of pathToTest includes the area of pathToBeTested\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isPathAreaOverlap = (\n pathToTest: string,\n pathToBeTested: string,\n): boolean => {\n if (pathToTest === pathToBeTested) {\n return true;\n }\n\n const pathWithSlash = addTrailingSlash(pathToTest);\n\n const pathAreaToTest = new RegExp(`^${RegExp.escape(pathWithSlash)}`, 'i');\n if (pathAreaToTest.test(pathToBeTested)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Determine whether can move by fromPath and toPath\n * @param fromPath string\n * @param toPath string\n * @returns boolean\n */\nexport const canMoveByPath = (fromPath: string, toPath: string): boolean => {\n return !isPathAreaOverlap(fromPath, toPath);\n};\n\n/**\n * check if string has '/' in it\n */\nexport const hasSlash = (str: string): boolean => {\n return str.includes('/');\n};\n\n/**\n * Get username from user page path\n * @param path string\n * @returns string | null\n */\nexport const getUsernameByPath = (path: string): string | null => {\n let username: string | null = null;\n // https://regex101.com/r/qj4SfD/1\n const match = path.match(/^\\/user\\/([^/]+)\\/?/);\n if (match) {\n username = match[1];\n }\n\n return username;\n};\n\nexport const isGlobPatternPath = (path: string): boolean => {\n // https://regex101.com/r/IBy7HS/1\n const globPattern = /^(?:\\/[^/*?[\\]{}]+)*\\/\\*$/;\n return globPattern.test(path);\n};\n\nexport * from './is-top-page';\n"],"names":["isTopPage","_isTopPage","isUsersTopPage","path","isPermalink","pageIdStr","isValidObjectId","isUsersHomepage","isUsersProtectedPages","isMovablePage","isUserPage","isTrashTopPage","isTrashPage","isSharedPage","restrictedPatternsToCreate","isCreatablePage","pattern","userHomepagePath","user","convertToNewAffiliationPath","oldPath","newPath","childPath","pathRegExp","encodeSpaces","generateEditorPath","paths","joinedPath","omitDuplicateAreaPathFromPaths","uniquePaths","p","omitDuplicateAreaPageFromPages","pages","page","isEitherOfPathAreaOverlap","path1","path2","path1WithSlash","addTrailingSlash","path2WithSlash","path1Area","path2Area","isPathAreaOverlap","pathToTest","pathToBeTested","pathWithSlash","canMoveByPath","fromPath","toPath","hasSlash","str","getUsernameByPath","username","match","isGlobPatternPath"],"mappings":"mOAIaA,EAAYC,EAAAA,UAQZC,EAAkBC,GACtBA,IAAS,QAOLC,EAAeD,GAA0B,CAC9C,MAAAE,EAAYF,EAAK,UAAU,CAAC,EAClC,OAAOG,EAAAA,gBAAgBD,CAAS,CAClC,EAMaE,EAAmBJ,GAE1B,EAAAA,EAAK,MAAM,iBAAiB,EAUrBK,EAAyBL,GAC7BD,EAAeC,CAAI,GAAKI,EAAgBJ,CAAI,EAOxCM,EAAiBN,GACrB,CAACH,EAAUG,CAAI,GAAK,CAACK,EAAsBL,CAAI,EAO3CO,EAAcP,GAErB,EAAAA,EAAK,MAAM,eAAe,EAWnBQ,EAAkBR,GACtBA,IAAS,SAOLS,EAAe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AM,KAAMF,GAC9B,IAAI,OAAO,IAAIA,EAAE,IAAI,QAAS,GAAG,EAAE,KAAKG,EAAK,IAAI,CACnD,CAGD,EAUUC,EAA4B,CACvCC,EACAC,IACY,CACZ,GAAID,IAAUC,EACL,MAAA,GAGH,MAAAC,EAAiBC,mBAAiBH,CAAK,EACvCI,EAAiBD,mBAAiBF,CAAK,EAEvCI,EAAY,IAAI,OAAO,IAAI,OAAO,OAAOH,CAAc,CAAC,GAAI,GAAG,EAC/DI,EAAY,IAAI,OAAO,IAAI,OAAO,OAAOF,CAAc,CAAC,GAAI,GAAG,EAErE,MAAI,GAAAC,EAAU,KAAKJ,CAAK,GAAKK,EAAU,KAAKN,CAAK,EAKnD,EASaO,EAAoB,CAC/BC,EACAC,IACY,CACZ,GAAID,IAAeC,EACV,MAAA,GAGH,MAAAC,EAAgBP,mBAAiBK,CAAU,EAG7C,MAAA,EADmB,IAAI,OAAO,IAAI,OAAO,OAAOE,CAAa,CAAC,GAAI,GAAG,EACtD,KAAKD,CAAc,CAKxC,EAQaE,EAAgB,CAACC,EAAkBC,IACvC,CAACN,EAAkBK,EAAUC,CAAM,EAM/BC,EAAYC,GAChBA,EAAI,SAAS,GAAG,EAQZC,EAAqBhD,GAAgC,CAChE,IAAIiD,EAA0B,KAExB,MAAAC,EAAQlD,EAAK,MAAM,qBAAqB,EAC9C,OAAIkD,IACFD,EAAWC,EAAM,CAAC,GAGbD,CACT,EAEaE,EAAqBnD,GAEZ,4BACD,KAAKA,CAAI"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const l = u, h = (e) => e === "/user", x = (e) => {
|
|
1
|
+
import { isValidObjectId as i } from "../objectid-utils.js";
|
|
2
|
+
import { addTrailingSlash as n } from "../path-utils.js";
|
|
3
|
+
import { isTopPage as c } from "./is-top-page.js";
|
|
4
|
+
import { generateChildrenRegExp as H } from "./generate-children-regexp.js";
|
|
5
|
+
const u = c, l = (e) => e === "/user", E = (e) => {
|
|
7
6
|
const t = e.substring(1);
|
|
8
|
-
return
|
|
9
|
-
},
|
|
7
|
+
return i(t);
|
|
8
|
+
}, h = (e) => !!e.match(/^\/user\/[^/]+$/), p = (e) => l(e) || h(e), w = (e) => !u(e) && !p(e), x = (e) => !!e.match(/^\/user\/.*?$/), R = (e) => e === "/trash", A = (e) => !!e.match(/^\/trash(\/.*)?$/), T = (e) => !!e.match(/^\/share(\/.*)?$/), g = [
|
|
10
9
|
/\^|\$|\*|\+|#|<|>|%|\?/,
|
|
11
10
|
/^\/-\/.*/,
|
|
12
11
|
/^\/_r\/.*/,
|
|
@@ -31,70 +30,67 @@ const l = u, h = (e) => e === "/user", x = (e) => {
|
|
|
31
30
|
// https://regex101.com/r/9Eh2S1/1
|
|
32
31
|
/^(\/.+){130,}$/
|
|
33
32
|
// avoid deep layer path. see: https://regex101.com/r/L0kzOD/1
|
|
34
|
-
],
|
|
33
|
+
], m = (e) => !g.some((t) => e.match(t)), v = (e) => (e == null ? void 0 : e.username) == null ? "" : `/user/${e.username}`, S = (e, t, r) => {
|
|
35
34
|
if (t == null)
|
|
36
35
|
throw new Error("Please input the new page path");
|
|
37
|
-
const s = new RegExp(`^${
|
|
36
|
+
const s = new RegExp(`^${RegExp.escape(e)}`, "i");
|
|
38
37
|
return r.replace(s, t);
|
|
39
|
-
},
|
|
38
|
+
}, b = (e) => {
|
|
40
39
|
if (e != null)
|
|
41
40
|
return e.replace(/ /g, "%20").replace(/\u3000/g, "%E3%80%80");
|
|
42
|
-
},
|
|
41
|
+
}, y = (...e) => {
|
|
43
42
|
const t = [...e].join("/");
|
|
44
|
-
if (!
|
|
43
|
+
if (!m(t))
|
|
45
44
|
throw new Error("Invalid characters on path");
|
|
46
45
|
try {
|
|
47
46
|
return `${new URL(t, "https://dummy").pathname}#edit`;
|
|
48
47
|
} catch {
|
|
49
48
|
throw new Error("Invalid path format");
|
|
50
49
|
}
|
|
51
|
-
},
|
|
50
|
+
}, D = (e) => {
|
|
52
51
|
const t = Array.from(new Set(e));
|
|
53
52
|
return t.filter((r) => !(t.filter((a) => new RegExp(`^${a}\\/.+`, "i").test(r)).length > 0));
|
|
54
|
-
},
|
|
53
|
+
}, U = (e) => e.filter((t) => !e.some(
|
|
55
54
|
(s) => new RegExp(`^${s.path}\\/.+`, "i").test(t.path)
|
|
56
|
-
)),
|
|
55
|
+
)), I = (e, t) => {
|
|
57
56
|
if (e === t)
|
|
58
57
|
return !0;
|
|
59
|
-
const r =
|
|
60
|
-
return !!(a.test(t) ||
|
|
61
|
-
},
|
|
58
|
+
const r = n(e), s = n(t), a = new RegExp(`^${RegExp.escape(r)}`, "i"), o = new RegExp(`^${RegExp.escape(s)}`, "i");
|
|
59
|
+
return !!(a.test(t) || o.test(e));
|
|
60
|
+
}, f = (e, t) => {
|
|
62
61
|
if (e === t)
|
|
63
62
|
return !0;
|
|
64
|
-
const r =
|
|
65
|
-
return !!new RegExp(
|
|
66
|
-
|
|
67
|
-
"i"
|
|
68
|
-
).test(t);
|
|
69
|
-
}, j = (e, t) => !P(e, t), C = (e) => e.includes("/"), W = (e) => {
|
|
63
|
+
const r = n(e);
|
|
64
|
+
return !!new RegExp(`^${RegExp.escape(r)}`, "i").test(t);
|
|
65
|
+
}, O = (e, t) => !f(e, t), _ = (e) => e.includes("/"), j = (e) => {
|
|
70
66
|
let t = null;
|
|
71
67
|
const r = e.match(/^\/user\/([^/]+)\/?/);
|
|
72
68
|
return r && (t = r[1]), t;
|
|
73
|
-
},
|
|
69
|
+
}, C = (e) => /^(?:\/[^/*?[\]{}]+)*\/\*$/.test(e);
|
|
74
70
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
71
|
+
O as canMoveByPath,
|
|
72
|
+
S as convertToNewAffiliationPath,
|
|
73
|
+
b as encodeSpaces,
|
|
74
|
+
H as generateChildrenRegExp,
|
|
75
|
+
y as generateEditorPath,
|
|
76
|
+
j as getUsernameByPath,
|
|
77
|
+
_ as hasSlash,
|
|
78
|
+
m as isCreatablePage,
|
|
79
|
+
I as isEitherOfPathAreaOverlap,
|
|
80
|
+
C as isGlobPatternPath,
|
|
81
|
+
w as isMovablePage,
|
|
82
|
+
f as isPathAreaOverlap,
|
|
83
|
+
E as isPermalink,
|
|
84
|
+
T as isSharedPage,
|
|
85
|
+
u as isTopPage,
|
|
86
|
+
A as isTrashPage,
|
|
87
|
+
R as isTrashTopPage,
|
|
88
|
+
x as isUserPage,
|
|
89
|
+
h as isUsersHomepage,
|
|
90
|
+
p as isUsersProtectedPages,
|
|
91
|
+
l as isUsersTopPage,
|
|
92
|
+
U as omitDuplicateAreaPageFromPages,
|
|
93
|
+
D as omitDuplicateAreaPathFromPaths,
|
|
94
|
+
v as userHomepagePath
|
|
99
95
|
};
|
|
100
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/page-path-utils/index.ts"],"sourcesContent":["import escapeStringRegexp from 'escape-string-regexp';\n\nimport { isValidObjectId } from '../objectid-utils';\nimport { addTrailingSlash } from '../path-utils';\nimport { isTopPage as _isTopPage } from './is-top-page';\n\nexport const isTopPage = _isTopPage;\n\nexport * from './generate-children-regexp';\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isUsersTopPage = (path: string): boolean => {\n return path === '/user';\n};\n\n/**\n * Whether the path is permalink\n * @param path\n */\nexport const isPermalink = (path: string): boolean => {\n const pageIdStr = path.substring(1);\n return isValidObjectId(pageIdStr);\n};\n\n/**\n * Whether path is user's homepage\n * @param path\n */\nexport const isUsersHomepage = (path: string): boolean => {\n // https://regex101.com/r/utVQct/1\n if (path.match(/^\\/user\\/[^/]+$/)) {\n return true;\n }\n return false;\n};\n\n/**\n * Whether path is the protected pages for systems\n * @param path\n */\nexport const isUsersProtectedPages = (path: string): boolean => {\n return isUsersTopPage(path) || isUsersHomepage(path);\n};\n\n/**\n * Whether path is movable\n * @param path\n */\nexport const isMovablePage = (path: string): boolean => {\n return !isTopPage(path) && !isUsersProtectedPages(path);\n};\n\n/**\n * Whether path belongs to the user page\n * @param path\n */\nexport const isUserPage = (path: string): boolean => {\n // https://regex101.com/r/MwifLR/1\n if (path.match(/^\\/user\\/.*?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isTrashTopPage = (path: string): boolean => {\n return path === '/trash';\n};\n\n/**\n * Whether path belongs to the trash page\n * @param path\n */\nexport const isTrashPage = (path: string): boolean => {\n // https://regex101.com/r/BSDdRr/1\n if (path.match(/^\\/trash(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path belongs to the shared page\n * @param path\n */\nexport const isSharedPage = (path: string): boolean => {\n // https://regex101.com/r/ZjdOiB/1\n if (path.match(/^\\/share(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\nconst restrictedPatternsToCreate: Array<RegExp> = [\n /\\^|\\$|\\*|\\+|#|<|>|%|\\?/,\n /^\\/-\\/.*/,\n /^\\/_r\\/.*/,\n /^\\/_apix?(\\/.*)?/,\n /^\\/?https?:\\/\\/.+$/, // avoid miss in renaming\n /\\/{2,}/, // avoid miss in renaming\n /\\s+\\/\\s+/, // avoid miss in renaming\n /.+\\/edit$/,\n /.+\\.md$/,\n /^(\\.\\.)$/, // see: https://github.com/growilabs/growi/issues/3582\n /(\\/\\.\\.)\\/?/, // see: https://github.com/growilabs/growi/issues/3582\n /\\\\/, // see: https://github.com/growilabs/growi/issues/7241\n /^\\/(_search|_private-legacy-pages)(\\/.*|$)/,\n /^\\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\\/.*|$)/,\n /^\\/user(?:\\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1\n /^(\\/.+){130,}$/, // avoid deep layer path. see: https://regex101.com/r/L0kzOD/1\n];\nexport const isCreatablePage = (path: string): boolean => {\n return !restrictedPatternsToCreate.some((pattern) => path.match(pattern));\n};\n\n/**\n * return user's homepage path\n * @param user\n */\nexport const userHomepagePath = (\n user: { username: string } | null | undefined,\n): string => {\n if (user?.username == null) {\n return '';\n }\n return `/user/${user.username}`;\n};\n\n/**\n * return user path\n * @param parentPath\n * @param childPath\n * @param newPath\n */\nexport const convertToNewAffiliationPath = (\n oldPath: string,\n newPath: string,\n childPath: string,\n): string => {\n if (newPath == null) {\n throw new Error('Please input the new page path');\n }\n const pathRegExp = new RegExp(`^${escapeStringRegexp(oldPath)}`, 'i');\n return childPath.replace(pathRegExp, newPath);\n};\n\n/**\n * Encode SPACE and IDEOGRAPHIC SPACE\n * @param {string} path\n * @returns {string}\n */\nexport const encodeSpaces = (path?: string): string | undefined => {\n if (path == null) {\n return undefined;\n }\n\n // Encode SPACE and IDEOGRAPHIC SPACE\n return path.replace(/ /g, '%20').replace(/\\u3000/g, '%E3%80%80');\n};\n\n/**\n * Generate editor path\n * @param {string} paths\n * @returns {string}\n */\nexport const generateEditorPath = (...paths: string[]): string => {\n const joinedPath = [...paths].join('/');\n\n if (!isCreatablePage(joinedPath)) {\n throw new Error('Invalid characters on path');\n }\n\n try {\n const url = new URL(joinedPath, 'https://dummy');\n return `${url.pathname}#edit`;\n } catch {\n throw new Error('Invalid path format');\n }\n};\n\n/**\n * return paths without duplicate area of regexp /^${path}\\/.+/i\n * ex. expect(omitDuplicateAreaPathFromPaths(['/A', '/A/B', '/A/B/C'])).toStrictEqual(['/A'])\n * @param paths paths to be tested\n * @returns omitted paths\n */\nexport const omitDuplicateAreaPathFromPaths = (paths: string[]): string[] => {\n const uniquePaths = Array.from(new Set(paths));\n return uniquePaths.filter((path) => {\n const isDuplicate =\n uniquePaths.filter((p) => new RegExp(`^${p}\\\\/.+`, 'i').test(path))\n .length > 0;\n\n return !isDuplicate;\n });\n};\n\n/**\n * return pages with path without duplicate area of regexp /^${path}\\/.+/i\n * if the pages' path are the same, it will NOT omit any of them since the other attributes will not be the same\n * @param paths paths to be tested\n * @returns omitted paths\n */\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport const omitDuplicateAreaPageFromPages = (pages: any[]): any[] => {\n return pages.filter((page) => {\n const isDuplicate = pages.some((p) =>\n new RegExp(`^${p.path}\\\\/.+`, 'i').test(page.path),\n );\n\n return !isDuplicate;\n });\n};\n\n/**\n * Check if the area of either path1 or path2 includes the area of the other path\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isEitherOfPathAreaOverlap = (\n path1: string,\n path2: string,\n): boolean => {\n if (path1 === path2) {\n return true;\n }\n\n const path1WithSlash = addTrailingSlash(path1);\n const path2WithSlash = addTrailingSlash(path2);\n\n const path1Area = new RegExp(`^${escapeStringRegexp(path1WithSlash)}`, 'i');\n const path2Area = new RegExp(`^${escapeStringRegexp(path2WithSlash)}`, 'i');\n\n if (path1Area.test(path2) || path2Area.test(path1)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Check if the area of pathToTest includes the area of pathToBeTested\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isPathAreaOverlap = (\n pathToTest: string,\n pathToBeTested: string,\n): boolean => {\n if (pathToTest === pathToBeTested) {\n return true;\n }\n\n const pathWithSlash = addTrailingSlash(pathToTest);\n\n const pathAreaToTest = new RegExp(\n `^${escapeStringRegexp(pathWithSlash)}`,\n 'i',\n );\n if (pathAreaToTest.test(pathToBeTested)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Determine whether can move by fromPath and toPath\n * @param fromPath string\n * @param toPath string\n * @returns boolean\n */\nexport const canMoveByPath = (fromPath: string, toPath: string): boolean => {\n return !isPathAreaOverlap(fromPath, toPath);\n};\n\n/**\n * check if string has '/' in it\n */\nexport const hasSlash = (str: string): boolean => {\n return str.includes('/');\n};\n\n/**\n * Get username from user page path\n * @param path string\n * @returns string | null\n */\nexport const getUsernameByPath = (path: string): string | null => {\n let username: string | null = null;\n // https://regex101.com/r/qj4SfD/1\n const match = path.match(/^\\/user\\/([^/]+)\\/?/);\n if (match) {\n username = match[1];\n }\n\n return username;\n};\n\nexport const isGlobPatternPath = (path: string): boolean => {\n // https://regex101.com/r/IBy7HS/1\n const globPattern = /^(?:\\/[^/*?[\\]{}]+)*\\/\\*$/;\n return globPattern.test(path);\n};\n\nexport * from './is-top-page';\n"],"names":["isTopPage","_isTopPage","isUsersTopPage","path","isPermalink","pageIdStr","isValidObjectId","isUsersHomepage","isUsersProtectedPages","isMovablePage","isUserPage","isTrashTopPage","isTrashPage","isSharedPage","restrictedPatternsToCreate","isCreatablePage","pattern","userHomepagePath","user","convertToNewAffiliationPath","oldPath","newPath","childPath","pathRegExp","escapeStringRegexp","encodeSpaces","generateEditorPath","paths","joinedPath","omitDuplicateAreaPathFromPaths","uniquePaths","p","omitDuplicateAreaPageFromPages","pages","page","isEitherOfPathAreaOverlap","path1","path2","path1WithSlash","addTrailingSlash","path2WithSlash","path1Area","path2Area","isPathAreaOverlap","pathToTest","pathToBeTested","pathWithSlash","canMoveByPath","fromPath","toPath","hasSlash","str","getUsernameByPath","username","match","isGlobPatternPath"],"mappings":";;;;;AAMO,MAAMA,IAAYC,GAQZC,IAAiB,CAACC,MACtBA,MAAS,SAOLC,IAAc,CAACD,MAA0B;AAC9C,QAAAE,IAAYF,EAAK,UAAU,CAAC;AAClC,SAAOG,EAAgBD,CAAS;AAClC,GAMaE,IAAkB,CAACJ,MAE1B,EAAAA,EAAK,MAAM,iBAAiB,GAUrBK,IAAwB,CAACL,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AAIkD,IAA0B;AAExB,QAAAC,IAAQnD,EAAK,MAAM,qBAAqB;AAC9C,SAAImD,MACFD,IAAWC,EAAM,CAAC,IAGbD;AACT,GAEaE,IAAoB,CAACpD,MAEZ,4BACD,KAAKA,CAAI;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/page-path-utils/index.ts"],"sourcesContent":["import { isValidObjectId } from '../objectid-utils';\nimport { addTrailingSlash } from '../path-utils';\nimport { isTopPage as _isTopPage } from './is-top-page';\n\nexport const isTopPage = _isTopPage;\n\nexport * from './generate-children-regexp';\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isUsersTopPage = (path: string): boolean => {\n return path === '/user';\n};\n\n/**\n * Whether the path is permalink\n * @param path\n */\nexport const isPermalink = (path: string): boolean => {\n const pageIdStr = path.substring(1);\n return isValidObjectId(pageIdStr);\n};\n\n/**\n * Whether path is user's homepage\n * @param path\n */\nexport const isUsersHomepage = (path: string): boolean => {\n // https://regex101.com/r/utVQct/1\n if (path.match(/^\\/user\\/[^/]+$/)) {\n return true;\n }\n return false;\n};\n\n/**\n * Whether path is the protected pages for systems\n * @param path\n */\nexport const isUsersProtectedPages = (path: string): boolean => {\n return isUsersTopPage(path) || isUsersHomepage(path);\n};\n\n/**\n * Whether path is movable\n * @param path\n */\nexport const isMovablePage = (path: string): boolean => {\n return !isTopPage(path) && !isUsersProtectedPages(path);\n};\n\n/**\n * Whether path belongs to the user page\n * @param path\n */\nexport const isUserPage = (path: string): boolean => {\n // https://regex101.com/r/MwifLR/1\n if (path.match(/^\\/user\\/.*?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path is the top page of users\n * @param path\n */\nexport const isTrashTopPage = (path: string): boolean => {\n return path === '/trash';\n};\n\n/**\n * Whether path belongs to the trash page\n * @param path\n */\nexport const isTrashPage = (path: string): boolean => {\n // https://regex101.com/r/BSDdRr/1\n if (path.match(/^\\/trash(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Whether path belongs to the shared page\n * @param path\n */\nexport const isSharedPage = (path: string): boolean => {\n // https://regex101.com/r/ZjdOiB/1\n if (path.match(/^\\/share(\\/.*)?$/)) {\n return true;\n }\n\n return false;\n};\n\nconst restrictedPatternsToCreate: Array<RegExp> = [\n /\\^|\\$|\\*|\\+|#|<|>|%|\\?/,\n /^\\/-\\/.*/,\n /^\\/_r\\/.*/,\n /^\\/_apix?(\\/.*)?/,\n /^\\/?https?:\\/\\/.+$/, // avoid miss in renaming\n /\\/{2,}/, // avoid miss in renaming\n /\\s+\\/\\s+/, // avoid miss in renaming\n /.+\\/edit$/,\n /.+\\.md$/,\n /^(\\.\\.)$/, // see: https://github.com/growilabs/growi/issues/3582\n /(\\/\\.\\.)\\/?/, // see: https://github.com/growilabs/growi/issues/3582\n /\\\\/, // see: https://github.com/growilabs/growi/issues/7241\n /^\\/(_search|_private-legacy-pages)(\\/.*|$)/,\n /^\\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\\/.*|$)/,\n /^\\/user(?:\\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1\n /^(\\/.+){130,}$/, // avoid deep layer path. see: https://regex101.com/r/L0kzOD/1\n];\nexport const isCreatablePage = (path: string): boolean => {\n return !restrictedPatternsToCreate.some((pattern) => path.match(pattern));\n};\n\n/**\n * return user's homepage path\n * @param user\n */\nexport const userHomepagePath = (\n user: { username: string } | null | undefined,\n): string => {\n if (user?.username == null) {\n return '';\n }\n return `/user/${user.username}`;\n};\n\n/**\n * return user path\n * @param parentPath\n * @param childPath\n * @param newPath\n */\nexport const convertToNewAffiliationPath = (\n oldPath: string,\n newPath: string,\n childPath: string,\n): string => {\n if (newPath == null) {\n throw new Error('Please input the new page path');\n }\n const pathRegExp = new RegExp(`^${RegExp.escape(oldPath)}`, 'i');\n return childPath.replace(pathRegExp, newPath);\n};\n\n/**\n * Encode SPACE and IDEOGRAPHIC SPACE\n * @param {string} path\n * @returns {string}\n */\nexport const encodeSpaces = (path?: string): string | undefined => {\n if (path == null) {\n return undefined;\n }\n\n // Encode SPACE and IDEOGRAPHIC SPACE\n return path.replace(/ /g, '%20').replace(/\\u3000/g, '%E3%80%80');\n};\n\n/**\n * Generate editor path\n * @param {string} paths\n * @returns {string}\n */\nexport const generateEditorPath = (...paths: string[]): string => {\n const joinedPath = [...paths].join('/');\n\n if (!isCreatablePage(joinedPath)) {\n throw new Error('Invalid characters on path');\n }\n\n try {\n const url = new URL(joinedPath, 'https://dummy');\n return `${url.pathname}#edit`;\n } catch {\n throw new Error('Invalid path format');\n }\n};\n\n/**\n * return paths without duplicate area of regexp /^${path}\\/.+/i\n * ex. expect(omitDuplicateAreaPathFromPaths(['/A', '/A/B', '/A/B/C'])).toStrictEqual(['/A'])\n * @param paths paths to be tested\n * @returns omitted paths\n */\nexport const omitDuplicateAreaPathFromPaths = (paths: string[]): string[] => {\n const uniquePaths = Array.from(new Set(paths));\n return uniquePaths.filter((path) => {\n const isDuplicate =\n uniquePaths.filter((p) => new RegExp(`^${p}\\\\/.+`, 'i').test(path))\n .length > 0;\n\n return !isDuplicate;\n });\n};\n\n/**\n * return pages with path without duplicate area of regexp /^${path}\\/.+/i\n * if the pages' path are the same, it will NOT omit any of them since the other attributes will not be the same\n * @param paths paths to be tested\n * @returns omitted paths\n */\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport const omitDuplicateAreaPageFromPages = (pages: any[]): any[] => {\n return pages.filter((page) => {\n const isDuplicate = pages.some((p) =>\n new RegExp(`^${p.path}\\\\/.+`, 'i').test(page.path),\n );\n\n return !isDuplicate;\n });\n};\n\n/**\n * Check if the area of either path1 or path2 includes the area of the other path\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isEitherOfPathAreaOverlap = (\n path1: string,\n path2: string,\n): boolean => {\n if (path1 === path2) {\n return true;\n }\n\n const path1WithSlash = addTrailingSlash(path1);\n const path2WithSlash = addTrailingSlash(path2);\n\n const path1Area = new RegExp(`^${RegExp.escape(path1WithSlash)}`, 'i');\n const path2Area = new RegExp(`^${RegExp.escape(path2WithSlash)}`, 'i');\n\n if (path1Area.test(path2) || path2Area.test(path1)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Check if the area of pathToTest includes the area of pathToBeTested\n * The area of path is the same as /^\\/hoge\\//i\n * @param pathToTest string\n * @param pathToBeTested string\n * @returns boolean\n */\nexport const isPathAreaOverlap = (\n pathToTest: string,\n pathToBeTested: string,\n): boolean => {\n if (pathToTest === pathToBeTested) {\n return true;\n }\n\n const pathWithSlash = addTrailingSlash(pathToTest);\n\n const pathAreaToTest = new RegExp(`^${RegExp.escape(pathWithSlash)}`, 'i');\n if (pathAreaToTest.test(pathToBeTested)) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Determine whether can move by fromPath and toPath\n * @param fromPath string\n * @param toPath string\n * @returns boolean\n */\nexport const canMoveByPath = (fromPath: string, toPath: string): boolean => {\n return !isPathAreaOverlap(fromPath, toPath);\n};\n\n/**\n * check if string has '/' in it\n */\nexport const hasSlash = (str: string): boolean => {\n return str.includes('/');\n};\n\n/**\n * Get username from user page path\n * @param path string\n * @returns string | null\n */\nexport const getUsernameByPath = (path: string): string | null => {\n let username: string | null = null;\n // https://regex101.com/r/qj4SfD/1\n const match = path.match(/^\\/user\\/([^/]+)\\/?/);\n if (match) {\n username = match[1];\n }\n\n return username;\n};\n\nexport const isGlobPatternPath = (path: string): boolean => {\n // https://regex101.com/r/IBy7HS/1\n const globPattern = /^(?:\\/[^/*?[\\]{}]+)*\\/\\*$/;\n return globPattern.test(path);\n};\n\nexport * from './is-top-page';\n"],"names":["isTopPage","_isTopPage","isUsersTopPage","path","isPermalink","pageIdStr","isValidObjectId","isUsersHomepage","isUsersProtectedPages","isMovablePage","isUserPage","isTrashTopPage","isTrashPage","isSharedPage","restrictedPatternsToCreate","isCreatablePage","pattern","userHomepagePath","user","convertToNewAffiliationPath","oldPath","newPath","childPath","pathRegExp","encodeSpaces","generateEditorPath","paths","joinedPath","omitDuplicateAreaPathFromPaths","uniquePaths","p","omitDuplicateAreaPageFromPages","pages","page","isEitherOfPathAreaOverlap","path1","path2","path1WithSlash","addTrailingSlash","path2WithSlash","path1Area","path2Area","isPathAreaOverlap","pathToTest","pathToBeTested","pathWithSlash","canMoveByPath","fromPath","toPath","hasSlash","str","getUsernameByPath","username","match","isGlobPatternPath"],"mappings":";;;;AAIO,MAAMA,IAAYC,GAQZC,IAAiB,CAACC,MACtBA,MAAS,SAOLC,IAAc,CAACD,MAA0B;AAC9C,QAAAE,IAAYF,EAAK,UAAU,CAAC;AAClC,SAAOG,EAAgBD,CAAS;AAClC,GAMaE,IAAkB,CAACJ,MAE1B,EAAAA,EAAK,MAAM,iBAAiB,GAUrBK,IAAwB,CAACL,MAC7BD,EAAeC,CAAI,KAAKI,EAAgBJ,CAAI,GAOxCM,IAAgB,CAACN,MACrB,CAACH,EAAUG,CAAI,KAAK,CAACK,EAAsBL,CAAI,GAO3CO,IAAa,CAACP,MAErB,EAAAA,EAAK,MAAM,eAAe,GAWnBQ,IAAiB,CAACR,MACtBA,MAAS,UAOLS,IAAc,CAACT,MAEtB,EAAAA,EAAK,MAAM,kBAAkB,GAWtBU,IAAe,CAACV,MAEvB,EAAAA,EAAK,MAAM,kBAAkB,GAO7BW,IAA4C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,GACaC,IAAkB,CAACZ,MACvB,CAACW,EAA2B,KAAK,CAACE,MAAYb,EAAK,MAAMa,CAAO,CAAC,GAO7DC,IAAmB,CAC9BC,OAEIA,KAAA,gBAAAA,EAAM,aAAY,OACb,KAEF,SAASA,EAAK,QAAQ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AG,GAC/DI,IAAY,IAAI,OAAO,IAAI,OAAO,OAAOF,CAAc,CAAC,IAAI,GAAG;AAErE,SAAI,GAAAC,EAAU,KAAKJ,CAAK,KAAKK,EAAU,KAAKN,CAAK;AAKnD,GASaO,IAAoB,CAC/BC,GACAC,MACY;AACZ,MAAID,MAAeC;AACV,WAAA;AAGH,QAAAC,IAAgBP,EAAiBK,CAAU;AAG7C,SAAA,EADmB,IAAI,OAAO,IAAI,OAAO,OAAOE,CAAa,CAAC,IAAI,GAAG,EACtD,KAAKD,CAAc;AAKxC,GAQaE,IAAgB,CAACC,GAAkBC,MACvC,CAACN,EAAkBK,GAAUC,CAAM,GAM/BC,IAAW,CAACC,MAChBA,EAAI,SAAS,GAAG,GAQZC,IAAoB,CAAChD,MAAgC;AAChE,MAAIiD,IAA0B;AAExB,QAAAC,IAAQlD,EAAK,MAAM,qBAAqB;AAC9C,SAAIkD,MACFD,IAAWC,EAAM,CAAC,IAGbD;AACT,GAEaE,IAAoB,CAACnD,MAEZ,4BACD,KAAKA,CAAI;"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@growi/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-next.2bfd4eb5495915760b57720099af769843e4415d",
|
|
4
4
|
"description": "GROWI Core Libraries",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/growilabs/growi"
|
|
9
|
+
},
|
|
6
10
|
"keywords": [
|
|
7
11
|
"growi"
|
|
8
12
|
],
|
|
@@ -59,12 +63,9 @@
|
|
|
59
63
|
"require": "./dist/utils/*.cjs"
|
|
60
64
|
}
|
|
61
65
|
},
|
|
62
|
-
"// comments for dependencies": {
|
|
63
|
-
"escape-string-regexp": "5.0.0 or above exports only ESM"
|
|
64
|
-
},
|
|
66
|
+
"// comments for dependencies": {},
|
|
65
67
|
"dependencies": {
|
|
66
|
-
"bson-objectid": "^2.0.4"
|
|
67
|
-
"escape-string-regexp": "^4.0.0"
|
|
68
|
+
"bson-objectid": "^2.0.4"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
71
|
"@types/express": "^4",
|