Skip to content

Commit 8196a77

Browse files
committed
fix: irregular code and workflows
1 parent bd8603b commit 8196a77

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

.github/workflows/publish-npm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
fi
116116
117117
- name: Generate release
118-
if: steps.check-commits.outputs.should_release == 'true'
118+
if: success() && steps.check-commits.outputs.should_release == 'true'
119119
run: |
120120
if [ "${{ steps.check-commits.outputs.version_type }}" == "major" ]; then
121121
echo "Running major release"
@@ -129,14 +129,14 @@ jobs:
129129
fi
130130
131131
- name: Push changes and tags
132-
if: steps.check-commits.outputs.should_release == 'true'
132+
if: success() && steps.check-commits.outputs.should_release == 'true'
133133
run: |
134134
git push --follow-tags origin main
135135
env:
136136
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137137

138138
- name: Publish package
139-
if: steps.check-commits.outputs.should_release == 'true'
139+
if: success() && steps.check-commits.outputs.should_release == 'true'
140140
run: npm publish --access public
141141
env:
142142
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

nodes/CapSolver/Capsolver.node.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import {
33
INodeExecutionData,
44
INodeType,
55
INodeTypeDescription,
6+
NodeConnectionTypes,
67
NodeOperationError,
78
} from 'n8n-workflow';
89
import { INodeContext, Solver } from './libs';
910
import { handleRecognitionActions, handleTokenActions } from './actions';
1011
import { captchaTypes, resourceRecognition, resourceToken } from './config';
1112
import { optionalDescriptions, recognitionDescriptions, tokenDescriptions } from './descriptions';
1213

14+
const inputs = [NodeConnectionTypes.Main];
15+
const outputs = [NodeConnectionTypes.Main];
16+
1317
export class CapSolver implements INodeType {
1418
description: INodeTypeDescription = {
1519
displayName: 'CapSolver',
@@ -22,8 +26,8 @@ export class CapSolver implements INodeType {
2226
defaults: {
2327
name: 'CapSolver',
2428
},
25-
inputs: ['main'],
26-
outputs: ['main'],
29+
inputs,
30+
outputs,
2731
credentials: [
2832
{
2933
name: 'capSolverApi',
@@ -52,7 +56,7 @@ export class CapSolver implements INodeType {
5256

5357
// operation token
5458
{
55-
displayName: 'Captcha',
59+
displayName: 'Operation',
5660
name: 'operation',
5761
type: 'options',
5862
default: captchaTypes.recaptchaV2,

nodes/CapSolver/actions/recognitionActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function handleRecognitionActions(context: INodeContext): Promise<I
5656
success: true,
5757
data: result,
5858
},
59-
pairedItem: context.i,
59+
pairedItem: { item: context.i },
6060
};
6161
} catch (error) {
6262
if (context.functionThis.continueOnFail()) {

nodes/CapSolver/actions/tokenActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function handleTokenActions(context: INodeContext): Promise<INodeEx
3939
success: true,
4040
data: result,
4141
},
42-
pairedItem: context.i,
42+
pairedItem: { item: context.i },
4343
};
4444
} catch (error) {
4545
if (context.functionThis.continueOnFail()) {

nodes/CapSolver/libs/solver.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IExecuteFunctions, NodeOperationError } from 'n8n-workflow';
1+
import { IExecuteFunctions, NodeOperationError, sleep } from 'n8n-workflow';
22
import { Task } from './task';
33
import { resourceRecognition, TIME_OUT } from '../config';
44

@@ -43,13 +43,7 @@ export class Solver {
4343
`Get task result timeout: unable to solve within ${TIME_OUT} seconds`,
4444
);
4545
}
46-
this.delay(1000);
46+
await sleep(1000);
4747
}
4848
}
49-
50-
private delay(ms: number): void {
51-
const sab = new SharedArrayBuffer(4);
52-
const arr = new Int32Array(sab);
53-
Atomics.wait(arr, 0, 0, ms);
54-
}
5549
}

0 commit comments

Comments
 (0)