@panoptic-it-solutions/zoho-projects-client 0.1.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/fixtures/attachments.d.ts +126 -0
- package/dist/__tests__/fixtures/attachments.d.ts.map +1 -0
- package/dist/__tests__/fixtures/attachments.js +60 -0
- package/dist/__tests__/fixtures/attachments.js.map +1 -0
- package/dist/__tests__/fixtures/blueprints.d.ts +114 -0
- package/dist/__tests__/fixtures/blueprints.d.ts.map +1 -0
- package/dist/__tests__/fixtures/blueprints.js +102 -0
- package/dist/__tests__/fixtures/blueprints.js.map +1 -0
- package/dist/__tests__/fixtures/clients.d.ts +4 -0
- package/dist/__tests__/fixtures/clients.d.ts.map +1 -0
- package/dist/__tests__/fixtures/clients.js +38 -0
- package/dist/__tests__/fixtures/clients.js.map +1 -0
- package/dist/__tests__/fixtures/comments.d.ts +92 -0
- package/dist/__tests__/fixtures/comments.d.ts.map +1 -0
- package/dist/__tests__/fixtures/comments.js +42 -0
- package/dist/__tests__/fixtures/comments.js.map +1 -0
- package/dist/__tests__/fixtures/contacts.d.ts +4 -0
- package/dist/__tests__/fixtures/contacts.d.ts.map +1 -0
- package/dist/__tests__/fixtures/contacts.js +40 -0
- package/dist/__tests__/fixtures/contacts.js.map +1 -0
- package/dist/__tests__/fixtures/customviews.d.ts +5 -0
- package/dist/__tests__/fixtures/customviews.d.ts.map +1 -0
- package/dist/__tests__/fixtures/customviews.js +55 -0
- package/dist/__tests__/fixtures/customviews.js.map +1 -0
- package/dist/__tests__/fixtures/dashboards.d.ts +4 -0
- package/dist/__tests__/fixtures/dashboards.d.ts.map +1 -0
- package/dist/__tests__/fixtures/dashboards.js +42 -0
- package/dist/__tests__/fixtures/dashboards.js.map +1 -0
- package/dist/__tests__/fixtures/events.d.ts +133 -0
- package/dist/__tests__/fixtures/events.d.ts.map +1 -0
- package/dist/__tests__/fixtures/events.js +75 -0
- package/dist/__tests__/fixtures/events.js.map +1 -0
- package/dist/__tests__/fixtures/followers.d.ts +4 -0
- package/dist/__tests__/fixtures/followers.d.ts.map +1 -0
- package/dist/__tests__/fixtures/followers.js +33 -0
- package/dist/__tests__/fixtures/followers.js.map +1 -0
- package/dist/__tests__/fixtures/forums.d.ts +114 -0
- package/dist/__tests__/fixtures/forums.d.ts.map +1 -0
- package/dist/__tests__/fixtures/forums.js +53 -0
- package/dist/__tests__/fixtures/forums.js.map +1 -0
- package/dist/__tests__/fixtures/groups.d.ts +25 -0
- package/dist/__tests__/fixtures/groups.d.ts.map +1 -0
- package/dist/__tests__/fixtures/groups.js +36 -0
- package/dist/__tests__/fixtures/groups.js.map +1 -0
- package/dist/__tests__/fixtures/index.d.ts +34 -0
- package/dist/__tests__/fixtures/index.d.ts.map +1 -0
- package/dist/__tests__/fixtures/index.js +34 -0
- package/dist/__tests__/fixtures/index.js.map +1 -0
- package/dist/__tests__/fixtures/issues.d.ts +196 -0
- package/dist/__tests__/fixtures/issues.d.ts.map +1 -0
- package/dist/__tests__/fixtures/issues.js +80 -0
- package/dist/__tests__/fixtures/issues.js.map +1 -0
- package/dist/__tests__/fixtures/leaves.d.ts +4 -0
- package/dist/__tests__/fixtures/leaves.d.ts.map +1 -0
- package/dist/__tests__/fixtures/leaves.js +45 -0
- package/dist/__tests__/fixtures/leaves.js.map +1 -0
- package/dist/__tests__/fixtures/modules.d.ts +6 -0
- package/dist/__tests__/fixtures/modules.d.ts.map +1 -0
- package/dist/__tests__/fixtures/modules.js +103 -0
- package/dist/__tests__/fixtures/modules.js.map +1 -0
- package/dist/__tests__/fixtures/phases.d.ts +123 -0
- package/dist/__tests__/fixtures/phases.d.ts.map +1 -0
- package/dist/__tests__/fixtures/phases.js +68 -0
- package/dist/__tests__/fixtures/phases.js.map +1 -0
- package/dist/__tests__/fixtures/portals.d.ts +4 -0
- package/dist/__tests__/fixtures/portals.d.ts.map +1 -0
- package/dist/__tests__/fixtures/portals.js +48 -0
- package/dist/__tests__/fixtures/portals.js.map +1 -0
- package/dist/__tests__/fixtures/profiles.d.ts +4 -0
- package/dist/__tests__/fixtures/profiles.d.ts.map +1 -0
- package/dist/__tests__/fixtures/profiles.js +35 -0
- package/dist/__tests__/fixtures/profiles.js.map +1 -0
- package/dist/__tests__/fixtures/projects.d.ts +298 -0
- package/dist/__tests__/fixtures/projects.d.ts.map +1 -0
- package/dist/__tests__/fixtures/projects.js +44 -0
- package/dist/__tests__/fixtures/projects.js.map +1 -0
- package/dist/__tests__/fixtures/reports.d.ts +5 -0
- package/dist/__tests__/fixtures/reports.d.ts.map +1 -0
- package/dist/__tests__/fixtures/reports.js +70 -0
- package/dist/__tests__/fixtures/reports.js.map +1 -0
- package/dist/__tests__/fixtures/roles.d.ts +4 -0
- package/dist/__tests__/fixtures/roles.d.ts.map +1 -0
- package/dist/__tests__/fixtures/roles.js +38 -0
- package/dist/__tests__/fixtures/roles.js.map +1 -0
- package/dist/__tests__/fixtures/search.d.ts +5 -0
- package/dist/__tests__/fixtures/search.d.ts.map +1 -0
- package/dist/__tests__/fixtures/search.js +61 -0
- package/dist/__tests__/fixtures/search.js.map +1 -0
- package/dist/__tests__/fixtures/tags.d.ts +22 -0
- package/dist/__tests__/fixtures/tags.d.ts.map +1 -0
- package/dist/__tests__/fixtures/tags.js +33 -0
- package/dist/__tests__/fixtures/tags.js.map +1 -0
- package/dist/__tests__/fixtures/tasklists.d.ts +107 -0
- package/dist/__tests__/fixtures/tasklists.d.ts.map +1 -0
- package/dist/__tests__/fixtures/tasklists.js +31 -0
- package/dist/__tests__/fixtures/tasklists.js.map +1 -0
- package/dist/__tests__/fixtures/tasks.d.ts +209 -0
- package/dist/__tests__/fixtures/tasks.d.ts.map +1 -0
- package/dist/__tests__/fixtures/tasks.js +69 -0
- package/dist/__tests__/fixtures/tasks.js.map +1 -0
- package/dist/__tests__/fixtures/teams.d.ts +5 -0
- package/dist/__tests__/fixtures/teams.d.ts.map +1 -0
- package/dist/__tests__/fixtures/teams.js +40 -0
- package/dist/__tests__/fixtures/teams.js.map +1 -0
- package/dist/__tests__/fixtures/timelogs.d.ts +151 -0
- package/dist/__tests__/fixtures/timelogs.d.ts.map +1 -0
- package/dist/__tests__/fixtures/timelogs.js +79 -0
- package/dist/__tests__/fixtures/timelogs.js.map +1 -0
- package/dist/__tests__/fixtures/timers.d.ts +5 -0
- package/dist/__tests__/fixtures/timers.d.ts.map +1 -0
- package/dist/__tests__/fixtures/timers.js +50 -0
- package/dist/__tests__/fixtures/timers.js.map +1 -0
- package/dist/__tests__/fixtures/trash.d.ts +5 -0
- package/dist/__tests__/fixtures/trash.d.ts.map +1 -0
- package/dist/__tests__/fixtures/trash.js +62 -0
- package/dist/__tests__/fixtures/trash.js.map +1 -0
- package/dist/__tests__/fixtures/users.d.ts +55 -0
- package/dist/__tests__/fixtures/users.d.ts.map +1 -0
- package/dist/__tests__/fixtures/users.js +47 -0
- package/dist/__tests__/fixtures/users.js.map +1 -0
- package/dist/__tests__/fixtures/widgets.d.ts +4 -0
- package/dist/__tests__/fixtures/widgets.d.ts.map +1 -0
- package/dist/__tests__/fixtures/widgets.js +51 -0
- package/dist/__tests__/fixtures/widgets.js.map +1 -0
- package/dist/__tests__/integration/setup.d.ts +14 -0
- package/dist/__tests__/integration/setup.d.ts.map +1 -0
- package/dist/__tests__/integration/setup.js +52 -0
- package/dist/__tests__/integration/setup.js.map +1 -0
- package/dist/__tests__/mocks/handlers.d.ts +34 -0
- package/dist/__tests__/mocks/handlers.d.ts.map +1 -0
- package/dist/__tests__/mocks/handlers.js +49 -0
- package/dist/__tests__/mocks/handlers.js.map +1 -0
- package/dist/__tests__/mocks/server.d.ts +2 -0
- package/dist/__tests__/mocks/server.d.ts.map +1 -0
- package/dist/__tests__/mocks/server.js +7 -0
- package/dist/__tests__/mocks/server.js.map +1 -0
- package/dist/__tests__/setup.d.ts +2 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/setup.js +18 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/__tests__/unit/client/attachments.test.d.ts +2 -0
- package/dist/__tests__/unit/client/attachments.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/attachments.test.js +55 -0
- package/dist/__tests__/unit/client/attachments.test.js.map +1 -0
- package/dist/__tests__/unit/client/blueprints.test.d.ts +2 -0
- package/dist/__tests__/unit/client/blueprints.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/blueprints.test.js +127 -0
- package/dist/__tests__/unit/client/blueprints.test.js.map +1 -0
- package/dist/__tests__/unit/client/clients.test.d.ts +2 -0
- package/dist/__tests__/unit/client/clients.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/clients.test.js +87 -0
- package/dist/__tests__/unit/client/clients.test.js.map +1 -0
- package/dist/__tests__/unit/client/comments.test.d.ts +2 -0
- package/dist/__tests__/unit/client/comments.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/comments.test.js +95 -0
- package/dist/__tests__/unit/client/comments.test.js.map +1 -0
- package/dist/__tests__/unit/client/contacts.test.d.ts +2 -0
- package/dist/__tests__/unit/client/contacts.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/contacts.test.js +89 -0
- package/dist/__tests__/unit/client/contacts.test.js.map +1 -0
- package/dist/__tests__/unit/client/customviews.test.d.ts +2 -0
- package/dist/__tests__/unit/client/customviews.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/customviews.test.js +112 -0
- package/dist/__tests__/unit/client/customviews.test.js.map +1 -0
- package/dist/__tests__/unit/client/dashboards.test.d.ts +2 -0
- package/dist/__tests__/unit/client/dashboards.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/dashboards.test.js +87 -0
- package/dist/__tests__/unit/client/dashboards.test.js.map +1 -0
- package/dist/__tests__/unit/client/events.test.d.ts +2 -0
- package/dist/__tests__/unit/client/events.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/events.test.js +79 -0
- package/dist/__tests__/unit/client/events.test.js.map +1 -0
- package/dist/__tests__/unit/client/followers.test.d.ts +2 -0
- package/dist/__tests__/unit/client/followers.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/followers.test.js +109 -0
- package/dist/__tests__/unit/client/followers.test.js.map +1 -0
- package/dist/__tests__/unit/client/forums.test.d.ts +2 -0
- package/dist/__tests__/unit/client/forums.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/forums.test.js +75 -0
- package/dist/__tests__/unit/client/forums.test.js.map +1 -0
- package/dist/__tests__/unit/client/groups.test.d.ts +2 -0
- package/dist/__tests__/unit/client/groups.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/groups.test.js +74 -0
- package/dist/__tests__/unit/client/groups.test.js.map +1 -0
- package/dist/__tests__/unit/client/issues.test.d.ts +2 -0
- package/dist/__tests__/unit/client/issues.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/issues.test.js +75 -0
- package/dist/__tests__/unit/client/issues.test.js.map +1 -0
- package/dist/__tests__/unit/client/leaves.test.d.ts +2 -0
- package/dist/__tests__/unit/client/leaves.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/leaves.test.js +91 -0
- package/dist/__tests__/unit/client/leaves.test.js.map +1 -0
- package/dist/__tests__/unit/client/modules.test.d.ts +2 -0
- package/dist/__tests__/unit/client/modules.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/modules.test.js +92 -0
- package/dist/__tests__/unit/client/modules.test.js.map +1 -0
- package/dist/__tests__/unit/client/phases.test.d.ts +2 -0
- package/dist/__tests__/unit/client/phases.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/phases.test.js +79 -0
- package/dist/__tests__/unit/client/phases.test.js.map +1 -0
- package/dist/__tests__/unit/client/portals.test.d.ts +2 -0
- package/dist/__tests__/unit/client/portals.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/portals.test.js +54 -0
- package/dist/__tests__/unit/client/portals.test.js.map +1 -0
- package/dist/__tests__/unit/client/profiles.test.d.ts +2 -0
- package/dist/__tests__/unit/client/profiles.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/profiles.test.js +86 -0
- package/dist/__tests__/unit/client/profiles.test.js.map +1 -0
- package/dist/__tests__/unit/client/projects.test.d.ts +2 -0
- package/dist/__tests__/unit/client/projects.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/projects.test.js +171 -0
- package/dist/__tests__/unit/client/projects.test.js.map +1 -0
- package/dist/__tests__/unit/client/reports.test.d.ts +2 -0
- package/dist/__tests__/unit/client/reports.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/reports.test.js +86 -0
- package/dist/__tests__/unit/client/reports.test.js.map +1 -0
- package/dist/__tests__/unit/client/roles.test.d.ts +2 -0
- package/dist/__tests__/unit/client/roles.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/roles.test.js +86 -0
- package/dist/__tests__/unit/client/roles.test.js.map +1 -0
- package/dist/__tests__/unit/client/search.test.d.ts +2 -0
- package/dist/__tests__/unit/client/search.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/search.test.js +106 -0
- package/dist/__tests__/unit/client/search.test.js.map +1 -0
- package/dist/__tests__/unit/client/tags.test.d.ts +2 -0
- package/dist/__tests__/unit/client/tags.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/tags.test.js +99 -0
- package/dist/__tests__/unit/client/tags.test.js.map +1 -0
- package/dist/__tests__/unit/client/tasklists.test.d.ts +2 -0
- package/dist/__tests__/unit/client/tasklists.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/tasklists.test.js +75 -0
- package/dist/__tests__/unit/client/tasklists.test.js.map +1 -0
- package/dist/__tests__/unit/client/tasks.test.d.ts +2 -0
- package/dist/__tests__/unit/client/tasks.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/tasks.test.js +157 -0
- package/dist/__tests__/unit/client/tasks.test.js.map +1 -0
- package/dist/__tests__/unit/client/teams.test.d.ts +2 -0
- package/dist/__tests__/unit/client/teams.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/teams.test.js +115 -0
- package/dist/__tests__/unit/client/teams.test.js.map +1 -0
- package/dist/__tests__/unit/client/timelogs.test.d.ts +2 -0
- package/dist/__tests__/unit/client/timelogs.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/timelogs.test.js +112 -0
- package/dist/__tests__/unit/client/timelogs.test.js.map +1 -0
- package/dist/__tests__/unit/client/timers.test.d.ts +2 -0
- package/dist/__tests__/unit/client/timers.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/timers.test.js +122 -0
- package/dist/__tests__/unit/client/timers.test.js.map +1 -0
- package/dist/__tests__/unit/client/trash.test.d.ts +2 -0
- package/dist/__tests__/unit/client/trash.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/trash.test.js +103 -0
- package/dist/__tests__/unit/client/trash.test.js.map +1 -0
- package/dist/__tests__/unit/client/users.test.d.ts +2 -0
- package/dist/__tests__/unit/client/users.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/users.test.js +89 -0
- package/dist/__tests__/unit/client/users.test.js.map +1 -0
- package/dist/__tests__/unit/client/widgets.test.d.ts +2 -0
- package/dist/__tests__/unit/client/widgets.test.d.ts.map +1 -0
- package/dist/__tests__/unit/client/widgets.test.js +91 -0
- package/dist/__tests__/unit/client/widgets.test.js.map +1 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +130 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/client.d.ts +2613 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1623 -1
- package/dist/client.js.map +1 -1
- package/dist/types/attachments.d.ts +1545 -0
- package/dist/types/attachments.d.ts.map +1 -0
- package/dist/types/attachments.js +78 -0
- package/dist/types/attachments.js.map +1 -0
- package/dist/types/blueprints.d.ts +5070 -0
- package/dist/types/blueprints.d.ts.map +1 -0
- package/dist/types/blueprints.js +111 -0
- package/dist/types/blueprints.js.map +1 -0
- package/dist/types/clients.d.ts +384 -0
- package/dist/types/clients.d.ts.map +1 -0
- package/dist/types/clients.js +77 -0
- package/dist/types/clients.js.map +1 -0
- package/dist/types/comments.d.ts +1111 -0
- package/dist/types/comments.d.ts.map +1 -0
- package/dist/types/comments.js +73 -0
- package/dist/types/comments.js.map +1 -0
- package/dist/types/contacts.d.ts +444 -0
- package/dist/types/contacts.d.ts.map +1 -0
- package/dist/types/contacts.js +86 -0
- package/dist/types/contacts.js.map +1 -0
- package/dist/types/customviews.d.ts +1593 -0
- package/dist/types/customviews.d.ts.map +1 -0
- package/dist/types/customviews.js +117 -0
- package/dist/types/customviews.js.map +1 -0
- package/dist/types/dashboards.d.ts +1675 -0
- package/dist/types/dashboards.d.ts.map +1 -0
- package/dist/types/dashboards.js +77 -0
- package/dist/types/dashboards.js.map +1 -0
- package/dist/types/documents.d.ts +2322 -0
- package/dist/types/documents.d.ts.map +1 -0
- package/dist/types/documents.js +121 -0
- package/dist/types/documents.js.map +1 -0
- package/dist/types/events.d.ts +1747 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +122 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/followers.d.ts +198 -0
- package/dist/types/followers.d.ts.map +1 -0
- package/dist/types/followers.js +44 -0
- package/dist/types/followers.js.map +1 -0
- package/dist/types/forums.d.ts +1443 -0
- package/dist/types/forums.d.ts.map +1 -0
- package/dist/types/forums.js +89 -0
- package/dist/types/forums.js.map +1 -0
- package/dist/types/groups.d.ts +237 -0
- package/dist/types/groups.d.ts.map +1 -0
- package/dist/types/groups.js +52 -0
- package/dist/types/groups.js.map +1 -0
- package/dist/types/index.d.ts +31 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +58 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/issues.d.ts +2600 -0
- package/dist/types/issues.d.ts.map +1 -0
- package/dist/types/issues.js +147 -0
- package/dist/types/issues.js.map +1 -0
- package/dist/types/leaves.d.ts +435 -0
- package/dist/types/leaves.d.ts.map +1 -0
- package/dist/types/leaves.js +92 -0
- package/dist/types/leaves.js.map +1 -0
- package/dist/types/modules.d.ts +469 -0
- package/dist/types/modules.d.ts.map +1 -0
- package/dist/types/modules.js +91 -0
- package/dist/types/modules.js.map +1 -0
- package/dist/types/phases.d.ts +1564 -0
- package/dist/types/phases.d.ts.map +1 -0
- package/dist/types/phases.js +98 -0
- package/dist/types/phases.js.map +1 -0
- package/dist/types/portals.d.ts +1050 -0
- package/dist/types/portals.d.ts.map +1 -0
- package/dist/types/portals.js +58 -0
- package/dist/types/portals.js.map +1 -0
- package/dist/types/profiles.d.ts +243 -0
- package/dist/types/profiles.d.ts.map +1 -0
- package/dist/types/profiles.js +59 -0
- package/dist/types/profiles.js.map +1 -0
- package/dist/types/projects.d.ts +128 -0
- package/dist/types/projects.d.ts.map +1 -1
- package/dist/types/projects.js +44 -0
- package/dist/types/projects.js.map +1 -1
- package/dist/types/reports.d.ts +2010 -0
- package/dist/types/reports.d.ts.map +1 -0
- package/dist/types/reports.js +110 -0
- package/dist/types/reports.js.map +1 -0
- package/dist/types/roles.d.ts +243 -0
- package/dist/types/roles.d.ts.map +1 -0
- package/dist/types/roles.js +59 -0
- package/dist/types/roles.js.map +1 -0
- package/dist/types/search.d.ts +1091 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/search.js +83 -0
- package/dist/types/search.js.map +1 -0
- package/dist/types/tags.d.ts +198 -0
- package/dist/types/tags.d.ts.map +1 -0
- package/dist/types/tags.js +49 -0
- package/dist/types/tags.js.map +1 -0
- package/dist/types/tasklists.d.ts +1317 -0
- package/dist/types/tasklists.d.ts.map +1 -0
- package/dist/types/tasklists.js +78 -0
- package/dist/types/tasklists.js.map +1 -0
- package/dist/types/tasks.d.ts +182 -0
- package/dist/types/tasks.d.ts.map +1 -1
- package/dist/types/tasks.js +52 -0
- package/dist/types/tasks.js.map +1 -1
- package/dist/types/teams.d.ts +504 -0
- package/dist/types/teams.d.ts.map +1 -0
- package/dist/types/teams.js +75 -0
- package/dist/types/teams.js.map +1 -0
- package/dist/types/timelogs.d.ts +245 -0
- package/dist/types/timelogs.d.ts.map +1 -1
- package/dist/types/timelogs.js +53 -0
- package/dist/types/timelogs.js.map +1 -1
- package/dist/types/timers.d.ts +1334 -0
- package/dist/types/timers.d.ts.map +1 -0
- package/dist/types/timers.js +108 -0
- package/dist/types/timers.js.map +1 -0
- package/dist/types/trash.d.ts +1447 -0
- package/dist/types/trash.d.ts.map +1 -0
- package/dist/types/trash.js +77 -0
- package/dist/types/trash.js.map +1 -0
- package/dist/types/users.d.ts +100 -0
- package/dist/types/users.d.ts.map +1 -1
- package/dist/types/users.js +56 -0
- package/dist/types/users.js.map +1 -1
- package/dist/types/widgets.d.ts +1083 -0
- package/dist/types/widgets.d.ts.map +1 -0
- package/dist/types/widgets.js +87 -0
- package/dist/types/widgets.js.map +1 -0
- package/package.json +15 -3
- package/templates/CLAUDE.md +66 -0
- package/templates/commands/zoho-auth.md +195 -0
- package/templates/commands/zoho-examples.md +375 -0
- package/templates/commands/zoho-projects.md +183 -0
- package/templates/types/zoho-projects-api.d.ts +364 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for teams API
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
5
|
+
import { http, HttpResponse } from "msw";
|
|
6
|
+
import { server } from "../../mocks/server.js";
|
|
7
|
+
import { createZohoProjectsClient } from "../../../client.js";
|
|
8
|
+
import { mockTeam, mockTeams } from "../../fixtures/teams.js";
|
|
9
|
+
const TEST_PORTAL_ID = "12345";
|
|
10
|
+
const BASE_URL = `https://projectsapi.zoho.com/restapi/portal/${TEST_PORTAL_ID}`;
|
|
11
|
+
describe("teams", () => {
|
|
12
|
+
let client;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
client = createZohoProjectsClient({
|
|
15
|
+
clientId: "test-client-id",
|
|
16
|
+
clientSecret: "test-client-secret",
|
|
17
|
+
refreshToken: "test-refresh-token",
|
|
18
|
+
portalId: TEST_PORTAL_ID,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("list", () => {
|
|
22
|
+
it("should list all teams", async () => {
|
|
23
|
+
server.use(http.get(`${BASE_URL}/teams/`, () => {
|
|
24
|
+
return HttpResponse.json({
|
|
25
|
+
teams: mockTeams,
|
|
26
|
+
page_info: { page: 1, per_page: 100, has_more_page: false },
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
const result = await client.teams.list();
|
|
30
|
+
expect(result.data).toHaveLength(2);
|
|
31
|
+
expect(result.data[0]).toMatchObject({
|
|
32
|
+
id: expect.any(String),
|
|
33
|
+
name: expect.any(String),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("get", () => {
|
|
38
|
+
it("should get a single team by ID", async () => {
|
|
39
|
+
server.use(http.get(`${BASE_URL}/teams/team_001/`, () => {
|
|
40
|
+
return HttpResponse.json({ teams: [mockTeam] });
|
|
41
|
+
}));
|
|
42
|
+
const result = await client.teams.get("team_001");
|
|
43
|
+
expect(result.id).toBe("team_001");
|
|
44
|
+
expect(result.name).toBe("Engineering Team");
|
|
45
|
+
expect(result.members).toHaveLength(3);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe("create", () => {
|
|
49
|
+
it("should create a team", async () => {
|
|
50
|
+
let capturedBody;
|
|
51
|
+
server.use(http.post(`${BASE_URL}/teams/`, async ({ request }) => {
|
|
52
|
+
capturedBody = await request.json();
|
|
53
|
+
return HttpResponse.json({ teams: [mockTeam] });
|
|
54
|
+
}));
|
|
55
|
+
const result = await client.teams.create({
|
|
56
|
+
name: "Engineering Team",
|
|
57
|
+
description: "Core engineering team",
|
|
58
|
+
lead_id: "user_001",
|
|
59
|
+
});
|
|
60
|
+
expect(capturedBody).toMatchObject({
|
|
61
|
+
name: "Engineering Team",
|
|
62
|
+
description: "Core engineering team",
|
|
63
|
+
});
|
|
64
|
+
expect(result.name).toBe("Engineering Team");
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe("update", () => {
|
|
68
|
+
it("should update a team", async () => {
|
|
69
|
+
const updatedTeam = { ...mockTeam, name: "Core Engineering" };
|
|
70
|
+
server.use(http.put(`${BASE_URL}/teams/team_001/`, () => {
|
|
71
|
+
return HttpResponse.json({ teams: [updatedTeam] });
|
|
72
|
+
}));
|
|
73
|
+
const result = await client.teams.update("team_001", {
|
|
74
|
+
name: "Core Engineering",
|
|
75
|
+
});
|
|
76
|
+
expect(result.name).toBe("Core Engineering");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe("delete", () => {
|
|
80
|
+
it("should delete a team", async () => {
|
|
81
|
+
server.use(http.delete(`${BASE_URL}/teams/team_001/`, () => {
|
|
82
|
+
return new HttpResponse(null, { status: 204 });
|
|
83
|
+
}));
|
|
84
|
+
await expect(client.teams.delete("team_001")).resolves.toBeUndefined();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
describe("addMembers", () => {
|
|
88
|
+
it("should add members to a team", async () => {
|
|
89
|
+
const updatedTeam = {
|
|
90
|
+
...mockTeam,
|
|
91
|
+
members: [
|
|
92
|
+
...(mockTeam.members || []),
|
|
93
|
+
{ id: "user_005", name: "New Member", email: "new@example.com" },
|
|
94
|
+
],
|
|
95
|
+
members_count: 4,
|
|
96
|
+
};
|
|
97
|
+
server.use(http.post(`${BASE_URL}/teams/team_001/members/`, () => {
|
|
98
|
+
return HttpResponse.json({ teams: [updatedTeam] });
|
|
99
|
+
}));
|
|
100
|
+
const result = await client.teams.addMembers("team_001", {
|
|
101
|
+
members: "user_005",
|
|
102
|
+
});
|
|
103
|
+
expect(result.members_count).toBe(4);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe("removeMember", () => {
|
|
107
|
+
it("should remove a member from a team", async () => {
|
|
108
|
+
server.use(http.delete(`${BASE_URL}/teams/team_001/members/user_003/`, () => {
|
|
109
|
+
return new HttpResponse(null, { status: 204 });
|
|
110
|
+
}));
|
|
111
|
+
await expect(client.teams.removeMember("team_001", "user_003")).resolves.toBeUndefined();
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=teams.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.test.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/teams.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,QAAQ,GAAG,+CAA+C,cAAc,EAAE,CAAC;AAEjF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,MAAmD,CAAC;IAExD,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,wBAAwB,CAAC;YAChC,QAAQ,EAAE,gBAAgB;YAC1B,YAAY,EAAE,oBAAoB;YAClC,YAAY,EAAE,oBAAoB;YAClC,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;YACrC,MAAM,CAAC,GAAG,CACR,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,SAAS,EAAE,GAAG,EAAE;gBAClC,OAAO,YAAY,CAAC,IAAI,CAAC;oBACvB,KAAK,EAAE,SAAS;oBAChB,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE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,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE;gBACvD,OAAO,EAAE,UAAU;aACpB,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;YAClD,MAAM,CAAC,GAAG,CACR,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,mCAAmC,EAAE,GAAG,EAAE;gBAC/D,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACjD,CAAC,CAAC,CACH,CAAC;YAEF,MAAM,MAAM,CACV,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAClD,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timelogs.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/timelogs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for timelogs API
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
5
|
+
import { http, HttpResponse } from "msw";
|
|
6
|
+
import { server } from "../../mocks/server.js";
|
|
7
|
+
import { createZohoProjectsClient } from "../../../client.js";
|
|
8
|
+
import { createTimeLogFixture, createTimeLogListFixture, createTimeLogListResponse, } from "../../fixtures/timelogs.js";
|
|
9
|
+
const TEST_PORTAL_ID = "12345";
|
|
10
|
+
const BASE_URL = `https://projectsapi.zoho.com/restapi/portal/${TEST_PORTAL_ID}`;
|
|
11
|
+
describe("timelogs", () => {
|
|
12
|
+
let client;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
client = createZohoProjectsClient({
|
|
15
|
+
clientId: "test-client-id",
|
|
16
|
+
clientSecret: "test-client-secret",
|
|
17
|
+
refreshToken: "test-refresh-token",
|
|
18
|
+
portalId: TEST_PORTAL_ID,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("list", () => {
|
|
22
|
+
it("should list timelogs for a project", async () => {
|
|
23
|
+
const mockTimelogs = createTimeLogListFixture(3);
|
|
24
|
+
server.use(http.get(`${BASE_URL}/projects/proj_001/logs/`, () => {
|
|
25
|
+
return HttpResponse.json(createTimeLogListResponse(mockTimelogs));
|
|
26
|
+
}));
|
|
27
|
+
const result = await client.timelogs.list("proj_001", {
|
|
28
|
+
users_list: "all",
|
|
29
|
+
view_type: "week",
|
|
30
|
+
date: "01-15-2024",
|
|
31
|
+
bill_status: "All",
|
|
32
|
+
component_type: "task",
|
|
33
|
+
});
|
|
34
|
+
expect(result.data).toBeDefined();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("createForTask", () => {
|
|
38
|
+
it("should create a timelog for a task", async () => {
|
|
39
|
+
const mockTimelog = createTimeLogFixture();
|
|
40
|
+
server.use(http.post(`${BASE_URL}/projects/proj_001/logs/`, () => {
|
|
41
|
+
return HttpResponse.json({
|
|
42
|
+
timelogs: { tasklogs: [mockTimelog] },
|
|
43
|
+
});
|
|
44
|
+
}));
|
|
45
|
+
const result = await client.timelogs.createForTask("proj_001", {
|
|
46
|
+
task_id: "task_001",
|
|
47
|
+
date: "01-15-2024",
|
|
48
|
+
hours: "2",
|
|
49
|
+
bill_status: "Billable",
|
|
50
|
+
});
|
|
51
|
+
expect(result).toBeDefined();
|
|
52
|
+
expect(result.hours).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe("createForBug", () => {
|
|
56
|
+
it("should create a timelog for a bug", async () => {
|
|
57
|
+
const mockTimelog = createTimeLogFixture();
|
|
58
|
+
server.use(http.post(`${BASE_URL}/projects/proj_001/logs/`, () => {
|
|
59
|
+
return HttpResponse.json({
|
|
60
|
+
timelogs: { buglogs: [mockTimelog] },
|
|
61
|
+
});
|
|
62
|
+
}));
|
|
63
|
+
const result = await client.timelogs.createForBug("proj_001", {
|
|
64
|
+
bug_id: "bug_001",
|
|
65
|
+
date: "01-15-2024",
|
|
66
|
+
hours: "1",
|
|
67
|
+
bill_status: "Non Billable",
|
|
68
|
+
});
|
|
69
|
+
expect(result).toBeDefined();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
describe("createGeneral", () => {
|
|
73
|
+
it("should create a general timelog", async () => {
|
|
74
|
+
const mockTimelog = createTimeLogFixture();
|
|
75
|
+
server.use(http.post(`${BASE_URL}/projects/proj_001/logs/`, () => {
|
|
76
|
+
return HttpResponse.json({
|
|
77
|
+
timelogs: { generallogs: [mockTimelog] },
|
|
78
|
+
});
|
|
79
|
+
}));
|
|
80
|
+
const result = await client.timelogs.createGeneral("proj_001", {
|
|
81
|
+
name: "General work",
|
|
82
|
+
date: "01-15-2024",
|
|
83
|
+
hours: "3",
|
|
84
|
+
bill_status: "Billable",
|
|
85
|
+
});
|
|
86
|
+
expect(result).toBeDefined();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe("update", () => {
|
|
90
|
+
it("should update a timelog", async () => {
|
|
91
|
+
const mockTimelog = createTimeLogFixture({ hours: 4 });
|
|
92
|
+
server.use(http.put(`${BASE_URL}/projects/proj_001/logs/log_001/`, () => {
|
|
93
|
+
return HttpResponse.json({
|
|
94
|
+
timelogs: { tasklogs: [mockTimelog] },
|
|
95
|
+
});
|
|
96
|
+
}));
|
|
97
|
+
const result = await client.timelogs.update("proj_001", "log_001", {
|
|
98
|
+
hours: "4",
|
|
99
|
+
});
|
|
100
|
+
expect(result).toBeDefined();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe("delete", () => {
|
|
104
|
+
it("should delete a timelog", async () => {
|
|
105
|
+
server.use(http.delete(`${BASE_URL}/projects/proj_001/logs/log_001/`, () => {
|
|
106
|
+
return new HttpResponse(null, { status: 204 });
|
|
107
|
+
}));
|
|
108
|
+
await expect(client.timelogs.delete("proj_001", "log_001")).resolves.toBeUndefined();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=timelogs.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timelogs.test.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/timelogs.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,QAAQ,GAAG,+CAA+C,cAAc,EAAE,CAAC;AAEjF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,MAAmD,CAAC;IAExD,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,wBAAwB,CAAC;YAChC,QAAQ,EAAE,gBAAgB;YAC1B,YAAY,EAAE,oBAAoB;YAClC,YAAY,EAAE,oBAAoB;YAClC,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,oCAAoC,EAAE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AM,CACV,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAC9C,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timers.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/timers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for timers API
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
5
|
+
import { http, HttpResponse } from "msw";
|
|
6
|
+
import { server } from "../../mocks/server.js";
|
|
7
|
+
import { createZohoProjectsClient } from "../../../client.js";
|
|
8
|
+
import { mockTimer, mockTimers, mockPausedTimer } from "../../fixtures/timers.js";
|
|
9
|
+
const TEST_PORTAL_ID = "12345";
|
|
10
|
+
const BASE_URL = `https://projectsapi.zoho.com/restapi/portal/${TEST_PORTAL_ID}`;
|
|
11
|
+
describe("timers", () => {
|
|
12
|
+
let client;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
client = createZohoProjectsClient({
|
|
15
|
+
clientId: "test-client-id",
|
|
16
|
+
clientSecret: "test-client-secret",
|
|
17
|
+
refreshToken: "test-refresh-token",
|
|
18
|
+
portalId: TEST_PORTAL_ID,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("list", () => {
|
|
22
|
+
it("should list all running timers", async () => {
|
|
23
|
+
server.use(http.get(`${BASE_URL}/mytimers/`, () => {
|
|
24
|
+
return HttpResponse.json({ timers: mockTimers });
|
|
25
|
+
}));
|
|
26
|
+
const result = await client.timers.list();
|
|
27
|
+
expect(result).toHaveLength(2);
|
|
28
|
+
expect(result[0]).toMatchObject({
|
|
29
|
+
id: expect.any(String),
|
|
30
|
+
status: expect.any(String),
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
it("should return empty array when no timers", async () => {
|
|
34
|
+
server.use(http.get(`${BASE_URL}/mytimers/`, () => {
|
|
35
|
+
return new HttpResponse("", { status: 204 });
|
|
36
|
+
}));
|
|
37
|
+
const result = await client.timers.list();
|
|
38
|
+
expect(result).toHaveLength(0);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe("getCurrent", () => {
|
|
42
|
+
it("should get the current running timer", async () => {
|
|
43
|
+
server.use(http.get(`${BASE_URL}/mytimers/`, () => {
|
|
44
|
+
return HttpResponse.json({ timers: [mockTimer] });
|
|
45
|
+
}));
|
|
46
|
+
const result = await client.timers.getCurrent();
|
|
47
|
+
expect(result).not.toBeNull();
|
|
48
|
+
expect(result?.status).toBe("running");
|
|
49
|
+
});
|
|
50
|
+
it("should return null when no timer is running", async () => {
|
|
51
|
+
server.use(http.get(`${BASE_URL}/mytimers/`, () => {
|
|
52
|
+
return new HttpResponse("", { status: 204 });
|
|
53
|
+
}));
|
|
54
|
+
const result = await client.timers.getCurrent();
|
|
55
|
+
expect(result).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe("start", () => {
|
|
59
|
+
it("should start a timer for a task", async () => {
|
|
60
|
+
server.use(http.post(`${BASE_URL}/projects/proj_001/tasks/task_123/timer/start/`, () => {
|
|
61
|
+
return HttpResponse.json({ timer: mockTimer });
|
|
62
|
+
}));
|
|
63
|
+
const result = await client.timers.start({
|
|
64
|
+
entity_id: "task_123",
|
|
65
|
+
type: "Task",
|
|
66
|
+
project_id: "proj_001",
|
|
67
|
+
});
|
|
68
|
+
expect(result.status).toBe("running");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("stop", () => {
|
|
72
|
+
it("should stop the current timer", async () => {
|
|
73
|
+
const stoppedTimer = { ...mockTimer, status: "stopped" };
|
|
74
|
+
server.use(http.post(`${BASE_URL}/mytimers/stop/`, () => {
|
|
75
|
+
return HttpResponse.json({ timer: stoppedTimer });
|
|
76
|
+
}));
|
|
77
|
+
const result = await client.timers.stop({});
|
|
78
|
+
expect(result.status).toBe("stopped");
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe("pause", () => {
|
|
82
|
+
it("should pause the current timer", async () => {
|
|
83
|
+
server.use(http.post(`${BASE_URL}/mytimers/pause/`, () => {
|
|
84
|
+
return HttpResponse.json({ timer: mockPausedTimer });
|
|
85
|
+
}));
|
|
86
|
+
const result = await client.timers.pause();
|
|
87
|
+
expect(result.status).toBe("paused");
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe("resume", () => {
|
|
91
|
+
it("should resume a paused timer", async () => {
|
|
92
|
+
server.use(http.post(`${BASE_URL}/mytimers/resume/`, () => {
|
|
93
|
+
return HttpResponse.json({ timer: mockTimer });
|
|
94
|
+
}));
|
|
95
|
+
const result = await client.timers.resume();
|
|
96
|
+
expect(result.status).toBe("running");
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe("startForTask", () => {
|
|
100
|
+
it("should start a timer for a specific task", async () => {
|
|
101
|
+
server.use(http.post(`${BASE_URL}/projects/proj_001/tasks/task_123/timer/start/`, () => {
|
|
102
|
+
return HttpResponse.json({ timer: mockTimer });
|
|
103
|
+
}));
|
|
104
|
+
const result = await client.timers.startForTask("proj_001", "task_123", {
|
|
105
|
+
notes: "Starting work",
|
|
106
|
+
bill_status: "billable",
|
|
107
|
+
});
|
|
108
|
+
expect(result).toBeDefined();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe("startForIssue", () => {
|
|
112
|
+
it("should start a timer for a specific issue", async () => {
|
|
113
|
+
const issueTimer = { ...mockTimer, entity_type: "issue" };
|
|
114
|
+
server.use(http.post(`${BASE_URL}/projects/proj_001/issues/issue_123/timer/start/`, () => {
|
|
115
|
+
return HttpResponse.json({ timer: issueTimer });
|
|
116
|
+
}));
|
|
117
|
+
const result = await client.timers.startForIssue("proj_001", "issue_123");
|
|
118
|
+
expect(result).toBeDefined();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=timers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timers.test.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/timers.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,QAAQ,GAAG,+CAA+C,cAAc,EAAE,CAAC;AAEjF,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,MAAmD,CAAC;IAExD,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,wBAAwB,CAAC;YAChC,QAAQ,EAAE,gBAAgB;YAC1B,YAAY,EAAE,oBAAoB;YAClC,YAAY,EAAE,oBAAoB;YAClC,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;YAC9C,MAAM,CAAC,GAAG,CACR,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,YAAY,EAAE,GAAG,EAAE;gBACrC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YACnD,CAAC,CAAC,CACH,CAAC;YAEF,MA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CAC9C,UAAU,EACV,WAAW,CACZ,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trash.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/trash.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for trash API
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
5
|
+
import { http, HttpResponse } from "msw";
|
|
6
|
+
import { server } from "../../mocks/server.js";
|
|
7
|
+
import { createZohoProjectsClient } from "../../../client.js";
|
|
8
|
+
import { mockTrashItems, mockTrashRestoreResponse, } from "../../fixtures/trash.js";
|
|
9
|
+
const TEST_PORTAL_ID = "12345";
|
|
10
|
+
const BASE_URL = `https://projectsapi.zoho.com/restapi/portal/${TEST_PORTAL_ID}`;
|
|
11
|
+
describe("trash", () => {
|
|
12
|
+
let client;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
client = createZohoProjectsClient({
|
|
15
|
+
clientId: "test-client-id",
|
|
16
|
+
clientSecret: "test-client-secret",
|
|
17
|
+
refreshToken: "test-refresh-token",
|
|
18
|
+
portalId: TEST_PORTAL_ID,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("list", () => {
|
|
22
|
+
it("should list all items in trash", async () => {
|
|
23
|
+
server.use(http.get(`${BASE_URL}/trash/`, () => {
|
|
24
|
+
return HttpResponse.json({
|
|
25
|
+
trash: mockTrashItems,
|
|
26
|
+
page_info: { page: 1, per_page: 100, has_more_page: false },
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
const result = await client.trash.list();
|
|
30
|
+
expect(result.data).toHaveLength(3);
|
|
31
|
+
expect(result.data[0]).toMatchObject({
|
|
32
|
+
id: expect.anything(),
|
|
33
|
+
entity_type: expect.any(String),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
it("should filter trash by entity type", async () => {
|
|
37
|
+
let capturedParams;
|
|
38
|
+
server.use(http.get(`${BASE_URL}/trash/`, ({ request }) => {
|
|
39
|
+
capturedParams = new URL(request.url).searchParams;
|
|
40
|
+
return HttpResponse.json({
|
|
41
|
+
trash: mockTrashItems.filter((i) => i.entity_type === "task"),
|
|
42
|
+
page_info: { page: 1, per_page: 100, has_more_page: false },
|
|
43
|
+
});
|
|
44
|
+
}));
|
|
45
|
+
const result = await client.trash.list({ entity_type: "task" });
|
|
46
|
+
expect(capturedParams?.get("entity_type")).toBe("task");
|
|
47
|
+
expect(result.data).toHaveLength(1);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe("restore", () => {
|
|
51
|
+
it("should restore an item from trash", async () => {
|
|
52
|
+
server.use(http.post(`${BASE_URL}/trash/task/task_deleted_001/restore/`, () => {
|
|
53
|
+
return HttpResponse.json(mockTrashRestoreResponse);
|
|
54
|
+
}));
|
|
55
|
+
const result = await client.trash.restore("task", "task_deleted_001");
|
|
56
|
+
expect(result.restored).toBe(true);
|
|
57
|
+
expect(result.message).toBe("Item restored successfully");
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("permanentDelete", () => {
|
|
61
|
+
it("should permanently delete an item from trash", async () => {
|
|
62
|
+
server.use(http.delete(`${BASE_URL}/trash/task/task_deleted_001/`, () => {
|
|
63
|
+
return new HttpResponse(null, { status: 204 });
|
|
64
|
+
}));
|
|
65
|
+
await expect(client.trash.permanentDelete("task", "task_deleted_001")).resolves.toBeUndefined();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe("empty", () => {
|
|
69
|
+
it("should empty all trash", async () => {
|
|
70
|
+
server.use(http.delete(`${BASE_URL}/trash/`, () => {
|
|
71
|
+
return new HttpResponse(null, { status: 204 });
|
|
72
|
+
}));
|
|
73
|
+
await expect(client.trash.empty()).resolves.toBeUndefined();
|
|
74
|
+
});
|
|
75
|
+
it("should empty trash for a specific entity type", async () => {
|
|
76
|
+
server.use(http.delete(`${BASE_URL}/trash/task/`, () => {
|
|
77
|
+
return new HttpResponse(null, { status: 204 });
|
|
78
|
+
}));
|
|
79
|
+
await expect(client.trash.empty("task")).resolves.toBeUndefined();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe("listForProject", () => {
|
|
83
|
+
it("should list trash for a specific project", async () => {
|
|
84
|
+
server.use(http.get(`${BASE_URL}/trash/`, ({ request }) => {
|
|
85
|
+
const url = new URL(request.url);
|
|
86
|
+
const projectId = url.searchParams.get("project_id");
|
|
87
|
+
if (projectId === "proj_001") {
|
|
88
|
+
return HttpResponse.json({
|
|
89
|
+
trash: mockTrashItems,
|
|
90
|
+
page_info: { page: 1, per_page: 100, has_more_page: false },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return HttpResponse.json({
|
|
94
|
+
trash: [],
|
|
95
|
+
page_info: { page: 1, per_page: 100, has_more_page: false },
|
|
96
|
+
});
|
|
97
|
+
}));
|
|
98
|
+
const result = await client.trash.listForProject("proj_001");
|
|
99
|
+
expect(result.data).toHaveLength(3);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=trash.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trash.test.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/trash.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CA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AM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/users.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for users API
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
5
|
+
import { http, HttpResponse } from "msw";
|
|
6
|
+
import { server } from "../../mocks/server.js";
|
|
7
|
+
import { createZohoProjectsClient } from "../../../client.js";
|
|
8
|
+
import { createUserFixture, createUserListFixture, createUserListResponse, } from "../../fixtures/users.js";
|
|
9
|
+
const TEST_PORTAL_ID = "12345";
|
|
10
|
+
const BASE_URL = `https://projectsapi.zoho.com/restapi/portal/${TEST_PORTAL_ID}`;
|
|
11
|
+
describe("users", () => {
|
|
12
|
+
let client;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
client = createZohoProjectsClient({
|
|
15
|
+
clientId: "test-client-id",
|
|
16
|
+
clientSecret: "test-client-secret",
|
|
17
|
+
refreshToken: "test-refresh-token",
|
|
18
|
+
portalId: TEST_PORTAL_ID,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe("list", () => {
|
|
22
|
+
it("should list users with default pagination", async () => {
|
|
23
|
+
const mockUsers = createUserListFixture(3);
|
|
24
|
+
server.use(http.get(`${BASE_URL}/users/`, () => {
|
|
25
|
+
return HttpResponse.json(createUserListResponse(mockUsers));
|
|
26
|
+
}));
|
|
27
|
+
const result = await client.users.list();
|
|
28
|
+
expect(result.data).toHaveLength(3);
|
|
29
|
+
expect(result.data[0]).toMatchObject({
|
|
30
|
+
id: expect.any(String),
|
|
31
|
+
name: expect.any(String),
|
|
32
|
+
email: expect.any(String),
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
it("should handle empty response", async () => {
|
|
36
|
+
server.use(http.get(`${BASE_URL}/users/`, () => {
|
|
37
|
+
return HttpResponse.json(createUserListResponse([]));
|
|
38
|
+
}));
|
|
39
|
+
const result = await client.users.list();
|
|
40
|
+
expect(result.data).toHaveLength(0);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe("get", () => {
|
|
44
|
+
it("should get a single user by ID", async () => {
|
|
45
|
+
const mockUser = createUserFixture({ id: "123" });
|
|
46
|
+
server.use(http.get(`${BASE_URL}/users/123/`, () => {
|
|
47
|
+
return HttpResponse.json({ users: [mockUser] });
|
|
48
|
+
}));
|
|
49
|
+
const result = await client.users.get("123");
|
|
50
|
+
expect(result.id).toBe("123");
|
|
51
|
+
expect(result.name).toBeDefined();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("listAll", () => {
|
|
55
|
+
it("should auto-paginate through all users", async () => {
|
|
56
|
+
const page1 = createUserListFixture(100);
|
|
57
|
+
const page2 = createUserListFixture(50);
|
|
58
|
+
let requestCount = 0;
|
|
59
|
+
server.use(http.get(`${BASE_URL}/users/`, ({ request }) => {
|
|
60
|
+
requestCount++;
|
|
61
|
+
const url = new URL(request.url);
|
|
62
|
+
const index = parseInt(url.searchParams.get("index") || "0");
|
|
63
|
+
if (index === 0) {
|
|
64
|
+
return HttpResponse.json(createUserListResponse(page1, true));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return HttpResponse.json(createUserListResponse(page2, false));
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
const result = await client.users.listAll();
|
|
71
|
+
expect(requestCount).toBe(2);
|
|
72
|
+
expect(result).toHaveLength(150);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
describe("iterate", () => {
|
|
76
|
+
it("should yield users one at a time", async () => {
|
|
77
|
+
const mockUsers = createUserListFixture(3);
|
|
78
|
+
server.use(http.get(`${BASE_URL}/users/`, () => {
|
|
79
|
+
return HttpResponse.json(createUserListResponse(mockUsers));
|
|
80
|
+
}));
|
|
81
|
+
const results = [];
|
|
82
|
+
for await (const user of client.users.iterate()) {
|
|
83
|
+
results.push(user);
|
|
84
|
+
}
|
|
85
|
+
expect(results).toHaveLength(3);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=users.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.test.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/client/users.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,QAAQ,GAAG,+CAA+C,cAAc,EAAE,CAAC;AAEjF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,MAAmD,CAAC;IAExD,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,wBAAwB,CAAC;YAChC,QAAQ,EAAE,gBAAgB;YAC1B,YAAY,EAAE,oBAAoB;YAClC,YAAY,EAAE,oBAAoB;YAClC,QAAQ,EAAE,cAAc;SACzB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;YACzD,MAAM,SAAS,GAAG,qBAAqB,CAAC,CAA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