monday-cli 0.2.0 → 0.4.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 +675 -2
- package/README.md +223 -31
- package/dist/api/assets.d.ts +326 -0
- package/dist/api/assets.d.ts.map +1 -0
- package/dist/api/assets.js +519 -0
- package/dist/api/assets.js.map +1 -0
- 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 +37 -14
- package/dist/api/column-types.d.ts.map +1 -1
- package/dist/api/column-types.js +47 -6
- package/dist/api/column-types.js.map +1 -1
- package/dist/api/column-values.d.ts +234 -31
- package/dist/api/column-values.d.ts.map +1 -1
- package/dist/api/column-values.js +560 -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/documents.d.ts +519 -0
- package/dist/api/documents.d.ts.map +1 -0
- package/dist/api/documents.js +586 -0
- package/dist/api/documents.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/item-watch.d.ts +263 -0
- package/dist/api/item-watch.d.ts.map +1 -0
- package/dist/api/item-watch.js +709 -0
- package/dist/api/item-watch.js.map +1 -0
- package/dist/api/multipart-transport.d.ts +223 -0
- package/dist/api/multipart-transport.d.ts.map +1 -0
- package/dist/api/multipart-transport.js +274 -0
- package/dist/api/multipart-transport.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/parallel-dispatch.d.ts +155 -0
- package/dist/api/parallel-dispatch.d.ts.map +1 -0
- package/dist/api/parallel-dispatch.js +243 -0
- package/dist/api/parallel-dispatch.js.map +1 -0
- package/dist/api/partial-success-bulk.d.ts +480 -0
- package/dist/api/partial-success-bulk.d.ts.map +1 -0
- package/dist/api/partial-success-bulk.js +436 -0
- package/dist/api/partial-success-bulk.js.map +1 -0
- package/dist/api/partial-success-mutation.d.ts +13 -1
- package/dist/api/partial-success-mutation.d.ts.map +1 -1
- package/dist/api/partial-success-mutation.js +5 -1
- package/dist/api/partial-success-mutation.js.map +1 -1
- 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 +12 -4
- package/dist/api/raw-write.d.ts.map +1 -1
- package/dist/api/raw-write.js +32 -14
- 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 +22 -0
- package/dist/api/resolve-client.d.ts.map +1 -1
- package/dist/api/resolve-client.js +9 -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 +32 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +3 -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 +9 -8
- package/dist/commands/board/column-create.d.ts.map +1 -1
- package/dist/commands/board/column-create.js +61 -51
- 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/completion.d.ts +188 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +418 -0
- package/dist/commands/completion.js.map +1 -0
- 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/doc/get.d.ts +46 -0
- package/dist/commands/doc/get.d.ts.map +1 -0
- package/dist/commands/doc/get.js +95 -0
- package/dist/commands/doc/get.js.map +1 -0
- package/dist/commands/doc/list.d.ts +83 -0
- package/dist/commands/doc/list.d.ts.map +1 -0
- package/dist/commands/doc/list.js +248 -0
- package/dist/commands/doc/list.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 +141 -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 +2 -0
- package/dist/commands/item/update.d.ts.map +1 -1
- package/dist/commands/item/update.js +164 -113
- package/dist/commands/item/update.js.map +1 -1
- package/dist/commands/item/upload.d.ts +108 -0
- package/dist/commands/item/upload.d.ts.map +1 -0
- package/dist/commands/item/upload.js +370 -0
- package/dist/commands/item/upload.js.map +1 -0
- 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/item/watch.d.ts +90 -0
- package/dist/commands/item/watch.d.ts.map +1 -0
- package/dist/commands/item/watch.js +342 -0
- package/dist/commands/item/watch.js.map +1 -0
- 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/update/upload.d.ts +69 -0
- package/dist/commands/update/upload.d.ts.map +1 -0
- package/dist/commands/update/upload.js +235 -0
- package/dist/commands/update/upload.js.map +1 -0
- 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 +4 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +12 -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/mime.d.ts +24 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +64 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/output/envelope.d.ts +30 -0
- package/dist/utils/output/envelope.d.ts.map +1 -1
- package/dist/utils/output/envelope.js +26 -0
- package/dist/utils/output/envelope.js.map +1 -1
- package/dist/utils/output/ndjson.d.ts +90 -3
- package/dist/utils/output/ndjson.d.ts.map +1 -1
- package/dist/utils/output/ndjson.js +33 -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/dist/utils/signal.d.ts +42 -0
- package/dist/utils/signal.d.ts.map +1 -0
- package/dist/utils/signal.js +45 -0
- package/dist/utils/signal.js.map +1 -0
- 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,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Board-favorites resolver for the v0.3-M23 `monday board favorites`
|
|
3
|
+
* verb + the `monday item search --favorites` cross-board scoping
|
|
4
|
+
* lever (`cli-design.md` §13 v0.3 entry).
|
|
5
|
+
*
|
|
6
|
+
* **Empirical probe findings (2026-05-11, against `api.monday.com`,
|
|
7
|
+
* API version `2026-01`) — `scripts/probe/m23-favorites*.ts` +
|
|
8
|
+
* `scripts/probe/m23-hierarchy-*.ts`:**
|
|
9
|
+
*
|
|
10
|
+
* - **Favorites lives at the TOP-LEVEL `Query.favorites:
|
|
11
|
+
* [GraphqlHierarchyObjectItem!]`** — NOT `User.favorites` /
|
|
12
|
+
* `Board.is_starred` / `me { favorites }`. The original M23
|
|
13
|
+
* pre-decision wording ("current user's starred boards") was
|
|
14
|
+
* directionally correct but the surface lives on the Query
|
|
15
|
+
* root, not the User type.
|
|
16
|
+
* - **Polymorphic element shape.** Each `GraphqlHierarchyObjectItem`
|
|
17
|
+
* carries `id` (hierarchy-item ID, distinct from the underlying
|
|
18
|
+
* object ID), `accountId`, `object: { id: ID, type:
|
|
19
|
+
* GraphqlMondayObject }` (enum: `Board` | `Folder` |
|
|
20
|
+
* `Dashboard` | `Workspace`), `folderId`, `position` (Float —
|
|
21
|
+
* Monday's UI sort order), `createdAt`, `updatedAt`. The
|
|
22
|
+
* hierarchy-item ID is distinct from `object.id`; the latter
|
|
23
|
+
* is the underlying Board ID when `object.type === Board`.
|
|
24
|
+
* - **2-stage GraphQL operation.** Stage 1 fetches `Query.
|
|
25
|
+
* favorites { id object { id type } position }` and filters
|
|
26
|
+
* client-side to `object.type === Board`. Stage 2 hydrates the
|
|
27
|
+
* surviving board IDs via
|
|
28
|
+
* `boards(ids: [<board-typed-ids>]) { id name workspace_id
|
|
29
|
+
* state url }` for human-readable + agent-useful slots.
|
|
30
|
+
* - **Order by `position` (Float).** The probe's `position` field
|
|
31
|
+
* is Monday's UI sidebar order (lower = higher in the list).
|
|
32
|
+
* `monday board favorites` sorts by `position` ascending for
|
|
33
|
+
* parity with what users see in Monday's UI.
|
|
34
|
+
* - **No write surface in v0.3.** The probe did NOT enumerate
|
|
35
|
+
* mutations under `Mutation` for favorite/unfavorite — the v0.3
|
|
36
|
+
* scope is READ-ONLY (`board favorites` lists; the
|
|
37
|
+
* `item search --favorites` flag consumes the list as a scoping
|
|
38
|
+
* filter). Writes (`board favorite <bid>` / `board unfavorite
|
|
39
|
+
* <bid>`) are a v0.4+ candidate.
|
|
40
|
+
*
|
|
41
|
+
* **Sharing with `item search --favorites`.** Both verbs share the
|
|
42
|
+
* favorites-resolver. `monday board favorites` emits the full
|
|
43
|
+
* 2-stage hydrate output (id + name + workspace_id + state + url);
|
|
44
|
+
* `monday item search --favorites` consumes only the board IDs
|
|
45
|
+
* (Stage 1 filter result) since the cross-board fan-out hydrates
|
|
46
|
+
* board names inline via the same `boards(ids:)` call.
|
|
47
|
+
*
|
|
48
|
+
* **What's stub vs runtime at the pre-flight.** `fetchBoardFavorites`
|
|
49
|
+
* ships as a `Promise.reject(internal_error)` stub under `c8 ignore
|
|
50
|
+
* start/stop` — M23 implementation lands the runtime 2-stage body.
|
|
51
|
+
* The schema definitions, type exports, the GraphQL document
|
|
52
|
+
* constants, the pure-helper `filterFavoritesToBoardIds`, and the
|
|
53
|
+
* `sortByPosition` projection ship as REAL implementations so the
|
|
54
|
+
* pre-flight Codex review can verify the projection shape against
|
|
55
|
+
* the empirical-probe fixtures inline.
|
|
56
|
+
*
|
|
57
|
+
* **Mirrors M22 `monday usage` shape.** M22's `fetchUsage` runs a
|
|
58
|
+
* 2-stage projection (`platform_api.daily_limit` +
|
|
59
|
+
* `platform_api.daily_analytics`); `fetchBoardFavorites` runs a
|
|
60
|
+
* 2-stage filter+hydrate. The pre-flight pattern (schema + pure
|
|
61
|
+
* helper as real impl, async fetcher as stub) is the same.
|
|
62
|
+
*/
|
|
63
|
+
import { z } from 'zod';
|
|
64
|
+
import type { MondayClient } from './client.js';
|
|
65
|
+
import type { Complexity } from '../utils/output/envelope.js';
|
|
66
|
+
/**
|
|
67
|
+
* Monday's `GraphqlMondayObject` enum discriminator on
|
|
68
|
+
* `HierarchyObjectID.type`. Empirically confirmed via
|
|
69
|
+
* `scripts/probe/m23-monday-object-enum.ts` at 2026-05-11 against
|
|
70
|
+
* API `2026-01`. Includes non-Board kinds because Monday's UI
|
|
71
|
+
* favorites bar includes docs / dashboards / folders / workspaces;
|
|
72
|
+
* the M23 `board favorites` verb FILTERS to `Board` only.
|
|
73
|
+
*
|
|
74
|
+
* Schema kept open-ended (`z.string()` not `z.enum`) to forward-
|
|
75
|
+
* compatibly absorb future Monday enum additions; the filter step
|
|
76
|
+
* matches the LITERAL `Board` string so an unrecognised kind is
|
|
77
|
+
* just "not a board, skip" rather than a parse error.
|
|
78
|
+
*/
|
|
79
|
+
export declare const HIERARCHY_OBJECT_TYPE_BOARD: "Board";
|
|
80
|
+
/**
|
|
81
|
+
* Stage-1 GraphQL document — fetches the polymorphic favorites
|
|
82
|
+
* list. No args (`Query.favorites: [GraphqlHierarchyObjectItem!]`
|
|
83
|
+
* empirically has zero args per the introspection probe).
|
|
84
|
+
*
|
|
85
|
+
* The selection set is the minimum the M23 verbs need:
|
|
86
|
+
* - `id` of the hierarchy item (NOT used downstream — Monday's
|
|
87
|
+
* surrogate identifier; logged for traceability).
|
|
88
|
+
* - `object { id type }` — the discriminator + underlying object
|
|
89
|
+
* ID. The `id` here is the Board ID when `type === Board`.
|
|
90
|
+
* - `position` — Monday's UI sort key (Float).
|
|
91
|
+
*
|
|
92
|
+
* Not selected: `accountId`, `folderId`, `createdAt`, `updatedAt`
|
|
93
|
+
* — neither verb uses them; selecting widens the response payload
|
|
94
|
+
* for marginal benefit. Future v0.4 may add `createdAt` /
|
|
95
|
+
* `updatedAt` if a "favorited since" filter ships.
|
|
96
|
+
*/
|
|
97
|
+
export declare const FAVORITES_LIST_QUERY = "\n query BoardFavoritesStage1 {\n favorites {\n id\n object { id type }\n position\n }\n }\n";
|
|
98
|
+
/**
|
|
99
|
+
* Stage-2 GraphQL document — hydrates the surviving board IDs from
|
|
100
|
+
* Stage 1. The `boards(ids:)` surface silently omits inaccessible
|
|
101
|
+
* board IDs (per `scripts/probe/m23-cross-board-search-2.ts` finding
|
|
102
|
+
* #3); the favorites case is one path where silent-omission is the
|
|
103
|
+
* EXPECTED behaviour (the user removed access to a board after
|
|
104
|
+
* favoriting it; we don't want to crash the verb). The hydrator
|
|
105
|
+
* surfaces this as the count delta on the `board_favorites_stale`
|
|
106
|
+
* warning per {@link buildStaleFavoritesWarning}.
|
|
107
|
+
*
|
|
108
|
+
* **Codex P1-1 fix.** The query selects ONLY the leaf board fields
|
|
109
|
+
* `monday board favorites` projects — `complexity` is NOT selected
|
|
110
|
+
* here. Per the project's complexity-injection contract
|
|
111
|
+
* (`src/api/client.ts:257-307` `MondayClient.raw`), the
|
|
112
|
+
* `complexity { ... }` selection is injected at the operation root
|
|
113
|
+
* ONLY when `--verbose` is on, and parsed back out via
|
|
114
|
+
* `parseComplexity`. Hard-coding `complexity` here would (a) leak
|
|
115
|
+
* the field into non-verbose responses (cli-design §6.1 pins
|
|
116
|
+
* `meta.complexity: null` outside `--verbose`), and (b) inflate the
|
|
117
|
+
* per-call cost for every favorites read. The verbose path injects
|
|
118
|
+
* via MondayClient automatically.
|
|
119
|
+
*/
|
|
120
|
+
export declare const BOARDS_HYDRATE_QUERY = "\n query BoardFavoritesStage2($ids: [ID!]!) {\n boards(ids: $ids) {\n id\n name\n state\n workspace_id\n url\n }\n }\n";
|
|
121
|
+
/**
|
|
122
|
+
* One favorites entry post-Stage-1 parse. The `object.type` field is
|
|
123
|
+
* the polymorphic-favorites discriminator; `object.id` is the
|
|
124
|
+
* underlying object's ID (Board ID when `type === Board`).
|
|
125
|
+
*/
|
|
126
|
+
export interface RawFavoriteEntry {
|
|
127
|
+
readonly id: string;
|
|
128
|
+
readonly object: {
|
|
129
|
+
readonly id: string;
|
|
130
|
+
readonly type: string;
|
|
131
|
+
};
|
|
132
|
+
readonly position: number;
|
|
133
|
+
}
|
|
134
|
+
export declare const rawFavoriteEntrySchema: z.ZodObject<{
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
object: z.ZodObject<{
|
|
137
|
+
id: z.ZodString;
|
|
138
|
+
type: z.ZodString;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
position: z.ZodNumber;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
export declare const favoritesListResponseSchema: z.ZodObject<{
|
|
143
|
+
favorites: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
object: z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
type: z.ZodString;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
position: z.ZodNumber;
|
|
150
|
+
}, z.core.$strict>>>;
|
|
151
|
+
}, z.core.$loose>;
|
|
152
|
+
export type FavoritesListResponse = z.infer<typeof favoritesListResponseSchema>;
|
|
153
|
+
/**
|
|
154
|
+
* One hydrated board after Stage 2. Matches Monday's `boards(ids:)`
|
|
155
|
+
* selection set on the wire.
|
|
156
|
+
*/
|
|
157
|
+
export interface RawHydratedBoard {
|
|
158
|
+
readonly id: string;
|
|
159
|
+
readonly name: string;
|
|
160
|
+
readonly state: string | null;
|
|
161
|
+
readonly workspace_id: string | null;
|
|
162
|
+
readonly url: string | null;
|
|
163
|
+
}
|
|
164
|
+
export declare const rawHydratedBoardSchema: z.ZodObject<{
|
|
165
|
+
id: z.ZodString;
|
|
166
|
+
name: z.ZodString;
|
|
167
|
+
state: z.ZodNullable<z.ZodString>;
|
|
168
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
169
|
+
url: z.ZodNullable<z.ZodString>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
export declare const boardsHydrateResponseSchema: z.ZodObject<{
|
|
172
|
+
boards: z.ZodNullable<z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
name: z.ZodString;
|
|
175
|
+
state: z.ZodNullable<z.ZodString>;
|
|
176
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
177
|
+
url: z.ZodNullable<z.ZodString>;
|
|
178
|
+
}, z.core.$strict>>>>;
|
|
179
|
+
}, z.core.$loose>;
|
|
180
|
+
export type BoardsHydrateResponse = z.infer<typeof boardsHydrateResponseSchema>;
|
|
181
|
+
/**
|
|
182
|
+
* One row in the `monday board favorites` output. The `position`
|
|
183
|
+
* slot carries Monday's UI sort key for parity — the output is
|
|
184
|
+
* sorted by `position` ascending so agents see the same order
|
|
185
|
+
* users see.
|
|
186
|
+
*/
|
|
187
|
+
export interface BoardFavoriteOutput {
|
|
188
|
+
readonly id: string;
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly state: string | null;
|
|
191
|
+
readonly workspace_id: string | null;
|
|
192
|
+
readonly url: string | null;
|
|
193
|
+
readonly position: number;
|
|
194
|
+
}
|
|
195
|
+
export declare const boardFavoriteOutputSchema: z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
name: z.ZodString;
|
|
198
|
+
state: z.ZodNullable<z.ZodString>;
|
|
199
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
200
|
+
url: z.ZodNullable<z.ZodString>;
|
|
201
|
+
position: z.ZodNumber;
|
|
202
|
+
}, z.core.$strict>;
|
|
203
|
+
export declare const boardFavoritesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
state: z.ZodNullable<z.ZodString>;
|
|
207
|
+
workspace_id: z.ZodNullable<z.ZodString>;
|
|
208
|
+
url: z.ZodNullable<z.ZodString>;
|
|
209
|
+
position: z.ZodNumber;
|
|
210
|
+
}, z.core.$strict>>;
|
|
211
|
+
export type BoardFavoritesOutput = z.infer<typeof boardFavoritesOutputSchema>;
|
|
212
|
+
/**
|
|
213
|
+
* Warning the resolver surfaces when Stage 1 returned N favorite
|
|
214
|
+
* board entries but Stage 2 hydrated fewer (because the user lost
|
|
215
|
+
* access to a board after favoriting it, or the board was deleted).
|
|
216
|
+
* Not fatal — the verb still returns the boards Stage 2 hydrated.
|
|
217
|
+
*/
|
|
218
|
+
export interface StaleFavoritesWarning {
|
|
219
|
+
readonly code: 'board_favorites_stale';
|
|
220
|
+
readonly message: string;
|
|
221
|
+
readonly details: {
|
|
222
|
+
readonly favorited_count: number;
|
|
223
|
+
readonly hydrated_count: number;
|
|
224
|
+
readonly missing_board_ids: readonly string[];
|
|
225
|
+
readonly hint: string;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
export declare const staleFavoritesWarningSchema: z.ZodObject<{
|
|
229
|
+
code: z.ZodLiteral<"board_favorites_stale">;
|
|
230
|
+
message: z.ZodString;
|
|
231
|
+
details: z.ZodObject<{
|
|
232
|
+
favorited_count: z.ZodNumber;
|
|
233
|
+
hydrated_count: z.ZodNumber;
|
|
234
|
+
missing_board_ids: z.ZodArray<z.ZodString>;
|
|
235
|
+
hint: z.ZodString;
|
|
236
|
+
}, z.core.$strict>;
|
|
237
|
+
}, z.core.$strict>;
|
|
238
|
+
/**
|
|
239
|
+
* Filters {@link FavoritesListResponse} to the surviving Board-typed
|
|
240
|
+
* entries, sorted by `position` ascending for Monday-UI parity.
|
|
241
|
+
* Pure helper — **real implementation** at pre-flight (not a stub).
|
|
242
|
+
*/
|
|
243
|
+
export declare const filterFavoritesToBoards: (response: FavoritesListResponse) => readonly RawFavoriteEntry[];
|
|
244
|
+
/**
|
|
245
|
+
* Builds a {@link StaleFavoritesWarning} from the Stage-1 / Stage-2
|
|
246
|
+
* delta. **Real implementation** at pre-flight (pure helper).
|
|
247
|
+
*/
|
|
248
|
+
export declare const buildStaleFavoritesWarning: (favoritedIds: readonly string[], hydratedIds: readonly string[]) => StaleFavoritesWarning;
|
|
249
|
+
/**
|
|
250
|
+
* Joins the Stage-1 filtered favorites entries (carrying `position`)
|
|
251
|
+
* with the Stage-2 hydrated boards (carrying `name` / `state` /
|
|
252
|
+
* `workspace_id` / `url`) into the final {@link BoardFavoriteOutput}
|
|
253
|
+
* shape. Pure helper — **real implementation** at pre-flight.
|
|
254
|
+
*
|
|
255
|
+
* Result is sorted by `position` ascending (input order from
|
|
256
|
+
* {@link filterFavoritesToBoards}); rows where Stage 2 didn't
|
|
257
|
+
* hydrate (silently omitted by `boards(ids:)`) are filtered out and
|
|
258
|
+
* surfaced via {@link buildStaleFavoritesWarning} at the caller.
|
|
259
|
+
*/
|
|
260
|
+
export declare const joinFavoritesWithBoards: (filteredFavorites: readonly RawFavoriteEntry[], hydratedBoards: readonly RawHydratedBoard[]) => readonly BoardFavoriteOutput[];
|
|
261
|
+
/**
|
|
262
|
+
* Inputs to {@link fetchBoardFavorites}.
|
|
263
|
+
*
|
|
264
|
+
* **Codex P1-1 fix.** Takes the {@link MondayClient} (not
|
|
265
|
+
* `Transport`) so the resolver inherits the project's `--retry` +
|
|
266
|
+
* `--verbose`-complexity contract automatically. MondayClient owns
|
|
267
|
+
* the AbortSignal end-to-end; no per-call `signal` slot needed.
|
|
268
|
+
*/
|
|
269
|
+
export interface FetchBoardFavoritesInputs {
|
|
270
|
+
readonly client: MondayClient;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Result of the 2-stage favorites resolver. Carries the hydrated
|
|
274
|
+
* board rows + the optional warning + the per-call envelope-meta
|
|
275
|
+
* fields the command-action emits.
|
|
276
|
+
*
|
|
277
|
+
* **Codex P1-1 fix.** `complexity` is now `Complexity | null` from
|
|
278
|
+
* `src/utils/output/envelope.ts` (matches the project-wide envelope
|
|
279
|
+
* shape on `meta.complexity`); the previous bespoke shape was
|
|
280
|
+
* redundant with the canonical envelope type. `source` /
|
|
281
|
+
* `cacheAgeSeconds` are added so the command-action emits a fully
|
|
282
|
+
* correct §6.1 collection envelope. Favorites is a pure read with
|
|
283
|
+
* no per-call cache; both stages always hit live, so `source` is
|
|
284
|
+
* fixed at `'live'` and `cacheAgeSeconds` at `null`.
|
|
285
|
+
*/
|
|
286
|
+
export interface FetchBoardFavoritesResult {
|
|
287
|
+
readonly boards: readonly BoardFavoriteOutput[];
|
|
288
|
+
readonly warnings: readonly StaleFavoritesWarning[];
|
|
289
|
+
readonly source: 'live';
|
|
290
|
+
readonly cacheAgeSeconds: null;
|
|
291
|
+
readonly complexity: Complexity | null;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Issues the 2-stage favorites resolver against `inputs.client`.
|
|
295
|
+
*
|
|
296
|
+
* Stage 1: `FAVORITES_LIST_QUERY` → parse via
|
|
297
|
+
* `favoritesListResponseSchema` → filter via
|
|
298
|
+
* {@link filterFavoritesToBoards} (kind === Board, sort by
|
|
299
|
+
* `position` ascending).
|
|
300
|
+
*
|
|
301
|
+
* Stage 2: `BOARDS_HYDRATE_QUERY` with the filtered Stage-1 IDs →
|
|
302
|
+
* parse via `boardsHydrateResponseSchema` → join via
|
|
303
|
+
* {@link joinFavoritesWithBoards}.
|
|
304
|
+
*
|
|
305
|
+
* Stage-1/Stage-2 count delta surfaces a
|
|
306
|
+
* {@link StaleFavoritesWarning} on `result.warnings`.
|
|
307
|
+
*
|
|
308
|
+
* **Edge case: empty favorites.** When Stage 1 returns no Board-
|
|
309
|
+
* typed entries (or the favorites list is empty/null) the helper
|
|
310
|
+
* short-circuits — no Stage-2 call, empty `boards` output, no
|
|
311
|
+
* warnings. The verb-level envelope is success with an empty
|
|
312
|
+
* `data` array; agents detect via `data.length === 0`.
|
|
313
|
+
*
|
|
314
|
+
* **Parse-failure handling.** A schema mismatch on either stage
|
|
315
|
+
* surfaces `internal_error` with `details.issues` carrying the
|
|
316
|
+
* per-field zod path — a parse failure means Monday amended the
|
|
317
|
+
* surface (forward-compat additions pass through the `.loose()`
|
|
318
|
+
* wrappers; this catches the type-mismatch shapes that the v0.3
|
|
319
|
+
* surface doesn't tolerate).
|
|
320
|
+
*
|
|
321
|
+
* **Complexity / source.** The result's `complexity` is the last
|
|
322
|
+
* stage's value (Stage 2 when it runs, Stage 1 otherwise) — under
|
|
323
|
+
* `--verbose` MondayClient.raw injects + parses `complexity { ... }`
|
|
324
|
+
* at the operation root and returns it on the `MondayResponse`.
|
|
325
|
+
* `source: 'live'` + `cacheAgeSeconds: null` are constants per the
|
|
326
|
+
* P1-1 contract — favorites is a pure live read.
|
|
327
|
+
*/
|
|
328
|
+
export declare const fetchBoardFavorites: (inputs: FetchBoardFavoritesInputs) => Promise<FetchBoardFavoritesResult>;
|
|
329
|
+
//# sourceMappingURL=board-favorites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-favorites.d.ts","sourceRoot":"","sources":["../../src/api/board-favorites.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Board-favorites resolver for the v0.3-M23 `monday board favorites`
|
|
3
|
+
* verb + the `monday item search --favorites` cross-board scoping
|
|
4
|
+
* lever (`cli-design.md` §13 v0.3 entry).
|
|
5
|
+
*
|
|
6
|
+
* **Empirical probe findings (2026-05-11, against `api.monday.com`,
|
|
7
|
+
* API version `2026-01`) — `scripts/probe/m23-favorites*.ts` +
|
|
8
|
+
* `scripts/probe/m23-hierarchy-*.ts`:**
|
|
9
|
+
*
|
|
10
|
+
* - **Favorites lives at the TOP-LEVEL `Query.favorites:
|
|
11
|
+
* [GraphqlHierarchyObjectItem!]`** — NOT `User.favorites` /
|
|
12
|
+
* `Board.is_starred` / `me { favorites }`. The original M23
|
|
13
|
+
* pre-decision wording ("current user's starred boards") was
|
|
14
|
+
* directionally correct but the surface lives on the Query
|
|
15
|
+
* root, not the User type.
|
|
16
|
+
* - **Polymorphic element shape.** Each `GraphqlHierarchyObjectItem`
|
|
17
|
+
* carries `id` (hierarchy-item ID, distinct from the underlying
|
|
18
|
+
* object ID), `accountId`, `object: { id: ID, type:
|
|
19
|
+
* GraphqlMondayObject }` (enum: `Board` | `Folder` |
|
|
20
|
+
* `Dashboard` | `Workspace`), `folderId`, `position` (Float —
|
|
21
|
+
* Monday's UI sort order), `createdAt`, `updatedAt`. The
|
|
22
|
+
* hierarchy-item ID is distinct from `object.id`; the latter
|
|
23
|
+
* is the underlying Board ID when `object.type === Board`.
|
|
24
|
+
* - **2-stage GraphQL operation.** Stage 1 fetches `Query.
|
|
25
|
+
* favorites { id object { id type } position }` and filters
|
|
26
|
+
* client-side to `object.type === Board`. Stage 2 hydrates the
|
|
27
|
+
* surviving board IDs via
|
|
28
|
+
* `boards(ids: [<board-typed-ids>]) { id name workspace_id
|
|
29
|
+
* state url }` for human-readable + agent-useful slots.
|
|
30
|
+
* - **Order by `position` (Float).** The probe's `position` field
|
|
31
|
+
* is Monday's UI sidebar order (lower = higher in the list).
|
|
32
|
+
* `monday board favorites` sorts by `position` ascending for
|
|
33
|
+
* parity with what users see in Monday's UI.
|
|
34
|
+
* - **No write surface in v0.3.** The probe did NOT enumerate
|
|
35
|
+
* mutations under `Mutation` for favorite/unfavorite — the v0.3
|
|
36
|
+
* scope is READ-ONLY (`board favorites` lists; the
|
|
37
|
+
* `item search --favorites` flag consumes the list as a scoping
|
|
38
|
+
* filter). Writes (`board favorite <bid>` / `board unfavorite
|
|
39
|
+
* <bid>`) are a v0.4+ candidate.
|
|
40
|
+
*
|
|
41
|
+
* **Sharing with `item search --favorites`.** Both verbs share the
|
|
42
|
+
* favorites-resolver. `monday board favorites` emits the full
|
|
43
|
+
* 2-stage hydrate output (id + name + workspace_id + state + url);
|
|
44
|
+
* `monday item search --favorites` consumes only the board IDs
|
|
45
|
+
* (Stage 1 filter result) since the cross-board fan-out hydrates
|
|
46
|
+
* board names inline via the same `boards(ids:)` call.
|
|
47
|
+
*
|
|
48
|
+
* **What's stub vs runtime at the pre-flight.** `fetchBoardFavorites`
|
|
49
|
+
* ships as a `Promise.reject(internal_error)` stub under `c8 ignore
|
|
50
|
+
* start/stop` — M23 implementation lands the runtime 2-stage body.
|
|
51
|
+
* The schema definitions, type exports, the GraphQL document
|
|
52
|
+
* constants, the pure-helper `filterFavoritesToBoardIds`, and the
|
|
53
|
+
* `sortByPosition` projection ship as REAL implementations so the
|
|
54
|
+
* pre-flight Codex review can verify the projection shape against
|
|
55
|
+
* the empirical-probe fixtures inline.
|
|
56
|
+
*
|
|
57
|
+
* **Mirrors M22 `monday usage` shape.** M22's `fetchUsage` runs a
|
|
58
|
+
* 2-stage projection (`platform_api.daily_limit` +
|
|
59
|
+
* `platform_api.daily_analytics`); `fetchBoardFavorites` runs a
|
|
60
|
+
* 2-stage filter+hydrate. The pre-flight pattern (schema + pure
|
|
61
|
+
* helper as real impl, async fetcher as stub) is the same.
|
|
62
|
+
*/
|
|
63
|
+
import { z } from 'zod';
|
|
64
|
+
import { unwrapOrThrow } from '../utils/parse-boundary.js';
|
|
65
|
+
/**
|
|
66
|
+
* Monday's `GraphqlMondayObject` enum discriminator on
|
|
67
|
+
* `HierarchyObjectID.type`. Empirically confirmed via
|
|
68
|
+
* `scripts/probe/m23-monday-object-enum.ts` at 2026-05-11 against
|
|
69
|
+
* API `2026-01`. Includes non-Board kinds because Monday's UI
|
|
70
|
+
* favorites bar includes docs / dashboards / folders / workspaces;
|
|
71
|
+
* the M23 `board favorites` verb FILTERS to `Board` only.
|
|
72
|
+
*
|
|
73
|
+
* Schema kept open-ended (`z.string()` not `z.enum`) to forward-
|
|
74
|
+
* compatibly absorb future Monday enum additions; the filter step
|
|
75
|
+
* matches the LITERAL `Board` string so an unrecognised kind is
|
|
76
|
+
* just "not a board, skip" rather than a parse error.
|
|
77
|
+
*/
|
|
78
|
+
export const HIERARCHY_OBJECT_TYPE_BOARD = 'Board';
|
|
79
|
+
/**
|
|
80
|
+
* Stage-1 GraphQL document — fetches the polymorphic favorites
|
|
81
|
+
* list. No args (`Query.favorites: [GraphqlHierarchyObjectItem!]`
|
|
82
|
+
* empirically has zero args per the introspection probe).
|
|
83
|
+
*
|
|
84
|
+
* The selection set is the minimum the M23 verbs need:
|
|
85
|
+
* - `id` of the hierarchy item (NOT used downstream — Monday's
|
|
86
|
+
* surrogate identifier; logged for traceability).
|
|
87
|
+
* - `object { id type }` — the discriminator + underlying object
|
|
88
|
+
* ID. The `id` here is the Board ID when `type === Board`.
|
|
89
|
+
* - `position` — Monday's UI sort key (Float).
|
|
90
|
+
*
|
|
91
|
+
* Not selected: `accountId`, `folderId`, `createdAt`, `updatedAt`
|
|
92
|
+
* — neither verb uses them; selecting widens the response payload
|
|
93
|
+
* for marginal benefit. Future v0.4 may add `createdAt` /
|
|
94
|
+
* `updatedAt` if a "favorited since" filter ships.
|
|
95
|
+
*/
|
|
96
|
+
export const FAVORITES_LIST_QUERY = `
|
|
97
|
+
query BoardFavoritesStage1 {
|
|
98
|
+
favorites {
|
|
99
|
+
id
|
|
100
|
+
object { id type }
|
|
101
|
+
position
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
/**
|
|
106
|
+
* Stage-2 GraphQL document — hydrates the surviving board IDs from
|
|
107
|
+
* Stage 1. The `boards(ids:)` surface silently omits inaccessible
|
|
108
|
+
* board IDs (per `scripts/probe/m23-cross-board-search-2.ts` finding
|
|
109
|
+
* #3); the favorites case is one path where silent-omission is the
|
|
110
|
+
* EXPECTED behaviour (the user removed access to a board after
|
|
111
|
+
* favoriting it; we don't want to crash the verb). The hydrator
|
|
112
|
+
* surfaces this as the count delta on the `board_favorites_stale`
|
|
113
|
+
* warning per {@link buildStaleFavoritesWarning}.
|
|
114
|
+
*
|
|
115
|
+
* **Codex P1-1 fix.** The query selects ONLY the leaf board fields
|
|
116
|
+
* `monday board favorites` projects — `complexity` is NOT selected
|
|
117
|
+
* here. Per the project's complexity-injection contract
|
|
118
|
+
* (`src/api/client.ts:257-307` `MondayClient.raw`), the
|
|
119
|
+
* `complexity { ... }` selection is injected at the operation root
|
|
120
|
+
* ONLY when `--verbose` is on, and parsed back out via
|
|
121
|
+
* `parseComplexity`. Hard-coding `complexity` here would (a) leak
|
|
122
|
+
* the field into non-verbose responses (cli-design §6.1 pins
|
|
123
|
+
* `meta.complexity: null` outside `--verbose`), and (b) inflate the
|
|
124
|
+
* per-call cost for every favorites read. The verbose path injects
|
|
125
|
+
* via MondayClient automatically.
|
|
126
|
+
*/
|
|
127
|
+
export const BOARDS_HYDRATE_QUERY = `
|
|
128
|
+
query BoardFavoritesStage2($ids: [ID!]!) {
|
|
129
|
+
boards(ids: $ids) {
|
|
130
|
+
id
|
|
131
|
+
name
|
|
132
|
+
state
|
|
133
|
+
workspace_id
|
|
134
|
+
url
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
export const rawFavoriteEntrySchema = z
|
|
139
|
+
.object({
|
|
140
|
+
id: z.string().min(1),
|
|
141
|
+
object: z
|
|
142
|
+
.object({
|
|
143
|
+
id: z.string().min(1),
|
|
144
|
+
// Open-ended `z.string()` so a future Monday enum extension
|
|
145
|
+
// (e.g., `Form`, `Workdoc`, etc.) doesn't break the parse
|
|
146
|
+
// — the filter step matches the literal `Board` string
|
|
147
|
+
// so unrecognised kinds are just "not a board, skip".
|
|
148
|
+
type: z.string().min(1),
|
|
149
|
+
})
|
|
150
|
+
.strict(),
|
|
151
|
+
position: z.number(),
|
|
152
|
+
})
|
|
153
|
+
.strict();
|
|
154
|
+
export const favoritesListResponseSchema = z
|
|
155
|
+
.object({
|
|
156
|
+
favorites: z.array(rawFavoriteEntrySchema).nullable(),
|
|
157
|
+
})
|
|
158
|
+
// `.loose()` so future Monday Query-root extension fields don't
|
|
159
|
+
// fail this parse. Same forward-compat policy as M22's
|
|
160
|
+
// `usageQueryResponseSchema`.
|
|
161
|
+
.loose();
|
|
162
|
+
export const rawHydratedBoardSchema = z
|
|
163
|
+
.object({
|
|
164
|
+
id: z.string().min(1),
|
|
165
|
+
name: z.string(),
|
|
166
|
+
state: z.string().nullable(),
|
|
167
|
+
workspace_id: z.string().nullable(),
|
|
168
|
+
url: z.string().nullable(),
|
|
169
|
+
})
|
|
170
|
+
.strict();
|
|
171
|
+
export const boardsHydrateResponseSchema = z
|
|
172
|
+
.object({
|
|
173
|
+
boards: z.array(rawHydratedBoardSchema.nullable()).nullable(),
|
|
174
|
+
})
|
|
175
|
+
.loose();
|
|
176
|
+
export const boardFavoriteOutputSchema = z
|
|
177
|
+
.object({
|
|
178
|
+
id: z.string().min(1),
|
|
179
|
+
name: z.string(),
|
|
180
|
+
state: z.string().nullable(),
|
|
181
|
+
workspace_id: z.string().nullable(),
|
|
182
|
+
url: z.string().nullable(),
|
|
183
|
+
position: z.number(),
|
|
184
|
+
})
|
|
185
|
+
.strict();
|
|
186
|
+
export const boardFavoritesOutputSchema = z.array(boardFavoriteOutputSchema);
|
|
187
|
+
export const staleFavoritesWarningSchema = z
|
|
188
|
+
.object({
|
|
189
|
+
code: z.literal('board_favorites_stale'),
|
|
190
|
+
message: z.string().min(1),
|
|
191
|
+
details: z
|
|
192
|
+
.object({
|
|
193
|
+
favorited_count: z.number().int().nonnegative(),
|
|
194
|
+
hydrated_count: z.number().int().nonnegative(),
|
|
195
|
+
missing_board_ids: z.array(z.string().min(1)),
|
|
196
|
+
hint: z.string().min(1),
|
|
197
|
+
})
|
|
198
|
+
.strict(),
|
|
199
|
+
})
|
|
200
|
+
.strict();
|
|
201
|
+
/**
|
|
202
|
+
* Filters {@link FavoritesListResponse} to the surviving Board-typed
|
|
203
|
+
* entries, sorted by `position` ascending for Monday-UI parity.
|
|
204
|
+
* Pure helper — **real implementation** at pre-flight (not a stub).
|
|
205
|
+
*/
|
|
206
|
+
export const filterFavoritesToBoards = (response) => {
|
|
207
|
+
const entries = response.favorites ?? [];
|
|
208
|
+
const boards = entries.filter((e) => e.object.type === HIERARCHY_OBJECT_TYPE_BOARD);
|
|
209
|
+
// Sort by position ascending; ties broken by hierarchy-item id
|
|
210
|
+
// for deterministic output across runs.
|
|
211
|
+
return [...boards].sort((a, b) => {
|
|
212
|
+
if (a.position !== b.position)
|
|
213
|
+
return a.position - b.position;
|
|
214
|
+
return a.id.localeCompare(b.id);
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Builds a {@link StaleFavoritesWarning} from the Stage-1 / Stage-2
|
|
219
|
+
* delta. **Real implementation** at pre-flight (pure helper).
|
|
220
|
+
*/
|
|
221
|
+
export const buildStaleFavoritesWarning = (favoritedIds, hydratedIds) => {
|
|
222
|
+
const hydratedSet = new Set(hydratedIds);
|
|
223
|
+
const missing = favoritedIds.filter((id) => !hydratedSet.has(id));
|
|
224
|
+
return {
|
|
225
|
+
code: 'board_favorites_stale',
|
|
226
|
+
message: `${String(missing.length)} of ${String(favoritedIds.length)} favorited boards were not accessible or no longer exist`,
|
|
227
|
+
details: {
|
|
228
|
+
favorited_count: favoritedIds.length,
|
|
229
|
+
hydrated_count: hydratedIds.length,
|
|
230
|
+
missing_board_ids: missing,
|
|
231
|
+
hint: 'a favorited board was deleted, archived to a private workspace, or had access revoked since being favorited',
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Joins the Stage-1 filtered favorites entries (carrying `position`)
|
|
237
|
+
* with the Stage-2 hydrated boards (carrying `name` / `state` /
|
|
238
|
+
* `workspace_id` / `url`) into the final {@link BoardFavoriteOutput}
|
|
239
|
+
* shape. Pure helper — **real implementation** at pre-flight.
|
|
240
|
+
*
|
|
241
|
+
* Result is sorted by `position` ascending (input order from
|
|
242
|
+
* {@link filterFavoritesToBoards}); rows where Stage 2 didn't
|
|
243
|
+
* hydrate (silently omitted by `boards(ids:)`) are filtered out and
|
|
244
|
+
* surfaced via {@link buildStaleFavoritesWarning} at the caller.
|
|
245
|
+
*/
|
|
246
|
+
export const joinFavoritesWithBoards = (filteredFavorites, hydratedBoards) => {
|
|
247
|
+
const byId = new Map(hydratedBoards.map((b) => [b.id, b]));
|
|
248
|
+
const out = [];
|
|
249
|
+
for (const fav of filteredFavorites) {
|
|
250
|
+
const board = byId.get(fav.object.id);
|
|
251
|
+
if (board === undefined)
|
|
252
|
+
continue; // stale; warning surfaced at the action
|
|
253
|
+
out.push({
|
|
254
|
+
id: board.id,
|
|
255
|
+
name: board.name,
|
|
256
|
+
state: board.state,
|
|
257
|
+
workspace_id: board.workspace_id,
|
|
258
|
+
url: board.url,
|
|
259
|
+
position: fav.position,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Issues the 2-stage favorites resolver against `inputs.client`.
|
|
266
|
+
*
|
|
267
|
+
* Stage 1: `FAVORITES_LIST_QUERY` → parse via
|
|
268
|
+
* `favoritesListResponseSchema` → filter via
|
|
269
|
+
* {@link filterFavoritesToBoards} (kind === Board, sort by
|
|
270
|
+
* `position` ascending).
|
|
271
|
+
*
|
|
272
|
+
* Stage 2: `BOARDS_HYDRATE_QUERY` with the filtered Stage-1 IDs →
|
|
273
|
+
* parse via `boardsHydrateResponseSchema` → join via
|
|
274
|
+
* {@link joinFavoritesWithBoards}.
|
|
275
|
+
*
|
|
276
|
+
* Stage-1/Stage-2 count delta surfaces a
|
|
277
|
+
* {@link StaleFavoritesWarning} on `result.warnings`.
|
|
278
|
+
*
|
|
279
|
+
* **Edge case: empty favorites.** When Stage 1 returns no Board-
|
|
280
|
+
* typed entries (or the favorites list is empty/null) the helper
|
|
281
|
+
* short-circuits — no Stage-2 call, empty `boards` output, no
|
|
282
|
+
* warnings. The verb-level envelope is success with an empty
|
|
283
|
+
* `data` array; agents detect via `data.length === 0`.
|
|
284
|
+
*
|
|
285
|
+
* **Parse-failure handling.** A schema mismatch on either stage
|
|
286
|
+
* surfaces `internal_error` with `details.issues` carrying the
|
|
287
|
+
* per-field zod path — a parse failure means Monday amended the
|
|
288
|
+
* surface (forward-compat additions pass through the `.loose()`
|
|
289
|
+
* wrappers; this catches the type-mismatch shapes that the v0.3
|
|
290
|
+
* surface doesn't tolerate).
|
|
291
|
+
*
|
|
292
|
+
* **Complexity / source.** The result's `complexity` is the last
|
|
293
|
+
* stage's value (Stage 2 when it runs, Stage 1 otherwise) — under
|
|
294
|
+
* `--verbose` MondayClient.raw injects + parses `complexity { ... }`
|
|
295
|
+
* at the operation root and returns it on the `MondayResponse`.
|
|
296
|
+
* `source: 'live'` + `cacheAgeSeconds: null` are constants per the
|
|
297
|
+
* P1-1 contract — favorites is a pure live read.
|
|
298
|
+
*/
|
|
299
|
+
export const fetchBoardFavorites = async (inputs) => {
|
|
300
|
+
// Stage 1 — fetch the polymorphic favorites list.
|
|
301
|
+
const stage1 = await inputs.client.raw(FAVORITES_LIST_QUERY, undefined, { operationName: 'BoardFavoritesStage1' });
|
|
302
|
+
// R-NEW-19 lift — `unwrapOrThrow` produces the canonical
|
|
303
|
+
// `internal_error` + `details.issues` shape (path + message +
|
|
304
|
+
// zod code per failing field); the manual block here was the
|
|
305
|
+
// same shape minus the `code` slot.
|
|
306
|
+
const stage1Data = unwrapOrThrow(favoritesListResponseSchema.safeParse(stage1.data), {
|
|
307
|
+
context: 'Monday `Query.favorites` response',
|
|
308
|
+
hint: 'Monday may have amended the `Query.favorites` surface — re-probe via `scripts/probe/m23-favorites-deep.ts` and amend cli-design §13 v0.3 entry if so',
|
|
309
|
+
});
|
|
310
|
+
// Filter to Board-typed entries + sort by `position` ascending
|
|
311
|
+
// for Monday-UI parity. Drops Folder / Dashboard / Workspace and
|
|
312
|
+
// any future enum extension (open-ended `z.string()` on
|
|
313
|
+
// `object.type` is forward-compat).
|
|
314
|
+
const filtered = filterFavoritesToBoards(stage1Data);
|
|
315
|
+
// Empty short-circuit — no Stage 2 if there are no Board-typed
|
|
316
|
+
// favorites. Stage 1's complexity carries forward.
|
|
317
|
+
if (filtered.length === 0) {
|
|
318
|
+
return {
|
|
319
|
+
boards: [],
|
|
320
|
+
warnings: [],
|
|
321
|
+
source: 'live',
|
|
322
|
+
cacheAgeSeconds: null,
|
|
323
|
+
complexity: stage1.complexity,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
// Stage 2 — hydrate the surviving board IDs.
|
|
327
|
+
const filteredIds = filtered.map((e) => e.object.id);
|
|
328
|
+
const stage2 = await inputs.client.raw(BOARDS_HYDRATE_QUERY, { ids: filteredIds }, { operationName: 'BoardFavoritesStage2' });
|
|
329
|
+
const stage2Data = unwrapOrThrow(boardsHydrateResponseSchema.safeParse(stage2.data), {
|
|
330
|
+
context: 'Monday `boards(ids:)` response',
|
|
331
|
+
hint: 'Monday may have amended the `boards(ids:)` selection — re-probe via `scripts/probe/m23-favorites-deep.ts` and amend cli-design §13 v0.3 entry if so',
|
|
332
|
+
});
|
|
333
|
+
// Monday's `boards(ids:)` typically silently omits inaccessible
|
|
334
|
+
// entries (per the cross-board probe finding); the schema's
|
|
335
|
+
// `.nullable()` on each entry is defensive for accounts where
|
|
336
|
+
// Monday returns null placeholders instead of omitting. Drop
|
|
337
|
+
// nulls — the favorites case treats both shapes as "stale".
|
|
338
|
+
const hydrated = (stage2Data.boards ?? []).filter((b) => b !== null);
|
|
339
|
+
const joined = joinFavoritesWithBoards(filtered, hydrated);
|
|
340
|
+
const hydratedIds = hydrated.map((b) => b.id);
|
|
341
|
+
const warnings = [];
|
|
342
|
+
if (hydratedIds.length < filteredIds.length) {
|
|
343
|
+
warnings.push(buildStaleFavoritesWarning(filteredIds, hydratedIds));
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
boards: joined,
|
|
347
|
+
warnings,
|
|
348
|
+
source: 'live',
|
|
349
|
+
cacheAgeSeconds: null,
|
|
350
|
+
complexity: stage2.complexity,
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
//# sourceMappingURL=board-favorites.js.map
|