apify-sdk-js icon indicating copy to clipboard operation
apify-sdk-js copied to clipboard

Deprecate KeyValueStore.getPublicUrl(key) and introduce KeyValueStore.getRecordPublicUrl(key)

Open danpoletaev opened this issue 4 months ago • 0 comments

Feature

  1. Deprecate the synchronous method KeyValueStore.getPublicUrl(key: string).
  2. Introduce a new asynchronous method KeyValueStore.getRecordPublicUrl(key: string).

Motivation

The current KeyValueStore.getPublicUrl(key) method has several issues that impact developer experience, performance, and maintainability 👇

  • Synchronous: The method is synchronous.
  • Confusing name 🤔: With the recent addition of a public URL for the list of keys, the name getPublicUrl is ambiguous.
  • Lack of code reuse: The method manually constructs the URL string instead of calling the apify-client. This creates redundant logic.

Introducing an async method with a more specific name (getRecordPublicUrl) that leverages the apify-client will solve these issues.

Ideal solution or implementation, and any additional constraints

  1. Mark the existing KeyValueStore.getPublicUrl(key) method as deprecated. The deprecation message should advise users to switch to the new getRecordPublicUrl method.

  2. Implement the new method async getRecordPublicUrl(key: string) within the KeyValueStore class. This new method will call the appropriate apify-client function, keyValueStore(id).getRecordUrl(key), and return the resulting URL.

Alternative solutions or implementations

No response

Other context

No response

danpoletaev avatar Aug 21 '25 14:08 danpoletaev