Loading CHANGES.md +36 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,24 @@ Fedify changelog ================ Version 1.1.0 ------------- To be released. Version 1.0.1 ------------- Released on September 26, 2024. - Fixed deprecation messages related to the `{handle}` variable in URL templates; they had had wrong placeholders in the message templates. - Fixed a bug of `Object.toJsonLd()` method where it had not fall back to the proper compact form when the heuristic compact form was not available. Version 1.0.0 -------------- Released on September 26, 2024. Loading Loading @@ -174,6 +192,15 @@ Released on September 26, 2024. [#137]: https://github.com/dahlia/fedify/issues/137 Version 0.15.2 -------------- Released on September 26, 2024. - Fixed a bug of `Object.toJsonLd()` method where it had not fall back to the proper compact form when the heuristic compact form was not available. Version 0.15.1 -------------- Loading Loading @@ -247,6 +274,15 @@ Released on September 11, 2024. object. Version 0.14.5 -------------- Released on September 26, 2024. - Fixed a bug of `Object.toJsonLd()` method where it had not fall back to the proper compact form when the heuristic compact form was not available. Version 0.14.4 -------------- Loading src/codegen/__snapshots__/class.test.ts.snap +441 −309 File changed.Preview size limit exceeded, changes collapsed. Show changes src/codegen/codec.ts +17 −15 Original line number Diff line number Diff line Loading @@ -47,21 +47,7 @@ export async function* generateEncoder( `; if (isCompactableType(typeUri, types)) { yield ` if ( options.format == null `; for (const property of type.properties) { if (!property.range.every((r) => isCompactableType(r, types))) { yield ` && ( this.${await getFieldName(property.uri)} == null || this.${await getFieldName(property.uri)}.length < 1 ) `; } } yield ` ) { if (options.format == null && this.isCompactable()) { `; if (type.extends == null) { yield "const result: Record<string, unknown> = {};"; Loading Loading @@ -253,6 +239,22 @@ export async function* generateEncoder( } return compacted; } protected isCompactable(): boolean { `; for (const property of type.properties) { if (!property.range.every((r) => isCompactableType(r, types))) { yield ` if ( this.${await getFieldName(property.uri)} != null && this.${await getFieldName(property.uri)}.length > 0 ) return false; `; } } yield ` return ${type.extends == null ? "true" : "super.isCompactable()"}; } `; } Loading src/codegen/type.ts +3 −0 Original line number Diff line number Diff line Loading @@ -442,6 +442,9 @@ export function isCompactableType( } else if (typeUri in types) { const type = types[typeUri]; if (type.compactName == null) return false; else if (type.extends != null && !isCompactableType(type.extends, types)) { return false; } const defaultContext = type.defaultContext; return defaultContext != null && HEURISTICS_CONTEXTS.includes(defaultContext as string) || Loading src/federation/middleware.ts +18 −18 Original line number Diff line number Diff line Loading @@ -701,8 +701,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "actor"]).warn( "The {handle} variable in the actor dispatcher path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the actor dispatcher path is deprecated. " + "Use {{identifier}} instead.", ); } const callbacks: ActorCallbacks<TContextData> = { Loading Loading @@ -1020,8 +1020,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "inbox"]).warn( "The {handle} variable in the inbox dispatcher path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the inbox dispatcher path is deprecated. " + "Use {{identifier}} instead.", ); } this.inboxPath = path; Loading Loading @@ -1097,8 +1097,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "outbox"]).warn( "The {handle} variable in the outbox dispatcher path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the outbox dispatcher path is deprecated. " + "Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1173,8 +1173,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the following collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the following collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1245,8 +1245,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the followers collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the followers collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1313,8 +1313,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the liked collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the liked collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1389,8 +1389,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the featured collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the featured collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1465,8 +1465,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the featured tags collection dispatcher " + "path is deprecated. Use {identifier} instead.", "The {{handle}} variable in the featured tags collection dispatcher " + "path is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1539,8 +1539,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { this.inboxPath = inboxPath; if (variables.has("handle")) { getLogger(["fedify", "federation", "inbox"]).warn( "The {handle} variable in the inbox path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the inbox path is deprecated. " + "Use {{identifier}} instead.", ); } } Loading Loading
CHANGES.md +36 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,24 @@ Fedify changelog ================ Version 1.1.0 ------------- To be released. Version 1.0.1 ------------- Released on September 26, 2024. - Fixed deprecation messages related to the `{handle}` variable in URL templates; they had had wrong placeholders in the message templates. - Fixed a bug of `Object.toJsonLd()` method where it had not fall back to the proper compact form when the heuristic compact form was not available. Version 1.0.0 -------------- Released on September 26, 2024. Loading Loading @@ -174,6 +192,15 @@ Released on September 26, 2024. [#137]: https://github.com/dahlia/fedify/issues/137 Version 0.15.2 -------------- Released on September 26, 2024. - Fixed a bug of `Object.toJsonLd()` method where it had not fall back to the proper compact form when the heuristic compact form was not available. Version 0.15.1 -------------- Loading Loading @@ -247,6 +274,15 @@ Released on September 11, 2024. object. Version 0.14.5 -------------- Released on September 26, 2024. - Fixed a bug of `Object.toJsonLd()` method where it had not fall back to the proper compact form when the heuristic compact form was not available. Version 0.14.4 -------------- Loading
src/codegen/__snapshots__/class.test.ts.snap +441 −309 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/codegen/codec.ts +17 −15 Original line number Diff line number Diff line Loading @@ -47,21 +47,7 @@ export async function* generateEncoder( `; if (isCompactableType(typeUri, types)) { yield ` if ( options.format == null `; for (const property of type.properties) { if (!property.range.every((r) => isCompactableType(r, types))) { yield ` && ( this.${await getFieldName(property.uri)} == null || this.${await getFieldName(property.uri)}.length < 1 ) `; } } yield ` ) { if (options.format == null && this.isCompactable()) { `; if (type.extends == null) { yield "const result: Record<string, unknown> = {};"; Loading Loading @@ -253,6 +239,22 @@ export async function* generateEncoder( } return compacted; } protected isCompactable(): boolean { `; for (const property of type.properties) { if (!property.range.every((r) => isCompactableType(r, types))) { yield ` if ( this.${await getFieldName(property.uri)} != null && this.${await getFieldName(property.uri)}.length > 0 ) return false; `; } } yield ` return ${type.extends == null ? "true" : "super.isCompactable()"}; } `; } Loading
src/codegen/type.ts +3 −0 Original line number Diff line number Diff line Loading @@ -442,6 +442,9 @@ export function isCompactableType( } else if (typeUri in types) { const type = types[typeUri]; if (type.compactName == null) return false; else if (type.extends != null && !isCompactableType(type.extends, types)) { return false; } const defaultContext = type.defaultContext; return defaultContext != null && HEURISTICS_CONTEXTS.includes(defaultContext as string) || Loading
src/federation/middleware.ts +18 −18 Original line number Diff line number Diff line Loading @@ -701,8 +701,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "actor"]).warn( "The {handle} variable in the actor dispatcher path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the actor dispatcher path is deprecated. " + "Use {{identifier}} instead.", ); } const callbacks: ActorCallbacks<TContextData> = { Loading Loading @@ -1020,8 +1020,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "inbox"]).warn( "The {handle} variable in the inbox dispatcher path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the inbox dispatcher path is deprecated. " + "Use {{identifier}} instead.", ); } this.inboxPath = path; Loading Loading @@ -1097,8 +1097,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "outbox"]).warn( "The {handle} variable in the outbox dispatcher path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the outbox dispatcher path is deprecated. " + "Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1173,8 +1173,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the following collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the following collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1245,8 +1245,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the followers collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the followers collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1313,8 +1313,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the liked collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the liked collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1389,8 +1389,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the featured collection dispatcher path " + "is deprecated. Use {identifier} instead.", "The {{handle}} variable in the featured collection dispatcher path " + "is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1465,8 +1465,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { } if (variables.has("handle")) { getLogger(["fedify", "federation", "collection"]).warn( "The {handle} variable in the featured tags collection dispatcher " + "path is deprecated. Use {identifier} instead.", "The {{handle}} variable in the featured tags collection dispatcher " + "path is deprecated. Use {{identifier}} instead.", ); } const callbacks: CollectionCallbacks< Loading Loading @@ -1539,8 +1539,8 @@ export class FederationImpl<TContextData> implements Federation<TContextData> { this.inboxPath = inboxPath; if (variables.has("handle")) { getLogger(["fedify", "federation", "inbox"]).warn( "The {handle} variable in the inbox path is deprecated. " + "Use {identifier} instead.", "The {{handle}} variable in the inbox path is deprecated. " + "Use {{identifier}} instead.", ); } } Loading