@fibery/url-utils 2.2.5 → 2.2.7
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/index.ts +0 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -3
- package/lib/jest.config.d.ts +1 -1
- package/lib/make-path.js +4 -3
- package/lib/routes.d.ts +3 -3
- package/lib/routes.js +9 -6
- package/lib/workspaces.d.ts +8 -3
- package/lib/workspaces.js +2 -8
- package/package.json +16 -27
package/index.ts
CHANGED
|
@@ -8,8 +8,6 @@ export const appendQueryFlag = (url: string, key: string) => {
|
|
|
8
8
|
return [`${location}${prefix}${key}`, ...hash].join("#");
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export {makePath} from "./make-path";
|
|
12
|
-
|
|
13
11
|
export const appendQueryParameter = (url: string, key: string, value: string | null) => {
|
|
14
12
|
if (!value) {
|
|
15
13
|
return url;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const appendQueryFlag: (url: string, key: string) => string;
|
|
2
|
-
export { makePath } from "./make-path";
|
|
3
2
|
export declare const appendQueryParameter: (url: string, key: string, value: string | null) => string;
|
|
4
3
|
export declare const getFlagValue: (flag: string) => string | null;
|
|
5
4
|
export declare const getSharingKey: () => string | null;
|
|
@@ -34,3 +33,4 @@ export declare const createPureFiberyEntityUrlMatcher: ({ ownHost }: {
|
|
|
34
33
|
};
|
|
35
34
|
context?: Context;
|
|
36
35
|
};
|
|
36
|
+
export {};
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPureFiberyEntityUrlMatcher = exports.getRelativeUrlFromAbsolute = exports.isPublicUrlInPrivateMode = exports.isRelativeUrl = exports.isPublicAccessMode = exports.isPublicForm = exports.isPublicSpaceMode = exports.isSharingMode = exports.getRefURL = exports.signedFileUrl = exports.appendIsPublicParam = exports.appendSharingKey = exports.getSharingKey = exports.getFlagValue = exports.appendQueryParameter = exports.
|
|
3
|
+
exports.createPureFiberyEntityUrlMatcher = exports.getRelativeUrlFromAbsolute = exports.isPublicUrlInPrivateMode = exports.isRelativeUrl = exports.isPublicAccessMode = exports.isPublicForm = exports.isPublicSpaceMode = exports.isSharingMode = exports.getRefURL = exports.signedFileUrl = exports.appendIsPublicParam = exports.appendSharingKey = exports.getSharingKey = exports.getFlagValue = exports.appendQueryParameter = exports.appendQueryFlag = void 0;
|
|
4
4
|
const url_constants_1 = require("./url-constants");
|
|
5
5
|
const parse_page_location_1 = require("./parse-page-location");
|
|
6
6
|
const locator_utils_1 = require("./locator-utils");
|
|
@@ -10,8 +10,6 @@ const appendQueryFlag = (url, key) => {
|
|
|
10
10
|
return [`${location}${prefix}${key}`, ...hash].join("#");
|
|
11
11
|
};
|
|
12
12
|
exports.appendQueryFlag = appendQueryFlag;
|
|
13
|
-
var make_path_1 = require("./make-path");
|
|
14
|
-
Object.defineProperty(exports, "makePath", { enumerable: true, get: function () { return make_path_1.makePath; } });
|
|
15
13
|
const appendQueryParameter = (url, key, value) => {
|
|
16
14
|
if (!value) {
|
|
17
15
|
return url;
|
package/lib/jest.config.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export let coveragePathIgnorePatterns: string[];
|
|
|
3
3
|
export let collectCoverageFrom: string[];
|
|
4
4
|
export let coverageReporters: string[];
|
|
5
5
|
export let testRunner: string;
|
|
6
|
-
export let setupFiles:
|
|
6
|
+
export let setupFiles: any[];
|
|
7
7
|
export let transformIgnorePatterns: string[];
|
package/lib/make-path.js
CHANGED
|
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makePath = makePath;
|
|
7
|
-
const
|
|
7
|
+
const flow_1 = __importDefault(require("lodash/flow"));
|
|
8
|
+
const memoize_1 = __importDefault(require("lodash/memoize"));
|
|
8
9
|
const path_to_regexp_1 = __importDefault(require("path-to-regexp"));
|
|
9
10
|
const routes_1 = require("./routes");
|
|
10
11
|
const index_1 = require("./index");
|
|
@@ -12,14 +13,14 @@ const url_constants_1 = require("./url-constants");
|
|
|
12
13
|
const throwError = (message) => {
|
|
13
14
|
throw new Error(message);
|
|
14
15
|
};
|
|
15
|
-
const memoizedCompile =
|
|
16
|
+
const memoizedCompile = (0, memoize_1.default)(path_to_regexp_1.default.compile);
|
|
16
17
|
// History lesson: at some point we've encoded space with "–" and then decided to use "_"
|
|
17
18
|
// Need to support both old URLs and new ones
|
|
18
19
|
const encodeSpacesWithDashes = (str = "") => str.replace(/ /g, "–");
|
|
19
20
|
const encodeSpacesWithUnderscores = (str = "") => str.replace(/ /g, "_");
|
|
20
21
|
const makeEncodeURIComponentPretty = (spacesEncoder) => {
|
|
21
22
|
return (str) => {
|
|
22
|
-
return
|
|
23
|
+
return (0, flow_1.default)([
|
|
23
24
|
spacesEncoder,
|
|
24
25
|
encodeURI,
|
|
25
26
|
// old encodePretty implementation from prev version of path-to-regexp
|
package/lib/routes.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
1
|
export declare const appIndexViewLocator = "views";
|
|
3
2
|
export declare const userAccessViewLocator = "access";
|
|
4
3
|
export declare const specificObjectViewsCatalogViewLocator = "views";
|
|
@@ -19,12 +18,13 @@ export declare const highlightTypePage = "/fibery/settings/:subsection(highlight
|
|
|
19
18
|
export declare const highlightTypeFieldEditPage = "/fibery/settings/:subsection(highlights)/:typeWithoutNamespace/fields/:fieldWithoutNamespace/edit";
|
|
20
19
|
export declare const integrationSettingPage = "/fibery/settings/:subsection(integrations)/:templateId";
|
|
21
20
|
export declare const personalIntegrationSettingPage = "/fibery/settings/:subsection(personal-integrations)/:integrationId";
|
|
21
|
+
export declare const typeAccessTemplateSettingPage = "/fibery/settings/:subsection(database-access-templates)/:templateId";
|
|
22
22
|
export declare const isSettingsPage: (page?: string) => boolean;
|
|
23
23
|
export declare const ORDERED_PAGE_ROUTES: Array<[string, string]>;
|
|
24
|
-
export declare const PAGE_ROUTES:
|
|
24
|
+
export declare const PAGE_ROUTES: import("lodash").Dictionary<string>;
|
|
25
25
|
export declare const ORDERED_COMMON_AUX_ROUTES: Array<[string, string]>;
|
|
26
26
|
export declare const ORDERED_AUX_ROUTES: Array<[string, string]>;
|
|
27
|
-
export declare const AUX_ROUTES:
|
|
27
|
+
export declare const AUX_ROUTES: import("lodash").Dictionary<string>;
|
|
28
28
|
export declare const AUX_ROUTES_PATTERNS: string[];
|
|
29
29
|
export declare const ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP: {
|
|
30
30
|
[k: string]: boolean;
|
package/lib/routes.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP = exports.ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP = exports.AUX_ROUTES_PATTERNS = exports.AUX_ROUTES = exports.ORDERED_AUX_ROUTES = exports.ORDERED_COMMON_AUX_ROUTES = exports.PAGE_ROUTES = exports.ORDERED_PAGE_ROUTES = exports.isSettingsPage = exports.personalIntegrationSettingPage = exports.integrationSettingPage = exports.highlightTypeFieldEditPage = exports.highlightTypePage = exports.formsPublicPage = exports.appTypeModePageView = exports.appModePage = exports.appTypeModeGroupEditPage = exports.appTypeModeFieldEditPage = exports.appTypeModeAutomationSpecificPage = exports.appTypeModeAccessTemplatePage = exports.appTypeModeAutomationBasePage = exports.appTypeModeSubPage = exports.appTypeModePage = exports.specificObjectEditorViewLocator = exports.specificObjectUnknownObjectLocator = exports.deprecatedSpecificObjectEditorViewLocator = exports.specificObjectViewsCatalogViewLocator = exports.userAccessViewLocator = exports.appIndexViewLocator = void 0;
|
|
7
|
-
const
|
|
6
|
+
exports.ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP = exports.ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP = exports.AUX_ROUTES_PATTERNS = exports.AUX_ROUTES = exports.ORDERED_AUX_ROUTES = exports.ORDERED_COMMON_AUX_ROUTES = exports.PAGE_ROUTES = exports.ORDERED_PAGE_ROUTES = exports.isSettingsPage = exports.typeAccessTemplateSettingPage = exports.personalIntegrationSettingPage = exports.integrationSettingPage = exports.highlightTypeFieldEditPage = exports.highlightTypePage = exports.formsPublicPage = exports.appTypeModePageView = exports.appModePage = exports.appTypeModeGroupEditPage = exports.appTypeModeFieldEditPage = exports.appTypeModeAutomationSpecificPage = exports.appTypeModeAccessTemplatePage = exports.appTypeModeAutomationBasePage = exports.appTypeModeSubPage = exports.appTypeModePage = exports.specificObjectEditorViewLocator = exports.specificObjectUnknownObjectLocator = exports.deprecatedSpecificObjectEditorViewLocator = exports.specificObjectViewsCatalogViewLocator = exports.userAccessViewLocator = exports.appIndexViewLocator = void 0;
|
|
7
|
+
const fromPairs_1 = __importDefault(require("lodash/fromPairs"));
|
|
8
8
|
const locator_utils_1 = require("./locator-utils");
|
|
9
9
|
const url_constants_1 = require("./url-constants");
|
|
10
10
|
const titleWithPublicIdLocatorPattern = `[^/=]+?-\\d+`;
|
|
@@ -43,6 +43,7 @@ exports.highlightTypePage = "/fibery/settings/:subsection(highlights)/:typeWitho
|
|
|
43
43
|
exports.highlightTypeFieldEditPage = `${exports.highlightTypePage}/fields/:fieldWithoutNamespace/edit`;
|
|
44
44
|
exports.integrationSettingPage = "/fibery/settings/:subsection(integrations)/:templateId";
|
|
45
45
|
exports.personalIntegrationSettingPage = "/fibery/settings/:subsection(personal-integrations)/:integrationId";
|
|
46
|
+
exports.typeAccessTemplateSettingPage = "/fibery/settings/:subsection(database-access-templates)/:templateId";
|
|
46
47
|
const settingsPage = ":page/settings";
|
|
47
48
|
const appPage = ":page/app";
|
|
48
49
|
const typePage = ":page/type";
|
|
@@ -71,11 +72,13 @@ const orderedRoutes = [
|
|
|
71
72
|
[typePage, exports.appTypeModeSubPage],
|
|
72
73
|
[typePage, exports.appTypeModePage],
|
|
73
74
|
[":page/schema", `/:appNamespace(fibery)/settings/domain`],
|
|
75
|
+
[":page/schema", `/workspace-map`],
|
|
74
76
|
[":page/me", `/:appNamespace(fibery)/me`],
|
|
75
77
|
[settingsPage, exports.highlightTypePage],
|
|
76
78
|
[settingsPage, exports.integrationSettingPage],
|
|
77
79
|
[settingsPage, exports.highlightTypeFieldEditPage],
|
|
78
80
|
[settingsPage, exports.personalIntegrationSettingPage],
|
|
81
|
+
[settingsPage, exports.typeAccessTemplateSettingPage],
|
|
79
82
|
[settingsPage, "/fibery/settings/:subsection"],
|
|
80
83
|
[settingsPage, "/fibery/settings"],
|
|
81
84
|
[
|
|
@@ -113,7 +116,7 @@ const orderedRoutes = [
|
|
|
113
116
|
exports.ORDERED_PAGE_ROUTES = orderedRoutes
|
|
114
117
|
.map(([page, route]) => [page, `${url_constants_1.publicUrlPrefix}${route === "/" ? "" : route}`])
|
|
115
118
|
.concat(orderedRoutes);
|
|
116
|
-
exports.PAGE_ROUTES =
|
|
119
|
+
exports.PAGE_ROUTES = (0, fromPairs_1.default)(exports.ORDERED_PAGE_ROUTES);
|
|
117
120
|
exports.ORDERED_COMMON_AUX_ROUTES = [
|
|
118
121
|
[":aux/no-panel-support", `no-panel/:type`],
|
|
119
122
|
[":aux/notifications", `notifications`],
|
|
@@ -124,6 +127,8 @@ exports.ORDERED_COMMON_AUX_ROUTES = [
|
|
|
124
127
|
[":aux/ai-assistant", `ai-assistant/:agentId`],
|
|
125
128
|
[":aux/user-access", `user-access/:userPublicId`],
|
|
126
129
|
[":aux/user-group-access", `user-group-access/:auxTypeNamespace/:auxTypeName/:publicId`],
|
|
130
|
+
[":aux/type-access-templates", `database-access-templates/:templateId`],
|
|
131
|
+
[":aux/type-access-templates", `database-access-templates`],
|
|
127
132
|
[":aux/type-access", `:auxTypeNamespace/:auxTypeName/type-access`],
|
|
128
133
|
[":aux/type-object-editor", `:auxTypeNamespace/:auxTypeName/edit`],
|
|
129
134
|
[":aux/type-object-editor-implicit-namespace", `:auxTypeName/edit`],
|
|
@@ -155,8 +160,6 @@ exports.ORDERED_COMMON_AUX_ROUTES = [
|
|
|
155
160
|
[":aux/app-export", `app-export/:auxAppNamespace/share`],
|
|
156
161
|
[":aux/install-integration-app", `app-sync/:auxAppNamespace`],
|
|
157
162
|
[":aux/users-invite", `invite-users`],
|
|
158
|
-
[":aux/upgrade-to-plan", `upgrade/:auxPlanId`],
|
|
159
|
-
[":aux/update-payment-info", `update-payment-info`],
|
|
160
163
|
[":aux/share-workspace", "share-workspace"],
|
|
161
164
|
[":aux/ai-create-space", "ai-create-space"],
|
|
162
165
|
[":aux/ai-create-view", "ai-create-view/:appNamespace"],
|
|
@@ -168,7 +171,7 @@ exports.ORDERED_AUX_ROUTES = [
|
|
|
168
171
|
...exports.ORDERED_COMMON_AUX_ROUTES,
|
|
169
172
|
[":aux/view-config-raw", "config/raw"],
|
|
170
173
|
];
|
|
171
|
-
exports.AUX_ROUTES =
|
|
174
|
+
exports.AUX_ROUTES = (0, fromPairs_1.default)(exports.ORDERED_AUX_ROUTES);
|
|
172
175
|
exports.AUX_ROUTES_PATTERNS = exports.ORDERED_AUX_ROUTES.map(([, pattern]) => pattern);
|
|
173
176
|
const ROUTES_WITH_PRESERVED_UNDERSCORES = [
|
|
174
177
|
// enums
|
package/lib/workspaces.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
type
|
|
1
|
+
type WorkspaceSettings = {
|
|
2
2
|
display_name: string | null;
|
|
3
3
|
logo?: string | null;
|
|
4
|
+
publicSharing?: {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
} | null;
|
|
7
|
+
documentsDisabled?: boolean;
|
|
8
|
+
custom_domain?: string | null;
|
|
4
9
|
};
|
|
5
10
|
export type Workspace = {
|
|
6
|
-
ui_settings:
|
|
11
|
+
ui_settings: WorkspaceSettings | null;
|
|
7
12
|
name: string;
|
|
8
13
|
};
|
|
9
14
|
export declare function getWorkspaceTitle(workspace: Workspace): string;
|
|
10
15
|
export declare function isCurrentWorkspace(workspace: Workspace, hostname: string): boolean;
|
|
11
|
-
export declare function getCurrentWorkspaceTitle(workspace: Workspace | null, hostname: string
|
|
16
|
+
export declare function getCurrentWorkspaceTitle(workspace: Workspace | null, hostname: string): string;
|
|
12
17
|
export {};
|
package/lib/workspaces.js
CHANGED
|
@@ -16,15 +16,9 @@ function getWorkspaceTitle(workspace) {
|
|
|
16
16
|
return name.split(`-`).map(capitalizeFirstChar).join(" ");
|
|
17
17
|
}
|
|
18
18
|
function isCurrentWorkspace(workspace, hostname) {
|
|
19
|
-
return workspace.name === hostname;
|
|
19
|
+
return workspace.name === hostname || workspace.ui_settings?.custom_domain === hostname;
|
|
20
20
|
}
|
|
21
|
-
function getCurrentWorkspaceTitle(workspace, hostname
|
|
22
|
-
if (hostname === "localhost") {
|
|
23
|
-
if (remoteHost) {
|
|
24
|
-
return `Remote ${remoteHost}`;
|
|
25
|
-
}
|
|
26
|
-
return "Local Development";
|
|
27
|
-
}
|
|
21
|
+
function getCurrentWorkspaceTitle(workspace, hostname) {
|
|
28
22
|
return workspace
|
|
29
23
|
? getWorkspaceTitle(workspace)
|
|
30
24
|
: hostname.split(".")[0].split("-").map(capitalizeFirstChar).join(" ");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/url-utils",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"browser": "index.ts",
|
|
6
6
|
"files": [
|
|
@@ -8,46 +8,35 @@
|
|
|
8
8
|
],
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./lib/index.js",
|
|
11
|
-
"
|
|
12
|
-
"./routes": "./lib/routes.js",
|
|
13
|
-
"./locator-utils": "./lib/locator-utils.js",
|
|
14
|
-
"./url-constants": "./lib/url-constants.js",
|
|
15
|
-
"./workspaces": "./lib/workspaces.js",
|
|
16
|
-
"./make-path": "./make-path.js"
|
|
11
|
+
"./*": "./lib/*.js"
|
|
17
12
|
},
|
|
18
13
|
"fiberyDevExports": {
|
|
19
14
|
".": "./index.ts",
|
|
20
|
-
"
|
|
21
|
-
"./routes": "./routes.ts",
|
|
22
|
-
"./locator-utils": "./locator-utils.ts",
|
|
23
|
-
"./url-constants": "./url-constants.ts",
|
|
24
|
-
"./workspaces": "./workspaces.ts",
|
|
25
|
-
"./make-path": "./make-path.ts"
|
|
15
|
+
"./*": "./*.ts"
|
|
26
16
|
},
|
|
27
17
|
"dependencies": {
|
|
28
18
|
"path-to-regexp": "3.0.0"
|
|
29
19
|
},
|
|
30
20
|
"devDependencies": {
|
|
31
|
-
"@types/jest": "
|
|
21
|
+
"@types/jest": "30.0.0",
|
|
32
22
|
"@types/lodash": "4.14.172",
|
|
33
|
-
"@types/node": "18.11.17",
|
|
34
23
|
"@types/react-router-dom": "5.3.2",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "
|
|
36
|
-
"@typescript-eslint/parser": "
|
|
37
|
-
"eslint": "
|
|
38
|
-
"eslint-plugin-unicorn": "
|
|
39
|
-
"jest": "
|
|
40
|
-
"jest-circus": "
|
|
41
|
-
"jest-junit": "
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
25
|
+
"@typescript-eslint/parser": "8.54.0",
|
|
26
|
+
"eslint": "9.39.2",
|
|
27
|
+
"eslint-plugin-unicorn": "62.0.0",
|
|
28
|
+
"jest": "30.2.0",
|
|
29
|
+
"jest-circus": "30.2.0",
|
|
30
|
+
"jest-junit": "16.0.0",
|
|
42
31
|
"lodash": "4.17.21",
|
|
43
|
-
"react": "18.
|
|
32
|
+
"react": "18.3.1",
|
|
44
33
|
"react-router-dom": "5.3.0",
|
|
45
|
-
"typescript": "5.
|
|
46
|
-
"@fibery/babel-preset": "7.4.
|
|
47
|
-
"@fibery/eslint-config": "
|
|
34
|
+
"typescript": "5.9.3",
|
|
35
|
+
"@fibery/babel-preset": "7.4.2",
|
|
36
|
+
"@fibery/eslint-config": "9.0.1"
|
|
48
37
|
},
|
|
49
38
|
"peerDependencies": {
|
|
50
|
-
"lodash": "
|
|
39
|
+
"lodash": "4.17.21",
|
|
51
40
|
"react-router-dom": "^5.3.0"
|
|
52
41
|
},
|
|
53
42
|
"scripts": {
|