@fibery/url-utils 2.3.5 → 2.5.0

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.
@@ -1,4 +1,3 @@
1
1
  //#region src/diactrics.d.ts
2
- declare const replaceDiactrics: (str?: string) => string;
3
- //#endregion
4
- export { replaceDiactrics };
2
+ export declare const replaceDiactrics: (str?: string) => string;
3
+ //#endregion
package/lib/index.d.ts CHANGED
@@ -1,27 +1,29 @@
1
1
  //#region src/index.d.ts
2
- declare const appendQueryFlag: (url: string, key: string) => string;
3
- declare const appendQueryParameter: (url: string, key: string, value: string | null) => string;
4
- declare const getFlagValue: (flag: string) => string | null;
5
- declare const getSharingKey: () => string | null;
6
- declare const appendSharingKey: (url?: string | null, sharingKey?: undefined | string | null) => string;
7
- declare const appendIsPublicParam: (url: string) => string;
8
- declare const signedFileUrl: (url?: string | null) => string | null | undefined;
9
- declare const getRefURL: (location?: {
2
+ export declare const appendQueryFlag: (url: string, key: string) => string;
3
+ export declare const appendQueryParameter: (url: string, key: string, value: string | null) => string;
4
+ export declare const getFlagValue: (flag: string) => string | null;
5
+ export declare const getSharingKey: () => string | null;
6
+ export declare const appendSharingKey: (url?: string | null, sharingKey?: undefined | string | null) => string;
7
+ export declare const appendIsPublicParam: (url: string) => string;
8
+ export declare const signedFileUrl: (url?: string | null) => string | null | undefined;
9
+ export declare const getRefURL: (location?: {
10
10
  href: string;
11
11
  origin: string;
12
12
  }) => string;
13
- declare const isSharingMode: boolean;
14
- declare const isPublicSpaceMode: boolean;
15
- declare const isPublicForm: boolean;
16
- declare const isPublicAccessMode: boolean;
17
- declare const isRelativeUrl: (url: string) => boolean;
18
- declare const isPublicUrlInPrivateMode: (absoluteUrl: string, location?: Location) => boolean;
19
- declare const getRelativeUrlFromAbsolute: (absoluteUrl: string, location?: Location) => string;
13
+ export declare const isSharingMode: boolean;
14
+ export declare const isPublicSpaceMode: boolean;
15
+ export declare const isPublicForm: boolean;
16
+ export declare const isPublicAccessMode: boolean;
17
+ export declare const isRelativeUrl: (url: string) => boolean;
18
+ /** Resolves an href the way a user typed it: a bare host like `fibery.io` gets https, a path resolves against `origin`. */
19
+ export declare const createURLFromHref: (href: string, origin?: string) => URL | null;
20
+ export declare const isPublicUrlInPrivateMode: (absoluteUrl: string, location?: Location) => boolean;
21
+ export declare const getRelativeUrlFromAbsolute: (absoluteUrl: string, location?: Location) => string;
20
22
  type Context = {
21
23
  contextEntityTypeName: string;
22
24
  contextEntityPublicId: string;
23
25
  };
24
- declare const createPureFiberyEntityUrlMatcher: ({ ownHost }: {
26
+ export declare const createPureFiberyEntityUrlMatcher: ({ ownHost }: {
25
27
  ownHost: string;
26
28
  }) => (originalUrl: string, matchUserAsWell?: boolean) => null | {
27
29
  publicId: string;
@@ -34,5 +36,4 @@ declare const createPureFiberyEntityUrlMatcher: ({ ownHost }: {
34
36
  };
35
37
  context?: Context;
36
38
  };
37
- //#endregion
38
- export { appendIsPublicParam, appendQueryFlag, appendQueryParameter, appendSharingKey, createPureFiberyEntityUrlMatcher, getFlagValue, getRefURL, getRelativeUrlFromAbsolute, getSharingKey, isPublicAccessMode, isPublicForm, isPublicSpaceMode, isPublicUrlInPrivateMode, isRelativeUrl, isSharingMode, signedFileUrl };
39
+ //#endregion
package/lib/index.js CHANGED
@@ -45,6 +45,23 @@ const validPageMatchSet = /* @__PURE__ */ new Set([":page/app-view", ":page/spec
45
45
  const isRelativeUrl = (url) => {
46
46
  return url.startsWith("/");
47
47
  };
48
+ const bareHostRegex = /^[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_+.~#?&/=]*$/;
49
+ /** Resolves an href the way a user typed it: a bare host like `fibery.io` gets https, a path resolves against `origin`. */
50
+ const createURLFromHref = (href, origin = window.origin) => {
51
+ try {
52
+ return new URL(href);
53
+ } catch {
54
+ if (isRelativeUrl(href)) return new URL(href, origin);
55
+ if (bareHostRegex.test(href)) try {
56
+ return new URL(`https://${href}`);
57
+ } catch {}
58
+ }
59
+ try {
60
+ return new URL(href, origin);
61
+ } catch {
62
+ return null;
63
+ }
64
+ };
48
65
  const isPublicUrlInPrivateMode = (absoluteUrl, location = window.location) => {
49
66
  const isPublic = location.pathname.startsWith(publicUrlPrefix);
50
67
  let urlObject = null;
@@ -107,4 +124,4 @@ const createPureFiberyEntityUrlMatcher = ({ ownHost }) => (originalUrl, matchUse
107
124
  };
108
125
  };
109
126
  //#endregion
110
- export { appendIsPublicParam, appendQueryFlag, appendQueryParameter, appendSharingKey, createPureFiberyEntityUrlMatcher, getFlagValue, getRefURL, getRelativeUrlFromAbsolute, getSharingKey, isPublicAccessMode, isPublicForm, isPublicSpaceMode, isPublicUrlInPrivateMode, isRelativeUrl, isSharingMode, signedFileUrl };
127
+ export { appendIsPublicParam, appendQueryFlag, appendQueryParameter, appendSharingKey, createPureFiberyEntityUrlMatcher, createURLFromHref, getFlagValue, getRefURL, getRelativeUrlFromAbsolute, getSharingKey, isPublicAccessMode, isPublicForm, isPublicSpaceMode, isPublicUrlInPrivateMode, isRelativeUrl, isSharingMode, signedFileUrl };
@@ -1,21 +1,23 @@
1
1
  //#region src/locator-utils.d.ts
2
- declare const escapeRegExpChar: (x: string) => string;
3
- declare const parseLocator: (locator: string) => {
2
+ export declare const escapeRegExpChar: (x: string) => string;
3
+ export declare const parseLocator: (locator: string) => {
4
4
  publicId: string | null;
5
5
  title: null;
6
6
  } | {
7
7
  publicId: string;
8
8
  title: string;
9
9
  };
10
- declare const parseScrollLocator: (locator?: string | null) => Record<string, string | null>;
11
- declare const makeLocator: ({ publicId, title }: {
10
+ export declare const appPathLocatorPrefix = "app-path=";
11
+ export declare const isAppPathLocator: (locator: string) => boolean;
12
+ export declare const parseAppPathLocator: (locator?: string | null) => string | null;
13
+ export declare const parseScrollLocator: (locator?: string | null) => Record<string, string | null>;
14
+ export declare const makeLocator: ({ publicId, title }: {
12
15
  publicId: string | number | null;
13
16
  title?: string | null;
14
17
  }) => string;
15
- declare const createAnchorScrollLocatorValue: (params: {
18
+ export declare const createAnchorScrollLocatorValue: (params: {
16
19
  id: string;
17
20
  text?: string;
18
21
  }) => string;
19
- declare const parseScrollLocatorValue: (key: string, originalValue: string) => string;
20
- //#endregion
21
- export { createAnchorScrollLocatorValue, escapeRegExpChar, makeLocator, parseLocator, parseScrollLocator, parseScrollLocatorValue };
22
+ export declare const parseScrollLocatorValue: (key: string, originalValue: string) => string;
23
+ //#endregion
@@ -33,9 +33,12 @@ const normalizeLocatorTitle = (title, maxLength = TITLE_MAX_LENGTH) => {
33
33
  const normalizedTitle = replaceDiactrics(title.trim());
34
34
  return normalizedTitle.split(" ").filter(Boolean).join("-").match(threeNonUrlChars) ? "" : normalizedTitle.replace(nonUrlChars, " ").trim().replace(/\s+/g, "-").substr(0, maxLength).replace(/-+$/, "");
35
35
  };
36
+ const appPathLocatorPrefix = "app-path=";
37
+ const isAppPathLocator = (locator) => locator.startsWith(appPathLocatorPrefix);
38
+ const parseAppPathLocator = (locator) => locator && isAppPathLocator(locator) ? locator.slice(9) : null;
36
39
  const parseScrollLocator = (locator) => {
37
40
  const defaultResult = { field: null };
38
- if (locator) {
41
+ if (locator && !isAppPathLocator(locator)) {
39
42
  const entries = [...new URLSearchParams(locator).entries()].map(([key, value]) => {
40
43
  return [key, parseScrollLocatorValue(key, value)];
41
44
  });
@@ -63,4 +66,4 @@ const parseScrollLocatorValue = (key, originalValue) => {
63
66
  return originalValue;
64
67
  };
65
68
  //#endregion
66
- export { createAnchorScrollLocatorValue, escapeRegExpChar, makeLocator, parseLocator, parseScrollLocator, parseScrollLocatorValue };
69
+ export { appPathLocatorPrefix, createAnchorScrollLocatorValue, escapeRegExpChar, isAppPathLocator, makeLocator, parseAppPathLocator, parseLocator, parseScrollLocator, parseScrollLocatorValue };
@@ -1,4 +1,3 @@
1
1
  //#region src/make-path.d.ts
2
- declare function makePath(route?: string, params?: Record<string, unknown>): string;
3
- //#endregion
4
- export { makePath };
2
+ export declare function makePath(route?: string, params?: Record<string, unknown>): string;
3
+ //#endregion
package/lib/make-path.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { appPathLocatorPrefix, isAppPathLocator } from "./locator-utils.js";
1
2
  import { publicUrlPrefix } from "./url-constants.js";
2
3
  import { AUX_ROUTES_PATTERNS, ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP } from "./routes.js";
3
4
  import { isPublicSpaceMode } from "./index.js";
@@ -24,13 +25,15 @@ const makeEncodeURIComponentPretty = (spacesEncoder) => {
24
25
  };
25
26
  const makeEncodeURIComponentPrettyUnderscores = makeEncodeURIComponentPretty(encodeSpacesWithUnderscores);
26
27
  const makeEncodeURIComponentPrettyDashes = makeEncodeURIComponentPretty(encodeSpacesWithDashes);
28
+ const encodeAppPathLocator = (locator) => appPathLocatorPrefix + encodeURIComponent(locator.slice(appPathLocatorPrefix.length)).replace(/%2F/g, "/");
27
29
  const publicPrefixMaybe = (route) => {
28
30
  if (isPublicSpaceMode && !AUX_ROUTES_PATTERNS.includes(route) && !route.startsWith("/@public/forms")) return `${publicUrlPrefix}${route}`;
29
31
  return route;
30
32
  };
31
33
  function makePath(route = throwError("route arg is missing"), params = throwError("params arg is missing")) {
32
34
  const encodeFn = ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP[route] ? makeEncodeURIComponentPrettyDashes : makeEncodeURIComponentPrettyUnderscores;
33
- return memoizedCompile(publicPrefixMaybe(route))(params, { encode: encodeFn });
35
+ const encode = (value, token) => token.name === "scrollLocator" && isAppPathLocator(value) ? encodeAppPathLocator(value) : encodeFn(value);
36
+ return memoizedCompile(publicPrefixMaybe(route))(params, { encode });
34
37
  }
35
38
  //#endregion
36
39
  export { makePath };
@@ -1,19 +1,18 @@
1
1
  //#region src/parse-page-location.d.ts
2
- type PageMatch<P, PARAMS> = {
2
+ export type PageMatch<P, PARAMS> = {
3
3
  page: P;
4
4
  params: PARAMS;
5
5
  isFavorite: boolean;
6
6
  matchedPath: string | null;
7
7
  };
8
- declare function safeDecodeURIComponent(maybeEncodedPath: string): string;
9
- declare function findPageMatch(maybeEncodedPath: string): PageMatch<string, Record<string, unknown>> | null;
10
- type AuxMatch<AUX, PARAMS> = {
8
+ export declare function safeDecodeURIComponent(maybeEncodedPath: string): string;
9
+ export declare function findPageMatch(maybeEncodedPath: string): PageMatch<string, Record<string, string | undefined>> | null;
10
+ export type AuxMatch<AUX, PARAMS, Namespace = string> = {
11
11
  aux: AUX;
12
12
  params: PARAMS;
13
- pageAppNamespace: string;
13
+ pageAppNamespace: Namespace;
14
14
  };
15
- declare function findAuxMatch(path: string, pageAppNamespace: string): AuxMatch<string, Record<string, unknown>> | null;
16
- declare function getPageMatch(pathname: string): null | PageMatch<string, Record<string, unknown>>;
17
- declare function getAuxMatch(hash: string | null | undefined, implicitAppNamespace: string): AuxMatch<string, Record<string, unknown>> | null;
18
- //#endregion
19
- export { AuxMatch, PageMatch, findAuxMatch, findPageMatch, getAuxMatch, getPageMatch, safeDecodeURIComponent };
15
+ export declare function findAuxMatch<Namespace extends string | null>(path: string, pageAppNamespace: Namespace): AuxMatch<string, Record<string, string | undefined>, Namespace> | null;
16
+ 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
@@ -1,3 +1,4 @@
1
+ import { isAppPathLocator } from "./locator-utils.js";
1
2
  import { ORDERED_AUX_ROUTES, ORDERED_PAGE_ROUTES, ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP, ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP, isNonSpaPath } from "./routes.js";
2
3
  import { matchPath } from "react-router-dom";
3
4
  //#region src/parse-page-location.ts
@@ -12,6 +13,10 @@ const findTruthy = (items, transform) => {
12
13
  if (isTest && results.length > 1) throw new Error(`Found more than one route: ` + JSON.stringify(results, null, 2));
13
14
  return results[0] || null;
14
15
  };
16
+ const withRawAppPathLocator = (params, raw) => typeof raw?.scrollLocator === "string" && isAppPathLocator(raw.scrollLocator) ? {
17
+ ...params,
18
+ scrollLocator: raw.scrollLocator
19
+ } : params;
15
20
  function safeDecodeURIComponent(maybeEncodedPath) {
16
21
  let path = maybeEncodedPath;
17
22
  try {
@@ -25,16 +30,21 @@ function findPageMatch(maybeEncodedPath) {
25
30
  const dashDecodedPath = decodeDashesToSpaces(path);
26
31
  const processedPath = decodeUnderscoresToSpaces(dashDecodedPath);
27
32
  return findTruthy(ORDERED_PAGE_ROUTES, ([page, route]) => {
28
- const match = matchPath(ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP[route] ? dashDecodedPath : processedPath, {
33
+ const preserveUnderscores = ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP[route];
34
+ const match = matchPath(preserveUnderscores ? dashDecodedPath : processedPath, {
29
35
  path: route,
30
36
  exact: true
31
37
  });
32
- return match ? {
38
+ if (!match) return null;
39
+ return {
33
40
  page,
34
- params: match.params,
41
+ params: preserveUnderscores ? match.params : withRawAppPathLocator(match.params, matchPath(dashDecodedPath, {
42
+ path: route,
43
+ exact: true
44
+ })?.params),
35
45
  isFavorite: false,
36
46
  matchedPath: match.path
37
- } : null;
47
+ };
38
48
  });
39
49
  }
40
50
  function findAuxMatch(path, pageAppNamespace) {
@@ -50,12 +60,13 @@ function findAuxMatch(path, pageAppNamespace) {
50
60
  params: match.params,
51
61
  pageAppNamespace
52
62
  };
63
+ const nonEnumRouteMatch = matchPath(decodeUnderscoresToSpaces(decodedPath), {
64
+ path: route,
65
+ exact: true
66
+ });
53
67
  return {
54
68
  aux,
55
- params: matchPath(decodeUnderscoresToSpaces(decodedPath), {
56
- path: route,
57
- exact: true
58
- })?.params ?? {},
69
+ params: withRawAppPathLocator(nonEnumRouteMatch?.params ?? {}, match.params),
59
70
  pageAppNamespace
60
71
  };
61
72
  });
package/lib/routes.d.ts CHANGED
@@ -1,41 +1,40 @@
1
1
  //#region src/routes.d.ts
2
- declare const appIndexViewLocator = "views";
3
- declare const userAccessViewLocator = "access";
4
- declare const specificObjectViewsCatalogViewLocator = "views";
5
- declare const deprecatedSpecificObjectEditorViewLocator = "edit";
6
- declare const specificObjectUnknownObjectLocator = "any";
7
- declare const specificObjectEditorViewLocator: null;
8
- declare const appTypeModePage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace";
9
- declare const appTypeModeSubPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage";
10
- declare const appTypeModeAutomationBasePage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:automationType/:automationItemId";
11
- declare const appTypeModeAccessTemplatePage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/access-templates/:accessTemplateId";
12
- declare const appTypeModeFormPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/form/:formId";
13
- declare const appTypeModeAutomationSpecificPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:automationType/:automationItemId/:automationMode";
14
- declare const appTypeModeFieldEditPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:fieldTitle/edit";
15
- declare const appTypeModeGroupEditPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:typeId/members";
16
- declare const appModePage = "/fibery/space/:appNamespace/:mode";
17
- declare const appTypeModePageView: string;
18
- declare const formsPublicPage = "/@public/forms/:formKey";
19
- declare const highlightTypePage = "/fibery/settings/:subsection(highlights)/:typeWithoutNamespace";
20
- declare const highlightTypeFieldEditPage = "/fibery/settings/:subsection(highlights)/:typeWithoutNamespace/fields/:fieldWithoutNamespace/edit";
21
- declare const integrationSettingPage = "/fibery/settings/:subsection(integrations)/:templateId";
22
- declare const personalIntegrationSettingPage = "/fibery/settings/:subsection(personal-integrations)/:integrationId";
23
- declare const oauthApplicationSettingPage = "/fibery/settings/:subsection(oauth-applications)/:applicationId";
24
- declare const typeAccessTemplateSettingPage = "/fibery/settings/:subsection(database-access-templates)/:templateId";
25
- declare const isSettingsPage: (page?: string) => boolean;
26
- declare const NON_SPA_PATH_PREFIXES: string[];
27
- declare const isNonSpaPath: (path: string) => boolean;
28
- declare const ORDERED_PAGE_ROUTES: Array<[string, string]>;
29
- declare const PAGE_ROUTES: import("lodash").Dictionary<string>;
30
- declare const ORDERED_COMMON_AUX_ROUTES: Array<[string, string]>;
31
- declare const ORDERED_AUX_ROUTES: Array<[string, string]>;
32
- declare const AUX_ROUTES: import("lodash").Dictionary<string>;
33
- declare const AUX_ROUTES_PATTERNS: string[];
34
- declare const ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP: {
2
+ export declare const appIndexViewLocator = "views";
3
+ export declare const userAccessViewLocator = "access";
4
+ export declare const specificObjectViewsCatalogViewLocator = "views";
5
+ export declare const deprecatedSpecificObjectEditorViewLocator = "edit";
6
+ export declare const specificObjectUnknownObjectLocator = "any";
7
+ export declare const specificObjectEditorViewLocator: null;
8
+ export declare const appTypeModePage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace";
9
+ export declare const appTypeModeSubPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage";
10
+ export declare const appTypeModeAutomationBasePage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:automationType/:automationItemId";
11
+ export declare const appTypeModeAccessTemplatePage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/access-templates/:accessTemplateId";
12
+ export declare const appTypeModeFormPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/form/:formId";
13
+ export declare const appTypeModeAutomationSpecificPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:automationType/:automationItemId/:automationMode";
14
+ export declare const appTypeModeFieldEditPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:fieldTitle/edit";
15
+ export declare const appTypeModeGroupEditPage = "/fibery/space/:appNamespace/:mode/:typeWithoutNamespace/:subPage/:typeId/members";
16
+ export declare const appModePage = "/fibery/space/:appNamespace/:mode";
17
+ export declare const appTypeModePageView: string;
18
+ export declare const formsPublicPage = "/@public/forms/:formKey";
19
+ export declare const highlightTypePage = "/fibery/settings/:subsection(highlights)/:typeWithoutNamespace";
20
+ export declare const highlightTypeFieldEditPage = "/fibery/settings/:subsection(highlights)/:typeWithoutNamespace/fields/:fieldWithoutNamespace/edit";
21
+ export declare const integrationSettingPage = "/fibery/settings/:subsection(integrations)/:templateId";
22
+ export declare const personalIntegrationSettingPage = "/fibery/settings/:subsection(personal-integrations)/:integrationId";
23
+ export declare const oauthApplicationSettingPage = "/fibery/settings/:subsection(oauth-applications)/:applicationId";
24
+ export declare const typeAccessTemplateSettingPage = "/fibery/settings/:subsection(database-access-templates)/:templateId";
25
+ export declare const isSettingsPage: (page?: string) => boolean;
26
+ export declare const NON_SPA_PATH_PREFIXES: string[];
27
+ export declare const isNonSpaPath: (path: string) => boolean;
28
+ export declare const ORDERED_PAGE_ROUTES: Array<[string, string]>;
29
+ export declare const PAGE_ROUTES: import("lodash").Dictionary<string>;
30
+ export declare const ORDERED_COMMON_AUX_ROUTES: Array<[string, string]>;
31
+ export declare const ORDERED_AUX_ROUTES: Array<[string, string]>;
32
+ export declare const AUX_ROUTES: import("lodash").Dictionary<string>;
33
+ export declare const AUX_ROUTES_PATTERNS: string[];
34
+ export declare const ROUTES_WITH_PRESERVED_UNDERSCORES_LOOKUP: {
35
35
  [k: string]: boolean;
36
36
  };
37
- declare const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP: {
37
+ export declare const ROUTES_WITH_PRESERVED_UNDERSCORES_PATTERNS_LOOKUP: {
38
38
  [k: string]: boolean;
39
39
  };
40
- //#endregion
41
- 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 };
40
+ //#endregion
package/lib/routes.js CHANGED
@@ -1,4 +1,4 @@
1
- import { escapeRegExpChar } from "./locator-utils.js";
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
  //#region src/routes.ts
@@ -16,6 +16,7 @@ const extendedCommentLocatorPattern = `parentComment=${publicIdLocatorPattern}&c
16
16
  const anchorLocatorPattern = `anchor=${idLocatorPattern}`;
17
17
  const anchorWithTitleLocatorPattern = `anchor=${titleWithGuidLocatorPattern}`;
18
18
  const scrollLocatorPattern = `${extendedCommentLocatorPattern}|${commentLocatorPattern}|${`field=${idLocatorPattern}`}|${anchorLocatorPattern}|${anchorWithTitleLocatorPattern}|anchor=wb-[^/]+`;
19
+ const viewScrollLocatorPattern = `${scrollLocatorPattern}|${`${appPathLocatorPrefix}.+`}`;
19
20
  const appIndexViewLocator = "views";
20
21
  const userAccessViewLocator = "access";
21
22
  const specificObjectViewsCatalogViewLocator = "views";
@@ -53,6 +54,7 @@ const isSettingsPage = (page) => {
53
54
  };
54
55
  const orderedRoutes = [
55
56
  [":page/apps-gallery", `/fibery/apps-gallery/:appCategory`],
57
+ [":page/ai-connectors", `/fibery/ai-connectors/:connectorId?/:panel?/:section?`],
56
58
  [":page/app", `/fibery/space/:appNamespace`],
57
59
  [":page/app-access", `/fibery/space/:appNamespace/access`],
58
60
  [":page/app-import", `/fibery/space/:appNamespace/import/:connectorId?/:mode?`],
@@ -79,7 +81,7 @@ const orderedRoutes = [
79
81
  [settingsPage, typeAccessTemplateSettingPage],
80
82
  [settingsPage, "/fibery/settings/:subsection"],
81
83
  [settingsPage, "/fibery/settings"],
82
- [":page/app-view", `/:appNamespace/:viewLocator(${appIndexViewLocator}|${viewLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
84
+ [":page/app-view", `/:appNamespace/:viewLocator(${appIndexViewLocator}|${viewLocatorPattern})/:scrollLocator(${viewScrollLocatorPattern})?`],
83
85
  [":page/favorite", `/favorites/:parts+`],
84
86
  [":page/audit-log", "/audit-log"],
85
87
  [":page/home", "/home"],
@@ -100,7 +102,7 @@ const orderedRoutes = [
100
102
  `/:appNamespace/:typeWithoutNamespace`,
101
103
  `:objectLocator(any|${titleWithPublicIdLocatorPattern}|${publicIdLocatorPattern})`,
102
104
  `:viewLocator(${specificObjectViewsCatalogViewLocator}|${deprecatedSpecificObjectEditorViewLocator}|${viewLocatorPattern})?`,
103
- `:scrollLocator(${scrollLocatorPattern})?`
105
+ `:scrollLocator(${viewScrollLocatorPattern})?`
104
106
  ].join("/")],
105
107
  [":page/public-form", `/forms/:formKey`],
106
108
  [":page/app-root", `/:appNamespace`],
@@ -127,8 +129,8 @@ const ORDERED_COMMON_AUX_ROUTES = [
127
129
  [":aux/type-object-editor", `:auxTypeNamespace/:auxTypeName/edit`],
128
130
  [":aux/type-object-editor-implicit-namespace", `:auxTypeName/edit`],
129
131
  [":aux/type-object-editor-for-composite-type", `:nsA/:nameA\\_:nsB/:nameB/edit`],
130
- [":aux/app-view-with-context", `:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/context/:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
131
- [":aux/app-view", `:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
132
+ [":aux/app-view-with-context", `:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/context/:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${viewScrollLocatorPattern})?`],
133
+ [":aux/app-view", `:appNamespace/views/:viewType/:viewLocator(${viewLocatorPattern})/:scrollLocator(${viewScrollLocatorPattern})?`],
132
134
  [":aux/object-editor", `:auxTypeNamespace/:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
133
135
  [":aux/object-editor-implicit-namespace", `:auxTypeName/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
134
136
  [":aux/object-editor-for-composite-type", `:nsA/:nameA\\_:nsB/:nameB/:auxLocator(${auxLocatorPattern})/:scrollLocator(${scrollLocatorPattern})?`],
@@ -1,12 +1,15 @@
1
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
- declare const publicAppsUrlPrefix = "/@public/apps";
9
- declare const containerTypeParamName = "container-type";
10
- type DocumentContainerType = "entity" | "comment" | "view" | "canvas-comment";
11
- //#endregion
12
- export { DocumentContainerType, appsUrlPrefix, containerTypeParamName, formKeyParamName, formsUrlPrefix, publicAppsUrlPrefix, publicParamName, publicUrlPrefix, sharingParamName };
2
+ export declare const sharingParamName = "sharing-key";
3
+ export declare const publicParamName = "is-public";
4
+ export declare const publicUrlPrefix = "/@public";
5
+ export declare const formsUrlPrefix = "/@public/forms";
6
+ export declare const formKeyParamName = "form-key";
7
+ export declare const appsUrlPrefix = "/apps";
8
+ export declare const publicAppsUrlPrefix = "/@public/apps";
9
+ export declare const entityIdParamName = "entity-id";
10
+ export declare const entityTypeParamName = "entity-type";
11
+ export declare const containerTypeParamName = "container-type";
12
+ export declare const documentContainerTypes: readonly ["entity", "comment", "view", "canvas-comment"];
13
+ export type DocumentContainerType = (typeof documentContainerTypes)[number];
14
+ export declare const anyDocumentContainerType: string;
15
+ //#endregion
@@ -6,6 +6,15 @@ const formsUrlPrefix = "/@public/forms";
6
6
  const formKeyParamName = "form-key";
7
7
  const appsUrlPrefix = "/apps";
8
8
  const publicAppsUrlPrefix = `${publicUrlPrefix}${appsUrlPrefix}`;
9
+ const entityIdParamName = "entity-id";
10
+ const entityTypeParamName = "entity-type";
9
11
  const containerTypeParamName = "container-type";
12
+ const documentContainerTypes = [
13
+ "entity",
14
+ "comment",
15
+ "view",
16
+ "canvas-comment"
17
+ ];
18
+ const anyDocumentContainerType = documentContainerTypes.join(",");
10
19
  //#endregion
11
- export { appsUrlPrefix, containerTypeParamName, formKeyParamName, formsUrlPrefix, publicAppsUrlPrefix, publicParamName, publicUrlPrefix, sharingParamName };
20
+ export { anyDocumentContainerType, appsUrlPrefix, containerTypeParamName, documentContainerTypes, entityIdParamName, entityTypeParamName, formKeyParamName, formsUrlPrefix, publicAppsUrlPrefix, publicParamName, publicUrlPrefix, sharingParamName };
@@ -8,15 +8,19 @@ type WorkspaceSettings = {
8
8
  documentsDisabled?: boolean;
9
9
  custom_domain?: string | null;
10
10
  };
11
- type Workspace = {
11
+ export type DevEnvironmentLink = {
12
+ label: string;
13
+ origin: string;
14
+ };
15
+ export type Workspace = {
12
16
  ui_settings: WorkspaceSettings;
13
17
  name: string;
14
18
  id?: number;
15
19
  role?: string;
20
+ dev_environments?: DevEnvironmentLink[];
16
21
  };
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 };
22
+ export declare function getWorkspaceTitle(workspace: Workspace): string;
23
+ export declare function hostnameFromWorkspace(workspace: Workspace): string;
24
+ export declare function isCurrentWorkspace(workspace: Workspace, hostname: string): boolean;
25
+ export declare function getCurrentWorkspaceTitle(workspace: Workspace | null, hostname: string): string;
26
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/url-utils",
3
- "version": "2.3.5",
3
+ "version": "2.5.0",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "lib"