Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sync debug logs #203

Merged
merged 2 commits into from
Jan 11, 2024
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
6 changes: 6 additions & 0 deletions packages/cache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @trello-cli/cache

## 1.0.2

### Patch Changes

- Show Board details when sync fails

## 1.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trello-cli/cache",
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"publishConfig": {
"access": "public"
Expand Down
32 changes: 19 additions & 13 deletions packages/cache/src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,24 @@ export default class {
}

protected async process(data: any): Promise<any> {
for (let board of data) {
this.processBoard(board);
this.processLists(board.lists);
this.processCards(board.cards);
this.processMembers(board.members);
this.processOrg(board.organization);
let board;
for (board of data) {
try {
await this.processBoard(board);
await this.processLists(board.lists);
await this.processCards(board.cards);
await this.processMembers(board.members);
await this.processOrg(board.organization);
} catch (e) {
console.error("Error processing board", board);
throw e;
}
}
}

protected async processOrg(org: any): Promise<any> {
// Insert into boards
this.db.upsert("orgs", {
return this.db.upsert("orgs", {
id: org.id,
displayName: org.displayName,
creatorId: org.idMemberCreator,
Expand All @@ -53,20 +59,20 @@ export default class {

protected async processBoard(board: any): Promise<any> {
// Insert into boards
this.db.upsert("boards", {
await this.db.upsert("boards", {
id: board.id,
name: board.name,
orgId: board.idOrganization,
creatorId: board.idMemberCreator,
shortLink: board.shortLink,
closed: board.closed ? 1 : 0,
});
this.processLabels(board.labels);
return this.processLabels(board.labels);
}

protected async processLabels(labels: any): Promise<any> {
for (let label of labels) {
this.db.upsert("labels", {
await this.db.upsert("labels", {
id: label.id,
name: label.name,
boardId: label.idBoard,
Expand All @@ -77,7 +83,7 @@ export default class {

protected async processLists(lists: any): Promise<any> {
for (let list of lists) {
this.db.upsert("lists", {
await this.db.upsert("lists", {
id: list.id,
name: list.name,
boardId: list.idBoard,
Expand All @@ -88,7 +94,7 @@ export default class {

protected async processCards(cards: any): Promise<any> {
for (let card of cards) {
this.db.upsert("cards", {
await this.db.upsert("cards", {
id: card.id,
name: card.name,
boardId: card.idBoard,
Expand All @@ -100,7 +106,7 @@ export default class {

protected async processMembers(members: any): Promise<any> {
for (let member of members) {
this.db.upsert("members", {
await this.db.upsert("members", {
id: member.id,
username: member.username,
fullName: member.fullName,
Expand Down
7 changes: 7 additions & 0 deletions packages/trello-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @trello-cli/cli

## 1.0.6

### Patch Changes

- Updated dependencies
- @trello-cli/[email protected]

## 1.0.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/trello-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trello-cli",
"version": "1.0.5",
"version": "1.0.6",
"description": "Access your Trello account using the CLI",
"author": "Michael Heap <[email protected]>",
"publishConfig": {
Expand Down