monday-cli 0.2.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 +439 -0
- package/LICENSE +21 -0
- package/README.md +431 -0
- package/dist/api/board-child-finder.d.ts +95 -0
- package/dist/api/board-child-finder.d.ts.map +1 -0
- package/dist/api/board-child-finder.js +89 -0
- package/dist/api/board-child-finder.js.map +1 -0
- package/dist/api/board-metadata.d.ts +162 -0
- package/dist/api/board-metadata.d.ts.map +1 -0
- package/dist/api/board-metadata.js +238 -0
- package/dist/api/board-metadata.js.map +1 -0
- package/dist/api/board-mutation-invalidation.d.ts +153 -0
- package/dist/api/board-mutation-invalidation.d.ts.map +1 -0
- package/dist/api/board-mutation-invalidation.js +136 -0
- package/dist/api/board-mutation-invalidation.js.map +1 -0
- package/dist/api/board-mutation-result.d.ts +97 -0
- package/dist/api/board-mutation-result.d.ts.map +1 -0
- package/dist/api/board-mutation-result.js +99 -0
- package/dist/api/board-mutation-result.js.map +1 -0
- package/dist/api/board-projection.d.ts +68 -0
- package/dist/api/board-projection.d.ts.map +1 -0
- package/dist/api/board-projection.js +79 -0
- package/dist/api/board-projection.js.map +1 -0
- package/dist/api/cache.d.ts +150 -0
- package/dist/api/cache.d.ts.map +1 -0
- package/dist/api/cache.js +418 -0
- package/dist/api/cache.js.map +1 -0
- package/dist/api/client.d.ts +162 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +205 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/column-mapping.d.ts +68 -0
- package/dist/api/column-mapping.d.ts.map +1 -0
- package/dist/api/column-mapping.js +117 -0
- package/dist/api/column-mapping.js.map +1 -0
- package/dist/api/column-mutation-result.d.ts +136 -0
- package/dist/api/column-mutation-result.d.ts.map +1 -0
- package/dist/api/column-mutation-result.js +130 -0
- package/dist/api/column-mutation-result.js.map +1 -0
- package/dist/api/column-types.d.ts +215 -0
- package/dist/api/column-types.d.ts.map +1 -0
- package/dist/api/column-types.js +195 -0
- package/dist/api/column-types.js.map +1 -0
- package/dist/api/column-values.d.ts +446 -0
- package/dist/api/column-values.d.ts.map +1 -0
- package/dist/api/column-values.js +795 -0
- package/dist/api/column-values.js.map +1 -0
- package/dist/api/columns.d.ts +205 -0
- package/dist/api/columns.d.ts.map +1 -0
- package/dist/api/columns.js +343 -0
- package/dist/api/columns.js.map +1 -0
- package/dist/api/complexity.d.ts +90 -0
- package/dist/api/complexity.d.ts.map +1 -0
- package/dist/api/complexity.js +194 -0
- package/dist/api/complexity.js.map +1 -0
- package/dist/api/dates.d.ts +150 -0
- package/dist/api/dates.d.ts.map +1 -0
- package/dist/api/dates.js +490 -0
- package/dist/api/dates.js.map +1 -0
- package/dist/api/destructive-gate.d.ts +107 -0
- package/dist/api/destructive-gate.d.ts.map +1 -0
- package/dist/api/destructive-gate.js +19 -0
- package/dist/api/destructive-gate.js.map +1 -0
- package/dist/api/dry-run.d.ts +338 -0
- package/dist/api/dry-run.d.ts.map +1 -0
- package/dist/api/dry-run.js +607 -0
- package/dist/api/dry-run.js.map +1 -0
- package/dist/api/emails.d.ts +60 -0
- package/dist/api/emails.d.ts.map +1 -0
- package/dist/api/emails.js +113 -0
- package/dist/api/emails.js.map +1 -0
- package/dist/api/errors.d.ts +82 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +434 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/filters.d.ts +198 -0
- package/dist/api/filters.d.ts.map +1 -0
- package/dist/api/filters.js +328 -0
- package/dist/api/filters.js.map +1 -0
- package/dist/api/group-color.d.ts +33 -0
- package/dist/api/group-color.d.ts.map +1 -0
- package/dist/api/group-color.js +80 -0
- package/dist/api/group-color.js.map +1 -0
- package/dist/api/group-mutation-result.d.ts +150 -0
- package/dist/api/group-mutation-result.d.ts.map +1 -0
- package/dist/api/group-mutation-result.js +141 -0
- package/dist/api/group-mutation-result.js.map +1 -0
- package/dist/api/iso-country-codes.d.ts +45 -0
- package/dist/api/iso-country-codes.d.ts.map +1 -0
- package/dist/api/iso-country-codes.js +71 -0
- package/dist/api/iso-country-codes.js.map +1 -0
- package/dist/api/item-board-lookup.d.ts +86 -0
- package/dist/api/item-board-lookup.d.ts.map +1 -0
- package/dist/api/item-board-lookup.js +140 -0
- package/dist/api/item-board-lookup.js.map +1 -0
- package/dist/api/item-helpers.d.ts +133 -0
- package/dist/api/item-helpers.d.ts.map +1 -0
- package/dist/api/item-helpers.js +139 -0
- package/dist/api/item-helpers.js.map +1 -0
- package/dist/api/item-mutation-result.d.ts +60 -0
- package/dist/api/item-mutation-result.d.ts.map +1 -0
- package/dist/api/item-mutation-result.js +63 -0
- package/dist/api/item-mutation-result.js.map +1 -0
- package/dist/api/item-projection.d.ts +165 -0
- package/dist/api/item-projection.d.ts.map +1 -0
- package/dist/api/item-projection.js +235 -0
- package/dist/api/item-projection.js.map +1 -0
- package/dist/api/item-source-read.d.ts +45 -0
- package/dist/api/item-source-read.d.ts.map +1 -0
- package/dist/api/item-source-read.js +57 -0
- package/dist/api/item-source-read.js.map +1 -0
- package/dist/api/items-page-walker.d.ts +126 -0
- package/dist/api/items-page-walker.d.ts.map +1 -0
- package/dist/api/items-page-walker.js +256 -0
- package/dist/api/items-page-walker.js.map +1 -0
- package/dist/api/links.d.ts +70 -0
- package/dist/api/links.d.ts.map +1 -0
- package/dist/api/links.js +128 -0
- package/dist/api/links.js.map +1 -0
- package/dist/api/me-token.d.ts +52 -0
- package/dist/api/me-token.d.ts.map +1 -0
- package/dist/api/me-token.js +55 -0
- package/dist/api/me-token.js.map +1 -0
- package/dist/api/pagination.d.ts +201 -0
- package/dist/api/pagination.d.ts.map +1 -0
- package/dist/api/pagination.js +223 -0
- package/dist/api/pagination.js.map +1 -0
- package/dist/api/partial-success-mutation.d.ts +28 -0
- package/dist/api/partial-success-mutation.d.ts.map +1 -0
- package/dist/api/partial-success-mutation.js +68 -0
- package/dist/api/partial-success-mutation.js.map +1 -0
- package/dist/api/people.d.ts +182 -0
- package/dist/api/people.d.ts.map +1 -0
- package/dist/api/people.js +260 -0
- package/dist/api/people.js.map +1 -0
- package/dist/api/phones.d.ts +74 -0
- package/dist/api/phones.d.ts.map +1 -0
- package/dist/api/phones.js +167 -0
- package/dist/api/phones.js.map +1 -0
- package/dist/api/raw-document.d.ts +53 -0
- package/dist/api/raw-document.d.ts.map +1 -0
- package/dist/api/raw-document.js +177 -0
- package/dist/api/raw-document.js.map +1 -0
- package/dist/api/raw-write.d.ts +127 -0
- package/dist/api/raw-write.d.ts.map +1 -0
- package/dist/api/raw-write.js +233 -0
- package/dist/api/raw-write.js.map +1 -0
- package/dist/api/resolution-context.d.ts +32 -0
- package/dist/api/resolution-context.d.ts.map +1 -0
- package/dist/api/resolution-context.js +42 -0
- package/dist/api/resolution-context.js.map +1 -0
- package/dist/api/resolution-pass.d.ts +163 -0
- package/dist/api/resolution-pass.d.ts.map +1 -0
- package/dist/api/resolution-pass.js +254 -0
- package/dist/api/resolution-pass.js.map +1 -0
- package/dist/api/resolve-client.d.ts +69 -0
- package/dist/api/resolve-client.d.ts.map +1 -0
- package/dist/api/resolve-client.js +70 -0
- package/dist/api/resolve-client.js.map +1 -0
- package/dist/api/resolver-error-fold.d.ts +176 -0
- package/dist/api/resolver-error-fold.d.ts.map +1 -0
- package/dist/api/resolver-error-fold.js +230 -0
- package/dist/api/resolver-error-fold.js.map +1 -0
- package/dist/api/resolvers.d.ts +131 -0
- package/dist/api/resolvers.d.ts.map +1 -0
- package/dist/api/resolvers.js +262 -0
- package/dist/api/resolvers.js.map +1 -0
- package/dist/api/response-root.d.ts +65 -0
- package/dist/api/response-root.d.ts.map +1 -0
- package/dist/api/response-root.js +61 -0
- package/dist/api/response-root.js.map +1 -0
- package/dist/api/retry.d.ts +112 -0
- package/dist/api/retry.d.ts.map +1 -0
- package/dist/api/retry.js +181 -0
- package/dist/api/retry.js.map +1 -0
- package/dist/api/set-expression.d.ts +23 -0
- package/dist/api/set-expression.d.ts.map +1 -0
- package/dist/api/set-expression.js +31 -0
- package/dist/api/set-expression.js.map +1 -0
- package/dist/api/sort.d.ts +59 -0
- package/dist/api/sort.d.ts.map +1 -0
- package/dist/api/sort.js +73 -0
- package/dist/api/sort.js.map +1 -0
- package/dist/api/source-aggregator.d.ts +94 -0
- package/dist/api/source-aggregator.d.ts.map +1 -0
- package/dist/api/source-aggregator.js +111 -0
- package/dist/api/source-aggregator.js.map +1 -0
- package/dist/api/transport.d.ts +58 -0
- package/dist/api/transport.d.ts.map +1 -0
- package/dist/api/transport.js +190 -0
- package/dist/api/transport.js.map +1 -0
- package/dist/api/update-mutation-result.d.ts +133 -0
- package/dist/api/update-mutation-result.d.ts.map +1 -0
- package/dist/api/update-mutation-result.js +145 -0
- package/dist/api/update-mutation-result.js.map +1 -0
- package/dist/api/users-fan-out-mutation.d.ts +124 -0
- package/dist/api/users-fan-out-mutation.d.ts.map +1 -0
- package/dist/api/users-fan-out-mutation.js +331 -0
- package/dist/api/users-fan-out-mutation.js.map +1 -0
- package/dist/api/walk-pages.d.ts +91 -0
- package/dist/api/walk-pages.d.ts.map +1 -0
- package/dist/api/walk-pages.js +84 -0
- package/dist/api/walk-pages.js.map +1 -0
- package/dist/api/workspace-projection.d.ts +64 -0
- package/dist/api/workspace-projection.d.ts.map +1 -0
- package/dist/api/workspace-projection.js +83 -0
- package/dist/api/workspace-projection.js.map +1 -0
- package/dist/cli/envelope-out.d.ts +128 -0
- package/dist/cli/envelope-out.d.ts.map +1 -0
- package/dist/cli/envelope-out.js +146 -0
- package/dist/cli/envelope-out.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +27 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +29 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +109 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/run.d.ts +108 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +105 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/commands/account/client-helper.d.ts +37 -0
- package/dist/commands/account/client-helper.d.ts.map +1 -0
- package/dist/commands/account/client-helper.js +55 -0
- package/dist/commands/account/client-helper.js.map +1 -0
- package/dist/commands/account/complexity.d.ts +29 -0
- package/dist/commands/account/complexity.d.ts.map +1 -0
- package/dist/commands/account/complexity.js +70 -0
- package/dist/commands/account/complexity.js.map +1 -0
- package/dist/commands/account/info.d.ts +36 -0
- package/dist/commands/account/info.d.ts.map +1 -0
- package/dist/commands/account/info.js +74 -0
- package/dist/commands/account/info.js.map +1 -0
- package/dist/commands/account/version.d.ts +44 -0
- package/dist/commands/account/version.d.ts.map +1 -0
- package/dist/commands/account/version.js +98 -0
- package/dist/commands/account/version.js.map +1 -0
- package/dist/commands/account/whoami.d.ts +34 -0
- package/dist/commands/account/whoami.d.ts.map +1 -0
- package/dist/commands/account/whoami.js +77 -0
- package/dist/commands/account/whoami.js.map +1 -0
- package/dist/commands/board/add-users.d.ts +60 -0
- package/dist/commands/board/add-users.d.ts.map +1 -0
- package/dist/commands/board/add-users.js +133 -0
- package/dist/commands/board/add-users.js.map +1 -0
- package/dist/commands/board/archive.d.ts +64 -0
- package/dist/commands/board/archive.d.ts.map +1 -0
- package/dist/commands/board/archive.js +226 -0
- package/dist/commands/board/archive.js.map +1 -0
- package/dist/commands/board/column-create.d.ts +146 -0
- package/dist/commands/board/column-create.d.ts.map +1 -0
- package/dist/commands/board/column-create.js +564 -0
- package/dist/commands/board/column-create.js.map +1 -0
- package/dist/commands/board/column-delete.d.ts +76 -0
- package/dist/commands/board/column-delete.d.ts.map +1 -0
- package/dist/commands/board/column-delete.js +224 -0
- package/dist/commands/board/column-delete.js.map +1 -0
- package/dist/commands/board/column-update.d.ts +92 -0
- package/dist/commands/board/column-update.d.ts.map +1 -0
- package/dist/commands/board/column-update.js +364 -0
- package/dist/commands/board/column-update.js.map +1 -0
- package/dist/commands/board/columns.d.ts +30 -0
- package/dist/commands/board/columns.d.ts.map +1 -0
- package/dist/commands/board/columns.js +102 -0
- package/dist/commands/board/columns.js.map +1 -0
- package/dist/commands/board/create.d.ts +67 -0
- package/dist/commands/board/create.d.ts.map +1 -0
- package/dist/commands/board/create.js +226 -0
- package/dist/commands/board/create.js.map +1 -0
- package/dist/commands/board/delete.d.ts +60 -0
- package/dist/commands/board/delete.d.ts.map +1 -0
- package/dist/commands/board/delete.js +192 -0
- package/dist/commands/board/delete.js.map +1 -0
- package/dist/commands/board/describe.d.ts +68 -0
- package/dist/commands/board/describe.d.ts.map +1 -0
- package/dist/commands/board/describe.js +241 -0
- package/dist/commands/board/describe.js.map +1 -0
- package/dist/commands/board/doctor.d.ts +108 -0
- package/dist/commands/board/doctor.d.ts.map +1 -0
- package/dist/commands/board/doctor.js +417 -0
- package/dist/commands/board/doctor.js.map +1 -0
- package/dist/commands/board/duplicate.d.ts +85 -0
- package/dist/commands/board/duplicate.d.ts.map +1 -0
- package/dist/commands/board/duplicate.js +281 -0
- package/dist/commands/board/duplicate.js.map +1 -0
- package/dist/commands/board/find.d.ts +47 -0
- package/dist/commands/board/find.d.ts.map +1 -0
- package/dist/commands/board/find.js +153 -0
- package/dist/commands/board/find.js.map +1 -0
- package/dist/commands/board/get.d.ts +41 -0
- package/dist/commands/board/get.d.ts.map +1 -0
- package/dist/commands/board/get.js +66 -0
- package/dist/commands/board/get.js.map +1 -0
- package/dist/commands/board/group-archive.d.ts +83 -0
- package/dist/commands/board/group-archive.d.ts.map +1 -0
- package/dist/commands/board/group-archive.js +264 -0
- package/dist/commands/board/group-archive.js.map +1 -0
- package/dist/commands/board/group-create.d.ts +118 -0
- package/dist/commands/board/group-create.d.ts.map +1 -0
- package/dist/commands/board/group-create.js +239 -0
- package/dist/commands/board/group-create.js.map +1 -0
- package/dist/commands/board/group-delete.d.ts +79 -0
- package/dist/commands/board/group-delete.d.ts.map +1 -0
- package/dist/commands/board/group-delete.js +222 -0
- package/dist/commands/board/group-delete.js.map +1 -0
- package/dist/commands/board/group-duplicate.d.ts +70 -0
- package/dist/commands/board/group-duplicate.d.ts.map +1 -0
- package/dist/commands/board/group-duplicate.js +219 -0
- package/dist/commands/board/group-duplicate.js.map +1 -0
- package/dist/commands/board/group-update.d.ts +145 -0
- package/dist/commands/board/group-update.d.ts.map +1 -0
- package/dist/commands/board/group-update.js +341 -0
- package/dist/commands/board/group-update.js.map +1 -0
- package/dist/commands/board/groups.d.ts +28 -0
- package/dist/commands/board/groups.d.ts.map +1 -0
- package/dist/commands/board/groups.js +85 -0
- package/dist/commands/board/groups.js.map +1 -0
- package/dist/commands/board/list.d.ts +39 -0
- package/dist/commands/board/list.d.ts.map +1 -0
- package/dist/commands/board/list.js +135 -0
- package/dist/commands/board/list.js.map +1 -0
- package/dist/commands/board/subscribers.d.ts +24 -0
- package/dist/commands/board/subscribers.d.ts.map +1 -0
- package/dist/commands/board/subscribers.js +89 -0
- package/dist/commands/board/subscribers.js.map +1 -0
- package/dist/commands/board/update.d.ts +82 -0
- package/dist/commands/board/update.d.ts.map +1 -0
- package/dist/commands/board/update.js +328 -0
- package/dist/commands/board/update.js.map +1 -0
- package/dist/commands/cache/clear.d.ts +34 -0
- package/dist/commands/cache/clear.d.ts.map +1 -0
- package/dist/commands/cache/clear.js +113 -0
- package/dist/commands/cache/clear.js.map +1 -0
- package/dist/commands/cache/list.d.ts +50 -0
- package/dist/commands/cache/list.d.ts.map +1 -0
- package/dist/commands/cache/list.js +77 -0
- package/dist/commands/cache/list.js.map +1 -0
- package/dist/commands/cache/stats.d.ts +22 -0
- package/dist/commands/cache/stats.d.ts.map +1 -0
- package/dist/commands/cache/stats.js +56 -0
- package/dist/commands/cache/stats.js.map +1 -0
- package/dist/commands/config/path.d.ts +22 -0
- package/dist/commands/config/path.d.ts.map +1 -0
- package/dist/commands/config/path.js +74 -0
- package/dist/commands/config/path.js.map +1 -0
- package/dist/commands/config/show.d.ts +61 -0
- package/dist/commands/config/show.d.ts.map +1 -0
- package/dist/commands/config/show.js +137 -0
- package/dist/commands/config/show.js.map +1 -0
- package/dist/commands/emit.d.ts +156 -0
- package/dist/commands/emit.d.ts.map +1 -0
- package/dist/commands/emit.js +212 -0
- package/dist/commands/emit.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +195 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/item/archive.d.ts +81 -0
- package/dist/commands/item/archive.d.ts.map +1 -0
- package/dist/commands/item/archive.js +187 -0
- package/dist/commands/item/archive.js.map +1 -0
- package/dist/commands/item/clear.d.ts +140 -0
- package/dist/commands/item/clear.d.ts.map +1 -0
- package/dist/commands/item/clear.js +748 -0
- package/dist/commands/item/clear.js.map +1 -0
- package/dist/commands/item/create.d.ts +77 -0
- package/dist/commands/item/create.d.ts.map +1 -0
- package/dist/commands/item/create.js +802 -0
- package/dist/commands/item/create.js.map +1 -0
- package/dist/commands/item/delete.d.ts +82 -0
- package/dist/commands/item/delete.d.ts.map +1 -0
- package/dist/commands/item/delete.js +179 -0
- package/dist/commands/item/delete.js.map +1 -0
- package/dist/commands/item/duplicate.d.ts +117 -0
- package/dist/commands/item/duplicate.d.ts.map +1 -0
- package/dist/commands/item/duplicate.js +238 -0
- package/dist/commands/item/duplicate.js.map +1 -0
- package/dist/commands/item/find.d.ts +55 -0
- package/dist/commands/item/find.d.ts.map +1 -0
- package/dist/commands/item/find.js +231 -0
- package/dist/commands/item/find.js.map +1 -0
- package/dist/commands/item/get.d.ts +47 -0
- package/dist/commands/item/get.d.ts.map +1 -0
- package/dist/commands/item/get.js +66 -0
- package/dist/commands/item/get.js.map +1 -0
- package/dist/commands/item/list.d.ts +73 -0
- package/dist/commands/item/list.d.ts.map +1 -0
- package/dist/commands/item/list.js +284 -0
- package/dist/commands/item/list.js.map +1 -0
- package/dist/commands/item/move.d.ts +181 -0
- package/dist/commands/item/move.d.ts.map +1 -0
- package/dist/commands/item/move.js +560 -0
- package/dist/commands/item/move.js.map +1 -0
- package/dist/commands/item/search.d.ts +67 -0
- package/dist/commands/item/search.d.ts.map +1 -0
- package/dist/commands/item/search.js +322 -0
- package/dist/commands/item/search.js.map +1 -0
- package/dist/commands/item/set.d.ts +88 -0
- package/dist/commands/item/set.d.ts.map +1 -0
- package/dist/commands/item/set.js +387 -0
- package/dist/commands/item/set.js.map +1 -0
- package/dist/commands/item/subitems.d.ts +50 -0
- package/dist/commands/item/subitems.d.ts.map +1 -0
- package/dist/commands/item/subitems.js +86 -0
- package/dist/commands/item/subitems.js.map +1 -0
- package/dist/commands/item/update.d.ts +99 -0
- package/dist/commands/item/update.d.ts.map +1 -0
- package/dist/commands/item/update.js +884 -0
- package/dist/commands/item/update.js.map +1 -0
- package/dist/commands/item/upsert.d.ts +105 -0
- package/dist/commands/item/upsert.d.ts.map +1 -0
- package/dist/commands/item/upsert.js +998 -0
- package/dist/commands/item/upsert.js.map +1 -0
- package/dist/commands/parse-argv.d.ts +20 -0
- package/dist/commands/parse-argv.d.ts.map +1 -0
- package/dist/commands/parse-argv.js +40 -0
- package/dist/commands/parse-argv.js.map +1 -0
- package/dist/commands/raw/index.d.ts +23 -0
- package/dist/commands/raw/index.d.ts.map +1 -0
- package/dist/commands/raw/index.js +416 -0
- package/dist/commands/raw/index.js.map +1 -0
- package/dist/commands/run-by-id-lookup.d.ts +72 -0
- package/dist/commands/run-by-id-lookup.d.ts.map +1 -0
- package/dist/commands/run-by-id-lookup.js +58 -0
- package/dist/commands/run-by-id-lookup.js.map +1 -0
- package/dist/commands/schema/index.d.ts +104 -0
- package/dist/commands/schema/index.d.ts.map +1 -0
- package/dist/commands/schema/index.js +183 -0
- package/dist/commands/schema/index.js.map +1 -0
- package/dist/commands/types.d.ts +66 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +15 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/update/body-source.d.ts +38 -0
- package/dist/commands/update/body-source.d.ts.map +1 -0
- package/dist/commands/update/body-source.js +80 -0
- package/dist/commands/update/body-source.js.map +1 -0
- package/dist/commands/update/clear-all.d.ts +67 -0
- package/dist/commands/update/clear-all.d.ts.map +1 -0
- package/dist/commands/update/clear-all.js +281 -0
- package/dist/commands/update/clear-all.js.map +1 -0
- package/dist/commands/update/create.d.ts +51 -0
- package/dist/commands/update/create.d.ts.map +1 -0
- package/dist/commands/update/create.js +167 -0
- package/dist/commands/update/create.js.map +1 -0
- package/dist/commands/update/delete.d.ts +53 -0
- package/dist/commands/update/delete.d.ts.map +1 -0
- package/dist/commands/update/delete.js +148 -0
- package/dist/commands/update/delete.js.map +1 -0
- package/dist/commands/update/edit.d.ts +37 -0
- package/dist/commands/update/edit.d.ts.map +1 -0
- package/dist/commands/update/edit.js +129 -0
- package/dist/commands/update/edit.js.map +1 -0
- package/dist/commands/update/get.d.ts +37 -0
- package/dist/commands/update/get.d.ts.map +1 -0
- package/dist/commands/update/get.js +92 -0
- package/dist/commands/update/get.js.map +1 -0
- package/dist/commands/update/like.d.ts +17 -0
- package/dist/commands/update/like.d.ts.map +1 -0
- package/dist/commands/update/like.js +23 -0
- package/dist/commands/update/like.js.map +1 -0
- package/dist/commands/update/list.d.ts +58 -0
- package/dist/commands/update/list.d.ts.map +1 -0
- package/dist/commands/update/list.js +322 -0
- package/dist/commands/update/list.js.map +1 -0
- package/dist/commands/update/pin.d.ts +17 -0
- package/dist/commands/update/pin.d.ts.map +1 -0
- package/dist/commands/update/pin.js +23 -0
- package/dist/commands/update/pin.js.map +1 -0
- package/dist/commands/update/reply.d.ts +47 -0
- package/dist/commands/update/reply.d.ts.map +1 -0
- package/dist/commands/update/reply.js +149 -0
- package/dist/commands/update/reply.js.map +1 -0
- package/dist/commands/update/toggle.d.ts +70 -0
- package/dist/commands/update/toggle.d.ts.map +1 -0
- package/dist/commands/update/toggle.js +118 -0
- package/dist/commands/update/toggle.js.map +1 -0
- package/dist/commands/update/unlike.d.ts +17 -0
- package/dist/commands/update/unlike.d.ts.map +1 -0
- package/dist/commands/update/unlike.js +22 -0
- package/dist/commands/update/unlike.js.map +1 -0
- package/dist/commands/update/unpin.d.ts +17 -0
- package/dist/commands/update/unpin.d.ts.map +1 -0
- package/dist/commands/update/unpin.js +21 -0
- package/dist/commands/update/unpin.js.map +1 -0
- package/dist/commands/user/get.d.ts +31 -0
- package/dist/commands/user/get.d.ts.map +1 -0
- package/dist/commands/user/get.js +81 -0
- package/dist/commands/user/get.js.map +1 -0
- package/dist/commands/user/list.d.ts +61 -0
- package/dist/commands/user/list.d.ts.map +1 -0
- package/dist/commands/user/list.js +148 -0
- package/dist/commands/user/list.js.map +1 -0
- package/dist/commands/user/me.d.ts +17 -0
- package/dist/commands/user/me.d.ts.map +1 -0
- package/dist/commands/user/me.js +49 -0
- package/dist/commands/user/me.js.map +1 -0
- package/dist/commands/workspace/add-users.d.ts +76 -0
- package/dist/commands/workspace/add-users.d.ts.map +1 -0
- package/dist/commands/workspace/add-users.js +154 -0
- package/dist/commands/workspace/add-users.js.map +1 -0
- package/dist/commands/workspace/create.d.ts +59 -0
- package/dist/commands/workspace/create.d.ts.map +1 -0
- package/dist/commands/workspace/create.js +163 -0
- package/dist/commands/workspace/create.js.map +1 -0
- package/dist/commands/workspace/delete.d.ts +67 -0
- package/dist/commands/workspace/delete.d.ts.map +1 -0
- package/dist/commands/workspace/delete.js +182 -0
- package/dist/commands/workspace/delete.js.map +1 -0
- package/dist/commands/workspace/folders.d.ts +40 -0
- package/dist/commands/workspace/folders.d.ts.map +1 -0
- package/dist/commands/workspace/folders.js +124 -0
- package/dist/commands/workspace/folders.js.map +1 -0
- package/dist/commands/workspace/get.d.ts +35 -0
- package/dist/commands/workspace/get.d.ts.map +1 -0
- package/dist/commands/workspace/get.js +62 -0
- package/dist/commands/workspace/get.js.map +1 -0
- package/dist/commands/workspace/list.d.ts +57 -0
- package/dist/commands/workspace/list.d.ts.map +1 -0
- package/dist/commands/workspace/list.js +125 -0
- package/dist/commands/workspace/list.js.map +1 -0
- package/dist/commands/workspace/remove-users.d.ts +47 -0
- package/dist/commands/workspace/remove-users.d.ts.map +1 -0
- package/dist/commands/workspace/remove-users.js +122 -0
- package/dist/commands/workspace/remove-users.js.map +1 -0
- package/dist/commands/workspace/update.d.ts +68 -0
- package/dist/commands/workspace/update.d.ts.map +1 -0
- package/dist/commands/workspace/update.js +237 -0
- package/dist/commands/workspace/update.js.map +1 -0
- package/dist/config/load.d.ts +33 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +81 -0
- package/dist/config/load.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types/global-flags.d.ts +69 -0
- package/dist/types/global-flags.d.ts.map +1 -0
- package/dist/types/global-flags.js +170 -0
- package/dist/types/global-flags.js.map +1 -0
- package/dist/types/ids.d.ts +38 -0
- package/dist/types/ids.d.ts.map +1 -0
- package/dist/types/ids.js +51 -0
- package/dist/types/ids.js.map +1 -0
- package/dist/types/json.d.ts +60 -0
- package/dist/types/json.d.ts.map +1 -0
- package/dist/types/json.js +33 -0
- package/dist/types/json.js.map +1 -0
- package/dist/utils/errors.d.ts +121 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +264 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +39 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +49 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output/envelope.d.ts +140 -0
- package/dist/utils/output/envelope.d.ts.map +1 -0
- package/dist/utils/output/envelope.js +120 -0
- package/dist/utils/output/envelope.js.map +1 -0
- package/dist/utils/output/json.d.ts +10 -0
- package/dist/utils/output/json.d.ts.map +1 -0
- package/dist/utils/output/json.js +12 -0
- package/dist/utils/output/json.js.map +1 -0
- package/dist/utils/output/ndjson.d.ts +92 -0
- package/dist/utils/output/ndjson.d.ts.map +1 -0
- package/dist/utils/output/ndjson.js +33 -0
- package/dist/utils/output/ndjson.js.map +1 -0
- package/dist/utils/output/select.d.ts +22 -0
- package/dist/utils/output/select.d.ts.map +1 -0
- package/dist/utils/output/select.js +47 -0
- package/dist/utils/output/select.js.map +1 -0
- package/dist/utils/output/table.d.ts +32 -0
- package/dist/utils/output/table.d.ts.map +1 -0
- package/dist/utils/output/table.js +133 -0
- package/dist/utils/output/table.js.map +1 -0
- package/dist/utils/output/text.d.ts +5 -0
- package/dist/utils/output/text.d.ts.map +1 -0
- package/dist/utils/output/text.js +32 -0
- package/dist/utils/output/text.js.map +1 -0
- package/dist/utils/parse-boundary.d.ts +53 -0
- package/dist/utils/parse-boundary.d.ts.map +1 -0
- package/dist/utils/parse-boundary.js +62 -0
- package/dist/utils/parse-boundary.js.map +1 -0
- package/dist/utils/redact.d.ts +54 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +154 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/request-id.d.ts +17 -0
- package/dist/utils/request-id.d.ts.map +1 -0
- package/dist/utils/request-id.js +26 -0
- package/dist/utils/request-id.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response-root field assertion (R41 lift, v0.2-plan §22).
|
|
3
|
+
*
|
|
4
|
+
* Distinguishes "key absent" (response-shape drift →
|
|
5
|
+
* `internal_error`, whole-call) from "value null" (resource missing
|
|
6
|
+
* / can't be applied → `not_found`, per-record). Codex M14 round-2
|
|
7
|
+
* F1 + round-3 F1 pinned the contract; R41 lifts the inline helpers
|
|
8
|
+
* that workspace add-users / workspace remove-users / board add-
|
|
9
|
+
* users each ship verbatim.
|
|
10
|
+
*
|
|
11
|
+
* **Why distinct from `assertUpdateMutationPresent`**
|
|
12
|
+
* (`api/update-mutation-result.ts`). M13's helper handles null /
|
|
13
|
+
* undefined uniformly with `not_found` — pre-dating the M14
|
|
14
|
+
* missing-root-key vs null-value distinction. R42 (retroactive
|
|
15
|
+
* sweep across pre-M14 mutation verbs) handles unifying them; R41
|
|
16
|
+
* stays scoped to the M14 + M15 partial-success-fan-out family.
|
|
17
|
+
*
|
|
18
|
+
* **Used by:** `commands/workspace/add-users.ts` /
|
|
19
|
+
* `commands/workspace/remove-users.ts` / `commands/board/add-users.ts`.
|
|
20
|
+
*
|
|
21
|
+
* **Not used by:** single-target mutation verbs (board create /
|
|
22
|
+
* update / archive / delete / duplicate, workspace create / update /
|
|
23
|
+
* delete) — those carry their own per-verb missing-root-key checks
|
|
24
|
+
* because the contract is "every successful call returns the
|
|
25
|
+
* resource" rather than "value null is a per-record path"; the
|
|
26
|
+
* single-target verbs never throw `not_found` from the inline check
|
|
27
|
+
* (the per-verb projector does that on the unwrapped value).
|
|
28
|
+
*/
|
|
29
|
+
export interface AssertResponseFieldPresentInputs {
|
|
30
|
+
/** The parsed response data object (after the wire-shape parse). */
|
|
31
|
+
readonly data: Readonly<Record<string, unknown>>;
|
|
32
|
+
/** The mutation root key name (e.g. `'add_users_to_board'`). */
|
|
33
|
+
readonly key: string;
|
|
34
|
+
/** The operation label for `internal_error` messages
|
|
35
|
+
* (e.g. `'BoardAddUsers'`). Distinct from `key` because the
|
|
36
|
+
* GraphQL operation name is human-readable PascalCase whereas
|
|
37
|
+
* `key` is the snake_case mutation field. */
|
|
38
|
+
readonly operationLabel: string;
|
|
39
|
+
/** The scope-id detail key (`'workspace_id'` or `'board_id'`). */
|
|
40
|
+
readonly scopeKey: string;
|
|
41
|
+
/** The scope-id value (the workspace or board ID). */
|
|
42
|
+
readonly scopeId: string;
|
|
43
|
+
/** The target-id detail key (always `'user_id'` in M14/M15
|
|
44
|
+
* partial-success-fan-out verbs; future verbs may use other
|
|
45
|
+
* targets — keep this parameterised for forward-compat). */
|
|
46
|
+
readonly targetKey: string;
|
|
47
|
+
/** The target-id value (the user ID for the current dispatch
|
|
48
|
+
* iteration). */
|
|
49
|
+
readonly targetId: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Throws `ApiError('internal_error')` when `key` is absent from
|
|
53
|
+
* `data`; throws `ApiError('not_found')` when present but null.
|
|
54
|
+
* Returns void on success. The caller's downstream code can rely
|
|
55
|
+
* on `data[key]` being a non-null value after this call.
|
|
56
|
+
*
|
|
57
|
+
* Distinct error codes per the M14 round-2 F1 / round-3 F1
|
|
58
|
+
* contract — `dispatchSequential` re-throws `internal_error`
|
|
59
|
+
* (whole-call schema drift) but lets `not_found` land in the
|
|
60
|
+
* per-record slot. Without this distinction, a per-record
|
|
61
|
+
* not_found could be produced from a schema-drift response,
|
|
62
|
+
* masking the contract violation.
|
|
63
|
+
*/
|
|
64
|
+
export declare const assertResponseFieldPresent: (inputs: AssertResponseFieldPresentInputs) => void;
|
|
65
|
+
//# sourceMappingURL=response-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-root.d.ts","sourceRoot":"","sources":["../../src/api/response-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,MAAM,WAAW,gCAAgC;IAC/C,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;iDAG6C;IAC7C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;gEAE4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;qBACiB;IACjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,GACrC,QAAQ,gCAAgC,KACvC,IA2BF,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response-root field assertion (R41 lift, v0.2-plan §22).
|
|
3
|
+
*
|
|
4
|
+
* Distinguishes "key absent" (response-shape drift →
|
|
5
|
+
* `internal_error`, whole-call) from "value null" (resource missing
|
|
6
|
+
* / can't be applied → `not_found`, per-record). Codex M14 round-2
|
|
7
|
+
* F1 + round-3 F1 pinned the contract; R41 lifts the inline helpers
|
|
8
|
+
* that workspace add-users / workspace remove-users / board add-
|
|
9
|
+
* users each ship verbatim.
|
|
10
|
+
*
|
|
11
|
+
* **Why distinct from `assertUpdateMutationPresent`**
|
|
12
|
+
* (`api/update-mutation-result.ts`). M13's helper handles null /
|
|
13
|
+
* undefined uniformly with `not_found` — pre-dating the M14
|
|
14
|
+
* missing-root-key vs null-value distinction. R42 (retroactive
|
|
15
|
+
* sweep across pre-M14 mutation verbs) handles unifying them; R41
|
|
16
|
+
* stays scoped to the M14 + M15 partial-success-fan-out family.
|
|
17
|
+
*
|
|
18
|
+
* **Used by:** `commands/workspace/add-users.ts` /
|
|
19
|
+
* `commands/workspace/remove-users.ts` / `commands/board/add-users.ts`.
|
|
20
|
+
*
|
|
21
|
+
* **Not used by:** single-target mutation verbs (board create /
|
|
22
|
+
* update / archive / delete / duplicate, workspace create / update /
|
|
23
|
+
* delete) — those carry their own per-verb missing-root-key checks
|
|
24
|
+
* because the contract is "every successful call returns the
|
|
25
|
+
* resource" rather than "value null is a per-record path"; the
|
|
26
|
+
* single-target verbs never throw `not_found` from the inline check
|
|
27
|
+
* (the per-verb projector does that on the unwrapped value).
|
|
28
|
+
*/
|
|
29
|
+
import { ApiError } from '../utils/errors.js';
|
|
30
|
+
/**
|
|
31
|
+
* Throws `ApiError('internal_error')` when `key` is absent from
|
|
32
|
+
* `data`; throws `ApiError('not_found')` when present but null.
|
|
33
|
+
* Returns void on success. The caller's downstream code can rely
|
|
34
|
+
* on `data[key]` being a non-null value after this call.
|
|
35
|
+
*
|
|
36
|
+
* Distinct error codes per the M14 round-2 F1 / round-3 F1
|
|
37
|
+
* contract — `dispatchSequential` re-throws `internal_error`
|
|
38
|
+
* (whole-call schema drift) but lets `not_found` land in the
|
|
39
|
+
* per-record slot. Without this distinction, a per-record
|
|
40
|
+
* not_found could be produced from a schema-drift response,
|
|
41
|
+
* masking the contract violation.
|
|
42
|
+
*/
|
|
43
|
+
export const assertResponseFieldPresent = (inputs) => {
|
|
44
|
+
const { data, key, operationLabel, scopeKey, scopeId, targetKey, targetId } = inputs;
|
|
45
|
+
if (!(key in data)) {
|
|
46
|
+
throw new ApiError('internal_error', `Monday's ${operationLabel} response is missing the ${key} root field`, {
|
|
47
|
+
details: {
|
|
48
|
+
[scopeKey]: scopeId,
|
|
49
|
+
[targetKey]: targetId,
|
|
50
|
+
hint: 'this is a schema-drift error in Monday\'s GraphQL response; ' +
|
|
51
|
+
'verify the mutation declaration and update the response ' +
|
|
52
|
+
'schema if Monday\'s contract has changed.',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const raw = data[key];
|
|
57
|
+
if (raw === null || raw === undefined) {
|
|
58
|
+
throw new ApiError('not_found', `Monday returned no payload from ${key} for ${targetKey.replace(/_id$/u, '')} ${targetId}`, { details: { [targetKey]: targetId } });
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=response-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-root.js","sourceRoot":"","sources":["../../src/api/response-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAyB9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,MAAwC,EAClC,EAAE;IACR,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GACzE,MAAM,CAAC;IACT,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,QAAQ,CAChB,gBAAgB,EAChB,YAAY,cAAc,4BAA4B,GAAG,aAAa,EACtE;YACE,OAAO,EAAE;gBACP,CAAC,QAAQ,CAAC,EAAE,OAAO;gBACnB,CAAC,SAAS,CAAC,EAAE,QAAQ;gBACrB,IAAI,EACF,8DAA8D;oBAC9D,0DAA0D;oBAC1D,2CAA2C;aAC9C;SACF,CACF,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,QAAQ,CAChB,WAAW,EACX,mCAAmC,GAAG,QAAQ,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,QAAQ,EAAE,EAC1F,EAAE,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,CACvC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry layer for the Monday API client (`v0.1-plan.md` §3 M2,
|
|
3
|
+
* `cli-design.md` §2.5 retry behaviour).
|
|
4
|
+
*
|
|
5
|
+
* `withRetry(thunk, options)` invokes `thunk` until it returns
|
|
6
|
+
* successfully, the abort signal fires, or the retry budget is
|
|
7
|
+
* exhausted. Failures are inspected via the typed `MondayCliError`
|
|
8
|
+
* shape:
|
|
9
|
+
*
|
|
10
|
+
* - `error.retryable === false` → re-throw immediately.
|
|
11
|
+
* - `error.retryAfterSeconds` set → sleep that long (clamped to
|
|
12
|
+
* `maxBackoffMs`) before the next attempt.
|
|
13
|
+
* - Otherwise → exponential backoff with jitter, doubling per
|
|
14
|
+
* attempt up to `maxBackoffMs`.
|
|
15
|
+
*
|
|
16
|
+
* The retry count is exposed on `RetryStats` so the caller can
|
|
17
|
+
* surface attempt totals in `--verbose` output and so a regression
|
|
18
|
+
* test can assert "exactly N attempts for a `retryable: true`
|
|
19
|
+
* failure". The latter catches any future SDK update that
|
|
20
|
+
* re-introduces an internal retry layer (`v0.1-plan.md` risk
|
|
21
|
+
* register: "SDK retry double-counting"). Today's SDK
|
|
22
|
+
* (`graphql-request@6.1.0`) has no built-in retry — we still bake
|
|
23
|
+
* the assertion in so it stays true.
|
|
24
|
+
*
|
|
25
|
+
* The thunk receives the current `attempt` (0-indexed) so the API
|
|
26
|
+
* client can include it in debug logs / fixture matchers (e.g. a
|
|
27
|
+
* cassette can assert the second attempt sees the same headers).
|
|
28
|
+
*/
|
|
29
|
+
import { MondayCliError } from '../utils/errors.js';
|
|
30
|
+
export interface RetryOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Maximum number of *retries* — i.e. additional attempts after the
|
|
33
|
+
* first call. A value of `3` means up to 4 total transport calls.
|
|
34
|
+
* Comes from `--retry` (default 3).
|
|
35
|
+
*/
|
|
36
|
+
readonly retries: number;
|
|
37
|
+
/**
|
|
38
|
+
* Caps the backoff we'll wait between attempts. Honoured even when
|
|
39
|
+
* `retry_after_seconds` requests longer; the design avoids a
|
|
40
|
+
* runaway 60s sleep on a single retry by clamping to the cap and
|
|
41
|
+
* returning the next failure faster.
|
|
42
|
+
*/
|
|
43
|
+
readonly maxBackoffMs?: number;
|
|
44
|
+
/** Initial backoff — doubled per attempt, jittered. Default 200ms. */
|
|
45
|
+
readonly baseBackoffMs?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Source of randomness for the jitter. Tests pass a deterministic
|
|
48
|
+
* value (`() => 0.5`) so the sleep schedule is reproducible.
|
|
49
|
+
*/
|
|
50
|
+
readonly random?: () => number;
|
|
51
|
+
/**
|
|
52
|
+
* Sleep implementation. Tests pass a fast / instant impl
|
|
53
|
+
* (`(ms) => Promise.resolve()`) so the retry cycle doesn't spend
|
|
54
|
+
* real wall-clock seconds.
|
|
55
|
+
*/
|
|
56
|
+
readonly sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Cancellation source. When the signal fires mid-backoff, the
|
|
59
|
+
* outstanding sleep rejects and the retry loop bails — `withRetry`
|
|
60
|
+
* surfaces the underlying `MondayCliError` (or a synthetic abort
|
|
61
|
+
* one) without making another attempt.
|
|
62
|
+
*/
|
|
63
|
+
readonly signal: AbortSignal;
|
|
64
|
+
}
|
|
65
|
+
export interface RetryStats {
|
|
66
|
+
/**
|
|
67
|
+
* Total number of times the thunk was invoked. `1` means the first
|
|
68
|
+
* call succeeded; `>= 2` means at least one retry was applied.
|
|
69
|
+
*/
|
|
70
|
+
readonly attempts: number;
|
|
71
|
+
/**
|
|
72
|
+
* Cumulative milliseconds spent sleeping between attempts. Useful
|
|
73
|
+
* for the `--verbose` complexity hint and for diagnosing slow
|
|
74
|
+
* retries in production.
|
|
75
|
+
*/
|
|
76
|
+
readonly totalBackoffMs: number;
|
|
77
|
+
}
|
|
78
|
+
export interface RetryResult<T> {
|
|
79
|
+
readonly value: T;
|
|
80
|
+
readonly stats: RetryStats;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Computes the delay before the next attempt. Honours
|
|
84
|
+
* `retry_after_seconds` when present (clamped to `maxBackoffMs`),
|
|
85
|
+
* otherwise grows exponentially: `baseBackoffMs * 2 ** attempt` with
|
|
86
|
+
* ±50% jitter.
|
|
87
|
+
*
|
|
88
|
+
* Exported so the unit suite can snapshot the curve and so a future
|
|
89
|
+
* caller-side decorator (e.g. a CI runner that wants to log "next
|
|
90
|
+
* attempt in N ms") can reuse the same algorithm.
|
|
91
|
+
*/
|
|
92
|
+
export declare const computeBackoffMs: (attempt: number, err: MondayCliError, opts: {
|
|
93
|
+
readonly baseBackoffMs: number;
|
|
94
|
+
readonly maxBackoffMs: number;
|
|
95
|
+
readonly random: () => number;
|
|
96
|
+
}) => number;
|
|
97
|
+
/**
|
|
98
|
+
* Calls `thunk` until it succeeds or the budget is exhausted.
|
|
99
|
+
*
|
|
100
|
+
* Throwing semantics:
|
|
101
|
+
* - On final success: returns `{ value, stats }`.
|
|
102
|
+
* - On a non-retryable error: rethrows the original error.
|
|
103
|
+
* - On a retryable error after budget exhaustion: rethrows the
|
|
104
|
+
* *last* error with `details.attempts` set to the total count, so
|
|
105
|
+
* agents can see how many times the CLI tried.
|
|
106
|
+
* - On abort (signal fired): rethrows an `ApiError(internal_error)`
|
|
107
|
+
* tagged `aborted: true` (the runner inspects `signal.reason` and
|
|
108
|
+
* decides 130 vs 2). Throwing here keeps the flow uniform — the
|
|
109
|
+
* caller doesn't have to special-case mid-sleep cancellation.
|
|
110
|
+
*/
|
|
111
|
+
export declare const withRetry: <T>(thunk: (attempt: number) => Promise<T>, options: RetryOptions) => Promise<RetryResult<T>>;
|
|
112
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/api/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAkCD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,MAAM,EACf,KAAK,cAAc,EACnB,MAAM;IACJ,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC;CAC/B,KACA,MASF,CAAC;AAyBF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS,GAAU,CAAC,EAC/B,OAAO,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,SAAS,YAAY,KACpB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAsExB,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry layer for the Monday API client (`v0.1-plan.md` §3 M2,
|
|
3
|
+
* `cli-design.md` §2.5 retry behaviour).
|
|
4
|
+
*
|
|
5
|
+
* `withRetry(thunk, options)` invokes `thunk` until it returns
|
|
6
|
+
* successfully, the abort signal fires, or the retry budget is
|
|
7
|
+
* exhausted. Failures are inspected via the typed `MondayCliError`
|
|
8
|
+
* shape:
|
|
9
|
+
*
|
|
10
|
+
* - `error.retryable === false` → re-throw immediately.
|
|
11
|
+
* - `error.retryAfterSeconds` set → sleep that long (clamped to
|
|
12
|
+
* `maxBackoffMs`) before the next attempt.
|
|
13
|
+
* - Otherwise → exponential backoff with jitter, doubling per
|
|
14
|
+
* attempt up to `maxBackoffMs`.
|
|
15
|
+
*
|
|
16
|
+
* The retry count is exposed on `RetryStats` so the caller can
|
|
17
|
+
* surface attempt totals in `--verbose` output and so a regression
|
|
18
|
+
* test can assert "exactly N attempts for a `retryable: true`
|
|
19
|
+
* failure". The latter catches any future SDK update that
|
|
20
|
+
* re-introduces an internal retry layer (`v0.1-plan.md` risk
|
|
21
|
+
* register: "SDK retry double-counting"). Today's SDK
|
|
22
|
+
* (`graphql-request@6.1.0`) has no built-in retry — we still bake
|
|
23
|
+
* the assertion in so it stays true.
|
|
24
|
+
*
|
|
25
|
+
* The thunk receives the current `attempt` (0-indexed) so the API
|
|
26
|
+
* client can include it in debug logs / fixture matchers (e.g. a
|
|
27
|
+
* cassette can assert the second attempt sees the same headers).
|
|
28
|
+
*/
|
|
29
|
+
import { ApiError, MondayCliError } from '../utils/errors.js';
|
|
30
|
+
const defaultSleep = (ms, signal) => new Promise((resolve, reject) => {
|
|
31
|
+
if (signal.aborted) {
|
|
32
|
+
reject(signalAbortError(signal));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const timer = setTimeout(() => {
|
|
36
|
+
signal.removeEventListener('abort', onAbort);
|
|
37
|
+
resolve();
|
|
38
|
+
}, ms);
|
|
39
|
+
const onAbort = () => {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
reject(signalAbortError(signal));
|
|
42
|
+
};
|
|
43
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
44
|
+
});
|
|
45
|
+
const signalAbortError = (signal) => {
|
|
46
|
+
const reason = signal.reason;
|
|
47
|
+
if (reason instanceof Error) {
|
|
48
|
+
return reason;
|
|
49
|
+
}
|
|
50
|
+
// Match Web Platform behaviour: a DOMException-style AbortError
|
|
51
|
+
// surface so callers can `.name === 'AbortError'` if they want.
|
|
52
|
+
const err = new Error(typeof reason === 'string' ? reason : 'aborted');
|
|
53
|
+
err.name = 'AbortError';
|
|
54
|
+
return err;
|
|
55
|
+
};
|
|
56
|
+
const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
57
|
+
/**
|
|
58
|
+
* Computes the delay before the next attempt. Honours
|
|
59
|
+
* `retry_after_seconds` when present (clamped to `maxBackoffMs`),
|
|
60
|
+
* otherwise grows exponentially: `baseBackoffMs * 2 ** attempt` with
|
|
61
|
+
* ±50% jitter.
|
|
62
|
+
*
|
|
63
|
+
* Exported so the unit suite can snapshot the curve and so a future
|
|
64
|
+
* caller-side decorator (e.g. a CI runner that wants to log "next
|
|
65
|
+
* attempt in N ms") can reuse the same algorithm.
|
|
66
|
+
*/
|
|
67
|
+
export const computeBackoffMs = (attempt, err, opts) => {
|
|
68
|
+
if (err.retryAfterSeconds !== undefined) {
|
|
69
|
+
return clamp(err.retryAfterSeconds * 1000, 0, opts.maxBackoffMs);
|
|
70
|
+
}
|
|
71
|
+
// Exponential backoff: base * 2^attempt, ±50% jitter so simultaneous
|
|
72
|
+
// clients don't synchronise.
|
|
73
|
+
const exp = opts.baseBackoffMs * 2 ** attempt;
|
|
74
|
+
const jitterFactor = 0.5 + opts.random(); // [0.5, 1.5)
|
|
75
|
+
return clamp(exp * jitterFactor, 0, opts.maxBackoffMs);
|
|
76
|
+
};
|
|
77
|
+
const isRetryable = (err) => err instanceof MondayCliError && err.retryable;
|
|
78
|
+
const wrapAbortAsApiError = (signal, attempt) => {
|
|
79
|
+
// The runner attaches a tagged reason; preserve it so callers can
|
|
80
|
+
// distinguish SIGINT from timeout. We don't *map* SIGINT to a code
|
|
81
|
+
// here — the runner short-circuits before any envelope is emitted —
|
|
82
|
+
// but a test that drives an explicit cancel still gets a typed
|
|
83
|
+
// throwable.
|
|
84
|
+
const reason = signal.reason;
|
|
85
|
+
const cause = reason;
|
|
86
|
+
const message = reason instanceof Error
|
|
87
|
+
? reason.message
|
|
88
|
+
: typeof reason === 'string'
|
|
89
|
+
? reason
|
|
90
|
+
: `aborted after ${String(attempt)} attempt${attempt === 1 ? '' : 's'}`;
|
|
91
|
+
return new ApiError('internal_error', message, {
|
|
92
|
+
cause,
|
|
93
|
+
details: { aborted: true, attempts: attempt },
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Calls `thunk` until it succeeds or the budget is exhausted.
|
|
98
|
+
*
|
|
99
|
+
* Throwing semantics:
|
|
100
|
+
* - On final success: returns `{ value, stats }`.
|
|
101
|
+
* - On a non-retryable error: rethrows the original error.
|
|
102
|
+
* - On a retryable error after budget exhaustion: rethrows the
|
|
103
|
+
* *last* error with `details.attempts` set to the total count, so
|
|
104
|
+
* agents can see how many times the CLI tried.
|
|
105
|
+
* - On abort (signal fired): rethrows an `ApiError(internal_error)`
|
|
106
|
+
* tagged `aborted: true` (the runner inspects `signal.reason` and
|
|
107
|
+
* decides 130 vs 2). Throwing here keeps the flow uniform — the
|
|
108
|
+
* caller doesn't have to special-case mid-sleep cancellation.
|
|
109
|
+
*/
|
|
110
|
+
export const withRetry = async (thunk, options) => {
|
|
111
|
+
const baseBackoffMs = options.baseBackoffMs ?? 200;
|
|
112
|
+
const maxBackoffMs = options.maxBackoffMs ?? 30_000;
|
|
113
|
+
const random = options.random ?? Math.random;
|
|
114
|
+
const sleep = options.sleep ?? defaultSleep;
|
|
115
|
+
const { signal, retries } = options;
|
|
116
|
+
// Read `signal.aborted` via a helper so the TS narrowing on the
|
|
117
|
+
// initial check at top-of-loop doesn't lock the type into `false`
|
|
118
|
+
// — the runtime value can flip between attempts when the thunk's
|
|
119
|
+
// own abort fires the signal mid-call.
|
|
120
|
+
const isAborted = () => signal.aborted;
|
|
121
|
+
let totalBackoffMs = 0;
|
|
122
|
+
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
123
|
+
if (isAborted()) {
|
|
124
|
+
throw wrapAbortAsApiError(signal, attempt);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const value = await thunk(attempt);
|
|
128
|
+
return { value, stats: { attempts: attempt + 1, totalBackoffMs } };
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
if (isAborted()) {
|
|
132
|
+
throw wrapAbortAsApiError(signal, attempt + 1);
|
|
133
|
+
}
|
|
134
|
+
if (!isRetryable(err)) {
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
if (attempt === retries) {
|
|
138
|
+
// Decorate the final error with the attempt count so the
|
|
139
|
+
// envelope carries it without losing the original code.
|
|
140
|
+
const decorated = new ApiError(err.code, err.message, {
|
|
141
|
+
cause: err.cause ?? err,
|
|
142
|
+
...(err.httpStatus === undefined ? {} : { httpStatus: err.httpStatus }),
|
|
143
|
+
...(err.mondayCode === undefined ? {} : { mondayCode: err.mondayCode }),
|
|
144
|
+
...(err.requestId === undefined ? {} : { requestId: err.requestId }),
|
|
145
|
+
retryable: err.retryable,
|
|
146
|
+
...(err.retryAfterSeconds === undefined
|
|
147
|
+
? {}
|
|
148
|
+
: { retryAfterSeconds: err.retryAfterSeconds }),
|
|
149
|
+
details: {
|
|
150
|
+
...(err.details ?? {}),
|
|
151
|
+
attempts: attempt + 1,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
throw decorated;
|
|
155
|
+
}
|
|
156
|
+
const backoffMs = computeBackoffMs(attempt, err, {
|
|
157
|
+
baseBackoffMs,
|
|
158
|
+
maxBackoffMs,
|
|
159
|
+
random,
|
|
160
|
+
});
|
|
161
|
+
totalBackoffMs += backoffMs;
|
|
162
|
+
try {
|
|
163
|
+
await sleep(backoffMs, signal);
|
|
164
|
+
}
|
|
165
|
+
catch (sleepErr) {
|
|
166
|
+
// Cancelled mid-backoff — the signal fired during the wait.
|
|
167
|
+
// Surface the abort so the runner / caller can decide on
|
|
168
|
+
// exit code rather than continuing the loop.
|
|
169
|
+
if (sleepErr instanceof MondayCliError) {
|
|
170
|
+
throw sleepErr;
|
|
171
|
+
}
|
|
172
|
+
throw wrapAbortAsApiError(signal, attempt + 1);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Unreachable — the loop returns or throws; the type checker still
|
|
177
|
+
// wants a guarantee.
|
|
178
|
+
/* c8 ignore next */
|
|
179
|
+
throw new ApiError('internal_error', 'retry loop fell through');
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/api/retry.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--set <col>=<val>` argv splitter, shared by `item set` / `item update`
|
|
3
|
+
* (single + bulk) / `item create`.
|
|
4
|
+
*
|
|
5
|
+
* Per cli-design §5.3 lines 712-715: split on the FIRST `=`. Tokens with
|
|
6
|
+
* `=` in the title need shell quoting plus the explicit `id:` / `title:`
|
|
7
|
+
* prefix or `--filter-json`-style escape. An empty token raises
|
|
8
|
+
* `usage_error`; an empty value (`status=`) is accepted at this layer
|
|
9
|
+
* and propagated to the per-type translator which decides whether to
|
|
10
|
+
* accept (e.g. `status= ` becomes `{label: ""}`) or reject (dropdown
|
|
11
|
+
* empty-input rejects per `column-values.ts`).
|
|
12
|
+
*
|
|
13
|
+
* Lifted from three identical 12-line copies (`set.ts`, `update.ts`,
|
|
14
|
+
* `create.ts`) — see v0.2-plan §12 R22. The sibling `parseSetRawExpression`
|
|
15
|
+
* in `raw-write.ts` shares the same first-`=` rule but layers JSON-object
|
|
16
|
+
* parsing on top, so it stays where it is.
|
|
17
|
+
*/
|
|
18
|
+
export interface SetExpression {
|
|
19
|
+
readonly token: string;
|
|
20
|
+
readonly value: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const splitSetExpression: (raw: string) => SetExpression;
|
|
23
|
+
//# sourceMappingURL=set-expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-expression.d.ts","sourceRoot":"","sources":["../../src/api/set-expression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,aAchD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--set <col>=<val>` argv splitter, shared by `item set` / `item update`
|
|
3
|
+
* (single + bulk) / `item create`.
|
|
4
|
+
*
|
|
5
|
+
* Per cli-design §5.3 lines 712-715: split on the FIRST `=`. Tokens with
|
|
6
|
+
* `=` in the title need shell quoting plus the explicit `id:` / `title:`
|
|
7
|
+
* prefix or `--filter-json`-style escape. An empty token raises
|
|
8
|
+
* `usage_error`; an empty value (`status=`) is accepted at this layer
|
|
9
|
+
* and propagated to the per-type translator which decides whether to
|
|
10
|
+
* accept (e.g. `status= ` becomes `{label: ""}`) or reject (dropdown
|
|
11
|
+
* empty-input rejects per `column-values.ts`).
|
|
12
|
+
*
|
|
13
|
+
* Lifted from three identical 12-line copies (`set.ts`, `update.ts`,
|
|
14
|
+
* `create.ts`) — see v0.2-plan §12 R22. The sibling `parseSetRawExpression`
|
|
15
|
+
* in `raw-write.ts` shares the same first-`=` rule but layers JSON-object
|
|
16
|
+
* parsing on top, so it stays where it is.
|
|
17
|
+
*/
|
|
18
|
+
import { UsageError } from '../utils/errors.js';
|
|
19
|
+
export const splitSetExpression = (raw) => {
|
|
20
|
+
const idx = raw.indexOf('=');
|
|
21
|
+
if (idx <= 0) {
|
|
22
|
+
throw new UsageError(`--set: expected <col>=<val> (got ${JSON.stringify(raw)}); ` +
|
|
23
|
+
`use shell quoting and the id:/title: prefix when the column ` +
|
|
24
|
+
`token contains "="`, { details: { input: raw } });
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
token: raw.slice(0, idx),
|
|
28
|
+
value: raw.slice(idx + 1),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=set-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-expression.js","sourceRoot":"","sources":["../../src/api/set-expression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAiB,EAAE;IAC/D,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACb,MAAM,IAAI,UAAU,CAClB,oCAAoC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK;YAC1D,8DAA8D;YAC9D,oBAAoB,EACtB,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAC5B,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QACxB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;KAC1B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-page deterministic sort (`cli-design.md` §3.1 #8, `v0.1-plan.md`
|
|
3
|
+
* §3 M4).
|
|
4
|
+
*
|
|
5
|
+
* Lists default to "by ID, ascending" regardless of Monday's response
|
|
6
|
+
* order. The seam lives here so `item list` (cursor-paginated),
|
|
7
|
+
* `item search`, and `item subitems` all share a single
|
|
8
|
+
* implementation — and so the M5b dry-run engine can sort its
|
|
9
|
+
* `planned_changes` array against the same rule when bulk operations
|
|
10
|
+
* are involved.
|
|
11
|
+
*
|
|
12
|
+
* **Per-page only, by design.** Cursor pagination delivers a stable
|
|
13
|
+
* page-by-page walk but Monday doesn't promise the cross-page order
|
|
14
|
+
* is ID-ascending. Sorting *within* a page is cheap and gives agents
|
|
15
|
+
* a stable shape to assert against (snapshot tests, fixture diffs);
|
|
16
|
+
* trying to sort across pages would either require collecting every
|
|
17
|
+
* page in memory (defeats NDJSON streaming) or a server-side
|
|
18
|
+
* `order_by` clause the agent can already pass via `--filter-json`.
|
|
19
|
+
* The §5.6 caveat documents this; the helper keeps the per-page
|
|
20
|
+
* scope explicit.
|
|
21
|
+
*
|
|
22
|
+
* **Sort key: numeric ID.** Monday's item / board / user / workspace
|
|
23
|
+
* IDs are decimal strings that can exceed `Number.MAX_SAFE_INTEGER`
|
|
24
|
+
* for older accounts (`cli-design.md` §6.2 — "IDs are always
|
|
25
|
+
* strings"). Lex sort is wrong (`"9" > "10"` in JS string compare);
|
|
26
|
+
* `Number.parseInt` is wrong for IDs past 2^53. We compare on the
|
|
27
|
+
* tuple `(length, lexicographic)` — same-length decimal strings
|
|
28
|
+
* sort numerically by lex compare, and shorter strings always
|
|
29
|
+
* represent smaller numbers (no leading zeros on Monday IDs). That's
|
|
30
|
+
* the same trick `findOne`'s `--first` selector uses (see
|
|
31
|
+
* `src/api/resolvers.ts`); centralising here means a future ID-kind
|
|
32
|
+
* with leading-zero conventions surfaces as one bug, not many.
|
|
33
|
+
*
|
|
34
|
+
* Stable sort: `Array.prototype.sort` is stable in V8 / Node ≥ 12,
|
|
35
|
+
* so tied IDs keep arrival order. The helper doesn't fall back to a
|
|
36
|
+
* second key.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Compares two decimal-string IDs as if they were numeric. Returns
|
|
40
|
+
* a negative / zero / positive number suitable for `Array#sort`.
|
|
41
|
+
* Exported for unit tests and for callers that want to thread the
|
|
42
|
+
* comparator into their own collection (e.g. `findOne`'s `--first`
|
|
43
|
+
* selector — see `resolvers.ts`).
|
|
44
|
+
*/
|
|
45
|
+
export declare const compareNumericId: (a: string, b: string) => number;
|
|
46
|
+
/**
|
|
47
|
+
* Sorts a page of resources by their ID ascending. Pure — returns a
|
|
48
|
+
* new array, leaves the input untouched. Caller passes the projector
|
|
49
|
+
* because items / boards / etc. all expose `id` differently in
|
|
50
|
+
* fixture form (`{id}` vs `{node:{id}}` for paginated edges).
|
|
51
|
+
*
|
|
52
|
+
* Empty input is fine: returns `[]`. Single-element input is fine:
|
|
53
|
+
* returns a copy. Bypassing the sort entirely on small inputs is
|
|
54
|
+
* tempting but the cost is zero on the hot path and the regression
|
|
55
|
+
* surface is shorter when every shape goes through the same
|
|
56
|
+
* comparator.
|
|
57
|
+
*/
|
|
58
|
+
export declare const sortByIdAsc: <T>(items: readonly T[], getId: (t: T) => string) => readonly T[];
|
|
59
|
+
//# sourceMappingURL=sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/api/sort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAUvD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAC3B,OAAO,SAAS,CAAC,EAAE,EACnB,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,KACtB,SAAS,CAAC,EAEZ,CAAC"}
|
package/dist/api/sort.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-page deterministic sort (`cli-design.md` §3.1 #8, `v0.1-plan.md`
|
|
3
|
+
* §3 M4).
|
|
4
|
+
*
|
|
5
|
+
* Lists default to "by ID, ascending" regardless of Monday's response
|
|
6
|
+
* order. The seam lives here so `item list` (cursor-paginated),
|
|
7
|
+
* `item search`, and `item subitems` all share a single
|
|
8
|
+
* implementation — and so the M5b dry-run engine can sort its
|
|
9
|
+
* `planned_changes` array against the same rule when bulk operations
|
|
10
|
+
* are involved.
|
|
11
|
+
*
|
|
12
|
+
* **Per-page only, by design.** Cursor pagination delivers a stable
|
|
13
|
+
* page-by-page walk but Monday doesn't promise the cross-page order
|
|
14
|
+
* is ID-ascending. Sorting *within* a page is cheap and gives agents
|
|
15
|
+
* a stable shape to assert against (snapshot tests, fixture diffs);
|
|
16
|
+
* trying to sort across pages would either require collecting every
|
|
17
|
+
* page in memory (defeats NDJSON streaming) or a server-side
|
|
18
|
+
* `order_by` clause the agent can already pass via `--filter-json`.
|
|
19
|
+
* The §5.6 caveat documents this; the helper keeps the per-page
|
|
20
|
+
* scope explicit.
|
|
21
|
+
*
|
|
22
|
+
* **Sort key: numeric ID.** Monday's item / board / user / workspace
|
|
23
|
+
* IDs are decimal strings that can exceed `Number.MAX_SAFE_INTEGER`
|
|
24
|
+
* for older accounts (`cli-design.md` §6.2 — "IDs are always
|
|
25
|
+
* strings"). Lex sort is wrong (`"9" > "10"` in JS string compare);
|
|
26
|
+
* `Number.parseInt` is wrong for IDs past 2^53. We compare on the
|
|
27
|
+
* tuple `(length, lexicographic)` — same-length decimal strings
|
|
28
|
+
* sort numerically by lex compare, and shorter strings always
|
|
29
|
+
* represent smaller numbers (no leading zeros on Monday IDs). That's
|
|
30
|
+
* the same trick `findOne`'s `--first` selector uses (see
|
|
31
|
+
* `src/api/resolvers.ts`); centralising here means a future ID-kind
|
|
32
|
+
* with leading-zero conventions surfaces as one bug, not many.
|
|
33
|
+
*
|
|
34
|
+
* Stable sort: `Array.prototype.sort` is stable in V8 / Node ≥ 12,
|
|
35
|
+
* so tied IDs keep arrival order. The helper doesn't fall back to a
|
|
36
|
+
* second key.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Compares two decimal-string IDs as if they were numeric. Returns
|
|
40
|
+
* a negative / zero / positive number suitable for `Array#sort`.
|
|
41
|
+
* Exported for unit tests and for callers that want to thread the
|
|
42
|
+
* comparator into their own collection (e.g. `findOne`'s `--first`
|
|
43
|
+
* selector — see `resolvers.ts`).
|
|
44
|
+
*/
|
|
45
|
+
export const compareNumericId = (a, b) => {
|
|
46
|
+
if (a.length !== b.length) {
|
|
47
|
+
return a.length - b.length;
|
|
48
|
+
}
|
|
49
|
+
// Same-length decimal strings → lex order matches numeric order.
|
|
50
|
+
// localeCompare is overkill here (and locale-dependent); a direct
|
|
51
|
+
// < / > compare is what we want.
|
|
52
|
+
if (a < b)
|
|
53
|
+
return -1;
|
|
54
|
+
if (a > b)
|
|
55
|
+
return 1;
|
|
56
|
+
return 0;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Sorts a page of resources by their ID ascending. Pure — returns a
|
|
60
|
+
* new array, leaves the input untouched. Caller passes the projector
|
|
61
|
+
* because items / boards / etc. all expose `id` differently in
|
|
62
|
+
* fixture form (`{id}` vs `{node:{id}}` for paginated edges).
|
|
63
|
+
*
|
|
64
|
+
* Empty input is fine: returns `[]`. Single-element input is fine:
|
|
65
|
+
* returns a copy. Bypassing the sort entirely on small inputs is
|
|
66
|
+
* tempting but the cost is zero on the hot path and the regression
|
|
67
|
+
* surface is shorter when every shape goes through the same
|
|
68
|
+
* comparator.
|
|
69
|
+
*/
|
|
70
|
+
export const sortByIdAsc = (items, getId) => {
|
|
71
|
+
return [...items].sort((a, b) => compareNumericId(getId(a), getId(b)));
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=sort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../../src/api/sort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE;IAC/D,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,iEAAiE;IACjE,kEAAkE;IAClE,iCAAiC;IACjC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,KAAmB,EACnB,KAAuB,EACT,EAAE;IAChB,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC"}
|