auth0-deploy-cli 7.3.2 → 7.3.3
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/.nyc_output/284c60ec-1813-41e7-aaba-fb71f2d61f85.json +1 -0
- package/.nyc_output/processinfo/{891c5231-0bb9-4324-a2fd-a8a67b3acbd8.json → 284c60ec-1813-41e7-aaba-fb71f2d61f85.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +10 -1
- package/lib/tools/auth0/client.js +89 -38
- package/lib/tools/auth0/handlers/organizations.js +1 -1
- package/package.json +1 -1
- package/.nyc_output/891c5231-0bb9-4324-a2fd-a8a67b3acbd8.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":null,"pid":
|
|
1
|
+
{"parent":null,"pid":218,"argv":["/usr/local/bin/node","/home/circleci/repo/node_modules/.bin/mocha","--recursive","--require","@babel/register","test"],"execArgv":[],"cwd":"/home/circleci/repo","time":1643234031516,"ppid":207,"coverageFilename":"/home/circleci/repo/.nyc_output/284c60ec-1813-41e7-aaba-fb71f2d61f85.json","externalId":"","uuid":"284c60ec-1813-41e7-aaba-fb71f2d61f85","files":["/home/circleci/repo/src/context/index.js","/home/circleci/repo/src/context/yaml/index.js","/home/circleci/repo/src/tools/index.js","/home/circleci/repo/src/tools/constants.js","/home/circleci/repo/src/tools/deploy.js","/home/circleci/repo/src/tools/auth0/index.js","/home/circleci/repo/src/tools/auth0/client.js","/home/circleci/repo/src/tools/utils.js","/home/circleci/repo/src/tools/logger.js","/home/circleci/repo/src/tools/auth0/schema.js","/home/circleci/repo/src/tools/auth0/handlers/index.js","/home/circleci/repo/src/tools/auth0/handlers/rules.js","/home/circleci/repo/src/tools/ValidationError.js","/home/circleci/repo/src/tools/auth0/handlers/default.js","/home/circleci/repo/src/tools/auth0/handlers/rulesConfigs.js","/home/circleci/repo/src/tools/auth0/handlers/hooks.js","/home/circleci/repo/src/tools/auth0/handlers/pages.js","/home/circleci/repo/src/tools/auth0/handlers/resourceServers.js","/home/circleci/repo/src/tools/auth0/handlers/databases.js","/home/circleci/repo/src/tools/auth0/handlers/connections.js","/home/circleci/repo/src/tools/auth0/handlers/clients.js","/home/circleci/repo/src/tools/auth0/handlers/tenant.js","/home/circleci/repo/src/tools/auth0/handlers/emailProvider.js","/home/circleci/repo/src/tools/auth0/handlers/emailTemplates.js","/home/circleci/repo/src/tools/auth0/handlers/clientGrants.js","/home/circleci/repo/src/tools/auth0/handlers/guardianFactors.js","/home/circleci/repo/src/tools/auth0/handlers/guardianFactorProviders.js","/home/circleci/repo/src/tools/auth0/handlers/guardianFactorTemplates.js","/home/circleci/repo/src/tools/auth0/handlers/guardianPolicies.js","/home/circleci/repo/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js","/home/circleci/repo/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js","/home/circleci/repo/src/tools/auth0/handlers/roles.js","/home/circleci/repo/src/tools/auth0/handlers/branding.js","/home/circleci/repo/src/tools/auth0/handlers/prompts.js","/home/circleci/repo/src/tools/auth0/handlers/migrations.js","/home/circleci/repo/src/tools/auth0/handlers/actions.js","/home/circleci/repo/src/tools/auth0/handlers/triggers.js","/home/circleci/repo/src/tools/auth0/handlers/organizations.js","/home/circleci/repo/src/logger.js","/home/circleci/repo/src/utils.js","/home/circleci/repo/src/context/yaml/handlers/index.js","/home/circleci/repo/src/context/yaml/handlers/pages.js","/home/circleci/repo/src/context/yaml/handlers/rules.js","/home/circleci/repo/src/context/yaml/handlers/hooks.js","/home/circleci/repo/src/context/yaml/handlers/clients.js","/home/circleci/repo/src/context/yaml/handlers/tenant.js","/home/circleci/repo/src/context/yaml/handlers/emailProvider.js","/home/circleci/repo/src/context/defaults.js","/home/circleci/repo/src/context/yaml/handlers/connections.js","/home/circleci/repo/src/context/yaml/handlers/databases.js","/home/circleci/repo/src/context/yaml/handlers/emailTemplates.js","/home/circleci/repo/src/context/yaml/handlers/clientGrants.js","/home/circleci/repo/src/context/yaml/handlers/rulesConfigs.js","/home/circleci/repo/src/context/yaml/handlers/resourceServers.js","/home/circleci/repo/src/context/yaml/handlers/guardianFactors.js","/home/circleci/repo/src/context/yaml/handlers/guardianFactorProviders.js","/home/circleci/repo/src/context/yaml/handlers/guardianFactorTemplates.js","/home/circleci/repo/src/context/yaml/handlers/guardianPhoneFactorMessageTypes.js","/home/circleci/repo/src/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js","/home/circleci/repo/src/context/yaml/handlers/guardianPolicies.js","/home/circleci/repo/src/context/yaml/handlers/roles.js","/home/circleci/repo/src/context/yaml/handlers/organizations.js","/home/circleci/repo/src/context/yaml/handlers/migrations.js","/home/circleci/repo/src/context/yaml/handlers/actions.js","/home/circleci/repo/src/context/yaml/handlers/triggers.js","/home/circleci/repo/src/readonly.js","/home/circleci/repo/src/context/directory/index.js","/home/circleci/repo/src/context/directory/handlers/index.js","/home/circleci/repo/src/context/directory/handlers/pages.js","/home/circleci/repo/src/context/directory/handlers/rules.js","/home/circleci/repo/src/context/directory/handlers/hooks.js","/home/circleci/repo/src/context/directory/handlers/clients.js","/home/circleci/repo/src/context/directory/handlers/tenant.js","/home/circleci/repo/src/context/directory/handlers/emailProvider.js","/home/circleci/repo/src/context/directory/handlers/connections.js","/home/circleci/repo/src/context/directory/handlers/databases.js","/home/circleci/repo/src/context/directory/handlers/emailTemplates.js","/home/circleci/repo/src/context/directory/handlers/clientGrants.js","/home/circleci/repo/src/context/directory/handlers/rulesConfigs.js","/home/circleci/repo/src/context/directory/handlers/resourceServers.js","/home/circleci/repo/src/context/directory/handlers/guardianFactors.js","/home/circleci/repo/src/context/directory/handlers/guardianFactorProviders.js","/home/circleci/repo/src/context/directory/handlers/guardianFactorTemplates.js","/home/circleci/repo/src/context/directory/handlers/guardianPhoneFactorMessageTypes.js","/home/circleci/repo/src/context/directory/handlers/guardianPhoneFactorSelectedProvider.js","/home/circleci/repo/src/context/directory/handlers/guardianPolicies.js","/home/circleci/repo/src/context/directory/handlers/roles.js","/home/circleci/repo/src/context/directory/handlers/migrations.js","/home/circleci/repo/src/context/directory/handlers/actions.js","/home/circleci/repo/src/context/directory/handlers/organizations.js","/home/circleci/repo/src/context/directory/handlers/triggers.js","/home/circleci/repo/src/index.js","/home/circleci/repo/src/args.js","/home/circleci/repo/src/commands/index.js","/home/circleci/repo/src/commands/import.js","/home/circleci/repo/src/configFactory.js","/home/circleci/repo/src/commands/export.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"284c60ec-1813-41e7-aaba-fb71f2d61f85":{"parent":null,"children":[]}},"files":{"/home/circleci/repo/src/context/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/constants.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/deploy.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/client.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/utils.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/logger.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/schema.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/rules.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/ValidationError.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/default.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/rulesConfigs.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/hooks.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/pages.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/resourceServers.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/databases.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/connections.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/clients.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/tenant.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/emailProvider.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/emailTemplates.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/clientGrants.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/guardianFactors.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/guardianFactorProviders.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/guardianFactorTemplates.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/guardianPolicies.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/roles.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/branding.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/prompts.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/migrations.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/actions.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/triggers.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/tools/auth0/handlers/organizations.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/logger.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/utils.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/pages.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/rules.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/hooks.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/clients.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/tenant.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/emailProvider.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/defaults.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/connections.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/databases.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/emailTemplates.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/clientGrants.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/rulesConfigs.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/resourceServers.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/guardianFactors.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/guardianFactorProviders.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/guardianFactorTemplates.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/guardianPhoneFactorMessageTypes.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/guardianPolicies.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/roles.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/organizations.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/migrations.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/actions.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/yaml/handlers/triggers.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/readonly.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/pages.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/rules.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/hooks.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/clients.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/tenant.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/emailProvider.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/connections.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/databases.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/emailTemplates.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/clientGrants.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/rulesConfigs.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/resourceServers.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/guardianFactors.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/guardianFactorProviders.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/guardianFactorTemplates.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/guardianPhoneFactorMessageTypes.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/guardianPhoneFactorSelectedProvider.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/guardianPolicies.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/roles.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/migrations.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/actions.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/organizations.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/context/directory/handlers/triggers.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/args.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/commands/index.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/commands/import.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/configFactory.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"],"/home/circleci/repo/src/commands/export.js":["284c60ec-1813-41e7-aaba-fb71f2d61f85"]},"externalIds":{}}
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.3.3] - 2022-01-26
|
|
11
|
+
### Fixed
|
|
12
|
+
- Fix pagination [#400]
|
|
13
|
+
|
|
14
|
+
### Security
|
|
15
|
+
- Security fixes from dependencies
|
|
16
|
+
|
|
10
17
|
## [7.3.2] - 2021-12-14
|
|
11
18
|
### Security
|
|
12
19
|
- Fixes dependency security issues
|
|
@@ -392,8 +399,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
392
399
|
[#364]: https://github.com/auth0/auth0-deploy-cli/issues/364
|
|
393
400
|
[#367]: https://github.com/auth0/auth0-deploy-cli/issues/367
|
|
394
401
|
[#379]: https://github.com/auth0/auth0-deploy-cli/issues/379
|
|
402
|
+
[#400]: https://github.com/auth0/auth0-deploy-cli/issues/400
|
|
395
403
|
|
|
396
|
-
[Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.
|
|
404
|
+
[Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.3...HEAD
|
|
405
|
+
[7.3.3]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.2...v7.3.3
|
|
397
406
|
[7.3.2]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.1...v7.3.2
|
|
398
407
|
[7.3.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.0...v7.3.1
|
|
399
408
|
[7.3.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.2.1...v7.3.0
|
|
@@ -29,50 +29,101 @@ function getEntity(rsp) {
|
|
|
29
29
|
throw new Error('There was an error trying to find the entity within paginate');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function checkpointPaginator(client, target, name) {
|
|
33
|
+
return async function (...args) {
|
|
34
|
+
const data = [];
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
checkpoint,
|
|
38
|
+
...newArgs
|
|
39
|
+
} = _lodash2.default.cloneDeep(args[0]);
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
total
|
|
43
|
+
} = await client.pool.addSingleTask({
|
|
44
|
+
data: newArgs,
|
|
45
|
+
generator: target[name]
|
|
46
|
+
}).promise();
|
|
47
|
+
let done = false;
|
|
48
|
+
newArgs.take = 50;
|
|
49
|
+
|
|
50
|
+
while (!done) {
|
|
51
|
+
const rsp = await client.pool.addSingleTask({
|
|
52
|
+
data: newArgs,
|
|
53
|
+
generator: target[name]
|
|
54
|
+
}).promise();
|
|
55
|
+
const entities = getEntity(rsp);
|
|
56
|
+
|
|
57
|
+
if (entities.length === 0) {
|
|
58
|
+
done = true;
|
|
59
|
+
} else {
|
|
60
|
+
data.push(...entities);
|
|
61
|
+
newArgs.from = rsp.next;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (data.length !== total) {
|
|
66
|
+
throw new Error('Fail to load data from tenant');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return data;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function pagePaginator(client, target, name) {
|
|
74
|
+
return async function (...args) {
|
|
75
|
+
const data = [];
|
|
76
|
+
const newArgs = [...args];
|
|
77
|
+
newArgs[0] = { ...newArgs[0],
|
|
78
|
+
page: 0
|
|
79
|
+
};
|
|
80
|
+
const perPage = newArgs[0].per_page || MAX_PAGE_SIZE;
|
|
81
|
+
newArgs[0].per_page = perPage;
|
|
82
|
+
delete newArgs[0].paginate;
|
|
83
|
+
const rsp = await client.pool.addSingleTask({
|
|
84
|
+
data: _lodash2.default.cloneDeep(newArgs),
|
|
85
|
+
generator: pageArgs => target[name](...pageArgs)
|
|
86
|
+
}).promise();
|
|
87
|
+
data.push(...getEntity(rsp));
|
|
88
|
+
const total = rsp.total || 0;
|
|
89
|
+
const pagesLeft = Math.ceil(total / perPage) - 1;
|
|
90
|
+
|
|
91
|
+
if (pagesLeft > 0) {
|
|
92
|
+
const pages = await client.pool.addEachTask({
|
|
93
|
+
data: Array.from(Array(pagesLeft).keys()),
|
|
94
|
+
generator: page => {
|
|
95
|
+
const pageArgs = _lodash2.default.cloneDeep(newArgs);
|
|
96
|
+
|
|
97
|
+
pageArgs[0].page = page + 1;
|
|
98
|
+
return target[name](...pageArgs).then(r => getEntity(r));
|
|
99
|
+
}
|
|
100
|
+
}).promise();
|
|
101
|
+
data.push(...(0, _utils.flatten)(pages));
|
|
102
|
+
|
|
103
|
+
if (data.length !== total) {
|
|
104
|
+
throw new Error('Fail to load data from tenant');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return data;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
32
112
|
function pagedManager(client, manager) {
|
|
33
113
|
return new Proxy(manager, {
|
|
34
114
|
get: function (target, name, receiver) {
|
|
35
115
|
if (name === 'getAll') {
|
|
36
116
|
return async function (...args) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
const perPage = newArgs[0].per_page || MAX_PAGE_SIZE;
|
|
45
|
-
newArgs[0].per_page = perPage;
|
|
46
|
-
delete newArgs[0].paginate;
|
|
47
|
-
const rsp = await client.pool.addSingleTask({
|
|
48
|
-
data: _lodash2.default.cloneDeep(newArgs),
|
|
49
|
-
generator: pageArgs => target[fnName](...pageArgs)
|
|
50
|
-
}).promise();
|
|
51
|
-
data.push(...getEntity(rsp));
|
|
52
|
-
const total = rsp.total || 0;
|
|
53
|
-
const pagesLeft = Math.ceil(total / perPage) - 1;
|
|
54
|
-
|
|
55
|
-
if (pagesLeft > 0) {
|
|
56
|
-
const pages = await client.pool.addEachTask({
|
|
57
|
-
data: Array.from(Array(pagesLeft).keys()),
|
|
58
|
-
generator: page => {
|
|
59
|
-
const pageArgs = _lodash2.default.cloneDeep(newArgs);
|
|
60
|
-
|
|
61
|
-
pageArgs[0].page = page + 1;
|
|
62
|
-
return target[fnName](...pageArgs).then(r => getEntity(r));
|
|
63
|
-
}
|
|
64
|
-
}).promise();
|
|
65
|
-
data.push(...(0, _utils.flatten)(pages));
|
|
66
|
-
|
|
67
|
-
if (data.length !== total) {
|
|
68
|
-
throw new Error('Fail to load data from tenant');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return data;
|
|
73
|
-
}
|
|
117
|
+
switch (true) {
|
|
118
|
+
case args[0] && typeof args[0] === 'object' && args[0].checkpoint:
|
|
119
|
+
return checkpointPaginator(client, target, name)(...args);
|
|
120
|
+
|
|
121
|
+
case args[0] && typeof args[0] === 'object' && args[0].paginate:
|
|
122
|
+
return pagePaginator(client, target, name)(...args);
|
|
74
123
|
|
|
75
|
-
|
|
124
|
+
default:
|
|
125
|
+
return target[name](...args);
|
|
126
|
+
}
|
|
76
127
|
};
|
|
77
128
|
}
|
|
78
129
|
|