nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: alchemyplatform/alchemy-sdk-js
Pull request #370 (2023-09-12 19:49:00)

Add base collection metadata to Nft metadata
Change v3 `Nft` interface to include new `collection` properties. Merge after backend change is complete.


Patch:
diff --git a/src/api/nft.ts b/src/api/nft.ts
index 1f4f091c..b814144a 100644
--- a/src/api/nft.ts
+++ b/src/api/nft.ts
@@ -138,10 +138,26 @@ export interface Nft {
    * request.
    */
   acquiredAt?: AcquiredAt;
+  /** Collection metadata for the NFT, if available. */
+  collection?: BaseNftCollection;
   /** Mint information for the NFT. */
   mint?: NftMint;
 }
 
+/**
+ * A base collection object as part of an {@link Nft}.
+ */
+export interface BaseNftCollection {
+  /** The name of the collection. */
+  name: string;
+  /** The OpenSea human-readable slug of the collection. */
+  slug?: string;
+  /** The external URL for the collection. */
+  externalUrl?: string;
+  /** The banner image URL for the collection. */
+  bannerImageUrl?: string;
+}
+
 /**
  * The raw metadata for the NFT based on the metadata URI on the NFT contract.
  */
diff --git a/src/internal/raw-interfaces.ts b/src/internal/raw-interfaces.ts
index cf2bdab7..0d6295fd 100644
--- a/src/internal/raw-interfaces.ts
+++ b/src/internal/raw-interfaces.ts
@@ -21,6 +21,7 @@ export interface RawNft {
   timeLastUpdated: string;
   acquiredAt?: RawAcquiredAt;
   mint?: RawNftMint;
+  collection: RawBaseNftCollection;
 }
 
 /** Information on the time at which an NFT was last acquired. */
@@ -89,6 +90,13 @@ export interface RawNftCollectionFloorPrice {
   priceCurrency: string | null;
 }
 
+export interface RawBaseNftCollection {
+  name: string;
+  slug: string | null;
+  externalUrl: string | null;
+  bannerImageUrl: string | null;
+}
+
 /** OpenSea's full metadata for an NFT collection. */
 export interface RawOpenSeaCollectionMetadata {
   floorPrice: number | null;
diff --git a/src/util/util.ts b/src/util/util.ts
index 9da28ec5..85e2b572 100644
--- a/src/util/util.ts
+++ b/src/util/util.ts
@@ -123,6 +123,7 @@ export function getNftFromRaw(rawNft: RawNft): Nft {
     contract: getNftContractForNftFromRaw(rawNft.contract),
     tokenType: parseNftTokenType(rawNft.tokenType),
     acquiredAt: rawNft.acquiredAt,
+    collection: rawNft.collection,
     mint: rawNft.mint
   });
 }


Test patch:
diff --git a/test/test-util.ts b/test/test-util.ts
index e6e66687..019dad5b 100644
--- a/test/test-util.ts
+++ b/test/test-util.ts
@@ -132,6 +132,12 @@ export function createRawNft(
       metadata: {},
       error: null
     },
+    collection: {
+      name: 'Collection Name',
+      slug: 'collection-name-slug',
+      externalUrl: 'https://external.url',
+      bannerImageUrl: 'https://banner.image.url'
+    },
     ...overrides
   };
 }
Repository: alchemyplatform/alchemy-sdk-js
Pull request #391 (2023-11-15 21:15:29)

fix(types): Add missing fields to openSeaMetadata type
This commit resolves a type issue where users could not reference 'bannerImageUrl' and 'collectionSlug' without encountering type errors. Updates have been made to both the SDK and API for version 3.0.0-beta.3.

Resolves: #384


Patch:
diff --git a/src/internal/raw-interfaces.ts b/src/internal/raw-interfaces.ts
index 65c4c659..ffa6af0d 100644
--- a/src/internal/raw-interfaces.ts
+++ b/src/internal/raw-interfaces.ts
@@ -122,8 +122,10 @@ export interface RawBaseNftCollection {
 export interface RawOpenSeaCollectionMetadata {
   floorPrice: number | null;
   collectionName: string | null;
+  collectionSlug: string | null;
   safelistRequestStatus: string | null;
   imageUrl: string | null;
+  bannerImageUrl: string | null;
   description: string | null;
   externalUrl: string | null;
   twitterUsername: string | null;
diff --git a/src/types/nft-types.ts b/src/types/nft-types.ts
index 5d7f4f62..3ad75880 100644
--- a/src/types/nft-types.ts
+++ b/src/types/nft-types.ts
@@ -1113,10 +1113,14 @@ export interface OpenSeaCollectionMetadata {
   floorPrice?: number;
   /** The name of the collection on OpenSea. */
   collectionName?: string;
+  /** The slug of the collection on OpenSea. */
+  collectionSlug?: string;
   /** The approval status of the collection on OpenSea. */
   safelistRequestStatus?: OpenSeaSafelistRequestStatus;
   /** The image URL determined by OpenSea. */
   imageUrl?: string;
+  /** The banner image URL determined by OpenSea. */
+  imageBannerUrl?: string;
   /** The description of the collection on OpenSea. */
   description?: string;
   /** The homepage of the collection as determined by OpenSea. */


Test patch:
diff --git a/test/test-util.ts b/test/test-util.ts
index 019dad5b..d0c3239a 100644
--- a/test/test-util.ts
+++ b/test/test-util.ts
@@ -32,8 +32,10 @@ export function createRawOpenSeaCollectionMetadata(): RawOpenSeaCollectionMetada
   return {
     floorPrice: 2.2998,
     collectionName: 'Collection Name',
+    collectionSlug: 'collectionname',
     safelistRequestStatus: 'verified',
     imageUrl: 'http://image.url',
+    bannerImageUrl: 'http://banner.url',
     description: 'A sample description',
     externalUrl: 'http://external.url',
     twitterUsername: 'twitter-handle',
diff --git a/test/unit/nft-api.test.ts b/test/unit/nft-api.test.ts
index 4d2096b4..f1d8719a 100644
--- a/test/unit/nft-api.test.ts
+++ b/test/unit/nft-api.test.ts
@@ -1137,8 +1137,10 @@ describe('NFT module', () => {
     const expectedOpenseaMetadata = {
       floorPrice: 2.2998,
       collectionName: 'Collection Name',
+      collectionSlug: 'collectionname',
       safelistRequestStatus: OpenSeaSafelistRequestStatus.VERIFIED,
       imageUrl: 'http://image.url',
+      bannerImageUrl: 'http://banner.url',
       description: 'A sample description',
       externalUrl: 'http://external.url',
       twitterUsername: 'twitter-handle',
Repository: League-of-Foundry-Developers/foundry-vtt-types
Pull request #2642 (2024-07-16 07:47:50)

 Update iterable-weak-map.mjs #2606
Very similar to weak-set, source have added clear() method, removed javascript `#private` props.


Patch:
diff --git a/src/foundry/common/utils/iterable-weak-map.d.mts b/src/foundry/common/utils/iterable-weak-map.d.mts
index 2f9084c0f..c140ca947 100644
--- a/src/foundry/common/utils/iterable-weak-map.d.mts
+++ b/src/foundry/common/utils/iterable-weak-map.d.mts
@@ -17,16 +17,6 @@ interface IterableWeakMapHeldValue<K extends WeakKey> {
  * @typeParam V - The type of the values contained in the IterableWeakMap
  */
 declare class IterableWeakMap<K extends WeakKey, V> extends WeakMap<K, V> {
-  /**
-   * A set of weak refs to the map's keys, allowing enumeration.
-   */
-  #refs: Set<WeakRef<K>>;
-
-  /**
-   * A FinalizationRegistry instance to clean up the ref set when objects are garbage collected.
-   */
-  #finalizer: FinalizationRegistry<IterableWeakMapHeldValue<K>>;
-
   /**
    * @param entries - The initial entries.
    */
@@ -80,6 +70,11 @@ declare class IterableWeakMap<K extends WeakKey, V> extends WeakMap<K, V> {
    * Enumerate the values.
    */
   values(): Generator<V, void, never>;
+
+  /**
+   * Clear all values from the map.
+   */
+  clear(): void;
 }
 
 export default IterableWeakMap;


Test patch:
diff --git a/tests/foundry/common/utils/iterable-weak-map.test-d.ts b/tests/foundry/common/utils/iterable-weak-map.test-d.ts
index 8d430461b..3c22224d7 100644
--- a/tests/foundry/common/utils/iterable-weak-map.test-d.ts
+++ b/tests/foundry/common/utils/iterable-weak-map.test-d.ts
@@ -9,3 +9,6 @@ expectTypeOf(m.set({ x: 1 }, { y: "2" })).toEqualTypeOf<IterableWeakMap<{ x: num
 expectTypeOf(m.entries()).toEqualTypeOf<Generator<[{ x: number }, { y: string }], void, never>>();
 expectTypeOf(m.keys()).toEqualTypeOf<Generator<{ x: number }, void, never>>();
 expectTypeOf(m.values()).toEqualTypeOf<Generator<{ y: string }, void, never>>();
+
+// Make sure void method exists by checking return type
+expectTypeOf(m.clear()).toEqualTypeOf<void>();
Repository: League-of-Foundry-Developers/foundry-vtt-types
Pull request #2643 (2024-07-16 09:43:10)

 Update http.mjs #2605
Only a jsdoc link change


Patch:
diff --git a/src/foundry/common/utils/http.d.mts b/src/foundry/common/utils/http.d.mts
index 712f6249e..5ea79251f 100644
--- a/src/foundry/common/utils/http.d.mts
+++ b/src/foundry/common/utils/http.d.mts
@@ -1,6 +1,6 @@
 /**
  * A wrapper method around `fetch` that attaches an AbortController signal to the `fetch` call for clean timeouts
- * @see https://www.npmjs.com/package/node-fetch#request-cancellation-with-abortsignal
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal#aborting_a_fetch_with_timeout_or_explicit_abort
  * @param url            - The URL to make the Request to
  * @param data           - The data of the Request
  *                         (defalt: `{}`)
diff --git a/src/foundry/common/utils/iterable-weak-map.d.mts b/src/foundry/common/utils/iterable-weak-map.d.mts
index 2f9084c0f..c140ca947 100644
--- a/src/foundry/common/utils/iterable-weak-map.d.mts
+++ b/src/foundry/common/utils/iterable-weak-map.d.mts
@@ -17,16 +17,6 @@ interface IterableWeakMapHeldValue<K extends WeakKey> {
  * @typeParam V - The type of the values contained in the IterableWeakMap
  */
 declare class IterableWeakMap<K extends WeakKey, V> extends WeakMap<K, V> {
-  /**
-   * A set of weak refs to the map's keys, allowing enumeration.
-   */
-  #refs: Set<WeakRef<K>>;
-
-  /**
-   * A FinalizationRegistry instance to clean up the ref set when objects are garbage collected.
-   */
-  #finalizer: FinalizationRegistry<IterableWeakMapHeldValue<K>>;
-
   /**
    * @param entries - The initial entries.
    */
@@ -80,6 +70,11 @@ declare class IterableWeakMap<K extends WeakKey, V> extends WeakMap<K, V> {
    * Enumerate the values.
    */
   values(): Generator<V, void, never>;
+
+  /**
+   * Clear all values from the map.
+   */
+  clear(): void;
 }
 
 export default IterableWeakMap;


Test patch:
diff --git a/tests/foundry/common/utils/iterable-weak-map.test-d.ts b/tests/foundry/common/utils/iterable-weak-map.test-d.ts
index 8d430461b..3c22224d7 100644
--- a/tests/foundry/common/utils/iterable-weak-map.test-d.ts
+++ b/tests/foundry/common/utils/iterable-weak-map.test-d.ts
@@ -9,3 +9,6 @@ expectTypeOf(m.set({ x: 1 }, { y: "2" })).toEqualTypeOf<IterableWeakMap<{ x: num
 expectTypeOf(m.entries()).toEqualTypeOf<Generator<[{ x: number }, { y: string }], void, never>>();
 expectTypeOf(m.keys()).toEqualTypeOf<Generator<{ x: number }, void, never>>();
 expectTypeOf(m.values()).toEqualTypeOf<Generator<{ y: string }, void, never>>();
+
+// Make sure void method exists by checking return type
+expectTypeOf(m.clear()).toEqualTypeOf<void>();
Repository: IduxFE/components
Pull request #137 (2021-01-14 03:32:00)

feat(cdk:utils): add hasOwnProperty function
## PR Checklist

Please check if your PR fulfills the following requirements:

- [x] The commit message follows [our guidelines](https://github.com/IduxFE/components/blob/main/docs/contributing.zh.md#commit)
- [x] Tests for the changes have been added/updated or not needed
- [x] Docs and demo have been added/updated or not needed

## PR Type

What kind of change does this PR introduce?

- [ ] Bugfix
- [x] Feature
- [ ] Component style update
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Application (the showcase website) / infrastructure changes
- [ ] Other... Please describe:

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

## What is the new behavior?

## Other information



Patch:
diff --git a/packages/cdk/utils/typeof.ts b/packages/cdk/utils/typeof.ts
index 416404c7..99257013 100644
--- a/packages/cdk/utils/typeof.ts
+++ b/packages/cdk/utils/typeof.ts
@@ -68,3 +68,7 @@ export function isDate(val: unknown): val is Date {
 export function isPromise<T = any>(val: unknown): val is Promise<T> {
   return isObject(val) && isFunction(val.then) && isFunction(val.catch)
 }
+
+export function hasOwnProperty(val: Record<string | symbol, unknown>, key: string | symbol): key is keyof typeof val {
+  return Object.prototype.hasOwnProperty.call(val, key)
+}


Test patch:
diff --git a/packages/cdk/utils/__tests__/typeof.spec.ts b/packages/cdk/utils/__tests__/typeof.spec.ts
index e6326e4f..adcb2bc8 100644
--- a/packages/cdk/utils/__tests__/typeof.spec.ts
+++ b/packages/cdk/utils/__tests__/typeof.spec.ts
@@ -16,6 +16,7 @@ import {
   isNil,
   isNonNil,
   isNumeric,
+  hasOwnProperty,
 } from '../typeof'
 
 describe('typeof.ts', () => {
@@ -154,4 +155,21 @@ describe('typeof.ts', () => {
     expect(isPromise({})).toEqual(false)
     expect(isPromise(function () {})).toEqual(false)
   })
+
+  test('hasOwnProperty work', () => {
+    const object1 = { prop: 1 }
+    expect(hasOwnProperty(object1, 'prop')).toEqual(true)
+    expect(hasOwnProperty(object1, 'toString')).toEqual(false)
+    expect(hasOwnProperty(object1, 'hasOwnProperty')).toEqual(false)
+
+    const object2 = new Object() as { prop: unknown; test?: unknown }
+    object2.prop = null
+    expect(hasOwnProperty(object2, 'prop')).toEqual(true)
+    object2.prop = undefined
+    expect(hasOwnProperty(object2, 'prop')).toEqual(true)
+
+    expect(hasOwnProperty(object2, 'test')).toEqual(false)
+    object2.test = undefined
+    expect(hasOwnProperty(object2, 'test')).toEqual(true)
+  })
 })
Repository: IduxFE/components
Pull request #140 (2021-01-15 07:13:21)

test(comp:badge,icon): fix warning
## PR Checklist

Please check if your PR fulfills the following requirements:

- [x] The commit message follows [our guidelines](https://github.com/IduxFE/components/blob/main/docs/contributing.zh.md#commit)
- [x] Tests for the changes have been added/updated or not needed
- [x] Docs and demo have been added/updated or not needed

## PR Type

What kind of change does this PR introduce?

- [x] Bugfix
- [ ] Feature
- [ ] Component style update
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Application (the showcase website) / infrastructure changes
- [ ] Other... Please describe:

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

## What is the new behavior?

## Other information



Patch:
diff --git a/packages/components/icon/src/Icon.vue b/packages/components/icon/src/Icon.vue
index 4787c79c..c788ff27 100644
--- a/packages/components/icon/src/Icon.vue
+++ b/packages/components/icon/src/Icon.vue
@@ -61,7 +61,7 @@ async function appendChild(props: IconProps, iconConfig: IconConfig, root: Ref<H
       : await loadSVGElement(name, iconConfig.loadIconDynamically)
     if (svgElement) {
       handleRotate(svgElement, rotate)
-      root.value.appendChild(svgElement)
+      root.value?.appendChild(svgElement)
     }
   }
 }


Test patch:
diff --git a/packages/components/badge/__tests__/badge.spec.ts b/packages/components/badge/__tests__/badge.spec.ts
index 21d5679d..35d15313 100644
--- a/packages/components/badge/__tests__/badge.spec.ts
+++ b/packages/components/badge/__tests__/badge.spec.ts
@@ -57,12 +57,17 @@ describe('Badge.vue', () => {
     await wrapper.setProps({ count: '1000', overflowCount: 999 })
     expect(badge.text()).toBe('999+')
     expect(badge.html()).toMatchSnapshot()
+
+    const warn = jest.spyOn(console, 'warn').mockImplementation(() => {})
+
     await wrapper.setProps({ count: '1000', overflowCount: '999' })
     expect(badge.text()).toBe('999+')
     expect(badge.html()).toMatchSnapshot()
     await wrapper.setProps({ count: '1000', overflowCount: 'xxx' })
     expect(badge.text()).toBe('1000')
     expect(badge.html()).toMatchSnapshot()
+
+    expect(warn).toBeCalledTimes(2)
   })
 
   // 圆点徽标呈现