diff --git a/.gitignore b/.gitignore index 842fdcf856..ce487b45bc 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,7 @@ frontend/src/openapi/apis frontend/src/openapi/index.ts # Generated docs -website/docs/reference/api/**/sidebar.js +website/docs/reference/api/**/sidebar.ts website/docs/reference/api/**/**.info.mdx website/docs/generated reports/jest-junit.xml diff --git a/frontend/package.json b/frontend/package.json index e3e3e2895f..c14a4f2097 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -93,7 +93,7 @@ "lodash.mapvalues": "^4.6.0", "lodash.omit": "4.5.0", "millify": "^6.0.0", - "msw": "2.4.12", + "msw": "2.5.0", "orval": "^6.31.0", "pkginfo": "0.4.1", "plausible-tracker": "0.3.9", @@ -118,7 +118,7 @@ "typescript": "5.4.5", "use-query-params": "^2.2.1", "vanilla-jsoneditor": "^0.23.0", - "vite": "5.4.9", + "vite": "5.4.10", "vite-plugin-env-compatible": "2.0.1", "vite-plugin-svgr": "3.3.0", "vite-tsconfig-paths": "4.3.2", @@ -128,9 +128,9 @@ "resolutions": { "@codemirror/state": "6.4.1", "@xmldom/xmldom": "^0.9.0", - "jsonpath-plus": "10.0.0", + "jsonpath-plus": "10.1.0", "json5": "^2.2.2", - "vite": "5.4.9", + "vite": "5.4.10", "semver": "7.6.3", "ws": "^8.18.0", "@types/react": "18.3.11" diff --git a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureDeleteConfirm/ArchivedFeatureDeleteConfirm.tsx b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureDeleteConfirm/ArchivedFeatureDeleteConfirm.tsx index 4fa9f92d76..4793db7e6c 100644 --- a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureDeleteConfirm/ArchivedFeatureDeleteConfirm.tsx +++ b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureDeleteConfirm/ArchivedFeatureDeleteConfirm.tsx @@ -11,7 +11,7 @@ interface IArchivedFeatureDeleteConfirmProps { deletedFeatures: string[]; projectId: string; open: boolean; - setOpen: React.Dispatch>; + setOpen: (open: boolean) => void; refetch: () => void; } diff --git a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx index 9fa0ffd358..3a1cfeee66 100644 --- a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx +++ b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx @@ -1,5 +1,4 @@ import { Alert, styled } from '@mui/material'; -import type React from 'react'; import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { formatUnknownError } from 'utils/formatUnknownError'; import useToast from 'hooks/useToast'; @@ -11,7 +10,7 @@ interface IArchivedFeatureReviveConfirmProps { revivedFeatures: string[]; projectId: string; open: boolean; - setOpen: React.Dispatch>; + setOpen: (open: boolean) => void; refetch: () => void; } diff --git a/frontend/src/component/layout/MainLayout/MainLayoutEventTimeline.tsx b/frontend/src/component/layout/MainLayout/MainLayoutEventTimeline.tsx index e50ebe81d2..fd32cf7cd6 100644 --- a/frontend/src/component/layout/MainLayout/MainLayoutEventTimeline.tsx +++ b/frontend/src/component/layout/MainLayout/MainLayoutEventTimeline.tsx @@ -3,7 +3,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit import { EventTimeline } from 'component/events/EventTimeline/EventTimeline'; import { useEventTimelineContext } from 'component/events/EventTimeline/EventTimelineContext'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; -import { useUiFlag } from 'hooks/useUiFlag'; import { useEffect, useState } from 'react'; const StyledEventTimelineSlider = styled(Box)(({ theme }) => ({ @@ -21,10 +20,9 @@ const StyledEventTimelineWrapper = styled(Box)(({ theme }) => ({ export const MainLayoutEventTimeline = () => { const { isOss } = useUiConfig(); const { open: showTimeline } = useEventTimelineContext(); - const eventTimelineEnabled = useUiFlag('eventTimeline') && !isOss(); const [isInitialLoad, setIsInitialLoad] = useState(true); - const open = showTimeline && eventTimelineEnabled; + const open = showTimeline && !isOss(); useEffect(() => { setIsInitialLoad(false); diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NewInUnleash/NewInUnleash.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NewInUnleash/NewInUnleash.tsx index d07b601d13..bfdb849f4c 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NewInUnleash/NewInUnleash.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NewInUnleash/NewInUnleash.tsx @@ -104,7 +104,6 @@ export const NewInUnleash = ({ ); const { isOss, isEnterprise } = useUiConfig(); const signalsEnabled = useUiFlag('signals'); - const eventTimelineEnabled = useUiFlag('eventTimeline'); const { setHighlighted } = useEventTimelineContext(); @@ -159,7 +158,7 @@ export const NewInUnleash = ({ }, docsLink: 'https://docs.getunleash.io/reference/events#event-timeline', - show: !isOss() && eventTimelineEnabled, + show: !isOss(), longDescription: ( <>

@@ -174,7 +173,6 @@ export const NewInUnleash = ({

), - beta: true, }, ]; diff --git a/frontend/src/component/menu/Header/HeaderEventTimelineButton.tsx b/frontend/src/component/menu/Header/HeaderEventTimelineButton.tsx index d40ad42fea..9340c166db 100644 --- a/frontend/src/component/menu/Header/HeaderEventTimelineButton.tsx +++ b/frontend/src/component/menu/Header/HeaderEventTimelineButton.tsx @@ -3,7 +3,6 @@ import LinearScaleIcon from '@mui/icons-material/LinearScale'; import { useEventTimelineContext } from 'component/events/EventTimeline/EventTimelineContext'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; -import { useUiFlag } from 'hooks/useUiFlag'; const StyledHeaderEventTimelineButton = styled(IconButton, { shouldForwardProp: (prop) => prop !== 'highlighted', @@ -34,14 +33,13 @@ const StyledHeaderEventTimelineButton = styled(IconButton, { export const HeaderEventTimelineButton = () => { const { trackEvent } = usePlausibleTracker(); const { isOss } = useUiConfig(); - const eventTimeline = useUiFlag('eventTimeline') && !isOss(); const { open: showTimeline, setOpen: setShowTimeline, highlighted, } = useEventTimelineContext(); - if (!eventTimeline) return null; + if (isOss()) return null; return ( { const { trackEvent } = usePlausibleTracker(); const { setSplashSeen } = useSplashApi(); const { splash } = useAuthSplash(); - const name = user?.name; + const name = user?.name || ''; - usePageTitle(`Dashboard: ${name}`); + usePageTitle(name ? `Dashboard: ${name}` : 'Dashboard'); const { personalDashboard, refetch: refetchDashboard } = usePersonalDashboard(); diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx index 9ae5d4b0f2..8525dfa00c 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureToggles.tsx @@ -47,6 +47,8 @@ import { ProjectOnboarding } from '../../../onboarding/flow/ProjectOnboarding'; import { useLocalStorageState } from 'hooks/useLocalStorageState'; import { ProjectOnboarded } from 'component/onboarding/flow/ProjectOnboarded'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; +import { ArchivedFeatureActionCell } from '../../../archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureActionCell'; +import { ArchiveBatchActions } from '../../../archive/ArchiveTable/ArchiveBatchActions'; interface IPaginatedProjectFeatureTogglesProps { environments: string[]; @@ -115,6 +117,8 @@ export const ProjectFeatureToggles = ({ setFeatureArchiveState, setFeatureStaleDialogState, setShowMarkCompletedDialogue, + setShowFeatureReviveDialogue, + setShowFeatureDeleteDialogue, } = useRowActions(refetch, projectId); const isPlaceholder = Boolean(initialLoad || (loading && total)); @@ -321,14 +325,32 @@ export const ProjectFeatureToggles = ({ columnHelper.display({ id: 'actions', header: '', - cell: ({ row }) => ( - - ), + cell: ({ row }) => + tableState.archived ? ( + { + setShowFeatureReviveDialogue({ + featureId: row.id, + open: true, + }); + }} + onDelete={() => { + setShowFeatureDeleteDialogue({ + featureId: row.id, + open: true, + }); + }} + /> + ) : ( + + ), + enableSorting: false, enableHiding: false, meta: { @@ -585,13 +607,24 @@ export const ProjectFeatureToggles = ({ } /> - + {tableState.archived ? ( + { + refetch(); + table.resetRowSelection(); + }} + /> + ) : ( + + )} ); diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOverviewFilters.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOverviewFilters.tsx index 0bbb2da2d3..0a2d8479a9 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOverviewFilters.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectOverviewFilters.tsx @@ -6,6 +6,7 @@ import { type IFilterItem, } from 'component/filter/Filters/Filters'; import { useProjectFlagCreators } from 'hooks/api/getters/useProjectFlagCreators/useProjectFlagCreators'; +import { useUiFlag } from 'hooks/useUiFlag'; interface IProjectOverviewFilters { state: FilterItemParamHolder; @@ -21,6 +22,7 @@ export const ProjectOverviewFilters: VFC = ({ const { tags } = useAllTags(); const { flagCreators } = useProjectFlagCreators(project); const [availableFilters, setAvailableFilters] = useState([]); + const simplifyProjectOverview = useUiFlag('simplifyProjectOverview'); useEffect(() => { const tagsOptions = (tags || []).map((tag) => ({ @@ -95,6 +97,18 @@ export const ProjectOverviewFilters: VFC = ({ singularOperators: ['IS', 'IS_NOT'], pluralOperators: ['IS_ANY_OF', 'IS_NONE_OF'], }, + ...(simplifyProjectOverview + ? ([ + { + label: 'Show only archived', + icon: 'inventory', + options: [{ label: 'True', value: 'true' }], + filterKey: 'archived', + singularOperators: ['IS'], + pluralOperators: ['IS_ANY_OF'], + }, + ] as IFilterItem[]) + : []), ]; setAvailableFilters(availableFilters); diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/hooks/useRowActions.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/hooks/useRowActions.tsx index 5ba17bf051..ad05827e40 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/hooks/useRowActions.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/hooks/useRowActions.tsx @@ -2,6 +2,8 @@ import { useState } from 'react'; import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog'; import { FeatureStaleDialog } from 'component/common/FeatureStaleDialog/FeatureStaleDialog'; import { MarkCompletedDialogue } from 'component/feature/FeatureView/FeatureOverview/FeatureLifecycle/MarkCompletedDialogue'; +import { ArchivedFeatureDeleteConfirm } from '../../../../archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureDeleteConfirm/ArchivedFeatureDeleteConfirm'; +import { ArchivedFeatureReviveConfirm } from '../../../../archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm'; export const useRowActions = (onChange: () => void, projectId: string) => { const [featureArchiveState, setFeatureArchiveState] = useState< @@ -20,6 +22,21 @@ export const useRowActions = (onChange: () => void, projectId: string) => { featureId: 'default', open: false, }); + const [showFeatureReviveDialogue, setShowFeatureReviveDialogue] = useState<{ + featureId: string; + open: boolean; + }>({ + featureId: 'default', + open: false, + }); + const [showFeatureDeleteDialogue, setShowFeatureDeleteDialogue] = useState<{ + featureId: string; + open: boolean; + }>({ + featureId: 'default', + open: false, + }); + const rowActionsDialogs = ( <> void, projectId: string) => { featureId={showMarkCompletedDialogue.featureId} onComplete={onChange} /> + { + setShowFeatureDeleteDialogue((prev) => ({ + ...prev, + open, + })); + }} + refetch={onChange} + /> + { + setShowFeatureReviveDialogue((prev) => ({ + ...prev, + open, + })); + }} + refetch={() => { + setShowFeatureReviveDialogue((prev) => ({ + ...prev, + open: false, + })); + onChange(); + }} + /> ); @@ -62,5 +109,7 @@ export const useRowActions = (onChange: () => void, projectId: string) => { setFeatureArchiveState, setFeatureStaleDialogState, setShowMarkCompletedDialogue, + setShowFeatureReviveDialogue, + setShowFeatureDeleteDialogue, }; }; diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index 71479206df..202cbceed3 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -91,6 +91,7 @@ export type UiFlags = { purchaseAdditionalEnvironments?: boolean; unleashAI?: boolean; releasePlans?: boolean; + simplifyProjectOverview?: boolean; }; export interface IVersionInfo { diff --git a/frontend/src/openapi/models/eventSchema.ts b/frontend/src/openapi/models/eventSchema.ts index 40a6f3ff17..1bfd2ab963 100644 --- a/frontend/src/openapi/models/eventSchema.ts +++ b/frontend/src/openapi/models/eventSchema.ts @@ -42,7 +42,7 @@ export interface EventSchema { */ id: number; /** - * **[Experimental]** The concise, human-readable name of the event. + * The concise, human-readable name of the event. * @nullable */ label?: string | null; @@ -57,7 +57,7 @@ export interface EventSchema { */ project?: string | null; /** - * **[Experimental]** A markdown-formatted summary of the event. + * A markdown-formatted summary of the event. * @nullable */ summary?: string | null; diff --git a/frontend/src/openapi/models/featureSearchResponseSchema.ts b/frontend/src/openapi/models/featureSearchResponseSchema.ts index 14d1d75673..5eb92e962e 100644 --- a/frontend/src/openapi/models/featureSearchResponseSchema.ts +++ b/frontend/src/openapi/models/featureSearchResponseSchema.ts @@ -15,8 +15,6 @@ import type { VariantSchema } from './variantSchema'; * A feature flag definition */ export interface FeatureSearchResponseSchema { - /** `true` if the feature is archived */ - archived?: boolean; /** * The date the feature was archived * @nullable diff --git a/frontend/src/openapi/models/featureTypeSchema.ts b/frontend/src/openapi/models/featureTypeSchema.ts index 7d1ee7edb9..f95a1e8afd 100644 --- a/frontend/src/openapi/models/featureTypeSchema.ts +++ b/frontend/src/openapi/models/featureTypeSchema.ts @@ -5,7 +5,7 @@ */ /** - * A [feature flag type](https://docs.getunleash.io/reference/feature-toggles#feature-flag-types. + * A [feature flag type](https://docs.getunleash.io/reference/feature-toggles#feature-flag-types). */ export interface FeatureTypeSchema { /** A description of what this feature flag type is intended to be used for. */ diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts index 30dfee7472..8cde624f62 100644 --- a/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchema.ts @@ -13,7 +13,7 @@ import type { PersonalDashboardProjectDetailsSchemaRolesItem } from './personalD * Project details in personal dashboard */ export interface PersonalDashboardProjectDetailsSchema { - /** Insights for the project */ + /** Insights for the project, including flag data and project health information. */ insights: PersonalDashboardProjectDetailsSchemaInsights; /** The latest events for the project. */ latestEvents: PersonalDashboardProjectDetailsSchemaLatestEventsItem[]; @@ -21,8 +21,6 @@ export interface PersonalDashboardProjectDetailsSchema { onboardingStatus: PersonalDashboardProjectDetailsSchemaOnboardingStatus; /** The users and/or groups that have the "owner" role in this project. If no such users or groups exist, the list will contain the "system" owner instead. */ owners: PersonalDashboardProjectDetailsSchemaOwners; - /** - * The list of roles that the user has in this project. - */ + /** The list of roles that the user has in this project. */ roles: PersonalDashboardProjectDetailsSchemaRolesItem[]; } diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts index 284f9bb620..44523408ee 100644 --- a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts @@ -5,22 +5,44 @@ */ /** - * Insights for the project + * Insights for the project, including flag data and project health information. */ export type PersonalDashboardProjectDetailsSchemaInsights = { /** - * The average health score in the current window of the last 4 weeks + * The number of active flags that are not stale or potentially stale + * @minimum 0 + */ + activeFlags: number; + /** + * The project's average health score over the last 4 weeks + * @minimum 0 * @nullable */ avgHealthCurrentWindow: number | null; /** - * The average health score in the previous 4 weeks before the current window + * The project's average health score over the previous 4-week window + * @minimum 0 * @nullable */ avgHealthPastWindow: number | null; - totalFlags: number; - activeFlags: number; - staleFlags: number; - potentiallyStaleFlags: number; + /** + * The project's current health score + * @minimum 0 + */ health: number; + /** + * The number of potentially stale flags as calculated by Unleash + * @minimum 0 + */ + potentiallyStaleFlags: number; + /** + * The current number of flags that have been manually marked as stale + * @minimum 0 + */ + staleFlags: number; + /** + * The current number of non-archived flags + * @minimum 0 + */ + totalFlags: number; }; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts index 2341bdaf3b..a30589ba73 100644 --- a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaLatestEventsItem.ts @@ -8,6 +8,8 @@ * An event summary */ export type PersonalDashboardProjectDetailsSchemaLatestEventsItem = { + /** When the event was recorded */ + createdAt: string; /** Which user created this event */ createdBy: string; /** URL used for the user profile image of the event author */ @@ -22,5 +24,4 @@ export type PersonalDashboardProjectDetailsSchemaLatestEventsItem = { * @nullable */ summary: string | null; - createdAt: string; }; diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts index 16931c4216..608590082b 100644 --- a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaRolesItemType.ts @@ -14,6 +14,4 @@ export type PersonalDashboardProjectDetailsSchemaRolesItemType = export const PersonalDashboardProjectDetailsSchemaRolesItemType = { custom: 'custom', project: 'project', - root: 'root', - 'custom-root': 'custom-root', } as const; diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts index 47672a5b7a..aa2ecbd6d3 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts @@ -5,13 +5,22 @@ */ export type PersonalDashboardSchemaProjectsItem = { - /** The number of features this project has */ + /** + * The number of features this project has + * @minimum 0 + */ featureCount: number; - /** An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#health-rating) on a scale from 0 to 100 */ + /** + * An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#health-rating) on a scale from 0 to 100 + * @minimum 0 + */ health: number; /** The id of the project */ id: string; - /** The number of members this project has */ + /** + * The number of members this project has + * @minimum 0 + */ memberCount: number; /** The name of the project */ name: string; diff --git a/frontend/src/openapi/models/searchFeaturesParams.ts b/frontend/src/openapi/models/searchFeaturesParams.ts index 4d2a4266dc..8042c470ce 100644 --- a/frontend/src/openapi/models/searchFeaturesParams.ts +++ b/frontend/src/openapi/models/searchFeaturesParams.ts @@ -58,6 +58,10 @@ export type SearchFeaturesParams = { * The flag to indicate if the favorite features should be returned first. By default it is set to false. */ favoritesFirst?: string; + /** + * Whether to get results for archived feature flags or active feature flags. If `true`, Unleash will return only archived flags. If `false`, it will return only active flags. + */ + archived?: string; /** * The date the feature was created. The date can be specified with an operator. The supported operators are IS_BEFORE, IS_ON_OR_AFTER. */ diff --git a/frontend/src/openapi/models/uiConfigSchema.ts b/frontend/src/openapi/models/uiConfigSchema.ts index 7cb033f9a8..efdf37add5 100644 --- a/frontend/src/openapi/models/uiConfigSchema.ts +++ b/frontend/src/openapi/models/uiConfigSchema.ts @@ -55,6 +55,8 @@ export interface UiConfigSchema { * @deprecated */ strategySegmentsLimit?: number; + /** Whether Unleash AI is available. */ + unleashAIAvailable?: boolean; /** The URL of the Unleash instance. */ unleashUrl: string; /** The current version of Unleash */ diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 098fac3960..5b3f0e5154 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1383,48 +1383,49 @@ __metadata: languageName: node linkType: hard -"@inquirer/confirm@npm:^3.0.0": - version: 3.1.9 - resolution: "@inquirer/confirm@npm:3.1.9" +"@inquirer/confirm@npm:^4.0.0": + version: 4.0.1 + resolution: "@inquirer/confirm@npm:4.0.1" dependencies: - "@inquirer/core": "npm:^8.2.2" - "@inquirer/type": "npm:^1.3.3" - checksum: 10c0/9fb63a052cbe3705bcab706b3e68d70aa75ac7c7bfc04cc4fee2319e4da9355150c99b205bc72b595844e1549705643049e71d14070a3ab3d6483941c1e6a239 + "@inquirer/core": "npm:^9.2.1" + "@inquirer/type": "npm:^2.0.0" + checksum: 10c0/8ea5e6a63efa348b626750384c249cc903280e38c2596bb42c640f178b375dbc389d8c4d040b2e4759b3937d8a188e245ca262b8dc7cdb2fa35dfce4104c2e8f languageName: node linkType: hard -"@inquirer/core@npm:^8.2.2": - version: 8.2.2 - resolution: "@inquirer/core@npm:8.2.2" +"@inquirer/core@npm:^9.2.1": + version: 9.2.1 + resolution: "@inquirer/core@npm:9.2.1" dependencies: - "@inquirer/figures": "npm:^1.0.3" - "@inquirer/type": "npm:^1.3.3" + "@inquirer/figures": "npm:^1.0.6" + "@inquirer/type": "npm:^2.0.0" "@types/mute-stream": "npm:^0.0.4" - "@types/node": "npm:^20.12.13" + "@types/node": "npm:^22.5.5" "@types/wrap-ansi": "npm:^3.0.0" ansi-escapes: "npm:^4.3.2" - chalk: "npm:^4.1.2" - cli-spinners: "npm:^2.9.2" cli-width: "npm:^4.1.0" mute-stream: "npm:^1.0.0" signal-exit: "npm:^4.1.0" strip-ansi: "npm:^6.0.1" wrap-ansi: "npm:^6.2.0" - checksum: 10c0/6a04b42f856b31f892bd2195cbb214a38836f708f09925b36a50b11e3e84dca73ebf008ff7a42f2e7901350450a1cec8fe625c43cc1a90eda3c10ed7e4527cca + yoctocolors-cjs: "npm:^2.1.2" + checksum: 10c0/11c14be77a9fa85831de799a585721b0a49ab2f3b7d8fd1780c48ea2b29229c6bdc94e7892419086d0f7734136c2ba87b6a32e0782571eae5bbd655b1afad453 languageName: node linkType: hard -"@inquirer/figures@npm:^1.0.3": - version: 1.0.3 - resolution: "@inquirer/figures@npm:1.0.3" - checksum: 10c0/099e062f000baafb4010014ece443d0cd211f562194854dc52a128bfe514611f8cc3da4cdb5092d75440956aff201dcd8e893b8a71feb104f97b0b00c6a696cf +"@inquirer/figures@npm:^1.0.6": + version: 1.0.7 + resolution: "@inquirer/figures@npm:1.0.7" + checksum: 10c0/d7b4cfcd38dd43d1ac79da52c4478aa89145207004a471aa2083856f1d9b99adef45563f09d66c09d6457b09200fcf784527804b70ad3bd517cbc5e11142c2df languageName: node linkType: hard -"@inquirer/type@npm:^1.3.3": - version: 1.3.3 - resolution: "@inquirer/type@npm:1.3.3" - checksum: 10c0/84048694410bb5b2c55dc4e48da6369ce942b9e8f8016d15ef63ab3f9873832a56cc12a50582b5b2b626821bfe29973dfcc19edc90f58490b51df1f4d9d0a074 +"@inquirer/type@npm:^2.0.0": + version: 2.0.0 + resolution: "@inquirer/type@npm:2.0.0" + dependencies: + mute-stream: "npm:^1.0.0" + checksum: 10c0/8c663d52beb2b89a896d3c3d5cc3d6d024fa149e565555bcb42fa640cbe23fba7ff2c51445342cef1fe6e46305e2d16c1590fa1d11ad0ddf93a67b655ef41f0a languageName: node linkType: hard @@ -3084,7 +3085,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.12.12, @types/node@npm:^20.12.13": +"@types/node@npm:^20.12.12": version: 20.17.1 resolution: "@types/node@npm:20.17.1" dependencies: @@ -3093,6 +3094,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^22.5.5": + version: 22.8.4 + resolution: "@types/node@npm:22.8.4" + dependencies: + undici-types: "npm:~6.19.8" + checksum: 10c0/f88d030480630194a9168772462ec09b2d86454f34368c46d2b7fda5dc6e14594b1576fcc5c35cc53b57a4d1e8dd2865a85ae81f34ded0d1af753a0f5d294c25 + languageName: node + linkType: hard + "@types/parse-json@npm:^4.0.0": version: 4.0.2 resolution: "@types/parse-json@npm:4.0.2" @@ -4143,13 +4153,6 @@ __metadata: languageName: node linkType: hard -"cli-spinners@npm:^2.9.2": - version: 2.9.2 - resolution: "cli-spinners@npm:2.9.2" - checksum: 10c0/907a1c227ddf0d7a101e7ab8b300affc742ead4b4ebe920a5bf1bc6d45dce2958fcd195eb28fa25275062fe6fa9b109b93b63bc8033396ed3bcb50297008b3a3 - languageName: node - linkType: hard - "cli-table3@npm:~0.6.1": version: 0.6.5 resolution: "cli-table3@npm:0.6.5" @@ -6737,9 +6740,9 @@ __metadata: languageName: node linkType: hard -"jsonpath-plus@npm:10.0.0": - version: 10.0.0 - resolution: "jsonpath-plus@npm:10.0.0" +"jsonpath-plus@npm:10.1.0": + version: 10.1.0 + resolution: "jsonpath-plus@npm:10.1.0" dependencies: "@jsep-plugin/assignment": "npm:^1.2.1" "@jsep-plugin/regex": "npm:^1.0.3" @@ -6747,7 +6750,7 @@ __metadata: bin: jsonpath: bin/jsonpath-cli.js jsonpath-plus: bin/jsonpath-cli.js - checksum: 10c0/0bd0ad79397f319c8543f090a944ea08c933c13d69ad5213f202f738ef4abd46de57c917844a83e2e89643cadbfc2e327a402c01eaf50bd1870882d50a4a8b95 + checksum: 10c0/1ff0743f9113f7750b598563c7886e1b07c19f112c4a8d976165e6799ff9774279985d1f4a147e87eacc0b94eb27dbd6e3ab5cf0728d4ba947f00757bc6aebb4 languageName: node linkType: hard @@ -7609,14 +7612,14 @@ __metadata: languageName: node linkType: hard -"msw@npm:2.4.12": - version: 2.4.12 - resolution: "msw@npm:2.4.12" +"msw@npm:2.5.0": + version: 2.5.0 + resolution: "msw@npm:2.5.0" dependencies: "@bundled-es-modules/cookie": "npm:^2.0.0" "@bundled-es-modules/statuses": "npm:^1.0.1" "@bundled-es-modules/tough-cookie": "npm:^0.1.6" - "@inquirer/confirm": "npm:^3.0.0" + "@inquirer/confirm": "npm:^4.0.0" "@mswjs/interceptors": "npm:^0.36.5" "@open-draft/until": "npm:^2.1.0" "@types/cookie": "npm:^0.6.0" @@ -7637,7 +7640,7 @@ __metadata: optional: true bin: msw: cli/index.js - checksum: 10c0/1f24544e5aaac4a5184cae48ee4f6f8a85d1476f361cb7b831fcabfb4cdedbb03a38298c1b1c3af77118c439b797d8a95e2398ba1c233cf353be496de1a0ef9c + checksum: 10c0/59eb6d2496b4d44f6b5507802beffd780ac03efc0b02cc092886d1ff6b9266297274ee655cf89bcccc49988d960f685f0dd571535663bc7f60f38e8040d9a092 languageName: node linkType: hard @@ -10153,7 +10156,7 @@ __metadata: lodash.mapvalues: "npm:^4.6.0" lodash.omit: "npm:4.5.0" millify: "npm:^6.0.0" - msw: "npm:2.4.12" + msw: "npm:2.5.0" orval: "npm:^6.31.0" pkginfo: "npm:0.4.1" plausible-tracker: "npm:0.3.9" @@ -10178,7 +10181,7 @@ __metadata: typescript: "npm:5.4.5" use-query-params: "npm:^2.2.1" vanilla-jsoneditor: "npm:^0.23.0" - vite: "npm:5.4.9" + vite: "npm:5.4.10" vite-plugin-env-compatible: "npm:2.0.1" vite-plugin-svgr: "npm:3.3.0" vite-tsconfig-paths: "npm:4.3.2" @@ -10451,9 +10454,9 @@ __metadata: languageName: node linkType: hard -"vite@npm:5.4.9": - version: 5.4.9 - resolution: "vite@npm:5.4.9" +"vite@npm:5.4.10": + version: 5.4.10 + resolution: "vite@npm:5.4.10" dependencies: esbuild: "npm:^0.21.3" fsevents: "npm:~2.3.3" @@ -10490,7 +10493,7 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: 10c0/e9c59f2c639047e37c79bbbb151c7a55a3dc27932957cf4cf0447ee0bdcc1ddfd9b1fb3ba0465371c01ba3616d62561327855794c2d652213c3a10a32e6d369d + checksum: 10c0/4ef4807d2fd166a920de244dbcec791ba8a903b017a7d8e9f9b4ac40d23f8152c1100610583d08f542b47ca617a0505cfc5f8407377d610599d58296996691ed languageName: node linkType: hard @@ -10836,6 +10839,13 @@ __metadata: languageName: node linkType: hard +"yoctocolors-cjs@npm:^2.1.2": + version: 2.1.2 + resolution: "yoctocolors-cjs@npm:2.1.2" + checksum: 10c0/a0e36eb88fea2c7981eab22d1ba45e15d8d268626e6c4143305e2c1628fa17ebfaa40cd306161a8ce04c0a60ee0262058eab12567493d5eb1409780853454c6f + languageName: node + linkType: hard + "zustand@npm:4.0.0": version: 4.0.0 resolution: "zustand@npm:4.0.0" diff --git a/package.json b/package.json index 2169d67b14..5c3aa1c456 100644 --- a/package.json +++ b/package.json @@ -173,7 +173,7 @@ }, "devDependencies": { "@apidevtools/swagger-parser": "10.1.0", - "@babel/core": "7.25.8", + "@babel/core": "7.25.9", "@biomejs/biome": "^1.8.3", "@cyclonedx/yarn-plugin-cyclonedx": "^1.0.0-rc.7", "@swc/core": "1.7.39", @@ -191,7 +191,7 @@ "@types/memoizee": "0.4.11", "@types/mime": "4.0.0", "@types/mustache": "^4.2.5", - "@types/node": "20.16.13", + "@types/node": "20.16.14", "@types/nodemailer": "6.4.16", "@types/owasp-password-strength-test": "1.3.2", "@types/pg": "8.11.10", diff --git a/src/lib/addons/addon.ts b/src/lib/addons/addon.ts index 173e84b750..3cbfbf93e5 100644 --- a/src/lib/addons/addon.ts +++ b/src/lib/addons/addon.ts @@ -94,12 +94,10 @@ export default abstract class Addon { integrationEvent: IntegrationEventWriteModel, ): Promise { await this.integrationEventsService.registerEvent(integrationEvent); - if (this.flagResolver.isEnabled('addonUsageMetrics')) { - this.eventBus.emit(ADDON_EVENTS_HANDLED, { - result: integrationEvent.state, - destination: this.name, - }); - } + this.eventBus.emit(ADDON_EVENTS_HANDLED, { + result: integrationEvent.state, + destination: this.name, + }); } destroy?(): void; diff --git a/src/lib/features/events/event-search-controller.ts b/src/lib/features/events/event-search-controller.ts index 3b59bede06..ba2810a9e4 100644 --- a/src/lib/features/events/event-search-controller.ts +++ b/src/lib/features/events/event-search-controller.ts @@ -111,19 +111,15 @@ export default class EventSearchController extends Controller { } enrichEvents(events: IEvent[]): IEvent[] | IEnrichedEvent[] { - if (this.flagResolver.isEnabled('eventTimeline')) { - return events.map((event) => { - const { label, text: summary } = - this.msgFormatter.format(event); + return events.map((event) => { + const { label, text: summary } = this.msgFormatter.format(event); - return { - ...event, - label, - summary, - }; - }); - } - return events; + return { + ...event, + label, + summary, + }; + }); } maybeAnonymiseEvents(events: IEvent[]): IEvent[] { diff --git a/src/lib/features/feature-search/feature-search-store.ts b/src/lib/features/feature-search/feature-search-store.ts index bf3fd577c1..f08eb624f8 100644 --- a/src/lib/features/feature-search/feature-search-store.ts +++ b/src/lib/features/feature-search/feature-search-store.ts @@ -121,6 +121,7 @@ class FeatureSearchStore implements IFeatureSearchStore { 'features.name as feature_name', 'features.description as description', 'features.type as type', + 'features.archived_at as archived_at', 'features.project as project', 'features.created_at as created_at', 'features.stale as stale', @@ -475,6 +476,7 @@ class FeatureSearchStore implements IFeatureSearchStore { name: row.feature_name, createdAt: row.created_at, stale: row.stale, + archivedAt: row.archived_at, impressionData: row.impression_data, lastSeenAt: row.last_seen_at, dependencyType: row.dependency, diff --git a/src/lib/features/feature-search/feature.search.e2e.test.ts b/src/lib/features/feature-search/feature.search.e2e.test.ts index 396010cc22..41d52ad589 100644 --- a/src/lib/features/feature-search/feature.search.e2e.test.ts +++ b/src/lib/features/feature-search/feature.search.e2e.test.ts @@ -179,6 +179,11 @@ const filterFeaturesByEnvironmentStatus = async ( const searchFeaturesWithoutQueryParams = async (expectedCode = 200) => { return app.request.get(`/api/admin/search/features`).expect(expectedCode); }; +const getProjectArchive = async (projectId = 'default', expectedCode = 200) => { + return app.request + .get(`/api/admin/archive/features/${projectId}`) + .expect(expectedCode); +}; test('should search matching features by name', async () => { await app.createFeature('my_feature_a'); @@ -1154,6 +1159,7 @@ test('should return archived when query param set', async () => { features: [ { name: 'my_feature_a', + archivedAt: null, }, ], }); @@ -1162,10 +1168,14 @@ test('should return archived when query param set', async () => { query: 'my_feature', archived: 'IS:true', }); + + const { body: archive } = await getProjectArchive(); + expect(archivedFeatures).toMatchObject({ features: [ { name: 'my_feature_b', + archivedAt: archive.features[0].archivedAt, }, ], }); diff --git a/src/lib/openapi/spec/event-schema.ts b/src/lib/openapi/spec/event-schema.ts index 78f8640e51..fe33fbe732 100644 --- a/src/lib/openapi/spec/event-schema.ts +++ b/src/lib/openapi/spec/event-schema.ts @@ -95,14 +95,12 @@ export const eventSchema = { label: { type: 'string', nullable: true, - description: - '**[Experimental]** The concise, human-readable name of the event.', + description: 'The concise, human-readable name of the event.', }, summary: { type: 'string', nullable: true, - description: - '**[Experimental]** A markdown-formatted summary of the event.', + description: 'A markdown-formatted summary of the event.', }, }, components: { diff --git a/src/lib/openapi/spec/feature-search-response-schema.ts b/src/lib/openapi/spec/feature-search-response-schema.ts index 3bb5e64f6d..5085116acc 100644 --- a/src/lib/openapi/spec/feature-search-response-schema.ts +++ b/src/lib/openapi/spec/feature-search-response-schema.ts @@ -54,11 +54,6 @@ export const featureSearchResponseSchema = { description: "The type of dependency. 'parent' means that the feature is a parent feature, 'child' means that the feature is a child feature.", }, - archived: { - type: 'boolean', - example: true, - description: '`true` if the feature is archived', - }, project: { type: 'string', example: 'dx-squad', diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 1df825499f..f24395ef49 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -51,17 +51,16 @@ export type IFlagKey = | 'removeUnsafeInlineStyleSrc' | 'onboardingUI' | 'projectRoleAssignment' - | 'eventTimeline' | 'personalDashboardUI' | 'trackLifecycleMetrics' | 'purchaseAdditionalEnvironments' | 'originMiddlewareRequestLogging' | 'unleashAI' | 'webhookDomainLogging' - | 'addonUsageMetrics' | 'releasePlans' | 'navigationSidebar' - | 'productivityReportEmail'; + | 'productivityReportEmail' + | 'simplifyProjectOverview'; export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>; @@ -262,10 +261,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_PROJECT_ROLE_ASSIGNMENT, false, ), - eventTimeline: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_EVENT_TIMELINE, - false, - ), personalDashboardUI: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_PERSONAL_DASHBOARD_UI, false, @@ -290,10 +285,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENT_WEBHOOK_DOMAIN_LOGGING, false, ), - addonUsageMetrics: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_ADDON_USAGE_METRICS, - false, - ), releasePlans: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_RELEASE_PLANS, false, @@ -306,6 +297,10 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_PRODUCTIVITY_REPORT_EMAIL, false, ), + simplifyProjectOverview: parseEnvVarBoolean( + process.env.UNLEASH_EXPERIMENTAL_SIMPLIFY_PROJECT_OVERVIEW, + false, + ), }; export const defaultExperimentalOptions: IExperimentalOptions = { diff --git a/src/lib/types/model.ts b/src/lib/types/model.ts index 46da479814..9300b58dad 100644 --- a/src/lib/types/model.ts +++ b/src/lib/types/model.ts @@ -261,6 +261,7 @@ export type IFeatureSearchOverview = Exclude< > & { dependencyType: 'parent' | 'child' | null; environments: FeatureSearchEnvironmentSchema[]; + archivedAt: string; createdBy: { id: number; name: string; diff --git a/src/mailtemplates/productivity-report/productivity-report.html.mustache b/src/mailtemplates/productivity-report/productivity-report.html.mustache index 68f1048d59..8bfaece458 100644 --- a/src/mailtemplates/productivity-report/productivity-report.html.mustache +++ b/src/mailtemplates/productivity-report/productivity-report.html.mustache @@ -73,7 +73,7 @@
This email was sent to {{userEmail}}. You’ve received this as you are a user of Unleash.
{{#unsubscribeUrl}} - If you wish to unsubscribe from updated, click here. + If you wish to unsubscribe, click here. {{/unsubscribeUrl}}
diff --git a/src/mailtemplates/productivity-report/productivity-report.plain.mustache b/src/mailtemplates/productivity-report/productivity-report.plain.mustache index a0fafd4245..6f7ccc1f3c 100644 --- a/src/mailtemplates/productivity-report/productivity-report.plain.mustache +++ b/src/mailtemplates/productivity-report/productivity-report.plain.mustache @@ -1,10 +1,19 @@ -Subject: Unleash productivity report +Subject: Unleash Productivity Report -Hello, +Hi {{userName}}, -Productivity report -{{! FIXME: create plaintext template }} +We are excited to share the latest insights for your instance. As always if you +have any questions or concerns let us know - we are here for you. +Your instance health: {{health}} + +Flags created last month: {{flagsCreated}} + +Production updates last month: {{productionUpdates}} + +Go to your Insights to learn more: {{unleashUrl}}/insights + +This email was sent to {{userEmail}}. You’ve received this as you are a user of Unleash. {{#unsubscribeUrl}} -If you wish to unsubscribe from updated, open {{unsubscribeUrl}}. + If you wish to unsubscribe, click here. {{/unsubscribeUrl}} diff --git a/src/migrations/20241030093439-release-plans-template-ref-and-missing-strategy-fields.js b/src/migrations/20241030093439-release-plans-template-ref-and-missing-strategy-fields.js new file mode 100644 index 0000000000..d18203eab7 --- /dev/null +++ b/src/migrations/20241030093439-release-plans-template-ref-and-missing-strategy-fields.js @@ -0,0 +1,27 @@ +exports.up = function(db, cb) { + db.runSql(` + ALTER TABLE release_plan_definitions ADD COLUMN release_plan_template_id TEXT REFERENCES release_plan_definitions(id) ON DELETE CASCADE; + CREATE INDEX idx_release_plan_template_definition_id ON release_plan_definitions (release_plan_template_id) WHERE release_plan_template_id IS NOT NULL; + + ALTER TABLE feature_strategies ADD COLUMN milestone_id TEXT REFERENCES milestones(id) ON DELETE CASCADE; + CREATE INDEX idx_feature_strategies_milestone_id ON feature_strategies (milestone_id) WHERE milestone_id IS NOT NULL; + + CREATE TABLE milestone_strategy_segments ( + segment_id INT NOT NULL references segments(id) ON DELETE CASCADE, + milestone_strategy_id TEXT NOT NULL references milestone_strategies(id) ON DELETE CASCADE, + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT (now() at time zone 'utc'), + PRIMARY KEY (segment_id, milestone_strategy_id) + ); + + ALTER TABLE milestone_strategies ADD COLUMN variants JSONB NOT NULL DEFAULT '[]'::JSONB; + `, cb) +}; + +exports.down = function(db, cb) { + db.runSql(` + ALTER TABLE release_plan_definitions DROP COLUMN release_plan_template_id; + ALTER TABLE feature_strategies DROP COLUMN milestone_id; + DROP TABLE milestone_strategy_segments; + ALTER TABLE milestone_strategies DROP COLUMN variants; + `, cb); +}; diff --git a/src/server-dev.ts b/src/server-dev.ts index 91c2bfc4c7..81a95d9f16 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -55,8 +55,8 @@ process.nextTick(async () => { originMiddlewareRequestLogging: true, unleashAI: true, webhookDomainLogging: true, - addonUsageMetrics: true, releasePlans: false, + simplifyProjectOverview: true, }, }, authentication: { diff --git a/website/.gitignore b/website/.gitignore index dc0baad8a9..d906f81365 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -20,7 +20,7 @@ yarn-debug.log* yarn-error.log* # OpenAPI docusaurus generated stuff -docs/reference/api/**/sidebar.js +docs/reference/api/**/sidebar.ts *.api.mdx *.tag.mdx diff --git a/website/babel.config.js b/website/babel.config.js deleted file mode 100644 index 0adade1fb9..0000000000 --- a/website/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], -}; diff --git a/website/clean-generated-docs.js b/website/clean-generated-docs.mjs similarity index 92% rename from website/clean-generated-docs.js rename to website/clean-generated-docs.mjs index 116a15ae60..b8bfcdd419 100644 --- a/website/clean-generated-docs.js +++ b/website/clean-generated-docs.mjs @@ -15,7 +15,7 @@ // the bits that are specific to the generation source we use, and make the docs // easier to use. In particular, removing the leading `/ushosted` is likely to // save us loooots of questions. -const replace = require('replace-in-file'); +import { replaceInFileSync } from 'replace-in-file'; const options = { files: 'docs/reference/api/**/*.api.mdx', @@ -27,4 +27,4 @@ const options = { to: ['', '""', '"path":['], }; -replace(options); +replaceInFileSync(options); diff --git a/website/docs/feature-flag-tutorials/ios/implementing-feature-flags.md b/website/docs/feature-flag-tutorials/ios/implementing-feature-flags-ios.md similarity index 93% rename from website/docs/feature-flag-tutorials/ios/implementing-feature-flags.md rename to website/docs/feature-flag-tutorials/ios/implementing-feature-flags-ios.md index 354b20707c..e5a8466eab 100644 --- a/website/docs/feature-flag-tutorials/ios/implementing-feature-flags.md +++ b/website/docs/feature-flag-tutorials/ios/implementing-feature-flags-ios.md @@ -13,12 +13,14 @@ In this tutorial, you will learn how to set up and use iOS feature flags with Un Here are the steps we will cover in this tutorial: -1. [Feature flag best practices for client-side apps](#1-architect-to-limit-pii-and-configuration-leakage) -2. [Spin up a local provider](#2-install-a-local-feature-flag-provider) -3. [Configure a feature flag](#3-create-and-configure-the-feature-flag) -4. [Add Unleash to an iOS app](#4-add-unleash-to-an-ios-app) -5. [Log status of iOS feature flag](#5-configure-unleash-and-log-ios-feature-flag-status) -6. [Verify the feature flag experience](#6-verify-the-feature-flag-experience) +- [Prerequisites](#prerequisites) +- [1. Architect to limit PII and configuration leakage](#1-architect-to-limit-pii-and-configuration-leakage) +- [2. Install a local feature flag provider](#2-install-a-local-feature-flag-provider) +- [3. Create and configure the feature flag](#3-create-and-configure-the-feature-flag) +- [4. Add Unleash to an iOS app](#4-add-unleash-to-an-ios-app) +- [5. Configure Unleash and log iOS feature flag status](#5-configure-unleash-and-log-ios-feature-flag-status) +- [6. Verify the feature flag experience](#6-verify-the-feature-flag-experience) +- [Conclusion](#conclusion) ## Prerequisites @@ -37,7 +39,7 @@ a. Limit PII (personally identifiable information) leakage from the end-user dev b. Avoid leakage of configuration information from the central feature flag control service to end-user devices. -Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/never-expose-pii). +Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/feature-flag-best-practices#2-protect-pii-by-evaluating-flags-server-side). ![Keep configurations and PII secure image](/img/react-tutorial-pii-diagram.png) diff --git a/website/docs/feature-flag-tutorials/react/implementing-feature-flags.mdx b/website/docs/feature-flag-tutorials/react/implementing-feature-flags.mdx index 0ccd8d0061..5e1adf687a 100644 --- a/website/docs/feature-flag-tutorials/react/implementing-feature-flags.mdx +++ b/website/docs/feature-flag-tutorials/react/implementing-feature-flags.mdx @@ -50,7 +50,7 @@ a. Limit PII (personally identifiable information) leakage from the end-user dev b. Avoid leakage of configuration information from the central feature flag control service to end-user devices. -Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/never-expose-pii). +Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/feature-flag-best-practices#2-protect-pii-by-evaluating-flags-server-side). ![Keep configurations and PII secure image](/img/react-tutorial-pii-diagram.png) diff --git a/website/docs/how-to/how-to-add-sso-azure-saml.mdx b/website/docs/how-to/how-to-add-sso-azure-saml.mdx index 7e36d4633f..60d6c36487 100644 --- a/website/docs/how-to/how-to-add-sso-azure-saml.mdx +++ b/website/docs/how-to/how-to-add-sso-azure-saml.mdx @@ -76,7 +76,7 @@ To find your Microsoft Entra identifier, go to the single sign-on settings of yo To finalize the configuration, do the following: -1. In the Unleash Admin UI, go to **Admin > Single sign-on> SAML 2.0**. +1. In the Unleash Admin UI, go to **Admin > Single sign-on > SAML 2.0**. 2. In **Entity ID**, enter your [Microsoft Entra identifier](#microsoft-entra-identifier). 3. In **Single sign-on URL**, enter your [Login URL](#login-url). 4. In **X.509 Certificate**, [enter your SAML certificate](#saml-certificate). diff --git a/website/docs/how-to/how-to-environment-import-export.mdx b/website/docs/how-to/how-to-environment-import-export.mdx index f0a48952a7..b358be382c 100644 --- a/website/docs/how-to/how-to-environment-import-export.mdx +++ b/website/docs/how-to/how-to-environment-import-export.mdx @@ -1,7 +1,10 @@ --- title: Environment Import & Export --- + + import VideoContent from '@site/src/components/VideoContent.jsx' +import Figure from '@site/src/components/Figure/Figure.tsx' :::note Availability diff --git a/website/docs/reference/feature-toggles.mdx b/website/docs/reference/feature-toggles.mdx index 5f0784b744..fdd0e5f9de 100644 --- a/website/docs/reference/feature-toggles.mdx +++ b/website/docs/reference/feature-toggles.mdx @@ -71,7 +71,7 @@ Marking a flag as stale helps you deprecate a feature flag without removing the You can use this to signal to your team to stop using the feature in your applications. Stale flags will show as stale in the [technical debt dashboard](./technical-debt). -Marking a flag as stale generates the `feature-stale-on` [event](./reference/events#feature-stale-on). You can use [an integration](/integrations/integrations) to trigger automated workflows, such as posting notifications in a Slack channel, breaking project builds if the code contains stale flags, or automatically opening pull requests to remove stale flags from the code. +Marking a flag as stale generates the `feature-stale-on` [event](/reference/events#feature-stale-on). You can use [an integration](/reference/integrations) to trigger automated workflows, such as posting notifications in a Slack channel, breaking project builds if the code contains stale flags, or automatically opening pull requests to remove stale flags from the code. ### Configure expected lifetime diff --git a/website/docs/reference/integrations/jira-server-plugin-installation.md b/website/docs/reference/integrations/jira-server-plugin-installation.md index 49757ae949..f1d36c1ed1 100644 --- a/website/docs/reference/integrations/jira-server-plugin-installation.md +++ b/website/docs/reference/integrations/jira-server-plugin-installation.md @@ -70,7 +70,7 @@ server configured for a specific Jira project. ![A table marked Unleash Server Configuration, listing Unleash server instances.](/img/jira_server_manage_servers.png) -Once you have configured at least one Unleash server, your users should be ready to [use the Jira Server plugin](/integrations/jira_server_plugin_usage) +Once you have configured at least one Unleash server, your users should be ready to [use the Jira Server plugin](/reference/integrations/jira-server-plugin-usage) ### Edit existing servers diff --git a/website/docs/reference/network-view.mdx b/website/docs/reference/network-view.mdx index 9bd6fa7e3d..bac9610240 100644 --- a/website/docs/reference/network-view.mdx +++ b/website/docs/reference/network-view.mdx @@ -77,14 +77,7 @@ The `PROMETHEUS_API` environment variable should point to the base path of the P This setup means that there is a mutual dependency between Unleash and Prometheus, where Prometheus regularly fetches data from Unleash's backstage API and Unleash fetches and displays this data when you use the network view. This diagram provides a visual representation of that. -```mermaid -sequenceDiagram - participant Unleash - loop Scrape data - Prometheus-->>Unleash: fetch internal-backstage/prometheus - end - Unleash->>+Prometheus: Query data for network view -``` +![](/img/network-view.png) [^1]: For instance: when using Unleash in an API setting, a common mistake is to instantiate a new SDK for every request instead of sharing a single instance across requests. This would be visible in the network overview graph as a large number of requests from the same app. diff --git a/website/docs/reference/sdks/index.mdx b/website/docs/reference/sdks/index.mdx index 71a82b94f1..ecf93f1a0f 100644 --- a/website/docs/reference/sdks/index.mdx +++ b/website/docs/reference/sdks/index.mdx @@ -55,7 +55,6 @@ If you see an item marked with a ❌ that you would find useful, feel free to re ::: - | Capability | [Java](/docs/generated/sdks/server-side/java.md) | [Node.js](/docs/generated/sdks/server-side/node.md) | [Go](/docs/generated/sdks/server-side/go.md) | [Python](/docs/generated/sdks/server-side/python.md) | [Ruby](/docs/generated/sdks/server-side/ruby.md) | [.NET](/docs/generated/sdks/server-side/dotnet.md) | [PHP](/docs/generated/sdks/server-side/php.md) | [Rust](/docs/generated/sdks/server-side/rust.md) | | --- | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | @@ -89,7 +88,7 @@ If you see an item marked with a ❌ that you would find useful, feel free to re | Static fields (`environment`, `appName`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Defined fields | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Custom properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| **Category: [`isEnabled`](./client-specification#implementation-of-isenabled)** | | | | | | | | | +| **Category: [`isEnabled`](/client-specification#implementation-of-isenabled)** | | | | | | | | | | Can take context | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Override fallback value | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Fallback function | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | ⭕ | ⭕ | @@ -110,7 +109,6 @@ If you see an item marked with a ❌ that you would find useful, feel free to re | Bootstrap from file | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | | Custom Bootstrap implementation | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | - ## Community SDKs ❤️ {#community-sdks} @@ -138,7 +136,7 @@ Here's some of the fantastic work our community has done to make Unleash work in If you can't find an SDK that fits your requirements, you can also develop your own SDK. To make implementation easier, check out these resources: - [Unleash Client Specifications](https://github.com/Unleash/client-specification) - Used by all official SDKs to make sure they behave correctly across different language implementations. This lets us verify that a gradual rollout to 10% of the users would affect the same users regardless of which SDK you're using. -- [Client SDK overview](./client-specification) - A brief, overall guide of the _Unleash Architecture_ and important aspects of the SDK role in it all. +- [Client SDK overview](/client-specification) - A brief, overall guide of the _Unleash Architecture_ and important aspects of the SDK role in it all. ## Client-side SDK behavior diff --git a/website/docs/reference/segments.mdx b/website/docs/reference/segments.mdx index 2c9fb4a0c8..c69c1ce6c4 100644 --- a/website/docs/reference/segments.mdx +++ b/website/docs/reference/segments.mdx @@ -52,7 +52,7 @@ In theory, you could create segments with a thousand constraints, each with a mi By default, you can apply **at most 5 segments to any one strategy**. Separate strategies (even on the same feature) do not count towards the same total, so you can have two strategies with 5 segments each. -You **can** [configure segment limits](./using-unleash/deploy/configuring-unleash#segments) with environment variables. +You **can** [configure segment limits](/using-unleash/deploy/configuring-unleash#segments) with environment variables. ### A note on large segments {#large-segments} diff --git a/website/docs/understanding-unleash/unleash-overview.md b/website/docs/understanding-unleash/unleash-overview.md index 05f09c1c46..48fc7ae7cc 100644 --- a/website/docs/understanding-unleash/unleash-overview.md +++ b/website/docs/understanding-unleash/unleash-overview.md @@ -23,7 +23,7 @@ Before you can connect your application to Unleash you need a Unleash server. Yo ![A visual overview of an Unleash system as described in the following paragraph.](/img/unleash-architecture-edge.png 'System Overview') - [**Unleash API**](/reference/api/unleash) - The Unleash instance. This is where you create feature flags, configure activation strategies, and parameters, etc. The service that contains all feature flags and their configurations. Configurations declare which activation strategies to use and which parameters they should get. -- **Unleash Admin UI** - The bundled web interface for interacting with the Unleash instance. Manage flags, define strategies, look at metrics, and much more. Use the UI to [create feature flags](/how-to-create-feature-flag), [manage project access roles](../how-to/how-to-create-and-assign-custom-project-roles), [create API tokens](how-to/how-to-create-api-tokens), and more. +- **Unleash Admin UI** - The bundled web interface for interacting with the Unleash instance. Manage flags, define strategies, look at metrics, and much more. Use the UI to [create feature flags](/how-to-create-feature-flag), [manage project access roles](../how-to/how-to-create-and-assign-custom-project-roles), [create API tokens](../how-to/how-to-create-api-tokens), and more. - [**Unleash SDKs**](../reference/sdks) - Unleash SDKs integrate into your applications and get feature configurations from the Unleash API. Use them to check whether features are enabled or disabled and to send metrics to the Unleash API. [See all our SDKs](../reference/sdks) - [**Unleash Edge**](../reference/unleash-edge) - The Unleash Edge sits between front-end and native applications on one side and the Unleash API on the other. It can also sit between server-side SDKs and the Unleash API as well. You can scale it independently of the Unleash API to handle large request rates without causing issues for the Unleash API. Edge has all endpoints for the client API, frontend API, and proxy API. diff --git a/website/docs/using-unleash/deploy/upgrading-unleash.mdx b/website/docs/using-unleash/deploy/upgrading-unleash.mdx index 2a1788f601..00120e6b6d 100644 --- a/website/docs/using-unleash/deploy/upgrading-unleash.mdx +++ b/website/docs/using-unleash/deploy/upgrading-unleash.mdx @@ -144,8 +144,6 @@ As such, if you're relying on the specifics of the error structure for those API Before you upgrade we strongly recommend that you take a full [database backup](database-backup), to make sure you can downgrade to version 3. -You can also read the highlights of **[what's new in v4](/user_guide/v4-whats-new)**. - ### 1. All API calls now require a token. {#1-all-api-calls-now-requires-token} If you are upgrading from Unleash Open-Source v3 client SDKs did not need to use an API token in order to connect to Unleash-server. Starting from v4 we have back-ported the API token handling for Enterprise in to the Open-Source version. This means that all client SDKs now need to use a client token in order to connect to Unleash. diff --git a/website/docusaurus.config.js b/website/docusaurus.config.ts similarity index 97% rename from website/docusaurus.config.js rename to website/docusaurus.config.ts index 7fa44adfa8..78829920dd 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.ts @@ -1,5 +1,8 @@ -const { sdks } = require('./remote-content/sdks'); -const { docs: edgeAndProxy } = require('./remote-content/edge-proxy'); +import type { Config } from '@docusaurus/types'; + +import { sdks } from './remote-content/sdks'; +import { docs as edgeAndProxy } from './remote-content/edge-proxy'; +import pluginNpm2Yarn from '@docusaurus/remark-plugin-npm2yarn'; // for a given redirect object, modify it's `from` property such that for every // path that doesn't start with `/docs/`, a corresponding path that _does_ start @@ -38,8 +41,8 @@ const addDocsRoutePrefix = ({ from, ...rest }) => { from: addDocs(from), }; }; -/** @type {import('@docusaurus/types').DocusaurusConfig} */ -module.exports = { + +const config: Config = { title: 'Unleash Documentation', tagline: 'The enterprise ready feature flag service', url: 'https://docs.getunleash.io', @@ -50,7 +53,6 @@ module.exports = { organizationName: 'Unleash', // Usually your GitHub org/user name. projectName: 'unleash.github.io', // Usually your repo name. trailingSlash: false, - markdown: { mermaid: true }, customFields: { // expose env vars etc here environment: process.env.NODE_ENV, @@ -170,17 +172,13 @@ module.exports = { ], }, prism: { - theme: require('prism-react-renderer/themes/oceanicNext'), additionalLanguages: [ 'csharp', 'dart', - 'http', 'java', - 'kotlin', 'php', 'ruby', - 'rust', - 'swift', + 'bash', ], }, languageTabs: [ @@ -290,22 +288,16 @@ module.exports = { '@docusaurus/preset-classic', { docs: { - sidebarPath: require.resolve('./sidebars.js'), // Please change this to your repo. editUrl: 'https://github.com/Unleash/unleash/edit/main/website/', routeBasePath: '/', - remarkPlugins: [ - [ - require('@docusaurus/remark-plugin-npm2yarn'), - { sync: true }, - ], - ], - docLayoutComponent: '@theme/DocPage', + remarkPlugins: [[pluginNpm2Yarn, { sync: true }]], docItemComponent: '@theme/ApiItem', + sidebarPath: './sidebars.ts', }, theme: { - customCss: require.resolve('./src/css/custom.css'), + customCss: './src/css/custom.css', }, googleAnalytics: { trackingID: 'UA-134882379-1', @@ -911,7 +903,6 @@ module.exports = { ], themes: [ 'docusaurus-theme-openapi-docs', // Allows use of @theme/ApiItem and other components - '@docusaurus/theme-mermaid', ], scripts: [ { @@ -924,5 +915,7 @@ module.exports = { defer: true, }, ], - clientModules: [require.resolve('./global.js')], + clientModules: ['./global.js'], }; + +export default config; diff --git a/website/package.json b/website/package.json index 360d8e69ca..a3dc07b71e 100644 --- a/website/package.json +++ b/website/package.json @@ -11,7 +11,7 @@ "build": "yarn generate && yarn fetch-remote-content && docusaurus build", "swizzle": "docusaurus swizzle", "fetch-remote-content": "docusaurus download-remote-content-external && docusaurus download-remote-content-sdks", - "generate": "docusaurus gen-api-docs all && node clean-generated-docs.js", + "generate": "docusaurus gen-api-docs all && node clean-generated-docs.mjs", "deploy": "yarn generate && yarn fetch-remote-content && docusaurus deploy", "clear": "docusaurus clear", "serve": "docusaurus serve", @@ -20,40 +20,22 @@ "test": "NODE_ENV=test node --trace-warnings ../node_modules/.bin/jest remote-content" }, "dependencies": { - "@docusaurus/core": "2.3.1", - "@docusaurus/plugin-client-redirects": "2.3.1", - "@docusaurus/plugin-google-analytics": "2.3.1", - "@docusaurus/preset-classic": "2.3.1", - "@docusaurus/remark-plugin-npm2yarn": "2.3.1", - "@docusaurus/theme-mermaid": "2.3.1", - "@mdx-js/react": "1.6.22", - "@svgr/webpack": "8.1.0", - "browserslist": "^4.16.5", - "docusaurus-plugin-openapi-docs": "2.0.0-beta.3", - "docusaurus-plugin-remote-content": "^3.1.0", - "docusaurus-theme-openapi-docs": "2.0.0-beta.2", - "git-url-parse": "^14.0.0", + "@docusaurus/core": "^3.5.2", + "@docusaurus/plugin-client-redirects": "^3.5.2", + "@docusaurus/plugin-google-analytics": "^3.5.2", + "@docusaurus/preset-classic": "^3.5.2", + "@docusaurus/remark-plugin-npm2yarn": "3.5.2", + "@mdx-js/react": "^3.1.0", + "docusaurus-plugin-openapi-docs": "^4.1.0", + "docusaurus-plugin-remote-content": "^4.0.0", + "docusaurus-theme-openapi-docs": "^4.1.0", + "git-url-parse": "^15.0.0", "plugin-image-zoom": "flexanalytics/plugin-image-zoom", + "prism-react-renderer": "^2.4.0", "prism-svelte": "^0.5.0", - "react": "18.3.1", - "react-dom": "18.3.1", - "url-loader": "4.1.1" - }, - "resolutions": { - "axios": "^0.28.0", - "async": "^3.2.4", - "trim": "^1.0.0", - "got": "^13.0.0", - "glob-parent": "^6.0.0", - "browserslist": "^4.16.5", - "set-value": "^4.0.1", - "ansi-regex": "^5.0.1", - "nth-check": "^2.0.1", - "minimatch": "^5.0.0", - "decode-uri-component": "^0.4.0", - "qs": "^6.9.7", - "ws": "^8.18.0", - "semver": "^7.5.3" + "react": "^18.3.1", + "react-dom": "^18.3.1", + "replace-in-file": "^8.2.0" }, "browserslist": { "production": [ @@ -68,14 +50,14 @@ ] }, "devDependencies": { - "@babel/core": "7.25.8", - "@docusaurus/module-type-aliases": "2.3.1", + "@docusaurus/module-type-aliases": "^3.5.2", + "@docusaurus/types": "^3.5.2", "@tsconfig/docusaurus": "2.0.3", - "babel-loader": "9.2.1", - "enhanced-resolve": "5.17.1", - "react-router": "6.27.0", - "replace-in-file": "7.2.0", - "typescript": "5.4.5" + "@types/react": "^18.3.12", + "typescript": "5.6.3" + }, + "resolutions": { + "http-proxy-middleware": "3.0.3" }, "packageManager": "yarn@4.5.1" } diff --git a/website/remote-content/edge-proxy.js b/website/remote-content/edge-proxy.js index df21dbce8c..4e1d642376 100644 --- a/website/remote-content/edge-proxy.js +++ b/website/remote-content/edge-proxy.js @@ -1,10 +1,10 @@ -const { +import { enrich, mapObject, modifyContent, getRepoData, getUrls, -} = require('./shared'); +} from './shared'; const DOCS = mapObject(enrich)({ 'unleash-proxy': { @@ -46,7 +46,7 @@ const modifyContent2 = modifyContent({ getAdditionalAdmonitions: getAdmonitions, }); -module.exports.docs = { +export const docs = { urls: getUrls(DOCS), modifyContent: modifyContent2, }; diff --git a/website/remote-content/sdks.js b/website/remote-content/sdks.js index 18684f2361..48482d42d4 100644 --- a/website/remote-content/sdks.js +++ b/website/remote-content/sdks.js @@ -1,9 +1,9 @@ -const { +import { enrichAdditional, modifyContent, getRepoData, getUrls, -} = require('./shared'); +} from './shared'; // Type definitions // @@ -117,7 +117,7 @@ const modifyContent2 = modifyContent({ getAdditionalAdmonitions: getAdmonitions, }); -module.exports.sdks = { +export const sdks = { urls: getUrls(SDKS), modifyContent: modifyContent2, }; diff --git a/website/remote-content/sdks.test.js b/website/remote-content/sdks.test.js index 8140cfc823..6b23ae85d9 100644 --- a/website/remote-content/sdks.test.js +++ b/website/remote-content/sdks.test.js @@ -1,4 +1,4 @@ -const { docs } = require('./edge-proxy'); +import { docs } from './edge-proxy'; test('Should get all sub pages', () => { expect(docs.urls).toStrictEqual([ diff --git a/website/remote-content/shared.js b/website/remote-content/shared.js index 184ceb9ff0..eec004cfc6 100644 --- a/website/remote-content/shared.js +++ b/website/remote-content/shared.js @@ -1,9 +1,9 @@ -const path = require('path'); +import path from 'node:path'; -module.exports.mapObject = (fn) => (o) => +export const mapObject = (fn) => (o) => Object.fromEntries(Object.entries(o).map(fn)); -module.exports.enrichAdditional = +export const enrichAdditional = (additionalProperties) => ([repoName, repoData]) => { const repoUrl = `https://github.com/Unleash/${repoName}`; @@ -17,9 +17,10 @@ module.exports.enrichAdditional = { ...repoData, repoUrl, slugName, branch, ...additionalProperties }, ]; }; -module.exports.enrich = module.exports.enrichAdditional({}); -module.exports.getRepoData = (documents) => (filename) => { +export const enrich = enrichAdditional({}); + +export const getRepoData = (documents) => (filename) => { const repoName = filename.split('/')[0]; const repoData = documents[repoName]; @@ -80,7 +81,7 @@ const replaceLinks = ({ content, repo }) => { .replaceAll(imageSrcLink, replaceImageSrcLink); }; -module.exports.modifyContent = +export const modifyContent = ({ getRepoDataFn, filePath = () => {}, @@ -128,11 +129,15 @@ module.exports.modifyContent = content: `--- title: ${subpage?.sidebarName ?? data.sidebarName} slug: ${processedSlug} -custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${subpage ? subpageKey : 'README.md'} +custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${ + subpage ? subpageKey : 'README.md' + } --- :::info Generated content -This document was generated from ${subpage ? subpageKey : 'README.md'} in the [${data.sidebarName} GitHub repository](${data.repoUrl}). +This document was generated from ${ + subpage ? subpageKey : 'README.md' + } in the [${data.sidebarName} GitHub repository](${data.repoUrl}). ::: ${additionalAdmonitions} @@ -152,7 +157,7 @@ This content was generated on