Loading CHANGES.md +9 −0 Original line number Diff line number Diff line Loading @@ -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 ------------- Loading codegen/__snapshots__/class.test.ts.snap +28 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; codegen/constructor.ts +4 −1 Original line number Diff line number Diff line Loading @@ -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};`; Loading vocab/__snapshots__/vocab.test.ts.snap +96 −2 File changed.Preview size limit exceeded, changes collapsed. Show changes vocab/vocab.test.ts +26 −0 Original line number Diff line number Diff line Loading @@ -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", Loading Loading
CHANGES.md +9 −0 Original line number Diff line number Diff line Loading @@ -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 ------------- Loading
codegen/__snapshots__/class.test.ts.snap +28 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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]; Loading Loading @@ -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];
codegen/constructor.ts +4 −1 Original line number Diff line number Diff line Loading @@ -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};`; Loading
vocab/__snapshots__/vocab.test.ts.snap +96 −2 File changed.Preview size limit exceeded, changes collapsed. Show changes
vocab/vocab.test.ts +26 −0 Original line number Diff line number Diff line Loading @@ -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", Loading