@fibery/url-utils 2.2.7 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/diactrics.d.ts +4 -1
- package/lib/diactrics.js +107 -111
- package/lib/index.d.ts +33 -31
- package/lib/index.js +76 -121
- package/lib/locator-utils.d.ts +17 -14
- package/lib/locator-utils.js +49 -54
- package/lib/make-path.d.ts +4 -1
- package/lib/make-path.js +25 -32
- package/lib/parse-page-location.d.ts +17 -14
- package/lib/parse-page-location.js +63 -61
- package/lib/routes.d.ts +36 -32
- package/lib/routes.js +133 -163
- package/lib/url-constants.d.ts +9 -5
- package/lib/url-constants.js +9 -8
- package/lib/workspaces.d.ts +19 -14
- package/lib/workspaces.js +16 -17
- package/package.json +17 -34
- package/index.ts +0 -168
- package/lib/babel.config.d.ts +0 -1
- package/lib/babel.config.js +0 -4
- package/lib/jest.config.d.ts +0 -7
- package/lib/jest.config.js +0 -10
package/lib/routes.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.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
|
-
const locator_utils_1 = require("./locator-utils");
|
|
9
|
-
const url_constants_1 = require("./url-constants");
|
|
1
|
+
import { escapeRegExpChar } from "./locator-utils.js";
|
|
2
|
+
import { formsUrlPrefix, publicUrlPrefix } from "./url-constants.js";
|
|
3
|
+
import fromPairs from "lodash/fromPairs.js";
|
|
4
|
+
//#region src/routes.ts
|
|
10
5
|
const titleWithPublicIdLocatorPattern = `[^/=]+?-\\d+`;
|
|
11
|
-
const transientIdPattern = "...".split("").map(
|
|
6
|
+
const transientIdPattern = "...".split("").map(escapeRegExpChar).join("");
|
|
12
7
|
const titleWithTransientIdLocatorPattern = `[^/]+?-${transientIdPattern}`;
|
|
13
8
|
const transientIdLocatorPattern = transientIdPattern;
|
|
14
9
|
const idLocatorPattern = `\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}`;
|
|
@@ -20,166 +15,141 @@ const commentLocatorPattern = `comment=${publicIdLocatorPattern}`;
|
|
|
20
15
|
const extendedCommentLocatorPattern = `parentComment=${publicIdLocatorPattern}&comment=${publicIdLocatorPattern}`;
|
|
21
16
|
const anchorLocatorPattern = `anchor=${idLocatorPattern}`;
|
|
22
17
|
const anchorWithTitleLocatorPattern = `anchor=${titleWithGuidLocatorPattern}`;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
exports.typeAccessTemplateSettingPage = "/fibery/settings/:subsection(database-access-templates)/:templateId";
|
|
18
|
+
const scrollLocatorPattern = `${extendedCommentLocatorPattern}|${commentLocatorPattern}|${`field=${idLocatorPattern}`}|${anchorLocatorPattern}|${anchorWithTitleLocatorPattern}|anchor=wb-[^/]+`;
|
|
19
|
+
const appIndexViewLocator = "views";
|
|
20
|
+
const userAccessViewLocator = "access";
|
|
21
|
+
const specificObjectViewsCatalogViewLocator = "views";
|
|
22
|
+
const deprecatedSpecificObjectEditorViewLocator = "edit";
|
|
23
|
+
const specificObjectUnknownObjectLocator = "any";
|
|
24
|
+
const specificObjectEditorViewLocator = null;
|
|
25
|
+
const appTypeModePage = `/fibery/space/:appNamespace/:mode/:typeWithoutNamespace`;
|
|
26
|
+
const appTypeModeSubPage = `/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage`;
|
|
27
|
+
const appTypeModeAutomationBasePage = `${appTypeModeSubPage}/:automationType/:automationItemId`;
|
|
28
|
+
const appTypeModeAccessTemplatePage = `${appTypeModeSubPage}/access-templates/:accessTemplateId`;
|
|
29
|
+
const appTypeModeFormPage = `${appTypeModeSubPage}/form/:formId`;
|
|
30
|
+
const appTypeModeAutomationSpecificPage = `${appTypeModeAutomationBasePage}/:automationMode`;
|
|
31
|
+
const appTypeModeFieldEditPage = `${appTypeModeSubPage}/:fieldTitle/edit`;
|
|
32
|
+
const appTypeModeGroupEditPage = `${appTypeModeSubPage}/:typeId/members`;
|
|
33
|
+
const appModePage = `/fibery/space/:appNamespace/:mode`;
|
|
34
|
+
const appTypeModePageView = `${appTypeModePage}/${appIndexViewLocator}/:viewLocator(${viewLocatorPattern})`;
|
|
35
|
+
const formsPublicPage = `${formsUrlPrefix}/:formKey`;
|
|
36
|
+
const highlightTypePage = "/fibery/settings/:subsection(highlights)/:typeWithoutNamespace";
|
|
37
|
+
const highlightTypeFieldEditPage = `${highlightTypePage}/fields/:fieldWithoutNamespace/edit`;
|
|
38
|
+
const integrationSettingPage = "/fibery/settings/:subsection(integrations)/:templateId";
|
|
39
|
+
const personalIntegrationSettingPage = "/fibery/settings/:subsection(personal-integrations)/:integrationId";
|
|
40
|
+
const typeAccessTemplateSettingPage = "/fibery/settings/:subsection(database-access-templates)/:templateId";
|
|
47
41
|
const settingsPage = ":page/settings";
|
|
48
42
|
const appPage = ":page/app";
|
|
49
43
|
const typePage = ":page/type";
|
|
50
|
-
const settingsPages = new Set([
|
|
44
|
+
const settingsPages = /* @__PURE__ */ new Set([
|
|
45
|
+
settingsPage,
|
|
46
|
+
appPage,
|
|
47
|
+
typePage
|
|
48
|
+
]);
|
|
51
49
|
const isSettingsPage = (page) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
return settingsPages.has(page);
|
|
50
|
+
if (!page) return false;
|
|
51
|
+
return settingsPages.has(page);
|
|
56
52
|
};
|
|
57
|
-
exports.isSettingsPage = isSettingsPage;
|
|
58
53
|
const orderedRoutes = [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
],
|
|
112
|
-
[":page/public-form", `/forms/:formKey`],
|
|
113
|
-
[":page/app-root", `/:appNamespace`],
|
|
114
|
-
[":page/root", `/`],
|
|
115
|
-
];
|
|
116
|
-
exports.ORDERED_PAGE_ROUTES = orderedRoutes
|
|
117
|
-
.map(([page, route]) => [page, `${url_constants_1.publicUrlPrefix}${route === "/" ? "" : route}`])
|
|
118
|
-
.concat(orderedRoutes);
|
|
119
|
-
exports.PAGE_ROUTES = (0, fromPairs_1.default)(exports.ORDERED_PAGE_ROUTES);
|
|
120
|
-
exports.ORDERED_COMMON_AUX_ROUTES = [
|
|
121
|
-
[":aux/no-panel-support", `no-panel/:type`],
|
|
122
|
-
[":aux/notifications", `notifications`],
|
|
123
|
-
[":aux/not-found", "not-found"],
|
|
124
|
-
[":aux/tutorial", `tutorial/:auxLocator(${auxLocatorPattern})/view`],
|
|
125
|
-
[":aux/ai-assistant-history", `ai-assistant-history`],
|
|
126
|
-
[":aux/ai-assistant", `ai-assistant/:agentId/:conversationId`],
|
|
127
|
-
[":aux/ai-assistant", `ai-assistant/:agentId`],
|
|
128
|
-
[":aux/user-access", `user-access/:userPublicId`],
|
|
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`],
|
|
132
|
-
[":aux/type-access", `:auxTypeNamespace/:auxTypeName/type-access`],
|
|
133
|
-
[":aux/type-object-editor", `:auxTypeNamespace/:auxTypeName/edit`],
|
|
134
|
-
[":aux/type-object-editor-implicit-namespace", `:auxTypeName/edit`],
|
|
135
|
-
[":aux/type-object-editor-for-composite-type", `:nsA/:nameA\\_:nsB/:nameB/edit`],
|
|
136
|
-
[
|
|
137
|
-
":aux/app-view-with-context",
|
|
138
|
-
`:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/context/:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`,
|
|
139
|
-
],
|
|
140
|
-
[
|
|
141
|
-
":aux/app-view",
|
|
142
|
-
`:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`,
|
|
143
|
-
],
|
|
144
|
-
[
|
|
145
|
-
":aux/object-editor",
|
|
146
|
-
`:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`,
|
|
147
|
-
],
|
|
148
|
-
[
|
|
149
|
-
":aux/object-editor-implicit-namespace",
|
|
150
|
-
`:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`,
|
|
151
|
-
],
|
|
152
|
-
[
|
|
153
|
-
":aux/object-editor-for-composite-type",
|
|
154
|
-
`:nsA/:nameA\\_:nsB/:nameB/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`,
|
|
155
|
-
],
|
|
156
|
-
[":aux/gallery-app", `gallery/:auxAppNamespace`],
|
|
157
|
-
[":aux/search", `search/:id`],
|
|
158
|
-
[":aux/shared-with-me", `shared-with-me`],
|
|
159
|
-
[":aux/import", `import`],
|
|
160
|
-
[":aux/app-export", `app-export/:auxAppNamespace/share`],
|
|
161
|
-
[":aux/install-integration-app", `app-sync/:auxAppNamespace`],
|
|
162
|
-
[":aux/users-invite", `invite-users`],
|
|
163
|
-
[":aux/share-workspace", "share-workspace"],
|
|
164
|
-
[":aux/ai-create-space", "ai-create-space"],
|
|
165
|
-
[":aux/ai-create-view", "ai-create-view/:appNamespace"],
|
|
166
|
-
[":aux/ai-update-view-filter", `ai-update-view-filter-:viewId(${idLocatorPattern})`],
|
|
167
|
-
[":aux/book-demo", `book-demo`],
|
|
168
|
-
[":aux/create-entity", `create-entity`],
|
|
54
|
+
[":page/apps-gallery", `/fibery/apps-gallery/:appCategory`],
|
|
55
|
+
[":page/app", `/fibery/space/:appNamespace`],
|
|
56
|
+
[":page/app-access", `/fibery/space/:appNamespace/access`],
|
|
57
|
+
[":page/app-import", `/fibery/space/:appNamespace/import/:connectorId?/:mode?`],
|
|
58
|
+
[":page/app-sync", `/fibery/space/:appNamespace/sync/:connectorId?/:mode?`],
|
|
59
|
+
[":page/database-import", `/fibery/space/:appNamespace/database/:databaseName/import/:connectorId?`],
|
|
60
|
+
[typePage, appModePage],
|
|
61
|
+
[":page/type-view", appTypeModePageView],
|
|
62
|
+
[typePage, appTypeModeFieldEditPage],
|
|
63
|
+
[typePage, appTypeModeGroupEditPage],
|
|
64
|
+
[typePage, appTypeModeAutomationSpecificPage],
|
|
65
|
+
[typePage, appTypeModeAccessTemplatePage],
|
|
66
|
+
[typePage, appTypeModeFormPage],
|
|
67
|
+
[typePage, appTypeModeAutomationBasePage],
|
|
68
|
+
[typePage, appTypeModeSubPage],
|
|
69
|
+
[typePage, appTypeModePage],
|
|
70
|
+
[":page/schema", `/:appNamespace(fibery)/settings/domain`],
|
|
71
|
+
[":page/schema", `/workspace-map`],
|
|
72
|
+
[":page/me", `/:appNamespace(fibery)/me`],
|
|
73
|
+
[settingsPage, highlightTypePage],
|
|
74
|
+
[settingsPage, integrationSettingPage],
|
|
75
|
+
[settingsPage, highlightTypeFieldEditPage],
|
|
76
|
+
[settingsPage, personalIntegrationSettingPage],
|
|
77
|
+
[settingsPage, typeAccessTemplateSettingPage],
|
|
78
|
+
[settingsPage, "/fibery/settings/:subsection"],
|
|
79
|
+
[settingsPage, "/fibery/settings"],
|
|
80
|
+
[":page/app-view", `/:appNamespace/:viewLocator(${appIndexViewLocator}|${viewLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
|
|
81
|
+
[":page/favorite", `/favorites/:parts+`],
|
|
82
|
+
[":page/audit-log", "/audit-log"],
|
|
83
|
+
[":page/home", "/home"],
|
|
84
|
+
[":page/activity", "/activity"],
|
|
85
|
+
[":page/activity-log", "/activity-log"],
|
|
86
|
+
[":page/audit-soft-deleted-fields", "/audit-soft-deleted-fields"],
|
|
87
|
+
[":page/global-search", "/search"],
|
|
88
|
+
[":page/global-notifications", "/inbox"],
|
|
89
|
+
[":page/desktop-app-redirect", "/desktop"],
|
|
90
|
+
[":page/search", "/search/:id"],
|
|
91
|
+
[":page/watchlist", "/watchlist"],
|
|
92
|
+
[":page/ai-assistant", "/ai-assistant/:agentId"],
|
|
93
|
+
[":page/shared-with-me", "/shared-with-me"],
|
|
94
|
+
[":page/trash", "/trash"],
|
|
95
|
+
[":page/trash-bin", "/trash-bin"],
|
|
96
|
+
[":page/not-found", "/not-found"],
|
|
97
|
+
[":page/specific-object-view", [
|
|
98
|
+
`/:appNamespace/:typeWithoutNamespace`,
|
|
99
|
+
`:objectLocator(any|${titleWithPublicIdLocatorPattern}|${publicIdLocatorPattern})`,
|
|
100
|
+
`:viewLocator(${specificObjectViewsCatalogViewLocator}|${deprecatedSpecificObjectEditorViewLocator}|${viewLocatorPattern})?`,
|
|
101
|
+
`:scrollLocator(${scrollLocatorPattern})?`
|
|
102
|
+
].join("/")],
|
|
103
|
+
[":page/public-form", `/forms/:formKey`],
|
|
104
|
+
[":page/app-root", `/:appNamespace`],
|
|
105
|
+
[":page/root", `/`]
|
|
169
106
|
];
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
107
|
+
const ORDERED_PAGE_ROUTES = orderedRoutes.map(([page, route]) => [page, `${publicUrlPrefix}${route === "/" ? "" : route}`]).concat(orderedRoutes);
|
|
108
|
+
const PAGE_ROUTES = fromPairs(ORDERED_PAGE_ROUTES);
|
|
109
|
+
const ORDERED_COMMON_AUX_ROUTES = [
|
|
110
|
+
[":aux/no-panel-support", `no-panel/:type`],
|
|
111
|
+
[":aux/notifications", `notifications`],
|
|
112
|
+
[":aux/not-found", "not-found"],
|
|
113
|
+
[":aux/tutorial", `tutorial/:auxLocator(${auxLocatorPattern})/view`],
|
|
114
|
+
[":aux/ai-assistant-history", `ai-assistant-history`],
|
|
115
|
+
[":aux/ai-assistant", `ai-assistant/:agentId/:conversationId`],
|
|
116
|
+
[":aux/ai-assistant", `ai-assistant/:agentId`],
|
|
117
|
+
[":aux/user-access", `user-access/:userPublicId`],
|
|
118
|
+
[":aux/user-group-access", `user-group-access/:auxTypeNamespace/:auxTypeName/:publicId`],
|
|
119
|
+
[":aux/type-access-templates", `database-access-templates/:templateId`],
|
|
120
|
+
[":aux/type-access-templates", `database-access-templates`],
|
|
121
|
+
[":aux/type-access", `:auxTypeNamespace/:auxTypeName/type-access`],
|
|
122
|
+
[":aux/type-object-editor", `:auxTypeNamespace/:auxTypeName/edit`],
|
|
123
|
+
[":aux/type-object-editor-implicit-namespace", `:auxTypeName/edit`],
|
|
124
|
+
[":aux/type-object-editor-for-composite-type", `:nsA/:nameA\\_:nsB/:nameB/edit`],
|
|
125
|
+
[":aux/app-view-with-context", `:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/context/:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
|
|
126
|
+
[":aux/app-view", `:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
|
|
127
|
+
[":aux/object-editor", `:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
|
|
128
|
+
[":aux/object-editor-implicit-namespace", `:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
|
|
129
|
+
[":aux/object-editor-for-composite-type", `:nsA/:nameA\\_:nsB/:nameB/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
|
|
130
|
+
[":aux/gallery-app", `gallery/:auxAppNamespace`],
|
|
131
|
+
[":aux/search", `search/:id`],
|
|
132
|
+
[":aux/shared-with-me", `shared-with-me`],
|
|
133
|
+
[":aux/import", `import`],
|
|
134
|
+
[":aux/app-export", `app-export/:auxAppNamespace/share`],
|
|
135
|
+
[":aux/install-integration-app", `app-sync/:auxAppNamespace`],
|
|
136
|
+
[":aux/users-invite", `invite-users`],
|
|
137
|
+
[":aux/share-workspace", "share-workspace"],
|
|
138
|
+
[":aux/ai-create-view", "ai-create-view/:appNamespace"],
|
|
139
|
+
[":aux/ai-update-view-filter", `ai-update-view-filter-:viewId(${idLocatorPattern})`],
|
|
140
|
+
[":aux/book-demo", `book-demo`],
|
|
141
|
+
[":aux/create-entity", `create-entity`]
|
|
173
142
|
];
|
|
174
|
-
|
|
175
|
-
|
|
143
|
+
const ORDERED_AUX_ROUTES = [...ORDERED_COMMON_AUX_ROUTES, [":aux/view-config-raw", "config/raw"]];
|
|
144
|
+
const AUX_ROUTES = fromPairs(ORDERED_AUX_ROUTES);
|
|
145
|
+
const AUX_ROUTES_PATTERNS = ORDERED_AUX_ROUTES.map(([, pattern]) => pattern);
|
|
176
146
|
const ROUTES_WITH_PRESERVED_UNDERSCORES = [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// other
|
|
181
|
-
":aux/upgrade-to-plan",
|
|
147
|
+
":aux/type-object-editor-for-composite-type",
|
|
148
|
+
":aux/object-editor-for-composite-type",
|
|
149
|
+
":aux/upgrade-to-plan"
|
|
182
150
|
];
|
|
183
|
-
const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS =
|
|
184
|
-
|
|
185
|
-
|
|
151
|
+
const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS = ORDERED_AUX_ROUTES.filter(([route]) => ROUTES_WITH_PRESERVED_UNDERSCORES.includes(route)).map(([, pattern]) => pattern);
|
|
152
|
+
const ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP = Object.fromEntries(ROUTES_WITH_PRESERVED_UNDERSCORES.map((x) => [x, true]));
|
|
153
|
+
const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP = Object.fromEntries(ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS.map((x) => [x, true]));
|
|
154
|
+
//#endregion
|
|
155
|
+
export { AUX_ROUTES, AUX_ROUTES_PATTERNS, 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, isSettingsPage, personalIntegrationSettingPage, specificObjectEditorViewLocator, specificObjectUnknownObjectLocator, specificObjectViewsCatalogViewLocator, typeAccessTemplateSettingPage, userAccessViewLocator };
|
package/lib/url-constants.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/url-constants.d.ts
|
|
2
|
+
declare const sharingParamName = "sharing-key";
|
|
3
|
+
declare const publicParamName = "is-public";
|
|
4
|
+
declare const publicUrlPrefix = "/@public";
|
|
5
|
+
declare const formsUrlPrefix = "/@public/forms";
|
|
6
|
+
declare const formKeyParamName = "form-key";
|
|
7
|
+
declare const appsUrlPrefix = "/apps";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { appsUrlPrefix, formKeyParamName, formsUrlPrefix, publicParamName, publicUrlPrefix, sharingParamName };
|
package/lib/url-constants.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//#region src/url-constants.ts
|
|
2
|
+
const sharingParamName = "sharing-key";
|
|
3
|
+
const publicParamName = "is-public";
|
|
4
|
+
const publicUrlPrefix = "/@public";
|
|
5
|
+
const formsUrlPrefix = "/@public/forms";
|
|
6
|
+
const formKeyParamName = "form-key";
|
|
7
|
+
const appsUrlPrefix = "/apps";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { appsUrlPrefix, formKeyParamName, formsUrlPrefix, publicParamName, publicUrlPrefix, sharingParamName };
|
package/lib/workspaces.d.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
//#region src/workspaces.d.ts
|
|
1
2
|
type WorkspaceSettings = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
display_name: string | null;
|
|
4
|
+
logo?: string | null;
|
|
5
|
+
publicSharing?: {
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
} | null;
|
|
8
|
+
documentsDisabled?: boolean;
|
|
9
|
+
custom_domain?: string | null;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
type Workspace = {
|
|
12
|
+
ui_settings: WorkspaceSettings | null;
|
|
13
|
+
name: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
role?: string;
|
|
13
16
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
declare function getWorkspaceTitle(workspace: Workspace): string;
|
|
18
|
+
declare function hostnameFromWorkspace(workspace: Workspace): string;
|
|
19
|
+
declare function isCurrentWorkspace(workspace: Workspace, hostname: string): boolean;
|
|
20
|
+
declare function getCurrentWorkspaceTitle(workspace: Workspace | null, hostname: string): string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Workspace, getCurrentWorkspaceTitle, getWorkspaceTitle, hostnameFromWorkspace, isCurrentWorkspace };
|
package/lib/workspaces.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkspaceTitle = getWorkspaceTitle;
|
|
4
|
-
exports.isCurrentWorkspace = isCurrentWorkspace;
|
|
5
|
-
exports.getCurrentWorkspaceTitle = getCurrentWorkspaceTitle;
|
|
1
|
+
//#region src/workspaces.ts
|
|
6
2
|
const capitalizeFirstChar = (input) => {
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const str = input || "";
|
|
4
|
+
return str ? str.charAt(0).toUpperCase() + str.slice(1) : str;
|
|
9
5
|
};
|
|
6
|
+
function withRolePostfix(title, role) {
|
|
7
|
+
return role ? `${title} (${role})` : title;
|
|
8
|
+
}
|
|
10
9
|
function getWorkspaceTitle(workspace) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
if (workspace.ui_settings?.display_name) return withRolePostfix(workspace.ui_settings.display_name, workspace.role);
|
|
11
|
+
const titleMatches = workspace.name.match(/(.+?)\.fibery\..+/);
|
|
12
|
+
return withRolePostfix((titleMatches ? titleMatches[1] : workspace.name).split(`-`).map(capitalizeFirstChar).join(" "), workspace.role);
|
|
13
|
+
}
|
|
14
|
+
function hostnameFromWorkspace(workspace) {
|
|
15
|
+
return workspace.name;
|
|
17
16
|
}
|
|
18
17
|
function isCurrentWorkspace(workspace, hostname) {
|
|
19
|
-
|
|
18
|
+
return hostnameFromWorkspace(workspace) === hostname || workspace.ui_settings?.custom_domain === hostname;
|
|
20
19
|
}
|
|
21
20
|
function getCurrentWorkspaceTitle(workspace, hostname) {
|
|
22
|
-
|
|
23
|
-
? getWorkspaceTitle(workspace)
|
|
24
|
-
: hostname.split(".")[0].split("-").map(capitalizeFirstChar).join(" ");
|
|
21
|
+
return workspace ? getWorkspaceTitle(workspace) : hostname.split(".")[0].split("-").map(capitalizeFirstChar).join(" ");
|
|
25
22
|
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { getCurrentWorkspaceTitle, getWorkspaceTitle, hostnameFromWorkspace, isCurrentWorkspace };
|
package/package.json
CHANGED
|
@@ -1,48 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/url-utils",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"
|
|
5
|
-
"browser": "index.ts",
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"license": "UNLICENSED",
|
|
6
5
|
"files": [
|
|
7
|
-
"
|
|
6
|
+
"lib"
|
|
8
7
|
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"main": "./lib/index.js",
|
|
11
|
+
"types": "./lib/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
|
-
".":
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
15
|
+
"default": "./lib/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./*": {
|
|
18
|
+
"types": "./lib/*.d.ts",
|
|
19
|
+
"default": "./lib/*.js"
|
|
20
|
+
}
|
|
16
21
|
},
|
|
17
22
|
"dependencies": {
|
|
18
|
-
"path-to-regexp": "3.0.0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@types/jest": "30.0.0",
|
|
22
|
-
"@types/lodash": "4.14.172",
|
|
23
|
-
"@types/react-router-dom": "5.3.2",
|
|
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",
|
|
31
23
|
"lodash": "4.17.21",
|
|
32
|
-
"
|
|
33
|
-
"react-router-dom": "5.3.
|
|
34
|
-
"typescript": "5.9.3",
|
|
35
|
-
"@fibery/babel-preset": "7.4.2",
|
|
36
|
-
"@fibery/eslint-config": "9.0.1"
|
|
24
|
+
"path-to-regexp": "3.0.0",
|
|
25
|
+
"react-router-dom": "5.3.4"
|
|
37
26
|
},
|
|
38
27
|
"peerDependencies": {
|
|
39
28
|
"lodash": "4.17.21",
|
|
40
29
|
"react-router-dom": "^5.3.0"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"test": "jest",
|
|
44
|
-
"build": "rm -rf lib && tsc --project ./tsconfig.build.json",
|
|
45
|
-
"test:ci": "jest --reporters=default --reporters=jest-junit",
|
|
46
|
-
"lint": "eslint ."
|
|
47
30
|
}
|
|
48
31
|
}
|