From a841c4eb82849cf625a527446f34cfd77ab6dfeb Mon Sep 17 00:00:00 2001 From: doubleface <christophe@cozycloud.cc> Date: Mon, 17 Jun 2024 09:09:09 +0200 Subject: [PATCH 1/4] feat: Add optionnal suffix property to runInWorkerUntilTrue This property, if present, will be used to better identify the source of timeout error and especially the selector which failed to be found. Usage: ```javascript this.runInWorkerUntilTrue({method, suffix: 'current context as string'}) ``` --- .../cozy-clisk/src/contentscript/ContentScript.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/cozy-clisk/src/contentscript/ContentScript.js b/packages/cozy-clisk/src/contentscript/ContentScript.js index 5448183b7..1e659ec8e 100644 --- a/packages/cozy-clisk/src/contentscript/ContentScript.js +++ b/packages/cozy-clisk/src/contentscript/ContentScript.js @@ -358,11 +358,17 @@ export default class ContentScript { * @param {object} options - options object * @param {string} options.method - name of the method to run * @param {number} [options.timeout] - number of miliseconds before the function sends a timeout error. Default Infinity + * @param {string} [options.suffix] - suffix used in timeout error message, to better identify error source * @param {Array} [options.args] - array of args to pass to the method * @returns {Promise<boolean>} - true * @throws {TimeoutError} - if timeout expired */ - async runInWorkerUntilTrue({ method, timeout = Infinity, args = [] }) { + async runInWorkerUntilTrue({ + method, + timeout = Infinity, + suffix = '', + args = [] + }) { this.onlyIn(PILOT_TYPE, 'runInWorkerUntilTrue') log.debug('runInWorkerUntilTrue', method) let result = false @@ -371,7 +377,7 @@ export default class ContentScript { while (!result) { if (isTimeout()) { throw new TimeoutError( - `runInWorkerUntilTrue ${method} Timeout error after ${timeout}` + `runInWorkerUntilTrue ${method}${suffix} Timeout error after ${timeout}` ) } log.debug('runInWorker call', method) @@ -394,6 +400,7 @@ export default class ContentScript { this.onlyIn(PILOT_TYPE, 'waitForElementInWorker') await this.runInWorkerUntilTrue({ method: 'waitForElementNoReload', + suffix: selector, timeout: options?.timeout ?? DEFAULT_WAIT_FOR_ELEMENT_ACCROSS_PAGES_TIMEOUT, args: [selector, { includesText: options.includesText }] From d8bbed286c6633aacf90c09983d2f02def0d8b85 Mon Sep 17 00:00:00 2001 From: Cozy Bot <npm@cozycloud.cc> Date: Mon, 17 Jun 2024 08:20:31 +0000 Subject: [PATCH 2/4] [skip ci] Publish - cozy-clisk@0.37.0 --- packages/cozy-clisk/CHANGELOG.md | 11 +++++++++++ packages/cozy-clisk/package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cozy-clisk/CHANGELOG.md b/packages/cozy-clisk/CHANGELOG.md index 878d2f2f9..39b358a03 100644 --- a/packages/cozy-clisk/CHANGELOG.md +++ b/packages/cozy-clisk/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.37.0](https://github.com/konnectors/libs/compare/cozy-clisk@0.36.1...cozy-clisk@0.37.0) (2024-06-17) + + +### Features + +* Add optionnal suffix property to runInWorkerUntilTrue ([a841c4e](https://github.com/konnectors/libs/commit/a841c4eb82849cf625a527446f34cfd77ab6dfeb)) + + + + + ## [0.36.1](https://github.com/konnectors/libs/compare/cozy-clisk@0.36.0...cozy-clisk@0.36.1) (2024-03-20) diff --git a/packages/cozy-clisk/package.json b/packages/cozy-clisk/package.json index e3c5a17fe..27021b727 100644 --- a/packages/cozy-clisk/package.json +++ b/packages/cozy-clisk/package.json @@ -1,6 +1,6 @@ { "name": "cozy-clisk", - "version": "0.36.1", + "version": "0.37.0", "description": "All the libs needed to run a cozy client connector", "repository": { "type": "git", From 1b3e9e9d9902a5527e81aaea40e391479420bd60 Mon Sep 17 00:00:00 2001 From: Killian Courvoisier <killian.courvoisier@cozycloud.cc> Date: Thu, 18 Jul 2024 12:03:15 +0200 Subject: [PATCH 3/4] feat: Remove standalone mode from the public doc --- packages/cozy-konnector-libs/docs/cli.md | 53 ------------------------ 1 file changed, 53 deletions(-) diff --git a/packages/cozy-konnector-libs/docs/cli.md b/packages/cozy-konnector-libs/docs/cli.md index 7dbda4138..c33821734 100644 --- a/packages/cozy-konnector-libs/docs/cli.md +++ b/packages/cozy-konnector-libs/docs/cli.md @@ -2,64 +2,11 @@ `cozy-jobs-cli` is a npm package providing CLI tools allowing to run your connector in different modes. -- standalone - development - or in dedicated REPL You can install it in your connector as a dev dependency. -#### cozy-run-standalone - -It can be handy to run a konnector without inserting the data in a cozy. This mode is called "standalone". -You can run your connector in standalone mode with : - -```sh -$ cozy-run-standalone -``` - -If you want, you can add the following code in the `scripts` section of your package.json file: - -```json - "scripts": { - "standalone": "cozy-run-standalone" - } -``` - -It will then possible to do: - -```sh -yarn standalone -``` - -The requests to the cozy-stack will be stubbed using the [./fixture.json] file as source of data -and when cozy-client-js is asked to create or update data, the data will be output to the console. -The bills (or any file) will be saved in the ./data directory. - -It is possible to add an argument to this command which tells which file to run. Default is -defined in `package.json` `main` section or ./src/index.js - -It is possible to record and replay the requests done by the standalone command using the -[replay](https://github.com/assaf/node-replay) module. - -When your connector is run with this command, a global function is available in your connector : -`global.openInBrowser`, which can take an html string or a cheerio object as input and will show -the corresponding html page in your default browser. - -##### Arguments - -``` -Usage: cozy-run-standalone [options] <file> - - -Options: - - --record Record all the requests in the ./fixtures directory using the replay module - --replay Replay all the recorded requests - --persist Do not empty ./data/importedData.json at each run - -h, --help output usage information -``` - - #### cozy-run-dev If you want to run your connector linked to a cozy-stack, even remotely, the "dev" mode is for you. From 37d9cbfaaa6fa5998b65422c54ca574297df9ad9 Mon Sep 17 00:00:00 2001 From: Cozy Bot <npm@cozycloud.cc> Date: Thu, 18 Jul 2024 10:27:34 +0000 Subject: [PATCH 4/4] [skip ci] Publish - cozy-jobs-cli@2.4.3 - cozy-konnector-libs@5.12.0 --- packages/cozy-jobs-cli/CHANGELOG.md | 8 ++++++++ packages/cozy-jobs-cli/package.json | 4 ++-- packages/cozy-konnector-libs/CHANGELOG.md | 11 +++++++++++ packages/cozy-konnector-libs/package.json | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/cozy-jobs-cli/CHANGELOG.md b/packages/cozy-jobs-cli/CHANGELOG.md index 6943bfe6d..c7bc8bbc1 100644 --- a/packages/cozy-jobs-cli/CHANGELOG.md +++ b/packages/cozy-jobs-cli/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.4.3](https://github.com/cozy/cozy-konnector-libs/compare/cozy-jobs-cli@2.4.2...cozy-jobs-cli@2.4.3) (2024-07-18) + +**Note:** Version bump only for package cozy-jobs-cli + + + + + ## [2.4.2](https://github.com/cozy/cozy-konnector-libs/compare/cozy-jobs-cli@2.4.1...cozy-jobs-cli@2.4.2) (2024-05-23) **Note:** Version bump only for package cozy-jobs-cli diff --git a/packages/cozy-jobs-cli/package.json b/packages/cozy-jobs-cli/package.json index 1ea9d64e5..0c8c9ffa3 100644 --- a/packages/cozy-jobs-cli/package.json +++ b/packages/cozy-jobs-cli/package.json @@ -1,6 +1,6 @@ { "name": "cozy-jobs-cli", - "version": "2.4.2", + "version": "2.4.3", "description": "Manage cozy jobs", "main": "index.js", "repository": { @@ -29,7 +29,7 @@ "cozy-client": "45.14.1", "cozy-device-helper": "^2.1.0", "cozy-flags": "^2.8.7", - "cozy-konnector-libs": "^5.11.0", + "cozy-konnector-libs": "^5.12.0", "cozy-logger": "1.9.0", "node-fetch": "2.7.0", "open": "8.4.0", diff --git a/packages/cozy-konnector-libs/CHANGELOG.md b/packages/cozy-konnector-libs/CHANGELOG.md index 93c272fef..a4ff6f028 100644 --- a/packages/cozy-konnector-libs/CHANGELOG.md +++ b/packages/cozy-konnector-libs/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.12.0](https://github.com/cozy/cozy-konnector-libs/compare/cozy-konnector-libs@5.11.0...cozy-konnector-libs@5.12.0) (2024-07-18) + + +### Features + +* Remove standalone mode from the public doc ([1b3e9e9](https://github.com/cozy/cozy-konnector-libs/commit/1b3e9e9d9902a5527e81aaea40e391479420bd60)) + + + + + # [5.11.0](https://github.com/cozy/cozy-konnector-libs/compare/cozy-konnector-libs@5.10.1...cozy-konnector-libs@5.11.0) (2024-05-23) diff --git a/packages/cozy-konnector-libs/package.json b/packages/cozy-konnector-libs/package.json index b8ebb38fa..7bf2fb28b 100644 --- a/packages/cozy-konnector-libs/package.json +++ b/packages/cozy-konnector-libs/package.json @@ -1,6 +1,6 @@ { "name": "cozy-konnector-libs", - "version": "5.11.0", + "version": "5.12.0", "description": "All the libs needed by a cozy v3 konnector", "main": "dist/index.js", "repository": {