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: Removes singleton registries #1634

Merged
merged 23 commits into from
Mar 24, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
revert package-lock
rkodev committed Mar 13, 2025
commit a1c4d058eb5ad813ed820bbde6bf9787da6c2f82
18 changes: 9 additions & 9 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"packages/abstractions": "1.0.0-preview.86",
"packages/authentication/azure": "1.0.0-preview.86",
"packages/authentication/spfx": "1.0.0-preview.86",
"packages/bundle": "1.0.0-preview.86",
"packages/http/fetch": "1.0.0-preview.86",
"packages/serialization/form": "1.0.0-preview.86",
"packages/serialization/json": "1.0.0-preview.86",
"packages/serialization/multipart": "1.0.0-preview.86",
"packages/serialization/text": "1.0.0-preview.86"
"packages/abstractions": "1.0.0-preview.86",
"packages/authentication/azure": "1.0.0-preview.86",
"packages/authentication/spfx": "1.0.0-preview.86",
"packages/bundle": "1.0.0-preview.86",
"packages/http/fetch": "1.0.0-preview.86",
"packages/serialization/form": "1.0.0-preview.86",
"packages/serialization/json": "1.0.0-preview.86",
"packages/serialization/multipart": "1.0.0-preview.86",
"packages/serialization/text": "1.0.0-preview.86"
}
34,680 changes: 17,340 additions & 17,340 deletions package-lock.json

Large diffs are not rendered by default.


Unchanged files with check annotations Beta

* @param serializationWriterFactoryRegistry The serialization writer factory registry to register the default serializer to.
* @param type the class of the factory to be registered.
*/
export function registerDefaultSerializer(serializationWriterFactoryRegistry: SerializationWriterFactoryRegistry, type: new () => SerializationWriterFactory): void {

Check warning on line 15 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 15 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 15 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!type) throw new Error("Type is required");
const serializer = new type();
serializationWriterFactoryRegistry.contentTypeAssociatedFactories.set(serializer.getValidContentType(), serializer);
* @param type the class of the factory to be registered.
* @param backingStoreFactory The backing store factory to use.
*/
export function registerDefaultDeserializer(parseNodeFactoryRegistry: ParseNodeFactoryRegistry, type: new (backingStoreFactory: BackingStoreFactory) => ParseNodeFactory, backingStoreFactory: BackingStoreFactory): void {

Check warning on line 26 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 26 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 26 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!type) throw new Error("Type is required");
const deserializer = new type(backingStoreFactory);
parseNodeFactoryRegistry.contentTypeAssociatedFactories.set(deserializer.getValidContentType(), deserializer);
* @param original The serialization writer to enable the backing store on.
* @returns A new serialization writer with the backing store enabled.
*/
export function enableBackingStoreForSerializationWriterFactory(serializationWriterFactoryRegistry: SerializationWriterFactoryRegistry, parseNodeFactoryRegistry: ParseNodeFactoryRegistry, original: SerializationWriterFactory): SerializationWriterFactory {

Check warning on line 38 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 38 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 38 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!original) throw new Error("Original must be specified");
let result = original;
if (original instanceof SerializationWriterFactoryRegistry) {
* @param original The parse node factory to enable the backing store on.
* @returns A new parse node factory with the backing store enabled.
*/
export function enableBackingStoreForParseNodeFactory(parseNodeFactoryRegistry: ParseNodeFactoryRegistry, original: ParseNodeFactory): ParseNodeFactory {

Check warning on line 56 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 56 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 56 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!original) throw new Error("Original must be specified");
let result = original;
if (original instanceof ParseNodeFactoryRegistry) {
* Enables the backing store on the given parse node factory registry.
* @param registry The parse node factory registry to enable the backing store on.
*/
function enableBackingStoreForParseNodeRegistry(registry: ParseNodeFactoryRegistry): void {

Check warning on line 71 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 71 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 71 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
for (const [k, v] of registry.contentTypeAssociatedFactories) {
if (!(v instanceof BackingStoreParseNodeFactory || v instanceof ParseNodeFactoryRegistry)) {
registry.contentTypeAssociatedFactories.set(k, new BackingStoreParseNodeFactory(v));
* Enables the backing store on the given serialization factory registry.
* @param registry The serialization factory registry to enable the backing store on.
*/
function enableBackingStoreForSerializationRegistry(registry: SerializationWriterFactoryRegistry): void {

Check warning on line 82 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 82 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 82 in packages/abstractions/src/apiClientBuilder.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
for (const [k, v] of registry.contentTypeAssociatedFactories) {
if (!(v instanceof BackingStoreSerializationWriterProxyFactory || v instanceof SerializationWriterFactoryRegistry)) {
registry.contentTypeAssociatedFactories.set(k, new BackingStoreSerializationWriterProxyFactory(v));
* Validates the protocol of the url.
* @param url - The url to validate.
*/
export function validateProtocol(url: string): void {

Check warning on line 14 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 14 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 14 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!isLocalhostUrl(url) && !url.toLocaleLowerCase().startsWith("https://") && !windowUrlStartsWithHttps()) {
throw new Error("Authentication scheme can only be used with https requests");
}
* Checks if the window url starts with https.
* @returns True if the window url starts with https, false otherwise.
*/
function windowUrlStartsWithHttps(): boolean {

Check warning on line 24 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 24 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 24 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
if (!inNodeEnv()) {
return window.location.protocol.toLocaleLowerCase() === "https:";
}
* @param urlString - The url to check.
* @returns True if the url is a localhost url, false otherwise.
*/
export function isLocalhostUrl(urlString: string): boolean {

Check warning on line 36 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 36 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 36 in packages/abstractions/src/authentication/validateProtocol.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
try {
const url = new URL(urlString);
return localhostStrings.has(url.hostname);
* @param digits The number of digits to pad
* @returns The formatted segment
*/
export function formatSegment(segment: number, digits = 2): string {

Check warning on line 104 in packages/abstractions/src/dateOnly.ts

GitHub Actions / build (18.x)

Use const or class constructors instead of named functions

Check warning on line 104 in packages/abstractions/src/dateOnly.ts

GitHub Actions / build (20.x)

Use const or class constructors instead of named functions

Check warning on line 104 in packages/abstractions/src/dateOnly.ts

GitHub Actions / build (22.x)

Use const or class constructors instead of named functions
return segment.toString().padStart(digits, "0");
}