Unverified Commit 52d750a0 authored by Hong Minhee's avatar Hong Minhee
Browse files

Merge tag '0.9.1'

Fedify 0.9.1
parents e581ce37 c27ed663
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -123,6 +123,15 @@ To be released.
[x-forwarded-fetch]: https://github.com/dahlia/x-forwarded-fetch


Version 0.9.1
-------------

Released on June 13, 2024.

 -  Fixed a bug of Activity Vocabulary API that `clone()` method of Vocabulary
    classes had not cloned the `id` property from the source object.


Version 0.9.0
-------------

+28 −7
Original line number Diff line number Diff line
@@ -475,7 +475,10 @@ proofs?: (DataIntegrityProof | URL)[];}
  ): Object {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: Object = new this.constructor({ id: values.id }, options);
    const clone: Object = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_49BipA5dq9eoH8LX8xdsVumveTca = this.#_49BipA5dq9eoH8LX8xdsVumveTca;
        if (\\"attachments\\" in values &&             values.attachments != null) {
      
@@ -4510,7 +4513,10 @@ name?: string | LanguageString | null;value?: string | LanguageString | null;}
  ): PropertyValue {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: PropertyValue = new this.constructor({ id: values.id }, options);
    const clone: PropertyValue = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav;
        if (\\"name\\" in values &&             values.name != null) {
          clone.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav = [values.name];
@@ -4850,7 +4856,10 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
  ): DataIntegrityProof {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: DataIntegrityProof = new this.constructor({ id: values.id }, options);
    const clone: DataIntegrityProof = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5 = this.#_3RurJsa7tnptyqMFR5hDGcP9pMs5;
        if (\\"cryptosuite\\" in values &&             values.cryptosuite != null) {
          clone.#_3RurJsa7tnptyqMFR5hDGcP9pMs5 = [values.cryptosuite];
@@ -5367,7 +5376,10 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi
  ): CryptographicKey {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: CryptographicKey = new this.constructor({ id: values.id }, options);
    const clone: CryptographicKey = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2 = this.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2;
        if (\\"owner\\" in values &&             values.owner != null) {
          clone.#_5UJq9NDh3ZHgswFwwdVxQvJxdx2 = [values.owner];
@@ -5776,7 +5788,10 @@ controller?: Application | Group | Organization | Person | Service | URL | null;
  ): Multikey {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: Multikey = new this.constructor({ id: values.id }, options);
    const clone: Multikey = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = this.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN;
        if (\\"controller\\" in values &&             values.controller != null) {
          clone.#_2yr3eUBTP6cNcyaxKzAXWjFsnGzN = [values.controller];
@@ -12370,7 +12385,10 @@ proxyUrl?: URL | null;oauthAuthorizationEndpoint?: URL | null;oauthTokenEndpoint
  ): Endpoints {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: Endpoints = new this.constructor({ id: values.id }, options);
    const clone: Endpoints = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR = this.#_2JCYDbSxEHCCLdBYed33cCETfGyR;
        if (\\"proxyUrl\\" in values &&             values.proxyUrl != null) {
          clone.#_2JCYDbSxEHCCLdBYed33cCETfGyR = [values.proxyUrl];
@@ -15264,7 +15282,10 @@ names?: (string | LanguageString)[];language?: LanguageTag | null;height?: numbe
  ): Link {
  
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: Link = new this.constructor({ id: values.id }, options);
    const clone: Link = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7 = this.#_pVjLsybKQdmkjuU7MHjiVmNnuj7;
        if (\\"href\\" in values &&             values.href != null) {
          clone.#_pVjLsybKQdmkjuU7MHjiVmNnuj7 = [values.href];
+4 −1
Original line number Diff line number Diff line
@@ -154,7 +154,10 @@ export async function* generateCloner(
  if (type.extends == null) {
    yield `
    // @ts-ignore: this.constructor is not recognized as a constructor, but it is.
    const clone: ${type.name} = new this.constructor({ id: values.id }, options);
    const clone: ${type.name} = new this.constructor(
      { id: values.id ?? this.id },
      options
    );
    `;
  } else {
    yield `const clone = super.clone(values, options) as unknown as ${type.name};`;
+96 −2

File changed.

Preview size limit exceeded, changes collapsed.

+26 −0
Original line number Diff line number Diff line
@@ -54,6 +54,32 @@ Deno.test("new Object()", () => {
  );
});

Deno.test("Object.clone()", () => {
  const obj = new Object({
    id: new URL("https://example.com/"),
    name: "Test",
    contents: [
      new LanguageString("Hello", "en"),
      new LanguageString("你好", "zh"),
    ],
  });

  const clone = obj.clone({ content: "Modified" });
  assertInstanceOf(clone, Object);
  assertEquals(clone.id, new URL("https://example.com/"));
  assertEquals(clone.name, "Test");
  assertEquals(clone.content, "Modified");

  const cloned2 = obj.clone({ id: new URL("https://example.com/modified") });
  assertInstanceOf(cloned2, Object);
  assertEquals(cloned2.id, new URL("https://example.com/modified"));
  assertEquals(cloned2.name, "Test");
  assertEquals(cloned2.contents, [
    new LanguageString("Hello", "en"),
    new LanguageString("你好", "zh"),
  ]);
});

Deno.test("Object.fromJsonLd()", async () => {
  const obj = await Object.fromJsonLd({
    "@context": "https://www.w3.org/ns/activitystreams",