Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): exactOptionalPropertyTypes clean up #22435

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/common/container-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Interface_IContainerContext": {
"backCompat": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ declare type old_as_current_for_Interface_IContainerContext = requireAssignableT
* typeValidation.broken:
* "Interface_IContainerContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IContainerContext = requireAssignableTo<TypeOnly<current.IContainerContext>, TypeOnly<old.IContainerContext>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export interface IDocumentStorageService extends Partial<IDisposable> {
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>;
readonly policies?: IDocumentStorageServicePolicies;
readonly policies?: IDocumentStorageServicePolicies | undefined;
readBlob(id: string): Promise<ArrayBufferLike>;
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/driver-definitions/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export interface IDocumentStorageService extends Partial<IDisposable> {
/**
* Policies implemented/instructed by driver.
*/
readonly policies?: IDocumentStorageServicePolicies;
readonly policies?: IDocumentStorageServicePolicies | undefined;

/**
* Returns the snapshot tree.
Expand Down
7 changes: 6 additions & 1 deletion packages/framework/aqueduct/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Interface_IDataObjectProps": {
"backCompat": false,
"forwardCompat": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ declare type current_as_old_for_Interface_DataObjectTypes = requireAssignableTo<
* typeValidation.broken:
* "Interface_IDataObjectProps": {"forwardCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type old_as_current_for_Interface_IDataObjectProps = requireAssignableTo<TypeOnly<old.IDataObjectProps>, TypeOnly<current.IDataObjectProps>>

/*
Expand All @@ -193,6 +194,7 @@ declare type old_as_current_for_Interface_IDataObjectProps = requireAssignableTo
* typeValidation.broken:
* "Interface_IDataObjectProps": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IDataObjectProps = requireAssignableTo<TypeOnly<current.IDataObjectProps>, TypeOnly<old.IDataObjectProps>>

/*
Expand Down
15 changes: 14 additions & 1 deletion packages/loader/driver-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Class_AuthorizationError": {
"backCompat": false
},
"Class_PrefetchDocumentStorageService": {
"backCompat": false
},
"ClassStatics_AuthorizationError": {
"backCompat": false
},
"ClassStatics_PrefetchDocumentStorageService": {
"backCompat": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class DocumentStorageServiceProxy implements IDocumentStorageService {
this._policies = policies;
}

public get policies() {
public get policies(): IDocumentStorageServicePolicies | undefined {
return this._policies ?? this.internalStorageService.policies;
}

Expand Down
12 changes: 10 additions & 2 deletions packages/loader/driver-utils/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,22 @@ export class AuthorizationError
implements IAuthorizationError, IFluidErrorBase
{
readonly errorType = DriverErrorTypes.authorizationError;
readonly claims?: string;
readonly tenantId?: string;
readonly canRetry = false;

constructor(
message: string,
readonly claims: string | undefined,
readonly tenantId: string | undefined,
claims: string | undefined,
tenantId: string | undefined,
props: DriverErrorTelemetryProps,
) {
if (claims !== undefined) {
props.claims = claims;
}
if (tenantId !== undefined) {
props.tenantId = tenantId;
}
// don't log claims or tenantId
super(message, props, new Set(["claims", "tenantId"]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* Licensed under the MIT License.
*/

import {
LoaderCachingPolicy,
import type {
IDocumentStorageServicePolicies,
ISnapshotTree,
IVersion,
} from "@fluidframework/driver-definitions/internal";
import { LoaderCachingPolicy } from "@fluidframework/driver-definitions/internal";

import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy.js";
import { canRetryOnError } from "./network.js";
Expand All @@ -20,7 +21,7 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
private readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();
private prefetchEnabled = true;

public get policies() {
public get policies(): IDocumentStorageServicePolicies | undefined {
const policies = this.internalStorageService.policies;
if (policies) {
return { ...policies, caching: LoaderCachingPolicy.NoCaching };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ declare type old_as_current_for_Class_AuthorizationError = requireAssignableTo<T
* typeValidation.broken:
* "Class_AuthorizationError": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Class_AuthorizationError = requireAssignableTo<TypeOnly<current.AuthorizationError>, TypeOnly<old.AuthorizationError>>

/*
Expand All @@ -67,6 +68,7 @@ declare type current_as_old_for_Class_AuthorizationError = requireAssignableTo<T
* typeValidation.broken:
* "ClassStatics_AuthorizationError": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_ClassStatics_AuthorizationError = requireAssignableTo<TypeOnly<typeof current.AuthorizationError>, TypeOnly<typeof old.AuthorizationError>>

/*
Expand Down Expand Up @@ -463,6 +465,7 @@ declare type old_as_current_for_Class_PrefetchDocumentStorageService = requireAs
* typeValidation.broken:
* "Class_PrefetchDocumentStorageService": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Class_PrefetchDocumentStorageService = requireAssignableTo<TypeOnly<current.PrefetchDocumentStorageService>, TypeOnly<old.PrefetchDocumentStorageService>>

/*
Expand All @@ -472,6 +475,7 @@ declare type current_as_old_for_Class_PrefetchDocumentStorageService = requireAs
* typeValidation.broken:
* "ClassStatics_PrefetchDocumentStorageService": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_ClassStatics_PrefetchDocumentStorageService = requireAssignableTo<TypeOnly<typeof current.PrefetchDocumentStorageService>, TypeOnly<typeof old.PrefetchDocumentStorageService>>

/*
Expand Down
9 changes: 8 additions & 1 deletion packages/runtime/container-runtime-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Interface_IContainerRuntime": {
"backCompat": false
},
"Interface_IContainerRuntimeWithResolveHandle_Deprecated": {
"backCompat": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ declare type old_as_current_for_Interface_IContainerRuntime = requireAssignableT
* typeValidation.broken:
* "Interface_IContainerRuntime": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IContainerRuntime = requireAssignableTo<TypeOnly<current.IContainerRuntime>, TypeOnly<old.IContainerRuntime>>

/*
Expand Down Expand Up @@ -85,4 +86,5 @@ declare type old_as_current_for_Interface_IContainerRuntimeWithResolveHandle_Dep
* typeValidation.broken:
* "Interface_IContainerRuntimeWithResolveHandle_Deprecated": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IContainerRuntimeWithResolveHandle_Deprecated = requireAssignableTo<TypeOnly<current.IContainerRuntimeWithResolveHandle_Deprecated>, TypeOnly<old.IContainerRuntimeWithResolveHandle_Deprecated>>
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface IFluidDataStoreRuntime extends IEventProvider<IFluidDataStoreRu
// (undocumented)
readonly id: string;
// (undocumented)
readonly idCompressor?: IIdCompressor;
readonly idCompressor: IIdCompressor | undefined;
// (undocumented)
readonly IFluidHandleContext: IFluidHandleContext;
// (undocumented)
Expand Down
6 changes: 5 additions & 1 deletion packages/runtime/datastore-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Interface_IFluidDataStoreRuntime": {
"backCompat": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface IFluidDataStoreRuntime
*/
readonly attachState: AttachState;

readonly idCompressor?: IIdCompressor;
readonly idCompressor: IIdCompressor | undefined;

/**
* Returns the channel with the given id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ declare type current_as_old_for_TypeAlias_IDeltaManagerErased = requireAssignabl
* typeValidation.broken:
* "Interface_IFluidDataStoreRuntime": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidDataStoreRuntime = requireAssignableTo<TypeOnly<current.IFluidDataStoreRuntime>, TypeOnly<old.IFluidDataStoreRuntime>>

/*
Expand Down
12 changes: 11 additions & 1 deletion packages/runtime/runtime-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Interface_IFluidDataStoreContext": {
"backCompat": false
},
"Interface_IFluidDataStoreContextDetached": {
"backCompat": false
},
"Interface_IFluidParentContext": {
"backCompat": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ declare type old_as_current_for_Interface_IFluidDataStoreContext = requireAssign
* typeValidation.broken:
* "Interface_IFluidDataStoreContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidDataStoreContext = requireAssignableTo<TypeOnly<current.IFluidDataStoreContext>, TypeOnly<old.IFluidDataStoreContext>>

/*
Expand All @@ -355,6 +356,7 @@ declare type old_as_current_for_Interface_IFluidDataStoreContextDetached = requi
* typeValidation.broken:
* "Interface_IFluidDataStoreContextDetached": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidDataStoreContextDetached = requireAssignableTo<TypeOnly<current.IFluidDataStoreContextDetached>, TypeOnly<old.IFluidDataStoreContextDetached>>

/*
Expand Down Expand Up @@ -427,6 +429,7 @@ declare type old_as_current_for_Interface_IFluidParentContext = requireAssignabl
* typeValidation.broken:
* "Interface_IFluidParentContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidParentContext = requireAssignableTo<TypeOnly<current.IFluidParentContext>, TypeOnly<old.IFluidParentContext>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class RequestParser implements IRequest {
createSubRequest(startingPathIndex: number): IRequest;
static getPathParts(url: string): readonly string[];
// (undocumented)
get headers(): IRequestHeader | undefined;
readonly headers?: IRequestHeader;
isLeaf(elements: number): boolean;
get pathParts(): readonly string[];
// (undocumented)
Expand Down
9 changes: 8 additions & 1 deletion packages/runtime/runtime-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Class_RequestParser": {
"backCompat": false
},
"ClassStatics_RequestParser": {
"backCompat": false
}
}
}
}
7 changes: 4 additions & 3 deletions packages/runtime/runtime-utils/src/requestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ export class RequestParser implements IRequest {
protected constructor(private readonly request: Readonly<IRequest>) {
const queryStartIndex = this.request.url.indexOf("?");
this.query = queryStartIndex >= 0 ? this.request.url.substring(queryStartIndex) : "";
if (request.headers !== undefined) {
this.headers = request.headers;
}
}

public get url(): string {
return this.request.url;
}

public get headers(): IRequestHeader | undefined {
return this.request.headers;
}
public readonly headers?: IRequestHeader;

/**
* Returns the decoded path parts of the request's url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ declare type old_as_current_for_Class_RequestParser = requireAssignableTo<TypeOn
* typeValidation.broken:
* "Class_RequestParser": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Class_RequestParser = requireAssignableTo<TypeOnly<current.RequestParser>, TypeOnly<old.RequestParser>>

/*
Expand All @@ -175,6 +176,7 @@ declare type current_as_old_for_Class_RequestParser = requireAssignableTo<TypeOn
* typeValidation.broken:
* "ClassStatics_RequestParser": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_ClassStatics_RequestParser = requireAssignableTo<TypeOnly<typeof current.RequestParser>, TypeOnly<typeof old.RequestParser>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export class MockFluidDataStoreRuntime extends EventEmitter implements IFluidDat
// (undocumented)
readonly id: string;
// (undocumented)
idCompressor?: IIdCompressor & IIdCompressorCore;
idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
// (undocumented)
get IFluidHandleContext(): IFluidHandleContext;
// (undocumented)
Expand Down
16 changes: 15 additions & 1 deletion packages/runtime/test-runtime-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {}
"broken": {
"Class_MockFluidDataStoreContext": {
"backCompat": false
},
"Class_MockFluidDataStoreRuntime": {
"backCompat": false,
"forwardCompat": false
},
"ClassStatics_MockFluidDataStoreContext": {
"backCompat": false
},
"ClassStatics_MockFluidDataStoreRuntime": {
"backCompat": false
}
}
}
}
2 changes: 1 addition & 1 deletion packages/runtime/test-runtime-utils/src/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ export class MockFluidDataStoreRuntime
public quorum = new MockQuorumClients();
private readonly audience = new MockAudience();
public containerRuntime?: MockContainerRuntime;
public idCompressor?: IIdCompressor & IIdCompressorCore;
public idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
private readonly deltaConnections: MockDeltaConnection[] = [];
private readonly registry?: ReadonlyMap<string, IChannelFactory>;

Expand Down
Loading
Loading