mikerourke / toggl-to-clockify-cli Goto Github PK
View Code? Open in Web Editor NEWTool to transfer Toggl entries to Clockify.
Home Page: https://www.npmjs.com/package/toggl-to-clockify
License: MIT License
Tool to transfer Toggl entries to Clockify.
Home Page: https://www.npmjs.com/package/toggl-to-clockify
License: MIT License
Setup Jest and write tests
jest
and ts-jest
Just giving this a try for the first time -- not super familiar with node so apologies. Got this error right off the bat:
~ toggl-to-clockify init
You must be using Node.js v10.3 or greater
Your current version, v11.2.0, won't work
v11.2.0 would seem to be greater than v10.3 ... do I need to target a specific version?
An error with message Cannot read property 'name' of undefined
is being thrown when attempting to run the transfer
command
User emailed me with error details
toggl-to-clockify init
)workspaces
field in the configuration file is populated with valid valuestoggl-to-clockify transfer
When running the toggl-to-clockify transfer
command, the time entry transfer portion would continue running even though entries weren't being created
User emailed me with error details
toggl-to-clockify init
)toggl-to-clockify transfer
First of all, thanks for this awesome project!
One thing that needs to be taken care of is to add some throttling between calls to the Toggl API. If one has several pages of data the following error will be thrown when paging through Toggl entries:
(node:49735) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://toggl.com/reports/api/v2/details?workspace_id=123456&user_agent=john%40doe.com&page=29&since=2018-01-01&until=2018-10-15 reason: Unexpected token < in JSON at position 0
at /Users/consulthys/workspaces/toggl-to-clockify/node_modules/node-fetch/lib/index.js:239:32
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:49735) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:49735) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This is due to the fact that the Toggl API will return the following response if requests are not properly throttled:
<html>
<head><title>429 Too Many Requests</title></head>
<body bgcolor="white">
<center><h1>429 Too Many Requests</h1></center>
<hr><center>nginx</center>
</body>
</html>
We can see on lines 134-138 of Toggl.ts
that all fetch calls go out at the same time, so it might be ok if one has only very few pages, but not otherwise.
Basically, the same way you did for the calls to the Clockify API using the pause
function would be perfect.
Hello
During import data from Toggl I'm getting error:
(node:4726) UnhandledPromiseRejectionWarning: TypeError: results.reduce is not a function at Clockify.<anonymous> (/home/tj/.nvm/versions/node/v11.11.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:518:44) at step (/home/tj/.nvm/versions/node/v11.11.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:43:23) at Object.next (/home/tj/.nvm/versions/node/v11.11.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:24:53) at fulfilled (/home/tj/.nvm/versions/node/v11.11.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:15:58) at processTicksAndRejections (internal/process/next_tick.js:81:5) (node:4726) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:4726) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Change code structure/functionality to be split up by entity, rather than tool.
It will make the codebase easier to test and manage. It also allows for incremental updates (e.g. the tool will still work with just projects, tasks, time entries, etc., but users can be added without breaking anything).
It will also address #7 and accommodate for teams.
The following entities are shared between Clockify and Toggl, and should be relatively easy to implement:
Toggl also includes the concept of Project and Workspace users, which will need to be included in the corresponding entity class.
Track changes and releases with CHANGELOG and changelog generation
After importing it doesn't seem like it links entries to the correct users in the workspace. It only links all the entries to the account holder.
โ toggl-to-clockify transfer
Fetching workspaces from Toggl...
Fetching time entries and projects in workspace: Default...
Getting time entries for page 1 for Default for the year of 2018...
Getting time entries for page 2 for Default for the year of 2018...
Getting time entries for page 1 for Default for the year of 2019...
Getting time entries for page 2 for Default for the year of 2019...
Getting time entries for page 3 for Default for the year of 2019...
Writing Toggl data to JSON file...
Toggl processing complete
Fetching workspaces from Clockify...
Getting clients for Default...
Getting projects for Default...
Getting tags for Default...
Transferring clients to Clockify in Default...
Transferring projects to Clockify in Default...
Transferring tags to Clockify in Default...
Transferring time entries to Clockify in Default...
Creating time entries for records 0 - 25...
Creating time entries for records 25 - 50...
Creating time entries for records 50 - 75...
Creating time entries for records 75 - 100...
Creating time entries for records 100 - 125...
Creating time entries for records 125 - 150...
Creating time entries for records 150 - 175...
Creating time entries for records 175 - 200...```
There's nowhere near this many entries, I started trying toggle last week.
{
"email": "REDACTED@REDACTED",
"togglApiToken": "REDACTED",
"clockifyApiToken": "REDACTED",
"workspaces": [
{
"name": "Default",
"years": [2018, 2019]
}
]
}
Before creating a new project in Clockify, it'd be nice to also import clients from Toggl, so that projects can be linked to clients (via toggleProject.cid
)
Hi, Im trying to migrate my companies data/hours etc from Toggl to Clockify. Ive followed the instructions you provided but I get the following...
Fetching workspaces from Toggl...
(node:14678) UnhandledPromiseRejectionWarning: TypeError: Symbol.asyncIterator is not defined.
at __asyncGenerator (/usr/local/lib/node_modules/toggl-to-clockify/lib/tools/Toggl.js:50:38)
at Toggl.getWorkspaceDetailsIteratable (/usr/local/lib/node_modules/toggl-to-clockify/lib/tools/Toggl.js:387:16)
at Toggl. (/usr/local/lib/node_modules/toggl-to-clockify/lib/tools/Toggl.js:463:49)
at step (/usr/local/lib/node_modules/toggl-to-clockify/lib/tools/Toggl.js:43:23)
at Object.next (/usr/local/lib/node_modules/toggl-to-clockify/lib/tools/Toggl.js:24:53)
at fulfilled (/usr/local/lib/node_modules/toggl-to-clockify/lib/tools/Toggl.js:15:58)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:14678) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14678) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Any ideas, please?
After running toggl-to-clockify transfer -c t2c.json
, I get an UnhandledPromiseRejectionWarning
when transferring clients to Clockify. Output below.
Node version: 11.5.0.
More information: my Clockify is completely empty as of now, while my Toggl has hundreds of time entries and many different projects.
This bug was mentioned in a comment in issue #12 . Any simple fix?
Thanks,
~Yuval
Fetching time entries and projects in workspace: Yuvalgat11...
Getting time entries for page 1 for Yuvalgat11 for the year of 2018...
Getting time entries for page 2 for Yuvalgat11 for the year of 2018...
Getting time entries for page 3 for Yuvalgat11 for the year of 2018...
Getting time entries for page 4 for Yuvalgat11 for the year of 2018...
Getting time entries for page 5 for Yuvalgat11 for the year of 2018...
Getting time entries for page 6 for Yuvalgat11 for the year of 2018...
Getting time entries for page 7 for Yuvalgat11 for the year of 2018...
Getting time entries for page 8 for Yuvalgat11 for the year of 2018...
Getting time entries for page 9 for Yuvalgat11 for the year of 2018...
Getting time entries for page 10 for Yuvalgat11 for the year of 2018...
Getting time entries for page 11 for Yuvalgat11 for the year of 2018...
Getting time entries for page 12 for Yuvalgat11 for the year of 2018...
Getting time entries for page 13 for Yuvalgat11 for the year of 2018...
Getting time entries for page 14 for Yuvalgat11 for the year of 2018...
Getting time entries for page 15 for Yuvalgat11 for the year of 2018...
Getting time entries for page 16 for Yuvalgat11 for the year of 2018...
Getting time entries for page 17 for Yuvalgat11 for the year of 2018...
Getting time entries for page 18 for Yuvalgat11 for the year of 2018...
Writing Toggl data to JSON file...
Toggl processing complete
Fetching workspaces from Clockify...
Getting clients for Yuvalgat11...
Getting projects for Yuvalgat11...
Getting tags for Yuvalgat11...
Transferring clients to Clockify in Yuvalgat11...
(node:34957) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of null
at Clockify.<anonymous> (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:300:63)
at step (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:43:23)
at Object.next (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:24:53)
at /Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:18:71
at new Promise (<anonymous>)
at __awaiter (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:14:12)
at Clockify.transferEntitiesFromToggl (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:293:16)
at Clockify.<anonymous> (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:407:41)
at step (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:43:23)
at Object.next (/Users/yuvalgat/.nvm/versions/node/v11.5.0/lib/node_modules/toggl-to-clockify/lib/tools/Clockify.js:24:53)
(node:34957) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:34957) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In thefuture, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.