diff --git a/server/historian/packages/historian-base/src/app.ts b/server/historian/packages/historian-base/src/app.ts index 03f343eb301d..b40026abaffd 100644 --- a/server/historian/packages/historian-base/src/app.ts +++ b/server/historian/packages/historian-base/src/app.ts @@ -5,6 +5,7 @@ import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -40,6 +41,7 @@ export function create( denyList?: IDenyList, ephemeralDocumentTTLSec?: number, readinessCheck?: IReadinessCheck, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ) { // Express app configuration const app: express.Express = express(); @@ -110,6 +112,7 @@ export function create( revokedTokenChecker, denyList, ephemeralDocumentTTLSec, + simplifiedCustomDataRetriever, ); app.use(apiRoutes.git.blobs); app.use(apiRoutes.git.refs); diff --git a/server/historian/packages/historian-base/src/customizations.ts b/server/historian/packages/historian-base/src/customizations.ts index df3173c643ff..aae34f201167 100644 --- a/server/historian/packages/historian-base/src/customizations.ts +++ b/server/historian/packages/historian-base/src/customizations.ts @@ -5,6 +5,7 @@ import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IRevokedTokenChecker, IReadinessCheck, } from "@fluidframework/server-services-core"; @@ -16,4 +17,5 @@ export interface IHistorianResourcesCustomizations { redisClientConnectionManager?: IRedisClientConnectionManager; redisClientConnectionManagerForThrottling?: IRedisClientConnectionManager; readinessCheck?: IReadinessCheck; + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever; } diff --git a/server/historian/packages/historian-base/src/routes/git/blobs.ts b/server/historian/packages/historian-base/src/routes/git/blobs.ts index 5e0b7c4ca320..342ad30889b4 100644 --- a/server/historian/packages/historian-base/src/routes/git/blobs.ts +++ b/server/historian/packages/historian-base/src/routes/git/blobs.ts @@ -6,6 +6,7 @@ import * as git from "@fluidframework/gitresources"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -34,6 +35,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/git/commits.ts b/server/historian/packages/historian-base/src/routes/git/commits.ts index bd28a9e325f9..fee867d141f7 100644 --- a/server/historian/packages/historian-base/src/routes/git/commits.ts +++ b/server/historian/packages/historian-base/src/routes/git/commits.ts @@ -6,6 +6,7 @@ import { ICommit, ICreateCommitParams } from "@fluidframework/gitresources"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -34,6 +35,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/git/tags.ts b/server/historian/packages/historian-base/src/routes/git/tags.ts index 550ace1e8aac..18ded9505aed 100644 --- a/server/historian/packages/historian-base/src/routes/git/tags.ts +++ b/server/historian/packages/historian-base/src/routes/git/tags.ts @@ -6,6 +6,7 @@ import * as git from "@fluidframework/gitresources"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -34,6 +35,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/git/trees.ts b/server/historian/packages/historian-base/src/routes/git/trees.ts index 93064b7c72ac..4a1652141657 100644 --- a/server/historian/packages/historian-base/src/routes/git/trees.ts +++ b/server/historian/packages/historian-base/src/routes/git/trees.ts @@ -6,6 +6,7 @@ import * as git from "@fluidframework/gitresources"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -34,6 +35,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/index.ts b/server/historian/packages/historian-base/src/routes/index.ts index 9dd28658b1f1..7788c2c5f274 100644 --- a/server/historian/packages/historian-base/src/routes/index.ts +++ b/server/historian/packages/historian-base/src/routes/index.ts @@ -5,6 +5,7 @@ import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -52,6 +53,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): IRoutes { const commonRouteParams: CommonRouteParams = [ config, diff --git a/server/historian/packages/historian-base/src/routes/repository/commits.ts b/server/historian/packages/historian-base/src/routes/repository/commits.ts index 110d4bad39a0..81da2bbe332d 100644 --- a/server/historian/packages/historian-base/src/routes/repository/commits.ts +++ b/server/historian/packages/historian-base/src/routes/repository/commits.ts @@ -6,6 +6,7 @@ import * as git from "@fluidframework/gitresources"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -34,6 +35,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/repository/contents.ts b/server/historian/packages/historian-base/src/routes/repository/contents.ts index 950e94a4f9ef..f5c77b059c9d 100644 --- a/server/historian/packages/historian-base/src/routes/repository/contents.ts +++ b/server/historian/packages/historian-base/src/routes/repository/contents.ts @@ -5,6 +5,7 @@ import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -33,6 +34,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/repository/headers.ts b/server/historian/packages/historian-base/src/routes/repository/headers.ts index e0df2b77009c..8e72440d3bc7 100644 --- a/server/historian/packages/historian-base/src/routes/repository/headers.ts +++ b/server/historian/packages/historian-base/src/routes/repository/headers.ts @@ -6,6 +6,7 @@ import { IHeader } from "@fluidframework/gitresources"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -34,6 +35,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); diff --git a/server/historian/packages/historian-base/src/routes/summaries.ts b/server/historian/packages/historian-base/src/routes/summaries.ts index dc74e92cc9b8..fdd4ecf800cb 100644 --- a/server/historian/packages/historian-base/src/routes/summaries.ts +++ b/server/historian/packages/historian-base/src/routes/summaries.ts @@ -10,6 +10,7 @@ import { } from "@fluidframework/server-services-client"; import { IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IThrottler, IRevokedTokenChecker, IDocumentManager, @@ -39,6 +40,7 @@ export function create( revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ): Router { const router: Router = Router(); const ignoreIsEphemeralFlag: boolean = config.get("ignoreEphemeralFlag") ?? true; @@ -129,6 +131,7 @@ export function create( isEphemeralContainer, denyList, ephemeralDocumentTTLSec, + simplifiedCustomDataRetriever, }); return service.createSummary(params, initial); } diff --git a/server/historian/packages/historian-base/src/routes/utils.ts b/server/historian/packages/historian-base/src/routes/utils.ts index fd0048ed7a0e..8bb2ac472605 100644 --- a/server/historian/packages/historian-base/src/routes/utils.ts +++ b/server/historian/packages/historian-base/src/routes/utils.ts @@ -18,6 +18,7 @@ import { import { runWithRetry, IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IRevokedTokenChecker, IDocumentManager, IDocumentStaticProperties, @@ -45,6 +46,7 @@ export type CommonRouteParams = [ revokedTokenChecker?: IRevokedTokenChecker, denyList?: IDenyList, ephemeralDocumentTTLSec?: number, + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ]; export class createGitServiceArgs { @@ -61,6 +63,7 @@ export class createGitServiceArgs { isEphemeralContainer?: boolean = false; ephemeralDocumentTTLSec?: number = 60 * 60 * 24; // 24 hours denyList?: IDenyList; + simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever; } function getEphemeralContainerCacheKey(documentId: string): string { @@ -250,6 +253,7 @@ export async function createGitService(createArgs: createGitServiceArgs): Promis isEphemeralContainer, ephemeralDocumentTTLSec, denyList, + simplifiedCustomDataRetriever, } = createArgs; const token = parseToken(tenantId, authorization); const decoded = decode(token) as ITokenClaims; @@ -263,6 +267,7 @@ export async function createGitService(createArgs: createGitServiceArgs): Promis } const details = await tenantService.getTenant(tenantId, token, allowDisabledTenant); const customData: ITenantCustomDataExternal = details.customData; + const simplifiedCustomData = simplifiedCustomDataRetriever?.get(customData); const writeToExternalStorage = !!customData?.externalStorageData; const storageUrl = config.get("storageUrl") as string | undefined; const ignoreEphemeralFlag: boolean = config.get("ignoreEphemeralFlag"); @@ -297,6 +302,7 @@ export async function createGitService(createArgs: createGitServiceArgs): Promis storageUrl, isEphemeral, maxCacheableSummarySize, + simplifiedCustomData, ); return service; } diff --git a/server/historian/packages/historian-base/src/runner.ts b/server/historian/packages/historian-base/src/runner.ts index 93e409d42e58..5adf9e32fabf 100644 --- a/server/historian/packages/historian-base/src/runner.ts +++ b/server/historian/packages/historian-base/src/runner.ts @@ -11,6 +11,7 @@ import { IRunner, IRevokedTokenChecker, IStorageNameRetriever, + ISimplifiedCustomDataRetriever, IDocumentManager, IReadinessCheck, } from "@fluidframework/server-services-core"; @@ -39,6 +40,7 @@ export class HistorianRunner implements IRunner { private readonly denyList?: IDenyList, private readonly ephemeralDocumentTTLSec?: number, private readonly readinessCheck?: IReadinessCheck, + private readonly simplifiedCustomDataRetriever?: ISimplifiedCustomDataRetriever, ) {} // eslint-disable-next-line @typescript-eslint/promise-function-async @@ -58,6 +60,7 @@ export class HistorianRunner implements IRunner { this.denyList, this.ephemeralDocumentTTLSec, this.readinessCheck, + this.simplifiedCustomDataRetriever, ); historian.set("port", this.port); diff --git a/server/historian/packages/historian-base/src/runnerFactory.ts b/server/historian/packages/historian-base/src/runnerFactory.ts index d93f64c986de..36311bc3301a 100644 --- a/server/historian/packages/historian-base/src/runnerFactory.ts +++ b/server/historian/packages/historian-base/src/runnerFactory.ts @@ -32,6 +32,7 @@ export class HistorianResources implements core.IResources { public readonly denyList?: historianServices.IDenyList, public readonly ephemeralDocumentTTLSec?: number, public readonly readinessCheck?: core.IReadinessCheck, + public readonly simplifiedCustomDataRetriever?: core.ISimplifiedCustomDataRetriever, ) { const httpServerConfig: services.IHttpServerConfig = config.get("system:httpServer"); this.webServerFactory = new services.BasicWebServerFactory(httpServerConfig); @@ -226,6 +227,7 @@ export class HistorianResourcesFactory implements core.IResourcesFactory