@fibery/url-utils 2.5.1 → 2.5.2
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/lib/diactrics.d.ts +1 -3
- package/lib/diactrics.js +1 -2
- package/lib/index.d.ts +1 -3
- package/lib/index.js +2 -3
- package/lib/locator-utils.d.ts +1 -3
- package/lib/locator-utils.js +1 -2
- package/lib/make-path.d.ts +1 -3
- package/lib/make-path.js +3 -4
- package/lib/parse-page-location.d.ts +1 -3
- package/lib/parse-page-location.js +1 -2
- package/lib/routes.d.ts +1 -3
- package/lib/routes.js +1 -3
- package/lib/url-constants.d.ts +1 -3
- package/lib/url-constants.js +1 -2
- package/lib/workspaces.d.ts +1 -3
- package/lib/workspaces.js +1 -2
- package/package.json +2 -2
package/lib/diactrics.d.ts
CHANGED
package/lib/diactrics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/diactrics.ts
|
|
2
2
|
const DIACTRICS_REPLACEMENT_MAP = {
|
|
3
3
|
à: "a",
|
|
4
4
|
á: "a",
|
|
@@ -107,5 +107,4 @@ const DIACTRICS_REPLACEMENT_MAP = {
|
|
|
107
107
|
const replaceDiactrics = (str = "") => {
|
|
108
108
|
return str.split("").map((char) => DIACTRICS_REPLACEMENT_MAP[char] || char).join("");
|
|
109
109
|
};
|
|
110
|
-
//#endregion
|
|
111
110
|
export { replaceDiactrics };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/index.d.ts
|
|
2
1
|
export declare const appendQueryFlag: (url: string, key: string) => string;
|
|
3
2
|
export declare const appendQueryParameter: (url: string, key: string, value: string | null) => string;
|
|
4
3
|
export declare const getFlagValue: (flag: string) => string | null;
|
|
@@ -35,5 +34,4 @@ export declare const createPureFiberyEntityUrlMatcher: ({ ownHost }: {
|
|
|
35
34
|
anchor?: string;
|
|
36
35
|
};
|
|
37
36
|
context?: Context;
|
|
38
|
-
};
|
|
39
|
-
//#endregion
|
|
37
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseLocator, parseScrollLocator } from "./locator-utils.js";
|
|
2
|
-
import { publicParamName, publicUrlPrefix, sharingParamName } from "./url-constants.js";
|
|
3
2
|
import { getAuxMatch, getPageMatch, safeDecodeURIComponent } from "./parse-page-location.js";
|
|
3
|
+
import { publicParamName, publicUrlPrefix, sharingParamName } from "./url-constants.js";
|
|
4
4
|
import { isEmptyObject } from "@fibery/helpers/src/object";
|
|
5
|
-
|
|
5
|
+
// src/index.ts
|
|
6
6
|
const appendQueryFlag = (url, key) => {
|
|
7
7
|
const [location, ...hash] = url.split("#");
|
|
8
8
|
return [`${location}${location.includes("?") ? "&" : "?"}${key}`, ...hash].join("#");
|
|
@@ -124,5 +124,4 @@ const createPureFiberyEntityUrlMatcher = ({ ownHost }) => (originalUrl, matchUse
|
|
|
124
124
|
context
|
|
125
125
|
};
|
|
126
126
|
};
|
|
127
|
-
//#endregion
|
|
128
127
|
export { appendIsPublicParam, appendQueryFlag, appendQueryParameter, appendSharingKey, createPureFiberyEntityUrlMatcher, createURLFromHref, getFlagValue, getRefURL, getRelativeUrlFromAbsolute, getSharingKey, isPublicAccessMode, isPublicForm, isPublicSpaceMode, isPublicUrlInPrivateMode, isRelativeUrl, isSharingMode, signedFileUrl };
|
package/lib/locator-utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/locator-utils.d.ts
|
|
2
1
|
export declare const escapeRegExpChar: (x: string) => string;
|
|
3
2
|
export declare const parseLocator: (locator: string) => {
|
|
4
3
|
publicId: string | null;
|
|
@@ -19,5 +18,4 @@ export declare const createAnchorScrollLocatorValue: (params: {
|
|
|
19
18
|
id: string;
|
|
20
19
|
text?: string;
|
|
21
20
|
}) => string;
|
|
22
|
-
export declare const parseScrollLocatorValue: (key: string, originalValue: string) => string;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare const parseScrollLocatorValue: (key: string, originalValue: string) => string;
|
package/lib/locator-utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { replaceDiactrics } from "./diactrics.js";
|
|
2
|
-
|
|
2
|
+
// src/locator-utils.ts
|
|
3
3
|
const urlAllowedChars = [
|
|
4
4
|
`$`,
|
|
5
5
|
`-`,
|
|
@@ -65,5 +65,4 @@ const parseScrollLocatorValue = (key, originalValue) => {
|
|
|
65
65
|
}
|
|
66
66
|
return originalValue;
|
|
67
67
|
};
|
|
68
|
-
//#endregion
|
|
69
68
|
export { appPathLocatorPrefix, createAnchorScrollLocatorValue, escapeRegExpChar, isAppPathLocator, makeLocator, parseAppPathLocator, parseLocator, parseScrollLocator, parseScrollLocatorValue };
|
package/lib/make-path.d.ts
CHANGED
package/lib/make-path.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { isPublicSpaceMode } from "./index.js";
|
|
1
2
|
import { appPathLocatorPrefix, isAppPathLocator } from "./locator-utils.js";
|
|
2
|
-
import { publicUrlPrefix } from "./url-constants.js";
|
|
3
3
|
import { AUX_ROUTES_PATTERNS, ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP } from "./routes.js";
|
|
4
|
-
import {
|
|
4
|
+
import { publicUrlPrefix } from "./url-constants.js";
|
|
5
5
|
import flow from "lodash/flow.js";
|
|
6
6
|
import memoize from "lodash/memoize.js";
|
|
7
7
|
import pathToRegExp from "path-to-regexp";
|
|
8
|
-
|
|
8
|
+
// src/make-path.ts
|
|
9
9
|
const throwError = (message) => {
|
|
10
10
|
throw new Error(message);
|
|
11
11
|
};
|
|
@@ -35,5 +35,4 @@ function makePath(route = throwError("route arg is missing"), params = throwErro
|
|
|
35
35
|
const encode = (value, token) => token.name === "scrollLocator" && isAppPathLocator(value) ? encodeAppPathLocator(value) : encodeFn(value);
|
|
36
36
|
return memoizedCompile(publicPrefixMaybe(route))(params, { encode });
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { makePath };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/parse-page-location.d.ts
|
|
2
1
|
export type PageMatch<P, PARAMS> = {
|
|
3
2
|
page: P;
|
|
4
3
|
params: PARAMS;
|
|
@@ -14,5 +13,4 @@ export type AuxMatch<AUX, PARAMS, Namespace = string> = {
|
|
|
14
13
|
};
|
|
15
14
|
export declare function findAuxMatch<Namespace extends string | null>(path: string, pageAppNamespace: Namespace): AuxMatch<string, Record<string, string | undefined>, Namespace> | null;
|
|
16
15
|
export declare function getPageMatch(pathname: string): null | PageMatch<string, Record<string, string | undefined>>;
|
|
17
|
-
export declare function getAuxMatch<Namespace extends string | null>(hash: string | null | undefined, implicitAppNamespace: Namespace): AuxMatch<string, Record<string, string | undefined>, Namespace> | null;
|
|
18
|
-
//#endregion
|
|
16
|
+
export declare function getAuxMatch<Namespace extends string | null>(hash: string | null | undefined, implicitAppNamespace: Namespace): AuxMatch<string, Record<string, string | undefined>, Namespace> | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAppPathLocator } from "./locator-utils.js";
|
|
2
2
|
import { ORDERED_AUX_ROUTES, ORDERED_PAGE_ROUTES, ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP, ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP, isNonSpaPath } from "./routes.js";
|
|
3
3
|
import { matchPath } from "react-router-dom";
|
|
4
|
-
|
|
4
|
+
// src/parse-page-location.ts
|
|
5
5
|
const decodeDashesToSpaces = (str = "") => str.replace(/–/g, " ");
|
|
6
6
|
const decodeUnderscoresToSpaces = (str = "") => str.replace(/_/g, " ");
|
|
7
7
|
const isTest = process.env.NODE_ENV === "test";
|
|
@@ -89,5 +89,4 @@ function getPageMatch(pathname) {
|
|
|
89
89
|
function getAuxMatch(hash, implicitAppNamespace) {
|
|
90
90
|
return hash ? findAuxMatch(decodeURIComponent(hash.slice(1)), implicitAppNamespace) : null;
|
|
91
91
|
}
|
|
92
|
-
//#endregion
|
|
93
92
|
export { findAuxMatch, findPageMatch, getAuxMatch, getPageMatch, safeDecodeURIComponent };
|
package/lib/routes.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/routes.d.ts
|
|
2
1
|
export declare const appIndexViewLocator = "views";
|
|
3
2
|
export declare const userAccessViewLocator = "access";
|
|
4
3
|
export declare const specificObjectViewsCatalogViewLocator = "views";
|
|
@@ -36,5 +35,4 @@ export declare const ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP: {
|
|
|
36
35
|
};
|
|
37
36
|
export declare const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP: {
|
|
38
37
|
[k: string]: boolean;
|
|
39
|
-
};
|
|
40
|
-
//#endregion
|
|
38
|
+
};
|
package/lib/routes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { appPathLocatorPrefix, escapeRegExpChar } from "./locator-utils.js";
|
|
2
2
|
import { appsUrlPrefix, formsUrlPrefix, publicAppsUrlPrefix, publicUrlPrefix } from "./url-constants.js";
|
|
3
3
|
import fromPairs from "lodash/fromPairs.js";
|
|
4
|
-
|
|
4
|
+
// src/routes.ts
|
|
5
5
|
const titleWithPublicIdLocatorPattern = `[^/=]+?-\\d+`;
|
|
6
6
|
const transientIdPattern = "...".split("").map(escapeRegExpChar).join("");
|
|
7
7
|
const titleWithTransientIdLocatorPattern = `[^/]+?-${transientIdPattern}`;
|
|
@@ -90,7 +90,6 @@ const orderedRoutes = [
|
|
|
90
90
|
[":page/audit-soft-deleted-fields", "/audit-soft-deleted-fields"],
|
|
91
91
|
[":page/global-search", "/search"],
|
|
92
92
|
[":page/global-notifications", "/inbox"],
|
|
93
|
-
[":page/desktop-app-redirect", "/desktop"],
|
|
94
93
|
[":page/search", "/search/:id"],
|
|
95
94
|
[":page/watchlist", "/watchlist"],
|
|
96
95
|
[":page/ai-assistant", "/ai-assistant/:agentId"],
|
|
@@ -154,5 +153,4 @@ const PAGE_ROUTES_WITH_PRESERVED_UNDERSCORES = [oauthApplicationSettingPage];
|
|
|
154
153
|
const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS = ORDERED_AUX_ROUTES.filter(([route]) => ROUTES_WITH_PRESERVED_UNDERSCORES.includes(route)).map(([, pattern]) => pattern).concat(PAGE_ROUTES_WITH_PRESERVED_UNDERSCORES.flatMap((route) => [route, withPublicPrefix(route)]));
|
|
155
154
|
const ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP = Object.fromEntries(ROUTES_WITH_PRESERVED_UNDERSCORES.map((x) => [x, true]));
|
|
156
155
|
const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP = Object.fromEntries(ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS.map((x) => [x, true]));
|
|
157
|
-
//#endregion
|
|
158
156
|
export { AUX_ROUTES, AUX_ROUTES_PATTERNS, NON_SPA_PATH_PREFIXES, ORDERED_AUX_ROUTES, ORDERED_COMMON_AUX_ROUTES, ORDERED_PAGE_ROUTES, PAGE_ROUTES, ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP, ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP, appIndexViewLocator, appModePage, appTypeModeAccessTemplatePage, appTypeModeAutomationBasePage, appTypeModeAutomationSpecificPage, appTypeModeFieldEditPage, appTypeModeFormPage, appTypeModeGroupEditPage, appTypeModePage, appTypeModePageView, appTypeModeSubPage, deprecatedSpecificObjectEditorViewLocator, formsPublicPage, highlightTypeFieldEditPage, highlightTypePage, integrationSettingPage, isNonSpaPath, isSettingsPage, oauthApplicationSettingPage, personalIntegrationSettingPage, specificObjectEditorViewLocator, specificObjectUnknownObjectLocator, specificObjectViewsCatalogViewLocator, typeAccessTemplateSettingPage, userAccessViewLocator };
|
package/lib/url-constants.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/url-constants.d.ts
|
|
2
1
|
export declare const sharingParamName = "sharing-key";
|
|
3
2
|
export declare const publicParamName = "is-public";
|
|
4
3
|
export declare const publicUrlPrefix = "/@public";
|
|
@@ -11,5 +10,4 @@ export declare const entityTypeParamName = "entity-type";
|
|
|
11
10
|
export declare const containerTypeParamName = "container-type";
|
|
12
11
|
export declare const documentContainerTypes: readonly ["entity", "comment", "view", "canvas-comment"];
|
|
13
12
|
export type DocumentContainerType = (typeof documentContainerTypes)[number];
|
|
14
|
-
export declare const anyDocumentContainerType: string;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare const anyDocumentContainerType: string;
|
package/lib/url-constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/url-constants.ts
|
|
2
2
|
const sharingParamName = "sharing-key";
|
|
3
3
|
const publicParamName = "is-public";
|
|
4
4
|
const publicUrlPrefix = "/@public";
|
|
@@ -16,5 +16,4 @@ const documentContainerTypes = [
|
|
|
16
16
|
"canvas-comment"
|
|
17
17
|
];
|
|
18
18
|
const anyDocumentContainerType = documentContainerTypes.join(",");
|
|
19
|
-
//#endregion
|
|
20
19
|
export { anyDocumentContainerType, appsUrlPrefix, containerTypeParamName, documentContainerTypes, entityIdParamName, entityTypeParamName, formKeyParamName, formsUrlPrefix, publicAppsUrlPrefix, publicParamName, publicUrlPrefix, sharingParamName };
|
package/lib/workspaces.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/workspaces.d.ts
|
|
2
1
|
type WorkspaceSettings = {
|
|
3
2
|
display_name?: string | null;
|
|
4
3
|
logo?: string | null;
|
|
@@ -22,5 +21,4 @@ export type Workspace = {
|
|
|
22
21
|
export declare function getWorkspaceTitle(workspace: Workspace): string;
|
|
23
22
|
export declare function hostnameFromWorkspace(workspace: Workspace): string;
|
|
24
23
|
export declare function isCurrentWorkspace(workspace: Workspace, hostname: string): boolean;
|
|
25
|
-
export declare function getCurrentWorkspaceTitle(workspace: Workspace | null, hostname: string): string;
|
|
26
|
-
//#endregion
|
|
24
|
+
export declare function getCurrentWorkspaceTitle(workspace: Workspace | null, hostname: string): string;
|
package/lib/workspaces.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/workspaces.ts
|
|
2
2
|
const capitalizeFirstChar = (input) => {
|
|
3
3
|
const str = input || "";
|
|
4
4
|
return str ? str.charAt(0).toUpperCase() + str.slice(1) : str;
|
|
@@ -20,5 +20,4 @@ function isCurrentWorkspace(workspace, hostname) {
|
|
|
20
20
|
function getCurrentWorkspaceTitle(workspace, hostname) {
|
|
21
21
|
return workspace ? getWorkspaceTitle(workspace) : hostname.split(".")[0].split("-").map(capitalizeFirstChar).join(" ");
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { getCurrentWorkspaceTitle, getWorkspaceTitle, hostnameFromWorkspace, isCurrentWorkspace };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/url-utils",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@fibery/helpers": "
|
|
23
|
+
"@fibery/helpers": "7.0.0",
|
|
24
24
|
"lodash": "4.18.1",
|
|
25
25
|
"path-to-regexp": "3.0.0",
|
|
26
26
|
"react-router-dom": "5.3.4"
|