Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions packages/pieces/community/chess-com/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": [
"../../../../.eslintrc.base.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}
5 changes: 5 additions & 0 deletions packages/pieces/community/chess-com/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pieces-chess-com

## Building

Run `turbo run build --filter=@activepieces/piece-chess-com` to build the library.
16 changes: 16 additions & 0 deletions packages/pieces/community/chess-com/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@activepieces/piece-chess-com",
"version": "0.0.1",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
"lint": "eslint 'src/**/*.ts'"
},
"dependencies": {
"@activepieces/pieces-common": "workspace:*",
"@activepieces/pieces-framework": "workspace:*",
"@activepieces/shared": "workspace:*",
"tslib": "2.6.2"
}
}
11 changes: 11 additions & 0 deletions packages/pieces/community/chess-com/src/i18n/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Access Chess.com player data": "Access Chess.com player data",
"Get Player Profile": "Get Player Profile",
"Get Player Stats": "Get Player Stats",
"Get Daily Puzzle": "Get Daily Puzzle",
"Retrieve a Chess.com player's public profile by username (avatar, country, join date, followers).": "Retrieve a Chess.com player's public profile by username (avatar, country, join date, followers).",
"Retrieve a Chess.com player's ratings and W/D/L for rapid, blitz, bullet, and chess960.": "Retrieve a Chess.com player's ratings and W/D/L for rapid, blitz, bullet, and chess960.",
"Retrieve today's Chess.com daily puzzle.": "Retrieve today's Chess.com daily puzzle.",
"Username": "Username",
"The Chess.com username to look up.": "The Chess.com username to look up."
}
16 changes: 16 additions & 0 deletions packages/pieces/community/chess-com/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
import { getPlayerProfile } from './lib/actions/get-player-profile';
import { getPlayerStats } from './lib/actions/get-player-stats';
import { getDailyPuzzle } from './lib/actions/get-daily-puzzle';

export const chesscom = createPiece({
displayName: 'Chess.com',
description: 'Access Chess.com player data',
auth: PieceAuth.None(),
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/chess-com.png',
categories: [],
authors: ['FionnHughes'],
actions: [getPlayerProfile, getPlayerStats, getDailyPuzzle],
triggers: [],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createAction } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';

export const getDailyPuzzle = createAction({
name: 'get_daily_puzzle',
displayName: 'Get Daily Puzzle',
description: "Retrieve today's Chess.com daily puzzle.",
props: {},
async run() {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: 'https://api.chess.com/pub/puzzle',
});
return response.body;
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import {
httpClient,
HttpMethod,
propsValidation,
} from '@activepieces/pieces-common';
import { z } from 'zod';

export const getPlayerProfile = createAction({
name: 'get_player_profile',
displayName: 'Get Player Profile',
description:
"Retrieve a Chess.com player's public profile by username (avatar, country, join date, followers).",
props: {
username: Property.ShortText({
displayName: 'Username',
description: 'The Chess.com username to look up.',
required: true,
}),
},
async run({ propsValue }) {
await propsValidation.validateZod(propsValue, {
username: z
.string()
.trim()
.min(3)
.max(25)
.regex(/^[A-Za-z0-9_-]+$/),
});
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `https://api.chess.com/pub/player/${encodeURIComponent(
propsValue.username.trim().toLowerCase(),
)}`,
});
return response.body;
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import {
httpClient,
HttpMethod,
propsValidation,
} from '@activepieces/pieces-common';
import { z } from 'zod';

export const getPlayerStats = createAction({
name: 'get_player_stats',
displayName: 'Get Player Stats',
description:
'Retrieve a Chess.com player\'s ratings and W/D/L for rapid, blitz, bullet, and chess960.',
props: {
username: Property.ShortText({
displayName: 'Username',
description: 'The Chess.com username to look up.',
required: true,
}),
},
async run({ propsValue }) {
await propsValidation.validateZod(propsValue, {
username: z
.string()
.trim()
.min(3)
.max(25)
.regex(/^[A-Za-z0-9_-]+$/),
});
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `https://api.chess.com/pub/player/${encodeURIComponent(
propsValue.username.trim().toLowerCase(),
)}/stats`,
});
return response.body;
},
});
19 changes: 19 additions & 0 deletions packages/pieces/community/chess-com/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
15 changes: 15 additions & 0 deletions packages/pieces/community/chess-com/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"rootDir": ".",
"baseUrl": ".",
"paths": {},
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}
9 changes: 9 additions & 0 deletions packages/pieces/community/descript/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["../../../../.eslintrc.base.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "rules": {} },
{ "files": ["*.ts", "*.tsx"], "rules": {} },
{ "files": ["*.js", "*.jsx"], "rules": {} }
]
}
16 changes: 16 additions & 0 deletions packages/pieces/community/descript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@activepieces/piece-descript",
"version": "0.0.1",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
"lint": "eslint 'src/**/*.ts'"
},
"dependencies": {
"@activepieces/pieces-common": "workspace:*",
"@activepieces/pieces-framework": "workspace:*",
"@activepieces/shared": "workspace:*",
"tslib": "2.6.2"
}
}
Loading
Loading