apify 4.0.0-beta.148 → 4.0.0-beta.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,7 +52,7 @@ export declare class ApifyStorageBackend implements StorageBackend {
|
|
|
52
52
|
getStorageBackendCacheKey(): string;
|
|
53
53
|
/** Lets crawlee's storage load signal see the API's rate-limit errors. */
|
|
54
54
|
get stats(): StorageBackend['stats'];
|
|
55
|
-
/** Short digest of the API base URL and token — identifies the credentials
|
|
55
|
+
/** Short digest of the API base URL and `identity`, the token unless given — identifies the credentials. */
|
|
56
56
|
private credentialsHash;
|
|
57
57
|
storageExists(id: string, type: StorageType): Promise<boolean>;
|
|
58
58
|
createDatasetBackend(options?: StorageIdentifier): Promise<DatasetBackend>;
|
|
@@ -77,10 +77,10 @@ export class ApifyStorageBackend {
|
|
|
77
77
|
get stats() {
|
|
78
78
|
return this.#client.stats;
|
|
79
79
|
}
|
|
80
|
-
/** Short digest of the API base URL and token — identifies the credentials
|
|
81
|
-
credentialsHash() {
|
|
80
|
+
/** Short digest of the API base URL and `identity`, the token unless given — identifies the credentials. */
|
|
81
|
+
credentialsHash(identity) {
|
|
82
82
|
return createHash('sha256')
|
|
83
|
-
.update(`${this.#client.publicBaseUrl}${this.#client.token
|
|
83
|
+
.update(`${this.#client.publicBaseUrl}${identity || this.#client.token || ''}`)
|
|
84
84
|
.digest('hex')
|
|
85
85
|
.slice(0, 8);
|
|
86
86
|
}
|
|
@@ -148,8 +148,10 @@ export class ApifyStorageBackend {
|
|
|
148
148
|
*/
|
|
149
149
|
async resolveAliasId(alias, type) {
|
|
150
150
|
// The credentials are part of the key, so the same alias opened through two
|
|
151
|
-
// differently-authenticated backends maps to two storages.
|
|
152
|
-
|
|
151
|
+
// differently-authenticated backends maps to two storages. The platform issues a new run token
|
|
152
|
+
// on migration, reboot and resurrection, so the run's own token is identified by its user.
|
|
153
|
+
const runUserId = this.#client.token === this.#config?.token ? this.#config?.userId : undefined;
|
|
154
|
+
const key = [type, alias, this.credentialsHash(runUserId)].join(',');
|
|
153
155
|
return this.#aliasLock.runExclusive(async () => {
|
|
154
156
|
const store = this.aliasMappingStore();
|
|
155
157
|
this.#persistedAliasIds ??= store ? await readAliasMapping(store) : {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.149",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.13.0"
|