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,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification send surface for the v0.3-M27 `monday notification
|
|
3
|
+
* send` verb (`cli-design.md` §2.7 + §4.3 + §13 v0.3 entry;
|
|
4
|
+
* `v0.3-plan.md` §3 M27).
|
|
5
|
+
*
|
|
6
|
+
* **Wire surface (empirical probe 2026-05-12, API `2026-01`).** One
|
|
7
|
+
* Monday GraphQL operation lands here:
|
|
8
|
+
*
|
|
9
|
+
* - `Mutation.create_notification(user_id: ID!, target_id: ID!,
|
|
10
|
+
* target_type: NotificationTargetType!, text: String!)` — returns
|
|
11
|
+
* the created `Notification { id, text }`.
|
|
12
|
+
*
|
|
13
|
+
* **`NotificationTargetType` is a 2-value wire enum: `Post` / `Project`.**
|
|
14
|
+
* Monday's `Post` value targets an Update (sending a notification
|
|
15
|
+
* about a specific post); `Project` targets an Item OR a Board (the
|
|
16
|
+
* wire enum doesn't distinguish). The CLI surface keeps the
|
|
17
|
+
* documented `--target-type item|board` argv vocabulary from
|
|
18
|
+
* cli-design §4.3 — both CLI values map to wire `Project`. The CLI
|
|
19
|
+
* preserves the item-vs-board distinction at the parse boundary
|
|
20
|
+
* for argv-validation discipline and to echo the agent-supplied
|
|
21
|
+
* kind in the output envelope; the CLI does NOT pre-verify that
|
|
22
|
+
* the supplied `--target <id>` actually names the declared kind,
|
|
23
|
+
* and Monday cannot either (the wire enum collapses both kinds to
|
|
24
|
+
* `Project`). Invisible / non-existent targets surface `not_found`
|
|
25
|
+
* at mutation time, but a passing `--target-type item` with a
|
|
26
|
+
* board-shaped ID succeeds and echoes the CLI-declared kind even
|
|
27
|
+
* though the record is a board. Monday's `Post` variant is
|
|
28
|
+
* unreachable at v0.3 — a v0.3.x / v0.4 contract-extension may add
|
|
29
|
+
* `--target-type update` once a clean argv-discriminator design is
|
|
30
|
+
* pinned (cli-design §13 v0.3 entry M27 sub-block carries the
|
|
31
|
+
* deferred note).
|
|
32
|
+
*
|
|
33
|
+
* **`Notification` read shape is minimal (2 fields).** `id` (ID,
|
|
34
|
+
* non-null), `text` (String, nullable). The CLI echoes the input
|
|
35
|
+
* fields (`user_id`, `target_id`, `target_type`) alongside the
|
|
36
|
+
* Monday-side fields so an agent verifies what was sent from a
|
|
37
|
+
* single envelope read.
|
|
38
|
+
*
|
|
39
|
+
* **No new ERROR_CODES (29 stays).** Notification send failures
|
|
40
|
+
* route through the existing codes: `not_found` (target user /
|
|
41
|
+
* `Project` invisible to the token or non-existent — Monday's
|
|
42
|
+
* visibility check; CLI-declared kind vs underlying record is NOT
|
|
43
|
+
* verified), `usage_error` (text empty / malformed argv — invalid
|
|
44
|
+
* `--target-type` enum value or non-numeric `--target` ID),
|
|
45
|
+
* `unauthorized` (token lacks notification scope), `forbidden`
|
|
46
|
+
* (account permissions), `validation_failed` (Monday-side rejection).
|
|
47
|
+
*
|
|
48
|
+
* **Notification send is single-recipient at v0.3** per cli-design
|
|
49
|
+
* §4.3 — the `--user <uid>` flag accepts one ID. Multi-recipient
|
|
50
|
+
* fan-out is a v0.3.x / v0.4 contract-extension (agents needing
|
|
51
|
+
* fan-out call `notification send` N times).
|
|
52
|
+
*
|
|
53
|
+
* **Notification send is not idempotent.** Re-running the verb
|
|
54
|
+
* produces a fresh notification with a new `id` (Monday treats
|
|
55
|
+
* each `create_notification` call as a discrete send). Agents
|
|
56
|
+
* needing send-once-semantics dedup on the CLI side; the verb
|
|
57
|
+
* does not enforce idempotency.
|
|
58
|
+
*
|
|
59
|
+
* **Runtime body (M27 IMPL).** Single `client.raw` round-trip
|
|
60
|
+
* against `mutation CreateNotification` with `operationName:
|
|
61
|
+
* 'CreateNotification'` (R-NEW-37 W2 audit-point). The CLI's
|
|
62
|
+
* 2-value `--target-type` enum collapses to wire `Project` at the
|
|
63
|
+
* runtime boundary; the CLI-side echo (`user_id` / `target_id` /
|
|
64
|
+
* `target_type`) is composed at the parse boundary so the envelope
|
|
65
|
+
* carries both the Monday-minted `id` + the agent-supplied inputs.
|
|
66
|
+
*/
|
|
67
|
+
import { z } from 'zod';
|
|
68
|
+
import type { MondayClient } from './client.js';
|
|
69
|
+
import type { Complexity } from '../utils/output/envelope.js';
|
|
70
|
+
/**
|
|
71
|
+
* CLI-side `target_type` vocabulary for `monday notification send
|
|
72
|
+
* --target-type <type>`. Both values map to Monday's wire
|
|
73
|
+
* `NotificationTargetType.Project` (which represents both items and
|
|
74
|
+
* boards) — the CLI keeps the item-vs-board distinction for argv
|
|
75
|
+
* validation discipline AND to echo the agent-supplied kind in the
|
|
76
|
+
* output envelope. The pairing of `--target-type` with `--target
|
|
77
|
+
* <id>` is **trusted, not verified**: the CLI validates the enum +
|
|
78
|
+
* numeric ID shape; Monday validates that the target is a visible
|
|
79
|
+
* `Project` (surfacing invisible / non-existent targets as
|
|
80
|
+
* `not_found`); but neither side verifies that the CLI-declared
|
|
81
|
+
* kind matches what the ID actually names — the wire enum
|
|
82
|
+
* collapses both kinds to `Project`. A CLI-side pre-read is
|
|
83
|
+
* deferred (v0.3.x / v0.4 contract-extension if agents need
|
|
84
|
+
* strict-kind enforcement).
|
|
85
|
+
*
|
|
86
|
+
* Monday's wire enum has only two values (`Post` / `Project`); the
|
|
87
|
+
* `Post` value targets Updates and is intentionally not surfaced
|
|
88
|
+
* at v0.3 per cli-design §4.3. A v0.3.x / v0.4 contract-extension
|
|
89
|
+
* may add a CLI third target-type `update` that dispatches to wire
|
|
90
|
+
* `Post`.
|
|
91
|
+
*/
|
|
92
|
+
export declare const NOTIFICATION_TARGET_TYPES: readonly ["item", "board"];
|
|
93
|
+
export type NotificationTargetType = (typeof NOTIFICATION_TARGET_TYPES)[number];
|
|
94
|
+
export declare const notificationTargetTypeSchema: z.ZodEnum<{
|
|
95
|
+
board: "board";
|
|
96
|
+
item: "item";
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Output shape for `monday notification send --user <uid> --target
|
|
100
|
+
* <iid|bid> --target-type item|board --text <t>`. Carries both the
|
|
101
|
+
* Monday-side fields (`id` of the minted notification, server-echo
|
|
102
|
+
* `text`) and the CLI-side inputs (`user_id`, `target_id`,
|
|
103
|
+
* `target_type`) so an agent verifies what was sent from a single
|
|
104
|
+
* envelope read.
|
|
105
|
+
*
|
|
106
|
+
* `text` is nullable on the wire (Monday's `Notification.text` is
|
|
107
|
+
* `String` not `String!`); we preserve nullability for fidelity even
|
|
108
|
+
* though `create_notification`'s input `text` is non-null. In
|
|
109
|
+
* practice it round-trips the input value.
|
|
110
|
+
*/
|
|
111
|
+
export declare const notificationSendOutputSchema: z.ZodObject<{
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
text: z.ZodNullable<z.ZodString>;
|
|
114
|
+
user_id: z.ZodString;
|
|
115
|
+
target_id: z.ZodString;
|
|
116
|
+
target_type: z.ZodEnum<{
|
|
117
|
+
board: "board";
|
|
118
|
+
item: "item";
|
|
119
|
+
}>;
|
|
120
|
+
}, z.core.$strict>;
|
|
121
|
+
export type NotificationSendOutput = z.infer<typeof notificationSendOutputSchema>;
|
|
122
|
+
export interface SendNotificationInputs {
|
|
123
|
+
readonly client: MondayClient;
|
|
124
|
+
readonly userId: string;
|
|
125
|
+
readonly targetId: string;
|
|
126
|
+
readonly targetType: NotificationTargetType;
|
|
127
|
+
readonly text: string;
|
|
128
|
+
}
|
|
129
|
+
export interface SendNotificationResult {
|
|
130
|
+
readonly notification: NotificationSendOutput;
|
|
131
|
+
readonly source: 'live';
|
|
132
|
+
readonly cacheAgeSeconds: null;
|
|
133
|
+
readonly complexity: Complexity | null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Fires Monday's `create_notification` mutation. Both CLI
|
|
137
|
+
* `--target-type` values (`item`/`board`) map to the wire enum
|
|
138
|
+
* `NotificationTargetType.Project` — Monday's wire surface doesn't
|
|
139
|
+
* distinguish items from boards at the enum level. Monday
|
|
140
|
+
* validates that `target_id` is a visible `Project` (invisible /
|
|
141
|
+
* non-existent targets surface `not_found`) but does NOT verify
|
|
142
|
+
* that the kind matches the CLI-declared `target_type`; the
|
|
143
|
+
* pairing is trusted and echoed but not enforced.
|
|
144
|
+
*
|
|
145
|
+
* The wire payload returns only `{id, text}`; the CLI-side echo
|
|
146
|
+
* (`user_id` / `target_id` / `target_type`) is composed at the
|
|
147
|
+
* caller's parse boundary so the resulting envelope carries both the
|
|
148
|
+
* Monday-minted `id` and the agent-supplied inputs in one read.
|
|
149
|
+
*
|
|
150
|
+
* `operationName: 'CreateNotification'` stays in sync with the named
|
|
151
|
+
* operation in {@link CREATE_NOTIFICATION_MUTATION} (R-NEW-37 W2
|
|
152
|
+
* audit-point). Not idempotent — re-running mints a fresh
|
|
153
|
+
* notification with a new ID.
|
|
154
|
+
*/
|
|
155
|
+
export declare const sendNotification: (inputs: SendNotificationInputs) => Promise<SendNotificationResult>;
|
|
156
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/api/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,4BAA6B,CAAC;AAEpE,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7C,eAAO,MAAM,4BAA4B;;;EAAoC,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;kBAQ9B,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC;AAgCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,sBAAsB,KAC7B,OAAO,CAAC,sBAAsB,CA6DhC,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification send surface for the v0.3-M27 `monday notification
|
|
3
|
+
* send` verb (`cli-design.md` §2.7 + §4.3 + §13 v0.3 entry;
|
|
4
|
+
* `v0.3-plan.md` §3 M27).
|
|
5
|
+
*
|
|
6
|
+
* **Wire surface (empirical probe 2026-05-12, API `2026-01`).** One
|
|
7
|
+
* Monday GraphQL operation lands here:
|
|
8
|
+
*
|
|
9
|
+
* - `Mutation.create_notification(user_id: ID!, target_id: ID!,
|
|
10
|
+
* target_type: NotificationTargetType!, text: String!)` — returns
|
|
11
|
+
* the created `Notification { id, text }`.
|
|
12
|
+
*
|
|
13
|
+
* **`NotificationTargetType` is a 2-value wire enum: `Post` / `Project`.**
|
|
14
|
+
* Monday's `Post` value targets an Update (sending a notification
|
|
15
|
+
* about a specific post); `Project` targets an Item OR a Board (the
|
|
16
|
+
* wire enum doesn't distinguish). The CLI surface keeps the
|
|
17
|
+
* documented `--target-type item|board` argv vocabulary from
|
|
18
|
+
* cli-design §4.3 — both CLI values map to wire `Project`. The CLI
|
|
19
|
+
* preserves the item-vs-board distinction at the parse boundary
|
|
20
|
+
* for argv-validation discipline and to echo the agent-supplied
|
|
21
|
+
* kind in the output envelope; the CLI does NOT pre-verify that
|
|
22
|
+
* the supplied `--target <id>` actually names the declared kind,
|
|
23
|
+
* and Monday cannot either (the wire enum collapses both kinds to
|
|
24
|
+
* `Project`). Invisible / non-existent targets surface `not_found`
|
|
25
|
+
* at mutation time, but a passing `--target-type item` with a
|
|
26
|
+
* board-shaped ID succeeds and echoes the CLI-declared kind even
|
|
27
|
+
* though the record is a board. Monday's `Post` variant is
|
|
28
|
+
* unreachable at v0.3 — a v0.3.x / v0.4 contract-extension may add
|
|
29
|
+
* `--target-type update` once a clean argv-discriminator design is
|
|
30
|
+
* pinned (cli-design §13 v0.3 entry M27 sub-block carries the
|
|
31
|
+
* deferred note).
|
|
32
|
+
*
|
|
33
|
+
* **`Notification` read shape is minimal (2 fields).** `id` (ID,
|
|
34
|
+
* non-null), `text` (String, nullable). The CLI echoes the input
|
|
35
|
+
* fields (`user_id`, `target_id`, `target_type`) alongside the
|
|
36
|
+
* Monday-side fields so an agent verifies what was sent from a
|
|
37
|
+
* single envelope read.
|
|
38
|
+
*
|
|
39
|
+
* **No new ERROR_CODES (29 stays).** Notification send failures
|
|
40
|
+
* route through the existing codes: `not_found` (target user /
|
|
41
|
+
* `Project` invisible to the token or non-existent — Monday's
|
|
42
|
+
* visibility check; CLI-declared kind vs underlying record is NOT
|
|
43
|
+
* verified), `usage_error` (text empty / malformed argv — invalid
|
|
44
|
+
* `--target-type` enum value or non-numeric `--target` ID),
|
|
45
|
+
* `unauthorized` (token lacks notification scope), `forbidden`
|
|
46
|
+
* (account permissions), `validation_failed` (Monday-side rejection).
|
|
47
|
+
*
|
|
48
|
+
* **Notification send is single-recipient at v0.3** per cli-design
|
|
49
|
+
* §4.3 — the `--user <uid>` flag accepts one ID. Multi-recipient
|
|
50
|
+
* fan-out is a v0.3.x / v0.4 contract-extension (agents needing
|
|
51
|
+
* fan-out call `notification send` N times).
|
|
52
|
+
*
|
|
53
|
+
* **Notification send is not idempotent.** Re-running the verb
|
|
54
|
+
* produces a fresh notification with a new `id` (Monday treats
|
|
55
|
+
* each `create_notification` call as a discrete send). Agents
|
|
56
|
+
* needing send-once-semantics dedup on the CLI side; the verb
|
|
57
|
+
* does not enforce idempotency.
|
|
58
|
+
*
|
|
59
|
+
* **Runtime body (M27 IMPL).** Single `client.raw` round-trip
|
|
60
|
+
* against `mutation CreateNotification` with `operationName:
|
|
61
|
+
* 'CreateNotification'` (R-NEW-37 W2 audit-point). The CLI's
|
|
62
|
+
* 2-value `--target-type` enum collapses to wire `Project` at the
|
|
63
|
+
* runtime boundary; the CLI-side echo (`user_id` / `target_id` /
|
|
64
|
+
* `target_type`) is composed at the parse boundary so the envelope
|
|
65
|
+
* carries both the Monday-minted `id` + the agent-supplied inputs.
|
|
66
|
+
*/
|
|
67
|
+
import { z } from 'zod';
|
|
68
|
+
import { unwrapOrThrow } from '../utils/parse-boundary.js';
|
|
69
|
+
import { assertResponseFieldPresent } from './response-root.js';
|
|
70
|
+
import { ApiError } from '../utils/errors.js';
|
|
71
|
+
/**
|
|
72
|
+
* CLI-side `target_type` vocabulary for `monday notification send
|
|
73
|
+
* --target-type <type>`. Both values map to Monday's wire
|
|
74
|
+
* `NotificationTargetType.Project` (which represents both items and
|
|
75
|
+
* boards) — the CLI keeps the item-vs-board distinction for argv
|
|
76
|
+
* validation discipline AND to echo the agent-supplied kind in the
|
|
77
|
+
* output envelope. The pairing of `--target-type` with `--target
|
|
78
|
+
* <id>` is **trusted, not verified**: the CLI validates the enum +
|
|
79
|
+
* numeric ID shape; Monday validates that the target is a visible
|
|
80
|
+
* `Project` (surfacing invisible / non-existent targets as
|
|
81
|
+
* `not_found`); but neither side verifies that the CLI-declared
|
|
82
|
+
* kind matches what the ID actually names — the wire enum
|
|
83
|
+
* collapses both kinds to `Project`. A CLI-side pre-read is
|
|
84
|
+
* deferred (v0.3.x / v0.4 contract-extension if agents need
|
|
85
|
+
* strict-kind enforcement).
|
|
86
|
+
*
|
|
87
|
+
* Monday's wire enum has only two values (`Post` / `Project`); the
|
|
88
|
+
* `Post` value targets Updates and is intentionally not surfaced
|
|
89
|
+
* at v0.3 per cli-design §4.3. A v0.3.x / v0.4 contract-extension
|
|
90
|
+
* may add a CLI third target-type `update` that dispatches to wire
|
|
91
|
+
* `Post`.
|
|
92
|
+
*/
|
|
93
|
+
export const NOTIFICATION_TARGET_TYPES = ['item', 'board'];
|
|
94
|
+
export const notificationTargetTypeSchema = z.enum(NOTIFICATION_TARGET_TYPES);
|
|
95
|
+
/**
|
|
96
|
+
* Output shape for `monday notification send --user <uid> --target
|
|
97
|
+
* <iid|bid> --target-type item|board --text <t>`. Carries both the
|
|
98
|
+
* Monday-side fields (`id` of the minted notification, server-echo
|
|
99
|
+
* `text`) and the CLI-side inputs (`user_id`, `target_id`,
|
|
100
|
+
* `target_type`) so an agent verifies what was sent from a single
|
|
101
|
+
* envelope read.
|
|
102
|
+
*
|
|
103
|
+
* `text` is nullable on the wire (Monday's `Notification.text` is
|
|
104
|
+
* `String` not `String!`); we preserve nullability for fidelity even
|
|
105
|
+
* though `create_notification`'s input `text` is non-null. In
|
|
106
|
+
* practice it round-trips the input value.
|
|
107
|
+
*/
|
|
108
|
+
export const notificationSendOutputSchema = z
|
|
109
|
+
.object({
|
|
110
|
+
id: z.string().min(1),
|
|
111
|
+
text: z.string().nullable(),
|
|
112
|
+
user_id: z.string().min(1),
|
|
113
|
+
target_id: z.string().min(1),
|
|
114
|
+
target_type: notificationTargetTypeSchema,
|
|
115
|
+
})
|
|
116
|
+
.strict();
|
|
117
|
+
const CREATE_NOTIFICATION_MUTATION = `
|
|
118
|
+
mutation CreateNotification(
|
|
119
|
+
$userId: ID!,
|
|
120
|
+
$targetId: ID!,
|
|
121
|
+
$targetType: NotificationTargetType!,
|
|
122
|
+
$text: String!
|
|
123
|
+
) {
|
|
124
|
+
create_notification(
|
|
125
|
+
user_id: $userId,
|
|
126
|
+
target_id: $targetId,
|
|
127
|
+
target_type: $targetType,
|
|
128
|
+
text: $text
|
|
129
|
+
) {
|
|
130
|
+
id
|
|
131
|
+
text
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
const wireNotificationSchema = z
|
|
136
|
+
.object({
|
|
137
|
+
id: z.string().min(1),
|
|
138
|
+
text: z.string().nullable(),
|
|
139
|
+
})
|
|
140
|
+
.strict();
|
|
141
|
+
/**
|
|
142
|
+
* Fires Monday's `create_notification` mutation. Both CLI
|
|
143
|
+
* `--target-type` values (`item`/`board`) map to the wire enum
|
|
144
|
+
* `NotificationTargetType.Project` — Monday's wire surface doesn't
|
|
145
|
+
* distinguish items from boards at the enum level. Monday
|
|
146
|
+
* validates that `target_id` is a visible `Project` (invisible /
|
|
147
|
+
* non-existent targets surface `not_found`) but does NOT verify
|
|
148
|
+
* that the kind matches the CLI-declared `target_type`; the
|
|
149
|
+
* pairing is trusted and echoed but not enforced.
|
|
150
|
+
*
|
|
151
|
+
* The wire payload returns only `{id, text}`; the CLI-side echo
|
|
152
|
+
* (`user_id` / `target_id` / `target_type`) is composed at the
|
|
153
|
+
* caller's parse boundary so the resulting envelope carries both the
|
|
154
|
+
* Monday-minted `id` and the agent-supplied inputs in one read.
|
|
155
|
+
*
|
|
156
|
+
* `operationName: 'CreateNotification'` stays in sync with the named
|
|
157
|
+
* operation in {@link CREATE_NOTIFICATION_MUTATION} (R-NEW-37 W2
|
|
158
|
+
* audit-point). Not idempotent — re-running mints a fresh
|
|
159
|
+
* notification with a new ID.
|
|
160
|
+
*/
|
|
161
|
+
export const sendNotification = async (inputs) => {
|
|
162
|
+
// CLI's 2-value enum collapses to wire `Project` (Monday's wire
|
|
163
|
+
// surface has no item-vs-board distinction). The `Post` wire value
|
|
164
|
+
// is unreachable at v0.3 per cli-design §4.3.
|
|
165
|
+
const wireTargetType = 'Project';
|
|
166
|
+
const response = await inputs.client.raw(CREATE_NOTIFICATION_MUTATION, {
|
|
167
|
+
userId: inputs.userId,
|
|
168
|
+
targetId: inputs.targetId,
|
|
169
|
+
targetType: wireTargetType,
|
|
170
|
+
text: inputs.text,
|
|
171
|
+
}, { operationName: 'CreateNotification' });
|
|
172
|
+
assertResponseFieldPresent({
|
|
173
|
+
data: response.data,
|
|
174
|
+
key: 'create_notification',
|
|
175
|
+
operationLabel: 'CreateNotification',
|
|
176
|
+
details: {
|
|
177
|
+
user_id: inputs.userId,
|
|
178
|
+
target_id: inputs.targetId,
|
|
179
|
+
target_type: inputs.targetType,
|
|
180
|
+
},
|
|
181
|
+
nullHandling: 'caller_handles',
|
|
182
|
+
});
|
|
183
|
+
const raw = response.data.create_notification;
|
|
184
|
+
if (raw === null || raw === undefined) {
|
|
185
|
+
throw new ApiError('not_found', `Monday returned no notification payload from create_notification for user ${inputs.userId} on target ${inputs.targetId}`, {
|
|
186
|
+
details: {
|
|
187
|
+
user_id: inputs.userId,
|
|
188
|
+
target_id: inputs.targetId,
|
|
189
|
+
target_type: inputs.targetType,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const wire = unwrapOrThrow(wireNotificationSchema.safeParse(raw), {
|
|
194
|
+
context: 'Monday `create_notification` response',
|
|
195
|
+
details: {
|
|
196
|
+
user_id: inputs.userId,
|
|
197
|
+
target_id: inputs.targetId,
|
|
198
|
+
target_type: inputs.targetType,
|
|
199
|
+
},
|
|
200
|
+
hint: 'Monday may have amended the `Notification` selection — re-probe and amend `src/api/notifications.ts` if so',
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
notification: {
|
|
204
|
+
id: wire.id,
|
|
205
|
+
text: wire.text,
|
|
206
|
+
user_id: inputs.userId,
|
|
207
|
+
target_id: inputs.targetId,
|
|
208
|
+
target_type: inputs.targetType,
|
|
209
|
+
},
|
|
210
|
+
source: 'live',
|
|
211
|
+
cacheAgeSeconds: null,
|
|
212
|
+
complexity: response.complexity,
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/api/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAKpE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,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AC;QACtC,MAAM,IAAI,QAAQ,CAChB,WAAW,EACX,6EAA6E,MAAM,CAAC,MAAM,cAAc,MAAM,CAAC,QAAQ,EAAE,EACzH;YACE,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAC,MAAM;gBACtB,SAAS,EAAE,MAAM,CAAC,QAAQ;gBAC1B,WAAW,EAAE,MAAM,CAAC,UAAU;aAC/B;SACF,CACF,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,aAAa,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAChE,OAAO,EAAE,uCAAuC;QAChD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC,MAAM;YACtB,SAAS,EAAE,MAAM,CAAC,QAAQ;YAC1B,WAAW,EAAE,MAAM,CAAC,UAAU;SAC/B;QACD,IAAI,EAAE,4GAA4G;KACnH,CAAC,CAAC;IACH,OAAO;QACL,YAAY,EAAE;YACZ,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,MAAM,CAAC,MAAM;YACtB,SAAS,EAAE,MAAM,CAAC,QAAQ;YAC1B,WAAW,EAAE,MAAM,CAAC,UAAU;SAC/B;QACD,MAAM,EAAE,MAAM;QACd,eAAe,EAAE,IAAI;QACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;KAChC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `__test_oauth_helper` test seam per cli-design §7.3.4.
|
|
3
|
+
*
|
|
4
|
+
* Substitutes for {@link bindOAuthListener} when the env var
|
|
5
|
+
* `__test_oauth_helper` is set; production code paths never see this
|
|
6
|
+
* helper. The substitution lives in `src/commands/auth/login.ts` —
|
|
7
|
+
* this module exposes the construction primitive.
|
|
8
|
+
*
|
|
9
|
+
* **Fixture file shape** (read from the path the env var holds):
|
|
10
|
+
*
|
|
11
|
+
* ```json
|
|
12
|
+
* {
|
|
13
|
+
* "code": "fixture-code",
|
|
14
|
+
* "force_csrf_mismatch": true,
|
|
15
|
+
* "force_user_denied": true,
|
|
16
|
+
* "force_authorization_failed": {
|
|
17
|
+
* "error": "invalid_scope",
|
|
18
|
+
* "error_description": "requested scope `boards:write` not granted"
|
|
19
|
+
* },
|
|
20
|
+
* "force_listener_timeout": true
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* All four `force_*` flags are mutually exclusive; the first
|
|
25
|
+
* non-undefined slot wins. The fixture **does not** carry `state` —
|
|
26
|
+
* it's randomly generated per invocation; the helper synthesises the
|
|
27
|
+
* redirect with the CLI's own generated `state` echoed back so CSRF
|
|
28
|
+
* verification passes by default.
|
|
29
|
+
*
|
|
30
|
+
* The fixture's PATH (the env var's value) is never echoed to the
|
|
31
|
+
* output envelope, never logged at any verbosity level, and is
|
|
32
|
+
* scrubbed from `--debug` output the same way `MONDAY_API_TOKEN` is.
|
|
33
|
+
*/
|
|
34
|
+
import { z } from 'zod';
|
|
35
|
+
import type { OAuthListenerHandle } from './oauth.js';
|
|
36
|
+
/** Env var name the test seam checks. The leading double-underscore
|
|
37
|
+
* discourages production use; tests set it explicitly. */
|
|
38
|
+
export declare const TEST_OAUTH_HELPER_ENV_VAR = "__test_oauth_helper";
|
|
39
|
+
declare const fixtureSchema: z.ZodObject<{
|
|
40
|
+
code: z.ZodString;
|
|
41
|
+
force_csrf_mismatch: z.ZodOptional<z.ZodLiteral<true>>;
|
|
42
|
+
force_user_denied: z.ZodOptional<z.ZodLiteral<true>>;
|
|
43
|
+
force_authorization_failed: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
error: z.ZodString;
|
|
45
|
+
error_description: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
force_listener_timeout: z.ZodOptional<z.ZodLiteral<true>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
export type TestOAuthFixture = z.infer<typeof fixtureSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Reads the test-helper fixture file and parses it. Surfaces
|
|
52
|
+
* `config_error` for any failure (file missing, malformed JSON,
|
|
53
|
+
* schema mismatch); a misconfigured test seam should fail loud,
|
|
54
|
+
* not silently fall back to the real listener.
|
|
55
|
+
*/
|
|
56
|
+
export declare const readTestOAuthFixture: (fixturePath: string) => Promise<TestOAuthFixture>;
|
|
57
|
+
/**
|
|
58
|
+
* Builds a synthetic {@link OAuthListenerHandle} from the fixture +
|
|
59
|
+
* the CLI's generated `state`. No real socket bind; `awaitRedirect`
|
|
60
|
+
* resolves (or rejects) based on the fixture's `force_*` flags.
|
|
61
|
+
*/
|
|
62
|
+
export declare const buildTestOAuthListener: (fixture: TestOAuthFixture, generatedState: string) => OAuthListenerHandle;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=oauth-test-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-test-helper.d.ts","sourceRoot":"","sources":["../../src/api/oauth-test-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,YAAY,CAAC;AAEvE;0DAC0D;AAC1D,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;kBAcR,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,aAAa,MAAM,KAClB,OAAO,CAAC,gBAAgB,CA6C1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,gBAAgB,EACzB,gBAAgB,MAAM,KACrB,mBA8FF,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `__test_oauth_helper` test seam per cli-design §7.3.4.
|
|
3
|
+
*
|
|
4
|
+
* Substitutes for {@link bindOAuthListener} when the env var
|
|
5
|
+
* `__test_oauth_helper` is set; production code paths never see this
|
|
6
|
+
* helper. The substitution lives in `src/commands/auth/login.ts` —
|
|
7
|
+
* this module exposes the construction primitive.
|
|
8
|
+
*
|
|
9
|
+
* **Fixture file shape** (read from the path the env var holds):
|
|
10
|
+
*
|
|
11
|
+
* ```json
|
|
12
|
+
* {
|
|
13
|
+
* "code": "fixture-code",
|
|
14
|
+
* "force_csrf_mismatch": true,
|
|
15
|
+
* "force_user_denied": true,
|
|
16
|
+
* "force_authorization_failed": {
|
|
17
|
+
* "error": "invalid_scope",
|
|
18
|
+
* "error_description": "requested scope `boards:write` not granted"
|
|
19
|
+
* },
|
|
20
|
+
* "force_listener_timeout": true
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* All four `force_*` flags are mutually exclusive; the first
|
|
25
|
+
* non-undefined slot wins. The fixture **does not** carry `state` —
|
|
26
|
+
* it's randomly generated per invocation; the helper synthesises the
|
|
27
|
+
* redirect with the CLI's own generated `state` echoed back so CSRF
|
|
28
|
+
* verification passes by default.
|
|
29
|
+
*
|
|
30
|
+
* The fixture's PATH (the env var's value) is never echoed to the
|
|
31
|
+
* output envelope, never logged at any verbosity level, and is
|
|
32
|
+
* scrubbed from `--debug` output the same way `MONDAY_API_TOKEN` is.
|
|
33
|
+
*/
|
|
34
|
+
import { readFile } from 'node:fs/promises';
|
|
35
|
+
import { z } from 'zod';
|
|
36
|
+
import { ApiError, ConfigError, asError } from '../utils/errors.js';
|
|
37
|
+
/** Env var name the test seam checks. The leading double-underscore
|
|
38
|
+
* discourages production use; tests set it explicitly. */
|
|
39
|
+
export const TEST_OAUTH_HELPER_ENV_VAR = '__test_oauth_helper';
|
|
40
|
+
const fixtureSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
code: z.string().min(1),
|
|
43
|
+
force_csrf_mismatch: z.literal(true).optional(),
|
|
44
|
+
force_user_denied: z.literal(true).optional(),
|
|
45
|
+
force_authorization_failed: z
|
|
46
|
+
.object({
|
|
47
|
+
error: z.string().min(1),
|
|
48
|
+
error_description: z.string().optional(),
|
|
49
|
+
})
|
|
50
|
+
.strict()
|
|
51
|
+
.optional(),
|
|
52
|
+
force_listener_timeout: z.literal(true).optional(),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
/**
|
|
56
|
+
* Reads the test-helper fixture file and parses it. Surfaces
|
|
57
|
+
* `config_error` for any failure (file missing, malformed JSON,
|
|
58
|
+
* schema mismatch); a misconfigured test seam should fail loud,
|
|
59
|
+
* not silently fall back to the real listener.
|
|
60
|
+
*/
|
|
61
|
+
export const readTestOAuthFixture = async (fixturePath) => {
|
|
62
|
+
let raw;
|
|
63
|
+
try {
|
|
64
|
+
raw = await readFile(fixturePath, 'utf8');
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
throw new ConfigError(`cannot read __test_oauth_helper fixture at ${fixturePath}`, {
|
|
68
|
+
cause: asError(err),
|
|
69
|
+
details: {
|
|
70
|
+
path: fixturePath,
|
|
71
|
+
hint: 'set __test_oauth_helper to the path of a valid fixture file or unset the env var to use the real OAuth listener',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
let parsed;
|
|
76
|
+
try {
|
|
77
|
+
parsed = JSON.parse(raw);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
throw new ConfigError(`__test_oauth_helper fixture at ${fixturePath} is not valid JSON`, {
|
|
81
|
+
cause: asError(err),
|
|
82
|
+
details: { path: fixturePath },
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const result = fixtureSchema.safeParse(parsed);
|
|
86
|
+
if (!result.success) {
|
|
87
|
+
throw new ConfigError(`__test_oauth_helper fixture at ${fixturePath} does not match the documented shape`, {
|
|
88
|
+
cause: result.error,
|
|
89
|
+
details: {
|
|
90
|
+
path: fixturePath,
|
|
91
|
+
issues: result.error.issues.map((i) => ({
|
|
92
|
+
path: i.path.join('.'),
|
|
93
|
+
message: i.message,
|
|
94
|
+
})),
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return result.data;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Builds a synthetic {@link OAuthListenerHandle} from the fixture +
|
|
102
|
+
* the CLI's generated `state`. No real socket bind; `awaitRedirect`
|
|
103
|
+
* resolves (or rejects) based on the fixture's `force_*` flags.
|
|
104
|
+
*/
|
|
105
|
+
export const buildTestOAuthListener = (fixture, generatedState) => {
|
|
106
|
+
let resolved = false;
|
|
107
|
+
const handle = {
|
|
108
|
+
port: 0,
|
|
109
|
+
awaitRedirect: () => new Promise((resolve, reject) => {
|
|
110
|
+
if (resolved) {
|
|
111
|
+
// Idempotent — repeat awaits are a programmer error in
|
|
112
|
+
// production, but the test seam guards explicitly so a
|
|
113
|
+
// double-await fails loud rather than hanging forever.
|
|
114
|
+
reject(new ApiError('internal_error', '__test_oauth_helper.awaitRedirect called twice'));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
resolved = true;
|
|
118
|
+
if (fixture.force_listener_timeout === true) {
|
|
119
|
+
// Mirror the real listener's timeout payload exactly so the
|
|
120
|
+
// command-level error mapping treats both surfaces
|
|
121
|
+
// identically.
|
|
122
|
+
reject(new ApiError('oauth_failed', 'OAuth listener timed out before the redirect arrived (test fixture)', {
|
|
123
|
+
details: {
|
|
124
|
+
reason: 'timeout',
|
|
125
|
+
hint: 're-run `monday auth login` and complete the consent flow within 5 minutes',
|
|
126
|
+
},
|
|
127
|
+
retryable: true,
|
|
128
|
+
}));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (fixture.force_csrf_mismatch === true) {
|
|
132
|
+
// Substitute a different state so the caller's verifyCsrf
|
|
133
|
+
// call fails. Length-equal so the timing-safe path runs
|
|
134
|
+
// (mirrors the production CSRF code path; not just a
|
|
135
|
+
// length-mismatch shortcut).
|
|
136
|
+
const sameLengthDifferentState = generatedState
|
|
137
|
+
.split('')
|
|
138
|
+
.reverse()
|
|
139
|
+
.join('');
|
|
140
|
+
// Ensure it's actually different — if `generatedState` is
|
|
141
|
+
// a palindrome (vanishingly rare), flip the first byte.
|
|
142
|
+
const echoed = sameLengthDifferentState === generatedState
|
|
143
|
+
? `${String.fromCharCode((generatedState.charCodeAt(0) ^ 1) & 0x7f)}${generatedState.slice(1)}`
|
|
144
|
+
: sameLengthDifferentState;
|
|
145
|
+
resolve({ kind: 'code', code: fixture.code, state: echoed });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (fixture.force_user_denied === true) {
|
|
149
|
+
resolve({
|
|
150
|
+
kind: 'error',
|
|
151
|
+
error: 'access_denied',
|
|
152
|
+
errorDescription: undefined,
|
|
153
|
+
state: generatedState,
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (fixture.force_authorization_failed !== undefined) {
|
|
158
|
+
resolve({
|
|
159
|
+
kind: 'error',
|
|
160
|
+
error: fixture.force_authorization_failed.error,
|
|
161
|
+
errorDescription: fixture.force_authorization_failed.error_description,
|
|
162
|
+
state: generatedState,
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// Default: success path with the CLI's own state echoed back.
|
|
167
|
+
resolve({
|
|
168
|
+
kind: 'code',
|
|
169
|
+
code: fixture.code,
|
|
170
|
+
state: generatedState,
|
|
171
|
+
});
|
|
172
|
+
}),
|
|
173
|
+
close: () => {
|
|
174
|
+
// No-op — no socket to close.
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
return handle;
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=oauth-test-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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