diff --git a/.changeset/friendly-ducks-rush.md b/.changeset/friendly-ducks-rush.md new file mode 100644 index 00000000..189548ca --- /dev/null +++ b/.changeset/friendly-ducks-rush.md @@ -0,0 +1,5 @@ +--- +"@farfetched/core": minor +--- + +Runtime deprecation warnings about `concurrency` field in `createJsonQuery` and `createJsonMutation` diff --git a/.changeset/pretty-mails-switch.md b/.changeset/pretty-mails-switch.md deleted file mode 100644 index 2f0d3d5c..00000000 --- a/.changeset/pretty-mails-switch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@farfetched/core": minor ---- - -Runtime deprecation warning in `attachOperation` diff --git a/apps/website/docs/releases/0-13.md b/apps/website/docs/releases/0-13.md index e10f8854..4b698ebf 100644 --- a/apps/website/docs/releases/0-13.md +++ b/apps/website/docs/releases/0-13.md @@ -8,4 +8,8 @@ TODO: This operator is deprecated since [v0.12](/releases/0-12) and will be removed in v0.14. Please read [this ADR](/adr/attach_operation_deprecation) for more information and migration guide. +### `concurrency` operator + +Field `concurrency` in `createJsonQuery` and `createJsonMutation` is deprecated since [v0.12](/releases/0-12) and has to be replaced by the [`concurrency` operator](/api/operators/concurrency). Please read [this ADR](/adr/concurrency) for more information and migration guide. + diff --git a/packages/core/src/mutation/create_json_mutation.ts b/packages/core/src/mutation/create_json_mutation.ts index 5bd4e8fb..6f33fdde 100644 --- a/packages/core/src/mutation/create_json_mutation.ts +++ b/packages/core/src/mutation/create_json_mutation.ts @@ -266,6 +266,10 @@ export function createJsonMutation(config: any): Mutation { /* TODO: in future releases we will remove this code and make concurrency a separate function */ if (config.concurrency) { + console.error( + 'concurrency field in createJsonMutation is deprecated, please use concurrency operator instead: https://farfetched.pages.dev/adr/concurrency' + ); + op.__.meta.flags.concurrencyFieldUsed = true; } diff --git a/packages/core/src/query/create_json_query.ts b/packages/core/src/query/create_json_query.ts index 2c18ca4f..06cd5036 100644 --- a/packages/core/src/query/create_json_query.ts +++ b/packages/core/src/query/create_json_query.ts @@ -394,11 +394,19 @@ export function createJsonQuery(config: any) { /* TODO: in future releases we will remove this code and make concurrency a separate function */ if (config.concurrency) { + console.error( + 'concurrency field in createJsonQuery is deprecated, please use concurrency operator instead: https://farfetched.pages.dev/adr/concurrency' + ); + op.__.meta.flags.concurrencyFieldUsed = true; } setTimeout(() => { if (!op.__.meta.flags.concurrencyOperatorUsed) { + console.error( + 'Please apply concurrency operator to the query, read more: https://farfetched.pages.dev/adr/concurrency' + ); + concurrency(op, { strategy: config.concurrency?.strategy ?? 'TAKE_LATEST', abortAll: config.concurrency?.abort,