monday-cli 0.2.0 → 0.3.0
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/CHANGELOG.md +324 -2
- package/README.md +128 -30
- package/dist/api/board-favorites.d.ts +329 -0
- package/dist/api/board-favorites.d.ts.map +1 -0
- package/dist/api/board-favorites.js +353 -0
- package/dist/api/board-favorites.js.map +1 -0
- package/dist/api/board-mutation-result.d.ts +9 -5
- package/dist/api/board-mutation-result.d.ts.map +1 -1
- package/dist/api/board-mutation-result.js +9 -5
- package/dist/api/board-mutation-result.js.map +1 -1
- package/dist/api/board-relation-validation.d.ts +161 -0
- package/dist/api/board-relation-validation.d.ts.map +1 -0
- package/dist/api/board-relation-validation.js +317 -0
- package/dist/api/board-relation-validation.js.map +1 -0
- package/dist/api/cache.d.ts +14 -5
- package/dist/api/cache.d.ts.map +1 -1
- package/dist/api/cache.js +8 -10
- package/dist/api/cache.js.map +1 -1
- package/dist/api/column-mapping.js +2 -2
- package/dist/api/column-mapping.js.map +1 -1
- package/dist/api/column-mutation-result.d.ts +9 -5
- package/dist/api/column-mutation-result.d.ts.map +1 -1
- package/dist/api/column-mutation-result.js +9 -5
- package/dist/api/column-mutation-result.js.map +1 -1
- package/dist/api/column-types.d.ts +26 -7
- package/dist/api/column-types.d.ts.map +1 -1
- package/dist/api/column-types.js +42 -3
- package/dist/api/column-types.js.map +1 -1
- package/dist/api/column-values.d.ts +228 -31
- package/dist/api/column-values.d.ts.map +1 -1
- package/dist/api/column-values.js +551 -124
- package/dist/api/column-values.js.map +1 -1
- package/dist/api/cross-board-search.d.ts +501 -0
- package/dist/api/cross-board-search.d.ts.map +1 -0
- package/dist/api/cross-board-search.js +547 -0
- package/dist/api/cross-board-search.js.map +1 -0
- package/dist/api/dev-conventions.d.ts +1038 -0
- package/dist/api/dev-conventions.d.ts.map +1 -0
- package/dist/api/dev-conventions.js +1556 -0
- package/dist/api/dev-conventions.js.map +1 -0
- package/dist/api/dry-run.d.ts +32 -5
- package/dist/api/dry-run.d.ts.map +1 -1
- package/dist/api/dry-run.js +149 -32
- package/dist/api/dry-run.js.map +1 -1
- package/dist/api/errors.d.ts.map +1 -1
- package/dist/api/errors.js +28 -7
- package/dist/api/errors.js.map +1 -1
- package/dist/api/group-mutation-result.d.ts +9 -5
- package/dist/api/group-mutation-result.d.ts.map +1 -1
- package/dist/api/group-mutation-result.js +9 -5
- package/dist/api/group-mutation-result.js.map +1 -1
- package/dist/api/item-history-projection.d.ts +919 -0
- package/dist/api/item-history-projection.d.ts.map +1 -0
- package/dist/api/item-history-projection.js +1104 -0
- package/dist/api/item-history-projection.js.map +1 -0
- package/dist/api/item-mutation-execute.d.ts +82 -0
- package/dist/api/item-mutation-execute.d.ts.map +1 -0
- package/dist/api/item-mutation-execute.js +199 -0
- package/dist/api/item-mutation-execute.js.map +1 -0
- package/dist/api/notifications.d.ts +156 -0
- package/dist/api/notifications.d.ts.map +1 -0
- package/dist/api/notifications.js +215 -0
- package/dist/api/notifications.js.map +1 -0
- package/dist/api/oauth-test-helper.d.ts +64 -0
- package/dist/api/oauth-test-helper.d.ts.map +1 -0
- package/dist/api/oauth-test-helper.js +179 -0
- package/dist/api/oauth-test-helper.js.map +1 -0
- package/dist/api/oauth.d.ts +198 -0
- package/dist/api/oauth.d.ts.map +1 -0
- package/dist/api/oauth.js +471 -0
- package/dist/api/oauth.js.map +1 -0
- package/dist/api/partial-success-bulk.d.ts +422 -0
- package/dist/api/partial-success-bulk.d.ts.map +1 -0
- package/dist/api/partial-success-bulk.js +378 -0
- package/dist/api/partial-success-bulk.js.map +1 -0
- package/dist/api/people.d.ts +54 -1
- package/dist/api/people.d.ts.map +1 -1
- package/dist/api/people.js +27 -3
- package/dist/api/people.js.map +1 -1
- package/dist/api/probes.d.ts +487 -0
- package/dist/api/probes.d.ts.map +1 -0
- package/dist/api/probes.js +881 -0
- package/dist/api/probes.js.map +1 -0
- package/dist/api/raw-document.d.ts.map +1 -1
- package/dist/api/raw-document.js +2 -2
- package/dist/api/raw-document.js.map +1 -1
- package/dist/api/raw-write.d.ts.map +1 -1
- package/dist/api/raw-write.js +11 -3
- package/dist/api/raw-write.js.map +1 -1
- package/dist/api/resolution-context.d.ts +23 -11
- package/dist/api/resolution-context.d.ts.map +1 -1
- package/dist/api/resolution-context.js +53 -12
- package/dist/api/resolution-context.js.map +1 -1
- package/dist/api/resolution-pass.d.ts +30 -1
- package/dist/api/resolution-pass.d.ts.map +1 -1
- package/dist/api/resolution-pass.js +36 -1
- package/dist/api/resolution-pass.js.map +1 -1
- package/dist/api/resolve-client.d.ts +11 -0
- package/dist/api/resolve-client.d.ts.map +1 -1
- package/dist/api/resolve-client.js +1 -1
- package/dist/api/resolve-client.js.map +1 -1
- package/dist/api/response-root.d.ts +92 -46
- package/dist/api/response-root.d.ts.map +1 -1
- package/dist/api/response-root.js +93 -41
- package/dist/api/response-root.js.map +1 -1
- package/dist/api/tag-directory.d.ts +154 -0
- package/dist/api/tag-directory.d.ts.map +1 -0
- package/dist/api/tag-directory.js +325 -0
- package/dist/api/tag-directory.js.map +1 -0
- package/dist/api/time-tracking.d.ts +165 -0
- package/dist/api/time-tracking.d.ts.map +1 -0
- package/dist/api/time-tracking.js +135 -0
- package/dist/api/time-tracking.js.map +1 -0
- package/dist/api/transport.js +3 -3
- package/dist/api/transport.js.map +1 -1
- package/dist/api/usage.d.ts +190 -0
- package/dist/api/usage.d.ts.map +1 -0
- package/dist/api/usage.js +194 -0
- package/dist/api/usage.js.map +1 -0
- package/dist/api/users-fan-out-mutation.d.ts.map +1 -1
- package/dist/api/users-fan-out-mutation.js +10 -5
- package/dist/api/users-fan-out-mutation.js.map +1 -1
- package/dist/api/webhooks.d.ts +357 -0
- package/dist/api/webhooks.d.ts.map +1 -0
- package/dist/api/webhooks.js +333 -0
- package/dist/api/webhooks.js.map +1 -0
- package/dist/cli/envelope-out.d.ts +18 -1
- package/dist/cli/envelope-out.d.ts.map +1 -1
- package/dist/cli/envelope-out.js +16 -2
- package/dist/cli/envelope-out.js.map +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +120 -1
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/run.d.ts +12 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +2 -0
- package/dist/cli/run.js.map +1 -1
- package/dist/commands/account/tags.d.ts +37 -0
- package/dist/commands/account/tags.d.ts.map +1 -0
- package/dist/commands/account/tags.js +84 -0
- package/dist/commands/account/tags.js.map +1 -0
- package/dist/commands/auth/login.d.ts +14 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +314 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +28 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +94 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/board/archive.d.ts.map +1 -1
- package/dist/commands/board/archive.js +14 -14
- package/dist/commands/board/archive.js.map +1 -1
- package/dist/commands/board/column-create.d.ts +3 -3
- package/dist/commands/board/column-create.d.ts.map +1 -1
- package/dist/commands/board/column-create.js +52 -45
- package/dist/commands/board/column-create.js.map +1 -1
- package/dist/commands/board/column-delete.d.ts.map +1 -1
- package/dist/commands/board/column-delete.js +15 -16
- package/dist/commands/board/column-delete.js.map +1 -1
- package/dist/commands/board/column-update.d.ts.map +1 -1
- package/dist/commands/board/column-update.js +23 -22
- package/dist/commands/board/column-update.js.map +1 -1
- package/dist/commands/board/create.d.ts.map +1 -1
- package/dist/commands/board/create.js +14 -17
- package/dist/commands/board/create.js.map +1 -1
- package/dist/commands/board/delete.d.ts.map +1 -1
- package/dist/commands/board/delete.js +12 -15
- package/dist/commands/board/delete.js.map +1 -1
- package/dist/commands/board/describe.d.ts.map +1 -1
- package/dist/commands/board/describe.js +30 -0
- package/dist/commands/board/describe.js.map +1 -1
- package/dist/commands/board/duplicate.d.ts.map +1 -1
- package/dist/commands/board/duplicate.js +12 -13
- package/dist/commands/board/duplicate.js.map +1 -1
- package/dist/commands/board/favorites.d.ts +33 -0
- package/dist/commands/board/favorites.d.ts.map +1 -0
- package/dist/commands/board/favorites.js +74 -0
- package/dist/commands/board/favorites.js.map +1 -0
- package/dist/commands/board/find.d.ts +1 -1
- package/dist/commands/board/group-archive.d.ts.map +1 -1
- package/dist/commands/board/group-archive.js +12 -16
- package/dist/commands/board/group-archive.js.map +1 -1
- package/dist/commands/board/group-create.d.ts.map +1 -1
- package/dist/commands/board/group-create.js +9 -19
- package/dist/commands/board/group-create.js.map +1 -1
- package/dist/commands/board/group-delete.d.ts.map +1 -1
- package/dist/commands/board/group-delete.js +12 -16
- package/dist/commands/board/group-delete.js.map +1 -1
- package/dist/commands/board/group-duplicate.d.ts.map +1 -1
- package/dist/commands/board/group-duplicate.js +12 -16
- package/dist/commands/board/group-duplicate.js.map +1 -1
- package/dist/commands/board/group-update.d.ts.map +1 -1
- package/dist/commands/board/group-update.js +12 -11
- package/dist/commands/board/group-update.js.map +1 -1
- package/dist/commands/board/list.d.ts +1 -1
- package/dist/commands/board/update.d.ts.map +1 -1
- package/dist/commands/board/update.js +16 -11
- package/dist/commands/board/update.js.map +1 -1
- package/dist/commands/cache/list.d.ts +2 -0
- package/dist/commands/cache/list.d.ts.map +1 -1
- package/dist/commands/cache/list.js +2 -2
- package/dist/commands/cache/list.js.map +1 -1
- package/dist/commands/dev/_shared.d.ts +40 -0
- package/dist/commands/dev/_shared.d.ts.map +1 -0
- package/dist/commands/dev/_shared.js +104 -0
- package/dist/commands/dev/_shared.js.map +1 -0
- package/dist/commands/dev/configure.d.ts +36 -0
- package/dist/commands/dev/configure.d.ts.map +1 -0
- package/dist/commands/dev/configure.js +145 -0
- package/dist/commands/dev/configure.js.map +1 -0
- package/dist/commands/dev/discover.d.ts +34 -0
- package/dist/commands/dev/discover.d.ts.map +1 -0
- package/dist/commands/dev/discover.js +117 -0
- package/dist/commands/dev/discover.js.map +1 -0
- package/dist/commands/dev/doctor.d.ts +39 -0
- package/dist/commands/dev/doctor.d.ts.map +1 -0
- package/dist/commands/dev/doctor.js +91 -0
- package/dist/commands/dev/doctor.js.map +1 -0
- package/dist/commands/dev/epic/items.d.ts +24 -0
- package/dist/commands/dev/epic/items.d.ts.map +1 -0
- package/dist/commands/dev/epic/items.js +103 -0
- package/dist/commands/dev/epic/items.js.map +1 -0
- package/dist/commands/dev/epic/list.d.ts +36 -0
- package/dist/commands/dev/epic/list.d.ts.map +1 -0
- package/dist/commands/dev/epic/list.js +120 -0
- package/dist/commands/dev/epic/list.js.map +1 -0
- package/dist/commands/dev/release/list.d.ts +21 -0
- package/dist/commands/dev/release/list.d.ts.map +1 -0
- package/dist/commands/dev/release/list.js +73 -0
- package/dist/commands/dev/release/list.js.map +1 -0
- package/dist/commands/dev/sprint/current.d.ts +24 -0
- package/dist/commands/dev/sprint/current.d.ts.map +1 -0
- package/dist/commands/dev/sprint/current.js +90 -0
- package/dist/commands/dev/sprint/current.js.map +1 -0
- package/dist/commands/dev/sprint/items.d.ts +34 -0
- package/dist/commands/dev/sprint/items.d.ts.map +1 -0
- package/dist/commands/dev/sprint/items.js +118 -0
- package/dist/commands/dev/sprint/items.js.map +1 -0
- package/dist/commands/dev/sprint/list.d.ts +41 -0
- package/dist/commands/dev/sprint/list.d.ts.map +1 -0
- package/dist/commands/dev/sprint/list.js +104 -0
- package/dist/commands/dev/sprint/list.js.map +1 -0
- package/dist/commands/dev/task/block.d.ts +29 -0
- package/dist/commands/dev/task/block.d.ts.map +1 -0
- package/dist/commands/dev/task/block.js +106 -0
- package/dist/commands/dev/task/block.js.map +1 -0
- package/dist/commands/dev/task/done.d.ts +30 -0
- package/dist/commands/dev/task/done.d.ts.map +1 -0
- package/dist/commands/dev/task/done.js +113 -0
- package/dist/commands/dev/task/done.js.map +1 -0
- package/dist/commands/dev/task/list.d.ts +42 -0
- package/dist/commands/dev/task/list.d.ts.map +1 -0
- package/dist/commands/dev/task/list.js +227 -0
- package/dist/commands/dev/task/list.js.map +1 -0
- package/dist/commands/dev/task/start.d.ts +29 -0
- package/dist/commands/dev/task/start.d.ts.map +1 -0
- package/dist/commands/dev/task/start.js +90 -0
- package/dist/commands/dev/task/start.js.map +1 -0
- package/dist/commands/emit.d.ts.map +1 -1
- package/dist/commands/emit.js +5 -3
- package/dist/commands/emit.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +95 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/item/archive.d.ts.map +1 -1
- package/dist/commands/item/archive.js +11 -0
- package/dist/commands/item/archive.js.map +1 -1
- package/dist/commands/item/clear.d.ts.map +1 -1
- package/dist/commands/item/clear.js +15 -0
- package/dist/commands/item/clear.js.map +1 -1
- package/dist/commands/item/create.d.ts.map +1 -1
- package/dist/commands/item/create.js +41 -8
- package/dist/commands/item/create.js.map +1 -1
- package/dist/commands/item/delete.d.ts.map +1 -1
- package/dist/commands/item/delete.js +11 -0
- package/dist/commands/item/delete.js.map +1 -1
- package/dist/commands/item/duplicate.d.ts.map +1 -1
- package/dist/commands/item/duplicate.js +12 -0
- package/dist/commands/item/duplicate.js.map +1 -1
- package/dist/commands/item/history.d.ts +60 -0
- package/dist/commands/item/history.d.ts.map +1 -0
- package/dist/commands/item/history.js +309 -0
- package/dist/commands/item/history.js.map +1 -0
- package/dist/commands/item/list.d.ts.map +1 -1
- package/dist/commands/item/list.js +16 -13
- package/dist/commands/item/list.js.map +1 -1
- package/dist/commands/item/move.d.ts.map +1 -1
- package/dist/commands/item/move.js +41 -7
- package/dist/commands/item/move.js.map +1 -1
- package/dist/commands/item/search.d.ts +99 -15
- package/dist/commands/item/search.d.ts.map +1 -1
- package/dist/commands/item/search.js +480 -36
- package/dist/commands/item/search.js.map +1 -1
- package/dist/commands/item/set.d.ts.map +1 -1
- package/dist/commands/item/set.js +52 -8
- package/dist/commands/item/set.js.map +1 -1
- package/dist/commands/item/time-track/start.d.ts +61 -0
- package/dist/commands/item/time-track/start.d.ts.map +1 -0
- package/dist/commands/item/time-track/start.js +138 -0
- package/dist/commands/item/time-track/start.js.map +1 -0
- package/dist/commands/item/time-track/stop.d.ts +32 -0
- package/dist/commands/item/time-track/stop.d.ts.map +1 -0
- package/dist/commands/item/time-track/stop.js +97 -0
- package/dist/commands/item/time-track/stop.js.map +1 -0
- package/dist/commands/item/update.d.ts +1 -0
- package/dist/commands/item/update.d.ts.map +1 -1
- package/dist/commands/item/update.js +103 -113
- package/dist/commands/item/update.js.map +1 -1
- package/dist/commands/item/upsert.d.ts.map +1 -1
- package/dist/commands/item/upsert.js +48 -1
- package/dist/commands/item/upsert.js.map +1 -1
- package/dist/commands/notification/send.d.ts +60 -0
- package/dist/commands/notification/send.d.ts.map +1 -0
- package/dist/commands/notification/send.js +147 -0
- package/dist/commands/notification/send.js.map +1 -0
- package/dist/commands/parse-argv.d.ts.map +1 -1
- package/dist/commands/parse-argv.js +14 -4
- package/dist/commands/parse-argv.js.map +1 -1
- package/dist/commands/raw/index.d.ts.map +1 -1
- package/dist/commands/raw/index.js +13 -15
- package/dist/commands/raw/index.js.map +1 -1
- package/dist/commands/run-by-id-lookup.d.ts.map +1 -1
- package/dist/commands/run-by-id-lookup.js +2 -2
- package/dist/commands/run-by-id-lookup.js.map +1 -1
- package/dist/commands/schema/index.d.ts +2 -0
- package/dist/commands/schema/index.d.ts.map +1 -1
- package/dist/commands/status.d.ts +120 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +365 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/update/body-source.d.ts.map +1 -1
- package/dist/commands/update/body-source.js +2 -2
- package/dist/commands/update/body-source.js.map +1 -1
- package/dist/commands/update/create.d.ts +2 -3
- package/dist/commands/update/create.d.ts.map +1 -1
- package/dist/commands/update/create.js +15 -3
- package/dist/commands/update/create.js.map +1 -1
- package/dist/commands/update/delete.d.ts.map +1 -1
- package/dist/commands/update/delete.js +11 -0
- package/dist/commands/update/delete.js.map +1 -1
- package/dist/commands/update/edit.d.ts.map +1 -1
- package/dist/commands/update/edit.js +11 -0
- package/dist/commands/update/edit.js.map +1 -1
- package/dist/commands/update/list.d.ts.map +1 -1
- package/dist/commands/update/list.js +15 -12
- package/dist/commands/update/list.js.map +1 -1
- package/dist/commands/update/reply.d.ts.map +1 -1
- package/dist/commands/update/reply.js +11 -0
- package/dist/commands/update/reply.js.map +1 -1
- package/dist/commands/update/toggle.d.ts.map +1 -1
- package/dist/commands/update/toggle.js +13 -0
- package/dist/commands/update/toggle.js.map +1 -1
- package/dist/commands/usage.d.ts +58 -0
- package/dist/commands/usage.d.ts.map +1 -0
- package/dist/commands/usage.js +94 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/webhook/create.d.ts +74 -0
- package/dist/commands/webhook/create.d.ts.map +1 -0
- package/dist/commands/webhook/create.js +150 -0
- package/dist/commands/webhook/create.js.map +1 -0
- package/dist/commands/webhook/delete.d.ts +46 -0
- package/dist/commands/webhook/delete.d.ts.map +1 -0
- package/dist/commands/webhook/delete.js +141 -0
- package/dist/commands/webhook/delete.js.map +1 -0
- package/dist/commands/webhook/list.d.ts +23 -0
- package/dist/commands/webhook/list.d.ts.map +1 -0
- package/dist/commands/webhook/list.js +68 -0
- package/dist/commands/webhook/list.js.map +1 -0
- package/dist/commands/workspace/create.d.ts.map +1 -1
- package/dist/commands/workspace/create.js +16 -0
- package/dist/commands/workspace/create.js.map +1 -1
- package/dist/commands/workspace/delete.d.ts.map +1 -1
- package/dist/commands/workspace/delete.js +13 -13
- package/dist/commands/workspace/delete.js.map +1 -1
- package/dist/commands/workspace/list.d.ts +1 -1
- package/dist/commands/workspace/update.d.ts.map +1 -1
- package/dist/commands/workspace/update.js +15 -15
- package/dist/commands/workspace/update.js.map +1 -1
- package/dist/config/credentials.d.ts +189 -0
- package/dist/config/credentials.d.ts.map +1 -0
- package/dist/config/credentials.js +300 -0
- package/dist/config/credentials.js.map +1 -0
- package/dist/config/profiles.d.ts +125 -0
- package/dist/config/profiles.d.ts.map +1 -0
- package/dist/config/profiles.js +227 -0
- package/dist/config/profiles.js.map +1 -0
- package/dist/types/global-flags.d.ts +1 -1
- package/dist/types/global-flags.d.ts.map +1 -1
- package/dist/types/global-flags.js +28 -16
- package/dist/types/global-flags.js.map +1 -1
- package/dist/types/ids.d.ts +2 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +5 -3
- package/dist/types/ids.js.map +1 -1
- package/dist/utils/errors.d.ts +57 -3
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +69 -2
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/fs.d.ts +35 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +36 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/json.d.ts +60 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +86 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/output/ndjson.d.ts +65 -3
- package/dist/utils/output/ndjson.d.ts.map +1 -1
- package/dist/utils/output/ndjson.js +21 -0
- package/dist/utils/output/ndjson.js.map +1 -1
- package/dist/utils/redact.d.ts.map +1 -1
- package/dist/utils/redact.js +31 -0
- package/dist/utils/redact.js.map +1 -1
- package/package.json +2 -1
- package/dist/commands/account/client-helper.d.ts +0 -37
- package/dist/commands/account/client-helper.d.ts.map +0 -1
- package/dist/commands/account/client-helper.js +0 -55
- package/dist/commands/account/client-helper.js.map +0 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-account tag-directory lookup helper for the v0.3-M19 `tags`
|
|
3
|
+
* friendly translator. Mirrors the `userByEmail` user-directory
|
|
4
|
+
* pattern in `src/api/resolvers.ts:191–402` (the existing precedent —
|
|
5
|
+
* there is no standalone `user-directory.ts` module; the user-
|
|
6
|
+
* directory cache / lookup / refresh-on-miss machinery lives inside
|
|
7
|
+
* `resolvers.ts`).
|
|
8
|
+
*
|
|
9
|
+
* **Two surfaces.**
|
|
10
|
+
*
|
|
11
|
+
* - `loadAccountTags({client, env?, noCache?})` — full-directory
|
|
12
|
+
* reader. Cache-then-live: prefers a fresh on-disk
|
|
13
|
+
* `account_tags/index.json` cache entry; falls through to a live
|
|
14
|
+
* `account { tags { id name } }` query on miss / expiry / `noCache`,
|
|
15
|
+
* and writes the response back to the cache. Also exposes
|
|
16
|
+
* `complexity: Complexity | null` for the live-fetch leg, mirroring
|
|
17
|
+
* `BoardMetadataLoadResult` so `monday account tags --verbose` can
|
|
18
|
+
* report budget like other cache-backed reads.
|
|
19
|
+
*
|
|
20
|
+
* - `resolveTags({client, input, env?, noCache?})` — name-list →
|
|
21
|
+
* tag-id resolver. Splits the input on commas, trims, deduplicates,
|
|
22
|
+
* NFC + case-fold matches against the cache; on any miss, refreshes
|
|
23
|
+
* the directory once (live `account.tags` re-fetch) and re-checks.
|
|
24
|
+
* Residual misses surface as `tag_not_found` per cli-design §6.5
|
|
25
|
+
* with `details.tags: misses[]` in array form (Decision 1, closed
|
|
26
|
+
* at `4c652d5`). Returns `{ ids, misses, source, cacheAgeSeconds }`
|
|
27
|
+
* so the caller can populate `meta.source` + `meta.cache_age_seconds`
|
|
28
|
+
* per cli-design §6.1.
|
|
29
|
+
*
|
|
30
|
+
* **Cache shape.** Per-account scope (`{ kind: 'accountTags' }` cache
|
|
31
|
+
* key, no per-board fan-out — Monday's data model scopes tags to the
|
|
32
|
+
* account, not the workspace). On-disk path
|
|
33
|
+
* `account_tags/index.json`; mode `0600` per the cache layer's existing
|
|
34
|
+
* security contract.
|
|
35
|
+
*
|
|
36
|
+
* **Refresh on miss.** A `--set tags=foo` call against a cache that
|
|
37
|
+
* doesn't list `foo` re-fetches the account directory, upserts, and
|
|
38
|
+
* re-checks before surfacing `tag_not_found`. Mirrors the
|
|
39
|
+
* `userByEmail` cache-then-live-refresh-then-error sequence verbatim.
|
|
40
|
+
*/
|
|
41
|
+
import { z } from 'zod';
|
|
42
|
+
import { readEntry, resolveCacheRoot, writeEntry, DEFAULT_CACHE_TTL_SECONDS, } from './cache.js';
|
|
43
|
+
import { ApiError } from '../utils/errors.js';
|
|
44
|
+
const DECIMAL_TAG_ID_PATTERN = /^\d+$/u;
|
|
45
|
+
const accountTagSchema = z
|
|
46
|
+
.object({
|
|
47
|
+
id: z.string().regex(DECIMAL_TAG_ID_PATTERN, {
|
|
48
|
+
message: 'tag id must be a decimal non-negative integer string',
|
|
49
|
+
}),
|
|
50
|
+
name: z.string(),
|
|
51
|
+
})
|
|
52
|
+
.strict();
|
|
53
|
+
const accountTagsSchema = z.array(accountTagSchema);
|
|
54
|
+
const ACCOUNT_TAGS_QUERY = `
|
|
55
|
+
query AccountTags {
|
|
56
|
+
account {
|
|
57
|
+
tags {
|
|
58
|
+
id
|
|
59
|
+
name
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const readDirectoryCache = async (env) => {
|
|
65
|
+
const root = resolveCacheRoot({ env });
|
|
66
|
+
try {
|
|
67
|
+
const hit = await readEntry(root, { kind: 'accountTags' }, (raw) => accountTagsSchema.parse(raw), { ttlSeconds: DEFAULT_CACHE_TTL_SECONDS });
|
|
68
|
+
if (hit === undefined)
|
|
69
|
+
return undefined;
|
|
70
|
+
return { entries: hit.data, ageSeconds: hit.ageSeconds };
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// A corrupt or unreadable cache file is non-fatal — the caller
|
|
74
|
+
// will fall through to a live fetch. Same shape `userByEmail`
|
|
75
|
+
// uses (`resolvers.ts:264–266`).
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const writeDirectoryCache = async (env, entries) => {
|
|
80
|
+
const root = resolveCacheRoot({ env });
|
|
81
|
+
try {
|
|
82
|
+
await writeEntry(root, { kind: 'accountTags' }, entries);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Best-effort — cache write failures don't block the lookup
|
|
86
|
+
// (mirrors `userByEmail`'s `writeDirectoryCache` policy).
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Loads the full per-account tag directory. Used by `monday account
|
|
91
|
+
* tags` (the read verb that resolves the §6.5 `tag_not_found.details
|
|
92
|
+
* .hint` forward-reference) and by `resolveTags`'s refresh-on-miss
|
|
93
|
+
* path. Cache-then-live: prefers a fresh on-disk entry; falls
|
|
94
|
+
* through to a live `account.tags` query on miss / expiry /
|
|
95
|
+
* `noCache`. Cache writes are best-effort (disk full / permission
|
|
96
|
+
* flips don't block the lookup).
|
|
97
|
+
*/
|
|
98
|
+
export const loadAccountTags = async (inputs) => {
|
|
99
|
+
/* c8 ignore next — defensive fallback; tests always pass `env`. */
|
|
100
|
+
const env = inputs.env ?? process.env;
|
|
101
|
+
const noCache = inputs.noCache ?? false;
|
|
102
|
+
if (!noCache) {
|
|
103
|
+
const cached = await readDirectoryCache(env);
|
|
104
|
+
if (cached !== undefined) {
|
|
105
|
+
return {
|
|
106
|
+
tags: cached.entries,
|
|
107
|
+
source: 'cache',
|
|
108
|
+
cacheAgeSeconds: cached.ageSeconds,
|
|
109
|
+
complexity: null,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const response = await inputs.client.raw(ACCOUNT_TAGS_QUERY, undefined, { operationName: 'AccountTags' });
|
|
114
|
+
// Codex post-Commit-5 P1-1 fix: `account === null` is NOT a
|
|
115
|
+
// successful empty directory — it indicates auth/scope/account-
|
|
116
|
+
// shape problems (guest token, disabled account, schema drift).
|
|
117
|
+
// Collapsing it to `[]` would hide the real issue and let later
|
|
118
|
+
// tag writes fail as `tag_not_found` instead of surfacing the
|
|
119
|
+
// account-level problem. Surface as `not_found` matching
|
|
120
|
+
// `account info`'s shape.
|
|
121
|
+
if (response.data.account === null) {
|
|
122
|
+
throw new ApiError('not_found', 'Monday returned no account for the supplied token (guest, ' +
|
|
123
|
+
'disabled, or restricted-scope token?). The per-account tag ' +
|
|
124
|
+
'directory cannot be loaded without an account.', {
|
|
125
|
+
details: {
|
|
126
|
+
hint: 'verify the token is for an active account user — try ' +
|
|
127
|
+
'`monday account whoami` to see the resolved identity.',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const tagsRaw = response.data.account.tags ?? [];
|
|
132
|
+
// Parse-then-wrap (R17 / `validation.md` "Never bubble raw ZodError
|
|
133
|
+
// out of a parse boundary"). Malformed Monday responses surface as
|
|
134
|
+
// typed `internal_error` with `details.issues` rather than a bare
|
|
135
|
+
// ZodError that the runner's catch-all maps to `internal_error` but
|
|
136
|
+
// loses the failing field path.
|
|
137
|
+
const parsed = accountTagsSchema.safeParse(tagsRaw);
|
|
138
|
+
if (!parsed.success) {
|
|
139
|
+
const issues = parsed.error.issues.map((i) => ({
|
|
140
|
+
path: i.path.join('.'),
|
|
141
|
+
message: i.message,
|
|
142
|
+
code: i.code,
|
|
143
|
+
}));
|
|
144
|
+
throw new ApiError('internal_error', `Monday returned a malformed account.tags response — the directory ` +
|
|
145
|
+
`schema rejected the payload at ${issues.length.toString()} ` +
|
|
146
|
+
`issue${issues.length === 1 ? '' : 's'}.`, {
|
|
147
|
+
cause: parsed.error,
|
|
148
|
+
details: {
|
|
149
|
+
issues,
|
|
150
|
+
hint: "this is a data-integrity error in Monday's response (or an " +
|
|
151
|
+
"accountTagsSchema drift); verify the response shape and " +
|
|
152
|
+
"update accountTagsSchema if Monday's contract has changed.",
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const fresh = parsed.data;
|
|
157
|
+
if (!noCache) {
|
|
158
|
+
await writeDirectoryCache(env, fresh);
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
tags: fresh,
|
|
162
|
+
source: 'live',
|
|
163
|
+
cacheAgeSeconds: null,
|
|
164
|
+
complexity: response.complexity,
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* NFC + case-fold + whitespace-collapse normalisation for tag-name
|
|
169
|
+
* matching. Same rule as `cli-design.md` §5.3 step 2's column-token
|
|
170
|
+
* normalisation — agents learning one rule shouldn't have to learn a
|
|
171
|
+
* different one for tags vs columns vs status labels. A stray
|
|
172
|
+
* trailing space or a `Café` vs `Café` (NFD) variant resolves to the
|
|
173
|
+
* same tag.
|
|
174
|
+
*/
|
|
175
|
+
const normaliseFold = (s) => s.normalize('NFC').trim().replace(/\s+/gu, ' ').toLocaleLowerCase('und');
|
|
176
|
+
const matchTags = (entries, inputs) => {
|
|
177
|
+
// Build a lookup table once per match pass. Multiple input tokens
|
|
178
|
+
// matching the same tag entry resolve to the same id (deduplication
|
|
179
|
+
// happens upstream in `resolveTags`).
|
|
180
|
+
const byNormalised = new Map();
|
|
181
|
+
for (const entry of entries) {
|
|
182
|
+
byNormalised.set(normaliseFold(entry.name), entry);
|
|
183
|
+
}
|
|
184
|
+
const ids = [];
|
|
185
|
+
const misses = [];
|
|
186
|
+
for (const input of inputs) {
|
|
187
|
+
const hit = byNormalised.get(normaliseFold(input));
|
|
188
|
+
if (hit === undefined) {
|
|
189
|
+
misses.push(input);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
// Decimal regex on the schema gates the `Number()` conversion;
|
|
193
|
+
// safe-integer guard mirrors the people translator's defensive
|
|
194
|
+
// shape (`people.ts:300`).
|
|
195
|
+
const parsed = Number(hit.id);
|
|
196
|
+
/* c8 ignore next 7 — the schema's regex (`/^\d+$/u`) gates entries
|
|
197
|
+
at parse boundary; combined with Number.isSafeInteger this branch
|
|
198
|
+
only fires if Monday surfaces a >2^53 tag id, which exceeds the
|
|
199
|
+
documented cap. Defensive guard for noUncheckedIndexedAccess +
|
|
200
|
+
future-proofing. */
|
|
201
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
202
|
+
throw new ApiError('internal_error', `Monday returned a tag id "${hit.id}" that exceeds the JavaScript ` +
|
|
203
|
+
`safe-integer range (2^53 - 1). Number(id) would lose precision, ` +
|
|
204
|
+
`corrupting the wire payload.`, {
|
|
205
|
+
details: {
|
|
206
|
+
tag_name: hit.name,
|
|
207
|
+
tag_id: hit.id,
|
|
208
|
+
hint: 'this is a data-integrity error in the account-tag ' +
|
|
209
|
+
'directory; report it at the monday-cli issues tracker.',
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
ids.push(parsed);
|
|
214
|
+
}
|
|
215
|
+
return { ids, misses };
|
|
216
|
+
};
|
|
217
|
+
const dedupePreserveOrder = (tokens) => {
|
|
218
|
+
const seen = new Set();
|
|
219
|
+
const out = [];
|
|
220
|
+
for (const token of tokens) {
|
|
221
|
+
const key = normaliseFold(token);
|
|
222
|
+
if (seen.has(key))
|
|
223
|
+
continue;
|
|
224
|
+
seen.add(key);
|
|
225
|
+
out.push(token);
|
|
226
|
+
}
|
|
227
|
+
return out;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Resolves a comma-split tag-name list against the per-account
|
|
231
|
+
* directory. Returns numeric tag IDs for the matched names and
|
|
232
|
+
* carries the misses through so the caller can construct a
|
|
233
|
+
* `tag_not_found` error envelope with `details.tags: misses[]` per
|
|
234
|
+
* cli-design §6.5 (`4c652d5`).
|
|
235
|
+
*
|
|
236
|
+
* **Three-step lookup** mirroring `userByEmail`:
|
|
237
|
+
*
|
|
238
|
+
* 1. Read the on-disk cache (skipped on `noCache`). Match input
|
|
239
|
+
* tokens against cached entries with NFC + case-fold +
|
|
240
|
+
* whitespace-collapse.
|
|
241
|
+
* 2. If any input token misses against the cached set, refresh
|
|
242
|
+
* the directory once via a live `account.tags` query (also
|
|
243
|
+
* skipped on `noCache` — the live leg always runs but the
|
|
244
|
+
* result isn't cached).
|
|
245
|
+
* 3. Match input tokens against the freshly-loaded set. Any
|
|
246
|
+
* residual miss is surfaced as `tag_not_found` (caller's
|
|
247
|
+
* responsibility — this function returns the misses array
|
|
248
|
+
* and the caller decides whether to throw).
|
|
249
|
+
*
|
|
250
|
+
* **Empty input handled by the caller** — this function does not
|
|
251
|
+
* reject an empty input list; `column-values.ts`'s `tags` translator
|
|
252
|
+
* is the boundary that surfaces `usage_error` for `--set tags=""`
|
|
253
|
+
* (mirroring the dropdown / people empty-input contract).
|
|
254
|
+
*/
|
|
255
|
+
export const resolveTags = async (inputs) => {
|
|
256
|
+
/* c8 ignore next — defensive fallback; tests always pass `env`. */
|
|
257
|
+
const env = inputs.env ?? process.env;
|
|
258
|
+
const noCache = inputs.noCache ?? false;
|
|
259
|
+
const tokens = inputs.input
|
|
260
|
+
.split(',')
|
|
261
|
+
.map((segment) => segment.trim())
|
|
262
|
+
.filter((segment) => segment.length > 0);
|
|
263
|
+
const dedup = dedupePreserveOrder(tokens);
|
|
264
|
+
// Empty after split+trim+filter+dedup: caller boundary handles. The
|
|
265
|
+
// resolver returns an empty result so the translator can decide
|
|
266
|
+
// (the friendly translator throws usage_error before reaching this
|
|
267
|
+
// function, but this contract stays defensive).
|
|
268
|
+
if (dedup.length === 0) {
|
|
269
|
+
return { ids: [], misses: [], source: 'cache', cacheAgeSeconds: null };
|
|
270
|
+
}
|
|
271
|
+
let cacheHitAge = null;
|
|
272
|
+
let cacheMatched;
|
|
273
|
+
if (!noCache) {
|
|
274
|
+
const cached = await readDirectoryCache(env);
|
|
275
|
+
if (cached !== undefined) {
|
|
276
|
+
cacheHitAge = cached.ageSeconds;
|
|
277
|
+
cacheMatched = matchTags(cached.entries, dedup);
|
|
278
|
+
if (cacheMatched.misses.length === 0) {
|
|
279
|
+
return {
|
|
280
|
+
ids: cacheMatched.ids,
|
|
281
|
+
misses: [],
|
|
282
|
+
source: 'cache',
|
|
283
|
+
cacheAgeSeconds: cached.ageSeconds,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Refresh-on-miss: bypass cache and hit live directly, then upsert
|
|
289
|
+
// the fresh entries into the cache. Same shape as `userByEmail`'s
|
|
290
|
+
// `users(emails:)` fallback — the cache may be stale (Monday's UI
|
|
291
|
+
// created a new tag between cache write and this call), so going
|
|
292
|
+
// through `loadAccountTags` would just re-read the same stale
|
|
293
|
+
// cache. The `noCache: true` override forces the live leg.
|
|
294
|
+
const live = await loadAccountTags({
|
|
295
|
+
client: inputs.client,
|
|
296
|
+
env,
|
|
297
|
+
noCache: true,
|
|
298
|
+
});
|
|
299
|
+
// Upsert the freshly-loaded directory into the cache so the next
|
|
300
|
+
// call benefits from the refresh (skipped on `noCache: true` —
|
|
301
|
+
// the agent explicitly disabled cache writes).
|
|
302
|
+
if (!noCache) {
|
|
303
|
+
await writeDirectoryCache(env, live.tags);
|
|
304
|
+
}
|
|
305
|
+
const liveMatched = matchTags(live.tags, dedup);
|
|
306
|
+
// Determine source discriminant. If the cache leg matched some but
|
|
307
|
+
// not all, the result mixes cache + live (we re-matched the entire
|
|
308
|
+
// input against live, so technically the final ids come from live —
|
|
309
|
+
// but we still touched cache, so `mixed` is the honest signal).
|
|
310
|
+
// If the cache leg matched nothing OR was skipped, this is a pure
|
|
311
|
+
// `live` resolution.
|
|
312
|
+
const source = cacheMatched !== undefined && cacheMatched.ids.length > 0 ? 'mixed' : 'live';
|
|
313
|
+
return {
|
|
314
|
+
ids: liveMatched.ids,
|
|
315
|
+
misses: liveMatched.misses,
|
|
316
|
+
source,
|
|
317
|
+
// For `'mixed'`, surface the cache leg's age as the worst-case
|
|
318
|
+
// staleness the agent observed — matches the broader §6.1
|
|
319
|
+
// mixed-source/cache-age contract (`mergeCacheAge` keeps the
|
|
320
|
+
// oldest age across legs that hit cache). For `'live'` (no
|
|
321
|
+
// cache leg fired), null.
|
|
322
|
+
cacheAgeSeconds: source === 'mixed' ? cacheHitAge : null,
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
//# sourceMappingURL=tag-directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-directory.js","sourceRoot":"","sources":["../../src/api/tag-directory.ts"],"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CAA+C;IAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChD,mEAAmE;IACnE,mEAAmE;IACnE,oEAAoE;IACpE,gEAAgE;IAChE,kEAAkE;IAClE,qBAAqB;IACrB,MAAM,MAAM,GACV,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/E,OAAO;QACL,GAAG,EAAE,WAAW,CAAC,GAAG;QACpB,MAAM,EAAE,WAAW,CAAC,MAAM;QAC1B,MAAM;QACN,+DAA+D;QAC/D,0DAA0D;QAC1D,6DAA6D;QAC7D,2DAA2D;QAC3D,0BAA0B;QAC1B,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;KACzD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-tracking start/stop verb primitives for the v0.3-M20
|
|
3
|
+
* `monday item time-track start / stop` surface (cli-design §5.2
|
|
4
|
+
* carve-out 2 — verb-shaped column-type extensions surface as
|
|
5
|
+
* `<noun> <subnoun> <verb>`).
|
|
6
|
+
*
|
|
7
|
+
* **Documentation-only verbs at v0.3.** An empirical probe against a
|
|
8
|
+
* real Monday workspace on 2026-05-10 against API version `2026-01`
|
|
9
|
+
* confirmed that Monday's public GraphQL API exposes **no mutation
|
|
10
|
+
* for writing to `time_tracking` columns**:
|
|
11
|
+
*
|
|
12
|
+
* - `change_simple_column_value` rejects every candidate value
|
|
13
|
+
* (`"true"`, `"false"`, `"start"`, `"stop"`) with
|
|
14
|
+
* `CorrectedValueException`. Verbatim Monday response: *"column
|
|
15
|
+
* type DurationColumn is not supporting changing the column
|
|
16
|
+
* value with simple column value, please check our API
|
|
17
|
+
* documentation for the correct data structure for this
|
|
18
|
+
* column."* — paraphrased elsewhere for brevity.
|
|
19
|
+
* - `change_column_value` rejects every candidate JSON shape
|
|
20
|
+
* (`{running:true}`, `{running:false}`, `{started_at}`,
|
|
21
|
+
* `{ended_at}`, `{}`) with `InvalidColumnTypeException`.
|
|
22
|
+
* Verbatim Monday response: *"This column type is not supported
|
|
23
|
+
* yet in the API"* (`actual_type: "DurationColumn"`).
|
|
24
|
+
* - Full mutation-root introspection (152 mutations) found zero
|
|
25
|
+
* time-tracking-related mutations matching
|
|
26
|
+
* `/time|track|session|duration|start|stop|play|pause|timer/i`.
|
|
27
|
+
*
|
|
28
|
+
* The pre-flight contract assumed `change_simple_column_value` would
|
|
29
|
+
* route through; that assumption was empirically wrong. M20 ships the
|
|
30
|
+
* verbs **as documentation-only** so the CLI surface is stable when
|
|
31
|
+
* Monday eventually exposes the underlying mutation: agents can
|
|
32
|
+
* grep for `monday item time-track start` and see a registered verb
|
|
33
|
+
* that today rejects with a clear `usage_error` and a hint pointing
|
|
34
|
+
* at Monday's UI as the only write path.
|
|
35
|
+
*
|
|
36
|
+
* **Two surfaces.**
|
|
37
|
+
*
|
|
38
|
+
* - `startTimeTracking({client, boardId, itemId, columnId, env?})`
|
|
39
|
+
* — when Monday's API supports it, will flip the column from
|
|
40
|
+
* stopped → running. Today, rejects with `usage_error` per the
|
|
41
|
+
* `API_UNSUPPORTED_HINT` constant below.
|
|
42
|
+
* - `stopTimeTracking({client, boardId, itemId, columnId, env?})`
|
|
43
|
+
* — when Monday's API supports it, will flip the column from
|
|
44
|
+
* running → stopped. Today, rejects with the same `usage_error`.
|
|
45
|
+
*
|
|
46
|
+
* The four exported `*Inputs` / `*Result` interfaces are kept verbatim
|
|
47
|
+
* from the pre-flight (`a702af2`) so when Monday ships the mutation,
|
|
48
|
+
* the api-layer change is small: replace the rejection bodies with
|
|
49
|
+
* the actual wire call against the pinned input shape. The
|
|
50
|
+
* `commands/item/time-track/{start,stop}.ts` command files will need
|
|
51
|
+
* follow-up wiring at the same time — column resolution against board
|
|
52
|
+
* metadata, `--dry-run` branching to emit `planned_changes`, and an
|
|
53
|
+
* `emitMutation` call against the primitive's success result.
|
|
54
|
+
*
|
|
55
|
+
* **Decisions 4.1 / 4.2 / 4.3 (v0.3-plan §3 M20)** stay closed but
|
|
56
|
+
* unenforceable today — the verb rejects before any state-machine
|
|
57
|
+
* branch is reachable. They describe the future behavior:
|
|
58
|
+
*
|
|
59
|
+
* - **4.1 — `start` against a running column:** future
|
|
60
|
+
* `usage_error` with `details.running: true` (state-discriminant);
|
|
61
|
+
* hint will point at the stop verb.
|
|
62
|
+
* - **4.2 — `stop` against a non-running column:** future
|
|
63
|
+
* symmetric `usage_error` with `details.running: false`.
|
|
64
|
+
* - **4.3 — Idempotency:** future verbs will be non-idempotent
|
|
65
|
+
* (start opens a new session each time; stop closes the open one
|
|
66
|
+
* — both throw on invalid pre-state).
|
|
67
|
+
*
|
|
68
|
+
* Today, every invocation throws the same `usage_error` regardless
|
|
69
|
+
* of pre-state, so the discriminants don't surface yet.
|
|
70
|
+
*
|
|
71
|
+
* **No cache surface, no board-invalidation fan-out.**
|
|
72
|
+
* `time_tracking` columns don't cache and don't affect board
|
|
73
|
+
* structure; the `env` slot in the inputs is preserved for parity
|
|
74
|
+
* with sibling primitives (test-isolation), not for cache-key
|
|
75
|
+
* resolution.
|
|
76
|
+
*/
|
|
77
|
+
import type { MondayClient } from './client.js';
|
|
78
|
+
import type { BoardId, ItemId } from '../types/ids.js';
|
|
79
|
+
/**
|
|
80
|
+
* Inputs to the `startTimeTracking` primitive. Pinned at pre-flight
|
|
81
|
+
* (`a702af2`); kept unchanged so M20-implementation's documentation-
|
|
82
|
+
* only rejection becomes a one-sided swap to a real wire call when
|
|
83
|
+
* Monday ships API support.
|
|
84
|
+
*
|
|
85
|
+
* `client` + `env` are unused today — the rejection is constructed
|
|
86
|
+
* synchronously in the body — but the contract retains them so
|
|
87
|
+
* future implementation has a stable signature.
|
|
88
|
+
*/
|
|
89
|
+
export interface StartTimeTrackingInputs {
|
|
90
|
+
readonly client: MondayClient;
|
|
91
|
+
readonly boardId: BoardId;
|
|
92
|
+
readonly itemId: ItemId;
|
|
93
|
+
readonly columnId: string;
|
|
94
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Inputs to the `stopTimeTracking` primitive. Same shape as
|
|
98
|
+
* `StartTimeTrackingInputs` — the verb pair will route through the
|
|
99
|
+
* same `(board_id, item_id, column_id)` triple at the wire layer
|
|
100
|
+
* once Monday exposes the mutation.
|
|
101
|
+
*/
|
|
102
|
+
export interface StopTimeTrackingInputs {
|
|
103
|
+
readonly client: MondayClient;
|
|
104
|
+
readonly boardId: BoardId;
|
|
105
|
+
readonly itemId: ItemId;
|
|
106
|
+
readonly columnId: string;
|
|
107
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Result of a `startTimeTracking` call once Monday's API supports
|
|
111
|
+
* time-tracking writes. **Aspirational at v0.3** — the verb rejects
|
|
112
|
+
* today, so this shape never materialises on the wire. Pinned so
|
|
113
|
+
* agents grepping the type surface see the documented future shape.
|
|
114
|
+
*
|
|
115
|
+
* `running: true` is a literal — verb-success implies the column
|
|
116
|
+
* state flipped to running. `startedAt` carries Monday's
|
|
117
|
+
* authoritative session-start timestamp.
|
|
118
|
+
*/
|
|
119
|
+
export interface StartTimeTrackingResult {
|
|
120
|
+
readonly itemId: string;
|
|
121
|
+
readonly columnId: string;
|
|
122
|
+
readonly running: true;
|
|
123
|
+
readonly startedAt: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Result of a `stopTimeTracking` call once Monday's API supports
|
|
127
|
+
* time-tracking writes. **Aspirational at v0.3** — see
|
|
128
|
+
* `StartTimeTrackingResult`.
|
|
129
|
+
*
|
|
130
|
+
* `startedAt` mirrors `TimeTrackingHistoryItem.started_at` (`null`
|
|
131
|
+
* when Monday omits it on the just-closed session record);
|
|
132
|
+
* `endedAt` is the stop wall-clock; `durationSeconds` is the
|
|
133
|
+
* just-stopped session's duration in seconds, **`null` when
|
|
134
|
+
* `startedAt` is `null`** — SDK 14.0.0 exposes no per-history
|
|
135
|
+
* duration field, so without a `startedAt` the per-session duration
|
|
136
|
+
* is uncomputable.
|
|
137
|
+
*/
|
|
138
|
+
export interface StopTimeTrackingResult {
|
|
139
|
+
readonly itemId: string;
|
|
140
|
+
readonly columnId: string;
|
|
141
|
+
readonly running: false;
|
|
142
|
+
readonly startedAt: string | null;
|
|
143
|
+
readonly endedAt: string;
|
|
144
|
+
readonly durationSeconds: number | null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Documentation-only `start` verb. Rejects with `usage_error` on
|
|
148
|
+
* every invocation; the inputs are echoed in `details` so agents
|
|
149
|
+
* inspecting the envelope can confirm the call site they intended.
|
|
150
|
+
*
|
|
151
|
+
* When Monday ships the underlying mutation, replace the body with
|
|
152
|
+
* the wire call (likely `change_simple_column_value` once Monday
|
|
153
|
+
* extends DurationColumn's accepted-value enum, or a new dedicated
|
|
154
|
+
* `start_time_tracking` mutation if Monday exposes one).
|
|
155
|
+
*/
|
|
156
|
+
export declare const startTimeTracking: (inputs: StartTimeTrackingInputs) => Promise<StartTimeTrackingResult>;
|
|
157
|
+
/**
|
|
158
|
+
* Documentation-only `stop` verb. Mirrors `startTimeTracking`'s
|
|
159
|
+
* rejection shape; differs only in the verb name in the
|
|
160
|
+
* envelope's `error.message` (so agents grepping the envelope
|
|
161
|
+
* for "time-track stop" vs "time-track start" can disambiguate
|
|
162
|
+
* the call site they invoked).
|
|
163
|
+
*/
|
|
164
|
+
export declare const stopTimeTracking: (inputs: StopTimeTrackingInputs) => Promise<StopTimeTrackingResult>;
|
|
165
|
+
//# sourceM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AAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAwBD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,uBAAuB,KAC9B,OAAO,CAAC,uBAAuB,CAgB/B,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,sBAAsB,KAC7B,OAAO,CAAC,sBAAsB,CAgB9B,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-tracking start/stop verb primitives for the v0.3-M20
|
|
3
|
+
* `monday item time-track start / stop` surface (cli-design §5.2
|
|
4
|
+
* carve-out 2 — verb-shaped column-type extensions surface as
|
|
5
|
+
* `<noun> <subnoun> <verb>`).
|
|
6
|
+
*
|
|
7
|
+
* **Documentation-only verbs at v0.3.** An empirical probe against a
|
|
8
|
+
* real Monday workspace on 2026-05-10 against API version `2026-01`
|
|
9
|
+
* confirmed that Monday's public GraphQL API exposes **no mutation
|
|
10
|
+
* for writing to `time_tracking` columns**:
|
|
11
|
+
*
|
|
12
|
+
* - `change_simple_column_value` rejects every candidate value
|
|
13
|
+
* (`"true"`, `"false"`, `"start"`, `"stop"`) with
|
|
14
|
+
* `CorrectedValueException`. Verbatim Monday response: *"column
|
|
15
|
+
* type DurationColumn is not supporting changing the column
|
|
16
|
+
* value with simple column value, please check our API
|
|
17
|
+
* documentation for the correct data structure for this
|
|
18
|
+
* column."* — paraphrased elsewhere for brevity.
|
|
19
|
+
* - `change_column_value` rejects every candidate JSON shape
|
|
20
|
+
* (`{running:true}`, `{running:false}`, `{started_at}`,
|
|
21
|
+
* `{ended_at}`, `{}`) with `InvalidColumnTypeException`.
|
|
22
|
+
* Verbatim Monday response: *"This column type is not supported
|
|
23
|
+
* yet in the API"* (`actual_type: "DurationColumn"`).
|
|
24
|
+
* - Full mutation-root introspection (152 mutations) found zero
|
|
25
|
+
* time-tracking-related mutations matching
|
|
26
|
+
* `/time|track|session|duration|start|stop|play|pause|timer/i`.
|
|
27
|
+
*
|
|
28
|
+
* The pre-flight contract assumed `change_simple_column_value` would
|
|
29
|
+
* route through; that assumption was empirically wrong. M20 ships the
|
|
30
|
+
* verbs **as documentation-only** so the CLI surface is stable when
|
|
31
|
+
* Monday eventually exposes the underlying mutation: agents can
|
|
32
|
+
* grep for `monday item time-track start` and see a registered verb
|
|
33
|
+
* that today rejects with a clear `usage_error` and a hint pointing
|
|
34
|
+
* at Monday's UI as the only write path.
|
|
35
|
+
*
|
|
36
|
+
* **Two surfaces.**
|
|
37
|
+
*
|
|
38
|
+
* - `startTimeTracking({client, boardId, itemId, columnId, env?})`
|
|
39
|
+
* — when Monday's API supports it, will flip the column from
|
|
40
|
+
* stopped → running. Today, rejects with `usage_error` per the
|
|
41
|
+
* `API_UNSUPPORTED_HINT` constant below.
|
|
42
|
+
* - `stopTimeTracking({client, boardId, itemId, columnId, env?})`
|
|
43
|
+
* — when Monday's API supports it, will flip the column from
|
|
44
|
+
* running → stopped. Today, rejects with the same `usage_error`.
|
|
45
|
+
*
|
|
46
|
+
* The four exported `*Inputs` / `*Result` interfaces are kept verbatim
|
|
47
|
+
* from the pre-flight (`a702af2`) so when Monday ships the mutation,
|
|
48
|
+
* the api-layer change is small: replace the rejection bodies with
|
|
49
|
+
* the actual wire call against the pinned input shape. The
|
|
50
|
+
* `commands/item/time-track/{start,stop}.ts` command files will need
|
|
51
|
+
* follow-up wiring at the same time — column resolution against board
|
|
52
|
+
* metadata, `--dry-run` branching to emit `planned_changes`, and an
|
|
53
|
+
* `emitMutation` call against the primitive's success result.
|
|
54
|
+
*
|
|
55
|
+
* **Decisions 4.1 / 4.2 / 4.3 (v0.3-plan §3 M20)** stay closed but
|
|
56
|
+
* unenforceable today — the verb rejects before any state-machine
|
|
57
|
+
* branch is reachable. They describe the future behavior:
|
|
58
|
+
*
|
|
59
|
+
* - **4.1 — `start` against a running column:** future
|
|
60
|
+
* `usage_error` with `details.running: true` (state-discriminant);
|
|
61
|
+
* hint will point at the stop verb.
|
|
62
|
+
* - **4.2 — `stop` against a non-running column:** future
|
|
63
|
+
* symmetric `usage_error` with `details.running: false`.
|
|
64
|
+
* - **4.3 — Idempotency:** future verbs will be non-idempotent
|
|
65
|
+
* (start opens a new session each time; stop closes the open one
|
|
66
|
+
* — both throw on invalid pre-state).
|
|
67
|
+
*
|
|
68
|
+
* Today, every invocation throws the same `usage_error` regardless
|
|
69
|
+
* of pre-state, so the discriminants don't surface yet.
|
|
70
|
+
*
|
|
71
|
+
* **No cache surface, no board-invalidation fan-out.**
|
|
72
|
+
* `time_tracking` columns don't cache and don't affect board
|
|
73
|
+
* structure; the `env` slot in the inputs is preserved for parity
|
|
74
|
+
* with sibling primitives (test-isolation), not for cache-key
|
|
75
|
+
* resolution.
|
|
76
|
+
*/
|
|
77
|
+
import { ApiError } from '../utils/errors.js';
|
|
78
|
+
/**
|
|
79
|
+
* Hint string shipped on every documentation-only rejection. Names
|
|
80
|
+
* the empirical probe (date + API version + the exact error codes
|
|
81
|
+
* Monday returned for each candidate wire shape) so an agent reading
|
|
82
|
+
* the envelope's `details.hint` can self-verify the limitation
|
|
83
|
+
* without re-running the probe themselves.
|
|
84
|
+
*/
|
|
85
|
+
const API_UNSUPPORTED_HINT = "Monday's public GraphQL API does not currently expose a " +
|
|
86
|
+
'mutation for writing to time_tracking columns. Empirical probe ' +
|
|
87
|
+
'(2026-05-10, API version 2026-01): change_simple_column_value ' +
|
|
88
|
+
"rejects every candidate value with CorrectedValueException " +
|
|
89
|
+
'("DurationColumn does not support simple column value writes"); ' +
|
|
90
|
+
'change_column_value rejects every candidate JSON shape with ' +
|
|
91
|
+
'InvalidColumnTypeException ("This column type is not supported ' +
|
|
92
|
+
'yet in the API"); the mutation root has no time-tracking-' +
|
|
93
|
+
'related mutation. Use Monday\'s UI to start/stop time-tracking ' +
|
|
94
|
+
'sessions until Monday ships API support — the verb is ' +
|
|
95
|
+
'registered for forward-compatibility so agent scripts targeting ' +
|
|
96
|
+
'`monday item time-track start/stop` are stable across the ' +
|
|
97
|
+
'eventual swap.';
|
|
98
|
+
/**
|
|
99
|
+
* Documentation-only `start` verb. Rejects with `usage_error` on
|
|
100
|
+
* every invocation; the inputs are echoed in `details` so agents
|
|
101
|
+
* inspecting the envelope can confirm the call site they intended.
|
|
102
|
+
*
|
|
103
|
+
* When Monday ships the underlying mutation, replace the body with
|
|
104
|
+
* the wire call (likely `change_simple_column_value` once Monday
|
|
105
|
+
* extends DurationColumn's accepted-value enum, or a new dedicated
|
|
106
|
+
* `start_time_tracking` mutation if Monday exposes one).
|
|
107
|
+
*/
|
|
108
|
+
export const startTimeTracking = (inputs) => Promise.reject(new ApiError('usage_error', "`monday item time-track start` is registered for forward-" +
|
|
109
|
+
"compatibility but cannot fire today — Monday's public API " +
|
|
110
|
+
'does not currently support writing to time_tracking columns.', {
|
|
111
|
+
details: {
|
|
112
|
+
board_id: inputs.boardId,
|
|
113
|
+
item_id: inputs.itemId,
|
|
114
|
+
column_id: inputs.columnId,
|
|
115
|
+
hint: API_UNSUPPORTED_HINT,
|
|
116
|
+
},
|
|
117
|
+
}));
|
|
118
|
+
/**
|
|
119
|
+
* Documentation-only `stop` verb. Mirrors `startTimeTracking`'s
|
|
120
|
+
* rejection shape; differs only in the verb name in the
|
|
121
|
+
* envelope's `error.message` (so agents grepping the envelope
|
|
122
|
+
* for "time-track stop" vs "time-track start" can disambiguate
|
|
123
|
+
* the call site they invoked).
|
|
124
|
+
*/
|
|
125
|
+
export const stopTimeTracking = (inputs) => Promise.reject(new ApiError('usage_error', "`monday item time-track stop` is registered for forward-" +
|
|
126
|
+
"compatibility but cannot fire today — Monday's public API " +
|
|
127
|
+
'does not currently support writing to time_tracking columns.', {
|
|
128
|
+
details: {
|
|
129
|
+
board_id: inputs.boardId,
|
|
130
|
+
item_id: inputs.itemId,
|
|
131
|
+
column_id: inputs.columnId,
|
|
132
|
+
hint: API_UNSUPPORTED_HINT,
|
|
133
|
+
},
|
|
134
|
+
}));
|
|
135
|
+
//# sourceMappingURL=time-tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-tracking.js","sourceRoot":"","sources":["../../src/api/time-tracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAyE9C;;;;;;GAMG;AACH,MAAM,oBAAoB,GACxB,0DAA0D;IAC1D,iEAAiE;IACjE,gEAAgE;IAChE,6DAA6D;IAC7D,kEAAkE;IAClE,8DAA8D;IAC9D,iEAAiE;IACjE,2DAA2D;IAC3D,iEAAiE;IACjE,wDAAwD;IACxD,kEAAkE;IAClE,4DAA4D;IAC5D,gBAAgB,CAAC;AAEnB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,MAA+B,EACG,EAAE,CACpC,OAAO,CAAC,MAAM,CACZ,IAAI,QAAQ,CACV,aAAa,EACb,2DAA2D;IACzD,4DAA4D;IAC5D,8DAA8D,EAChE;IACE,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC,OAAO;QACxB,OAAO,EAAE,MAAM,CAAC,MAAM;QACtB,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,IAAI,EAAE,oBAAoB;KAC3B;CACF,CACF,CACF,CAAC;AAEJ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,MAA8B,EACG,EAAE,CACnC,OAAO,CAAC,MAAM,CACZ,IAAI,QAAQ,CACV,aAAa,EACb,0DAA0D;IACxD,4DAA4D;IAC5D,8DAA8D,EAChE;IACE,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC,OAAO;QACxB,OAAO,EAAE,MAAM,CAAC,MAAM;QACtB,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,IAAI,EAAE,oBAAoB;KAC3B;CACF,CACF,CACF,CAAC"}
|
package/dist/api/transport.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiError } from '../utils/errors.js';
|
|
1
|
+
import { ApiError, errorCode } from '../utils/errors.js';
|
|
2
2
|
/**
|
|
3
3
|
* Builds a `Transport` over `fetch`. Owns:
|
|
4
4
|
* - `Authorization: <token>` (no `Bearer ` prefix per Monday's API).
|
|
@@ -119,8 +119,8 @@ const isAbortError = (err) => {
|
|
|
119
119
|
*/
|
|
120
120
|
const describeFetchError = (err) => {
|
|
121
121
|
if (err instanceof Error) {
|
|
122
|
-
const code = err
|
|
123
|
-
if (
|
|
122
|
+
const code = errorCode(err);
|
|
123
|
+
if (code !== undefined) {
|
|
124
124
|
if (code.startsWith('ENOTFOUND') || code.startsWith('EAI_')) {
|
|
125
125
|
return 'fetch failed: dns lookup failed';
|
|
126
126
|
}
|