Skip to content

Commit 097a0c3

Browse files
Fix grand_parent_id type and publicly expose isTimeout (#36)
https://app.devrev.ai/devrev/works/ISS-176098
1 parent c9bc593 commit 097a0c3

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devrev/ts-adaas",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
55
"type": "commonjs",
66
"main": "./dist/index.js",
@@ -23,7 +23,7 @@
2323
"author": "devrev",
2424
"license": "ISC",
2525
"devDependencies": {
26-
"@types/jest": "^29.5.12",
26+
"@types/jest": "^29.5.14",
2727
"@types/lambda-log": "^3.0.3",
2828
"@types/node": "^22.15.18",
2929
"@types/yargs": "^17.0.33",
@@ -33,12 +33,12 @@
3333
"eslint-config-prettier": "^10.1.5",
3434
"eslint-plugin-prettier": "^5.1.3",
3535
"jest": "^29.7.0",
36-
"ts-jest": "^29.1.2",
36+
"ts-jest": "^29.3.3",
3737
"typescript": "^5.3.3"
3838
},
3939
"dependencies": {
40-
"@devrev/typescript-sdk": "^1.1.54",
41-
"axios": "^1.7.9",
40+
"@devrev/typescript-sdk": "^1.1.59",
41+
"axios": "^1.9.0",
4242
"axios-retry": "^4.5.0",
4343
"form-data": "^4.0.1",
4444
"js-jsonl": "^1.1.1",

src/repo/repo.interfaces.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export interface NormalizedAttachment {
4141
file_name: string;
4242
parent_id: string;
4343
author_id?: string;
44-
grand_parent_id?: number;
44+
45+
// This should be a string, but it was a number in the past. Due to backwards
46+
// compatibility we are keeping it also as a number.
47+
grand_parent_id?: number | string;
4548
}
4649

4750
/**

src/workers/worker-adapter.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ export function createWorkerAdapter<ConnectorState>({
7676
export class WorkerAdapter<ConnectorState> {
7777
readonly event: AirdropEvent;
7878
readonly options?: WorkerAdapterOptions;
79+
isTimeout: boolean;
7980

8081
private adapterState: State<ConnectorState>;
8182
private _artifacts: Artifact[];
8283
private hasWorkerEmitted: boolean;
83-
private isTimeout: boolean;
8484
private repos: Repo[] = [];
8585

8686
// Loader
@@ -789,7 +789,7 @@ export class WorkerAdapter<ConnectorState> {
789789

790790
/**
791791
* Transforms an array of attachments into array of batches of the specified size.
792-
*
792+
*
793793
* @param {Object} parameters - The parameters object
794794
* @param {NormalizedAttachment[]} parameters.attachments - Array of attachments to be processed
795795
* @param {number} [parameters.batchSize=1] - The size of each batch (defaults to 1)
@@ -887,7 +887,7 @@ export class WorkerAdapter<ConnectorState> {
887887
// Store this promise result to be checked later
888888
return { delay: response.delay };
889889
}
890-
890+
891891
// No rate limiting, process normally
892892
if (
893893
adapter.state.toDevRev?.attachmentsMetadata
@@ -911,9 +911,9 @@ export class WorkerAdapter<ConnectorState> {
911911

912912
// Wait for all promises to settle and check for rate limiting
913913
const results = await Promise.all(promises);
914-
914+
915915
// Check if any of the results indicate rate limiting
916-
const rateLimit = results.find(result => result?.delay);
916+
const rateLimit = results.find((result) => result?.delay);
917917
if (rateLimit) {
918918
// Return the delay information to the caller
919919
return { delay: rateLimit.delay };
@@ -952,7 +952,9 @@ export class WorkerAdapter<ConnectorState> {
952952
batchSize?: number;
953953
}): Promise<StreamAttachmentsReturnType> {
954954
if (batchSize <= 0) {
955-
const error = new Error(`Invalid attachments batch size: ${batchSize}. Batch size must be greater than 0.`);
955+
const error = new Error(
956+
`Invalid attachments batch size: ${batchSize}. Batch size must be greater than 0.`
957+
);
956958
console.error(error.message);
957959
return { error };
958960
}

0 commit comments

Comments
 (0)