@sudoplatform/sudo-common 6.4.0 → 7.0.2
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/.gitignore +2 -1
- package/.yarn/releases/{yarn-1.22.18.cjs → yarn-1.22.19.cjs} +13 -4
- package/.yarnrc +1 -1
- package/bin/outdated-with-suppression.sh +117 -11
- package/bin/suppress-outdated.sh +36 -9
- package/dependencies-report.json +388 -4
- package/docs/assets/highlight.css +11 -11
- package/docs/assets/main.js +4 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +427 -617
- package/docs/classes/AccountLockedError.html +163 -8
- package/docs/classes/AuthenticationError.html +168 -8
- package/docs/classes/Base64.html +134 -3
- package/docs/classes/Buffer.html +158 -3
- package/docs/classes/ConfigurationNotSetError.html +163 -8
- package/docs/classes/ConfigurationSetNotFoundError.html +168 -8
- package/docs/classes/DecodeError.html +168 -8
- package/docs/classes/DefaultConfigurationManager.html +206 -18
- package/docs/classes/DefaultLogger.html +291 -25
- package/docs/classes/DefaultSudoKeyArchive.html +337 -39
- package/docs/classes/DefaultSudoKeyManager.html +813 -63
- package/docs/classes/FatalError.html +168 -8
- package/docs/classes/IllegalArgumentError.html +168 -8
- package/docs/classes/IllegalStateError.html +168 -8
- package/docs/classes/InsufficientEntitlementsError.html +163 -8
- package/docs/classes/InvalidOwnershipProofError.html +163 -8
- package/docs/classes/InvalidTokenError.html +163 -8
- package/docs/classes/KeyArchiveDecodingError.html +168 -8
- package/docs/classes/KeyArchiveIncorrectPasswordError.html +168 -8
- package/docs/classes/KeyArchiveMissingError.html +168 -8
- package/docs/classes/KeyArchiveNoPasswordRequiredError.html +168 -8
- package/docs/classes/KeyArchivePasswordRequiredError.html +168 -8
- package/docs/classes/KeyArchiveTypeError.html +168 -8
- package/docs/classes/KeyArchiveUnknownKeyTypeError.html +168 -8
- package/docs/classes/KeyArchiveVersionError.html +168 -8
- package/docs/classes/KeyNotFoundError.html +168 -8
- package/docs/classes/KeyStoreNotExportableError.html +168 -8
- package/docs/classes/LimitExceededError.html +163 -8
- package/docs/classes/NoEntitlementsError.html +163 -8
- package/docs/classes/NotAuthorizedError.html +168 -8
- package/docs/classes/NotRegisteredError.html +168 -8
- package/docs/classes/NotSignedInError.html +163 -8
- package/docs/classes/OperationNotImplementedError.html +168 -8
- package/docs/classes/RegisterError.html +168 -8
- package/docs/classes/RequestFailedError.html +188 -12
- package/docs/classes/ServiceError.html +168 -8
- package/docs/classes/SignOutError.html +168 -8
- package/docs/classes/SudoCryptoProviderDefaults.html +106 -1
- package/docs/classes/UnknownGraphQLError.html +168 -8
- package/docs/classes/UnrecognizedAlgorithmError.html +168 -8
- package/docs/classes/UserNotConfirmedError.html +163 -8
- package/docs/classes/VersionMismatchError.html +163 -8
- package/docs/enums/CachePolicy.html +71 -3
- package/docs/enums/EncryptionAlgorithm.html +78 -3
- package/docs/enums/KeyArchiveKeyType.html +86 -4
- package/docs/enums/KeyDataKeyFormat.html +84 -10
- package/docs/enums/KeyDataKeyType.html +85 -3
- package/docs/enums/ListOperationResultStatus.html +84 -9
- package/docs/enums/PublicKeyFormat.html +68 -1
- package/docs/functions/isAppSyncNetworkError.html +147 -0
- package/docs/functions/isInsecureKeyArchive.html +147 -0
- package/docs/functions/isSecureKeyArchive.html +147 -0
- package/docs/functions/isUnrecognizedKeyArchive.html +147 -0
- package/docs/functions/keyArchiveInfoFromKeyData.html +147 -0
- package/docs/functions/keyArchiveKeyTypeFromKeyDataKeyType.html +147 -0
- package/docs/functions/mapGraphQLToClientError.html +154 -0
- package/docs/functions/mapNetworkErrorToClientError.html +154 -0
- package/docs/index.html +134 -2
- package/docs/interfaces/AsymmetricEncryptionOptions.html +68 -3
- package/docs/interfaces/BooleanFilter.html +75 -3
- package/docs/interfaces/ConfigurationManager.html +191 -35
- package/docs/interfaces/KeyData.html +106 -8
- package/docs/interfaces/ListOperationFailureResult.html +76 -5
- package/docs/interfaces/ListOperationPartialResult.html +101 -9
- package/docs/interfaces/ListOperationSuccessResult.html +90 -7
- package/docs/interfaces/ListOutput.html +80 -3
- package/docs/interfaces/Logger.html +251 -45
- package/docs/interfaces/Owner.html +72 -1
- package/docs/interfaces/PublicKey.html +72 -1
- package/docs/interfaces/ServiceCompatibilityInfo.html +106 -13
- package/docs/interfaces/StringFilter.html +82 -3
- package/docs/interfaces/SudoCryptoProvider.html +860 -175
- package/docs/interfaces/SudoKeyArchive.html +245 -42
- package/docs/interfaces/SudoKeyManager.html +842 -169
- package/docs/interfaces/SymmetricEncryptionOptions.html +75 -3
- package/docs/interfaces/ValidationResult.html +79 -7
- package/docs/modules.html +248 -33
- package/docs/types/AppSyncError.html +138 -0
- package/docs/types/AppSyncNetworkError.html +138 -0
- package/docs/types/InsecureKeyArchive.html +138 -0
- package/docs/types/KeyArchive.html +138 -0
- package/docs/types/KeyArchiveKeyInfo.html +154 -0
- package/docs/types/KeyArchiveKeyInfoDecoded.html +138 -0
- package/docs/types/ListOperationResult.html +148 -0
- package/docs/types/SecureKeyArchive.html +138 -0
- package/docs/types/Subset.html +144 -0
- package/docs/types/UnrecognizedKeyArchive.html +138 -0
- package/docs/variables/CURRENT_ARCHIVE_VERSION.html +138 -0
- package/docs/variables/InsecureKeyArchiveCodec.html +138 -0
- package/docs/variables/InsecureKeyArchiveType.html +138 -0
- package/docs/variables/KeyArchiveCodec.html +138 -0
- package/docs/variables/KeyArchiveKeyInfoArrayCodec.html +138 -0
- package/docs/variables/KeyArchiveKeyInfoCodec.html +138 -0
- package/docs/variables/KeyArchiveKeyTypeCodec.html +138 -0
- package/docs/variables/SecureKeyArchiveCodec.html +138 -0
- package/docs/variables/SecureKeyArchiveType.html +138 -0
- package/docs/variables/UnrecognizedKeyArchiveCodec.html +138 -0
- package/github/.gitignore +2 -1
- package/github/.yarn/releases/{yarn-1.22.18.cjs → yarn-1.22.19.cjs} +13 -4
- package/github/.yarnrc +1 -1
- package/github/bin/outdated-with-suppression.sh +117 -11
- package/github/bin/suppress-outdated.sh +36 -9
- package/github/docs/assets/highlight.css +11 -11
- package/github/docs/assets/main.js +4 -2
- package/github/docs/assets/search.js +1 -1
- package/github/docs/assets/style.css +427 -617
- package/github/docs/classes/AccountLockedError.html +163 -8
- package/github/docs/classes/AuthenticationError.html +168 -8
- package/github/docs/classes/Base64.html +134 -3
- package/github/docs/classes/Buffer.html +158 -3
- package/github/docs/classes/ConfigurationNotSetError.html +163 -8
- package/github/docs/classes/ConfigurationSetNotFoundError.html +168 -8
- package/github/docs/classes/DecodeError.html +168 -8
- package/github/docs/classes/DefaultConfigurationManager.html +206 -18
- package/github/docs/classes/DefaultLogger.html +291 -25
- package/github/docs/classes/DefaultSudoKeyArchive.html +337 -39
- package/github/docs/classes/DefaultSudoKeyManager.html +813 -63
- package/github/docs/classes/FatalError.html +168 -8
- package/github/docs/classes/IllegalArgumentError.html +168 -8
- package/github/docs/classes/IllegalStateError.html +168 -8
- package/github/docs/classes/InsufficientEntitlementsError.html +163 -8
- package/github/docs/classes/InvalidOwnershipProofError.html +163 -8
- package/github/docs/classes/InvalidTokenError.html +163 -8
- package/github/docs/classes/KeyArchiveDecodingError.html +168 -8
- package/github/docs/classes/KeyArchiveIncorrectPasswordError.html +168 -8
- package/github/docs/classes/KeyArchiveMissingError.html +168 -8
- package/github/docs/classes/KeyArchiveNoPasswordRequiredError.html +168 -8
- package/github/docs/classes/KeyArchivePasswordRequiredError.html +168 -8
- package/github/docs/classes/KeyArchiveTypeError.html +168 -8
- package/github/docs/classes/KeyArchiveUnknownKeyTypeError.html +168 -8
- package/github/docs/classes/KeyArchiveVersionError.html +168 -8
- package/github/docs/classes/KeyNotFoundError.html +168 -8
- package/github/docs/classes/KeyStoreNotExportableError.html +168 -8
- package/github/docs/classes/LimitExceededError.html +163 -8
- package/github/docs/classes/NoEntitlementsError.html +163 -8
- package/github/docs/classes/NotAuthorizedError.html +168 -8
- package/github/docs/classes/NotRegisteredError.html +168 -8
- package/github/docs/classes/NotSignedInError.html +163 -8
- package/github/docs/classes/OperationNotImplementedError.html +168 -8
- package/github/docs/classes/RegisterError.html +168 -8
- package/github/docs/classes/RequestFailedError.html +188 -12
- package/github/docs/classes/ServiceError.html +168 -8
- package/github/docs/classes/SignOutError.html +168 -8
- package/github/docs/classes/SudoCryptoProviderDefaults.html +106 -1
- package/github/docs/classes/UnknownGraphQLError.html +168 -8
- package/github/docs/classes/UnrecognizedAlgorithmError.html +168 -8
- package/github/docs/classes/UserNotConfirmedError.html +163 -8
- package/github/docs/classes/VersionMismatchError.html +163 -8
- package/github/docs/enums/CachePolicy.html +71 -3
- package/github/docs/enums/EncryptionAlgorithm.html +78 -3
- package/github/docs/enums/KeyArchiveKeyType.html +86 -4
- package/github/docs/enums/KeyDataKeyFormat.html +84 -10
- package/github/docs/enums/KeyDataKeyType.html +85 -3
- package/github/docs/enums/ListOperationResultStatus.html +84 -9
- package/github/docs/enums/PublicKeyFormat.html +68 -1
- package/github/docs/functions/isAppSyncNetworkError.html +147 -0
- package/github/docs/functions/isInsecureKeyArchive.html +147 -0
- package/github/docs/functions/isSecureKeyArchive.html +147 -0
- package/github/docs/functions/isUnrecognizedKeyArchive.html +147 -0
- package/github/docs/functions/keyArchiveInfoFromKeyData.html +147 -0
- package/github/docs/functions/keyArchiveKeyTypeFromKeyDataKeyType.html +147 -0
- package/github/docs/functions/mapGraphQLToClientError.html +154 -0
- package/github/docs/functions/mapNetworkErrorToClientError.html +154 -0
- package/github/docs/index.html +134 -2
- package/github/docs/interfaces/AsymmetricEncryptionOptions.html +68 -3
- package/github/docs/interfaces/BooleanFilter.html +75 -3
- package/github/docs/interfaces/ConfigurationManager.html +191 -35
- package/github/docs/interfaces/KeyData.html +106 -8
- package/github/docs/interfaces/ListOperationFailureResult.html +76 -5
- package/github/docs/interfaces/ListOperationPartialResult.html +101 -9
- package/github/docs/interfaces/ListOperationSuccessResult.html +90 -7
- package/github/docs/interfaces/ListOutput.html +80 -3
- package/github/docs/interfaces/Logger.html +251 -45
- package/github/docs/interfaces/Owner.html +72 -1
- package/github/docs/interfaces/PublicKey.html +72 -1
- package/github/docs/interfaces/ServiceCompatibilityInfo.html +106 -13
- package/github/docs/interfaces/StringFilter.html +82 -3
- package/github/docs/interfaces/SudoCryptoProvider.html +860 -175
- package/github/docs/interfaces/SudoKeyArchive.html +245 -42
- package/github/docs/interfaces/SudoKeyManager.html +842 -169
- package/github/docs/interfaces/SymmetricEncryptionOptions.html +75 -3
- package/github/docs/interfaces/ValidationResult.html +79 -7
- package/github/docs/modules.html +248 -33
- package/github/docs/types/AppSyncError.html +138 -0
- package/github/docs/types/AppSyncNetworkError.html +138 -0
- package/github/docs/types/InsecureKeyArchive.html +138 -0
- package/github/docs/types/KeyArchive.html +138 -0
- package/github/docs/types/KeyArchiveKeyInfo.html +154 -0
- package/github/docs/types/KeyArchiveKeyInfoDecoded.html +138 -0
- package/github/docs/types/ListOperationResult.html +148 -0
- package/github/docs/types/SecureKeyArchive.html +138 -0
- package/github/docs/types/Subset.html +144 -0
- package/github/docs/types/UnrecognizedKeyArchive.html +138 -0
- package/github/docs/variables/CURRENT_ARCHIVE_VERSION.html +138 -0
- package/github/docs/variables/InsecureKeyArchiveCodec.html +138 -0
- package/github/docs/variables/InsecureKeyArchiveType.html +138 -0
- package/github/docs/variables/KeyArchiveCodec.html +138 -0
- package/github/docs/variables/KeyArchiveKeyInfoArrayCodec.html +138 -0
- package/github/docs/variables/KeyArchiveKeyInfoCodec.html +138 -0
- package/github/docs/variables/KeyArchiveKeyTypeCodec.html +138 -0
- package/github/docs/variables/SecureKeyArchiveCodec.html +138 -0
- package/github/docs/variables/SecureKeyArchiveType.html +138 -0
- package/github/docs/variables/UnrecognizedKeyArchiveCodec.html +138 -0
- package/github/package.json +25 -17
- package/github/src/sudoKeyArchive/sudoKeyArchive.ts +1 -1
- package/github/src/sudoKeyManager/sudoCryptoProvider.ts +44 -3
- package/github/src/sudoKeyManager/sudoKeyManager.ts +64 -6
- package/github/test/unit/sudoKeyManager.spec.ts +12 -12
- package/github/yarn.lock +1012 -735
- package/lib/sudoKeyArchive/sudoKeyArchive.d.ts +1 -1
- package/lib/sudoKeyArchive/sudoKeyArchive.js +1 -1
- package/lib/sudoKeyManager/sudoCryptoProvider.d.ts +34 -3
- package/lib/sudoKeyManager/sudoKeyManager.d.ts +32 -4
- package/lib/sudoKeyManager/sudoKeyManager.js +16 -4
- package/package.json +26 -18
- package/src/sudoKeyArchive/sudoKeyArchive.ts +1 -1
- package/src/sudoKeyManager/sudoCryptoProvider.ts +44 -3
- package/src/sudoKeyManager/sudoKeyManager.ts +64 -6
- package/test/unit/sudoKeyManager.spec.ts +12 -12
- package/yarn.lock +1012 -735
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/github/docs/assets/icons.css +0 -1043
- package/github/docs/assets/icons.png +0 -0
- package/github/docs/assets/icons@2x.png +0 -0
package/.gitignore
CHANGED
|
@@ -1565,7 +1565,13 @@ class ResponseError extends Error {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
1567
|
exports.ResponseError = ResponseError;
|
|
1568
|
-
class OneTimePasswordError extends Error {
|
|
1568
|
+
class OneTimePasswordError extends Error {
|
|
1569
|
+
constructor(notice) {
|
|
1570
|
+
super();
|
|
1571
|
+
this.notice = notice;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
}
|
|
1569
1575
|
exports.OneTimePasswordError = OneTimePasswordError;
|
|
1570
1576
|
|
|
1571
1577
|
/***/ }),
|
|
@@ -32867,6 +32873,10 @@ class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default {
|
|
|
32867
32873
|
}
|
|
32868
32874
|
|
|
32869
32875
|
_this.reporter.info(_this.reporter.lang('twoFactorAuthenticationEnabled'));
|
|
32876
|
+
if (error.notice) {
|
|
32877
|
+
_this.reporter.info(error.notice);
|
|
32878
|
+
}
|
|
32879
|
+
|
|
32870
32880
|
_this.otp = yield (0, (_login || _load_login()).getOneTimePassword)(_this.reporter);
|
|
32871
32881
|
|
|
32872
32882
|
_this.requestManager.clearCache();
|
|
@@ -46853,7 +46863,7 @@ function mkdirfix (name, opts, cb) {
|
|
|
46853
46863
|
/* 195 */
|
|
46854
46864
|
/***/ (function(module, exports) {
|
|
46855
46865
|
|
|
46856
|
-
module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.
|
|
46866
|
+
module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.19","packageManager":"yarn@1.22.17","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}}
|
|
46857
46867
|
|
|
46858
46868
|
/***/ }),
|
|
46859
46869
|
/* 196 */
|
|
@@ -77655,9 +77665,8 @@ class RequestManager {
|
|
|
77655
77665
|
|
|
77656
77666
|
if (res.statusCode === 401 && res.headers['www-authenticate']) {
|
|
77657
77667
|
const authMethods = res.headers['www-authenticate'].split(/,\s*/).map(s => s.toLowerCase());
|
|
77658
|
-
|
|
77659
77668
|
if (authMethods.indexOf('otp') !== -1) {
|
|
77660
|
-
reject(new (_errors || _load_errors()).OneTimePasswordError());
|
|
77669
|
+
reject(new (_errors || _load_errors()).OneTimePasswordError(res.headers['npm-notice']));
|
|
77661
77670
|
return;
|
|
77662
77671
|
}
|
|
77663
77672
|
}
|
package/.yarnrc
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
set -e
|
|
4
|
+
d="$(dirname "$0")"
|
|
5
|
+
|
|
6
|
+
version_diff_type() {
|
|
4
7
|
v1="$1"
|
|
5
8
|
v2="$2"
|
|
6
|
-
v1_major=$(echo $v1 | sed -E -e 's/^([^.]+)\..*/\1/')
|
|
7
|
-
v2_major=$(echo $v2 | sed -E -e 's/^([^.]+)\..*/\1/')
|
|
8
|
-
v1_minor=$(echo $v1 | sed -E -e 's/^([^.]+)\.([^.]+)\..*/\2/')
|
|
9
|
-
v2_minor=$(echo $v2 | sed -E -e 's/^([^.]+)\.([^.]+)\..*/\2/')
|
|
9
|
+
v1_major=$(echo "$v1" | sed -E -e 's/^([^.]+)\..*/\1/')
|
|
10
|
+
v2_major=$(echo "$v2" | sed -E -e 's/^([^.]+)\..*/\1/')
|
|
11
|
+
v1_minor=$(echo "$v1" | sed -E -e 's/^([^.]+)\.([^.]+)\..*/\2/')
|
|
12
|
+
v2_minor=$(echo "$v2" | sed -E -e 's/^([^.]+)\.([^.]+)\..*/\2/')
|
|
10
13
|
if [ "${v1_major}" != "${v2_major}" ]; then echo 'major'; return 0; fi
|
|
11
14
|
if [ "${v1_minor}" != "${v2_minor}" ]; then echo 'minor'; return 0; fi
|
|
12
15
|
if [ "${v1}" != "${v2}" ]; then echo 'patch'; return 0; fi
|
|
@@ -14,7 +17,7 @@ function version_diff_type() {
|
|
|
14
17
|
return 0
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
suppression_from_diff_type() {
|
|
18
21
|
diff_type="$1"
|
|
19
22
|
majorSuppression="$2"
|
|
20
23
|
minorSuppression="$3"
|
|
@@ -45,17 +48,92 @@ function suppression_from_diff_type() {
|
|
|
45
48
|
esac
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
# Number of days to suppress if accepting or refreshing and cadence to run if --last specified
|
|
52
|
+
cadence=30
|
|
53
|
+
|
|
54
|
+
# If set, accept any outdated packages. Has the effect of refreshing existing suppressions
|
|
55
|
+
# as well.
|
|
56
|
+
accept=""
|
|
57
|
+
|
|
58
|
+
# If set, refresh any existing suppressions
|
|
59
|
+
refresh=""
|
|
60
|
+
|
|
61
|
+
# If set, records/references last success in the specified directory.
|
|
62
|
+
# Only run the dependency check every cadence days if a last success
|
|
63
|
+
# timestamp is found
|
|
64
|
+
last=""
|
|
65
|
+
|
|
66
|
+
while [ -n "${1}" ]; do
|
|
67
|
+
case "${1}" in
|
|
68
|
+
--cadence)
|
|
69
|
+
if [ -z "$2" ]; then
|
|
70
|
+
echo "ERROR: --cadence requires number of days argument" 1>&2
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
shift
|
|
74
|
+
cadence="$1"
|
|
75
|
+
;;
|
|
76
|
+
--accept) accept="1" ;;
|
|
77
|
+
--refresh) refresh="1" ;;
|
|
78
|
+
--last)
|
|
79
|
+
if [ -z "$2" ]; then
|
|
80
|
+
echo "ERROR: --last requires directory argument in which last successful run timestamp is to be store" 1>&2
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
shift
|
|
84
|
+
last="$1"
|
|
85
|
+
;;
|
|
86
|
+
*)
|
|
87
|
+
echo "ERROR: Unrecognized argument '${1}'" 1>&2
|
|
88
|
+
exit 1
|
|
89
|
+
esac
|
|
90
|
+
shift
|
|
91
|
+
done
|
|
92
|
+
|
|
93
|
+
dateFromSeconds() {
|
|
94
|
+
s="$1"
|
|
95
|
+
case $(uname) in
|
|
96
|
+
Darwin)
|
|
97
|
+
date -Iseconds -r"${s}"
|
|
98
|
+
;;
|
|
99
|
+
*)
|
|
100
|
+
date -Iseconds "-d@${s}"
|
|
101
|
+
;;
|
|
102
|
+
esac
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
within_cadence=""
|
|
106
|
+
if [ -r "${last}/last_success" ]; then
|
|
107
|
+
cadence_seconds=$((cadence * 24 * 3600))
|
|
108
|
+
now="$(date +%s)"
|
|
109
|
+
last_run="$(cat "${last}/last_success")"
|
|
110
|
+
due="$((last_run + cadence_seconds))"
|
|
111
|
+
if [ "$((due > now))" = "1" ]; then
|
|
112
|
+
echo "Last success: $(dateFromSeconds "${last_run}")"
|
|
113
|
+
echo "Now: $(date -Iseconds)"
|
|
114
|
+
echo "Due from: $(dateFromSeconds "${due}")"
|
|
115
|
+
within_cadence="1"
|
|
116
|
+
else
|
|
117
|
+
echo "Last success: $(dateFromSeconds "${last_run}")"
|
|
118
|
+
echo "Now: $(date -Iseconds)"
|
|
119
|
+
echo "Due since: $(dateFromSeconds "${due}")"
|
|
120
|
+
fi
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
yarn outdated --json | jq -r -s -c 'map(select(.type == "table").data.body) | .[] | unique_by(.[0]) | .[] | .[0] + " " + .[1] + " " + .[2] + " " + .[3]' | (new=""; while read -r package_name current wanted latest; do
|
|
49
125
|
majorSuppression=$(jq ".outdatedSuppressions.major[\"${package_name}\"] | select (. != null)" package.json)
|
|
50
126
|
minorSuppression=$(jq ".outdatedSuppressions.minor[\"${package_name}\"] | select (. != null)" package.json)
|
|
51
127
|
patchSuppression=$(jq ".outdatedSuppressions[\"${package_name}\"] | select (. != null)" package.json)
|
|
52
128
|
latest_diff_type=$(version_diff_type "${current}" "${latest}")
|
|
53
129
|
wanted_diff_type=$(version_diff_type "${current}" "${wanted}")
|
|
54
130
|
|
|
131
|
+
# shellcheck disable=SC2046
|
|
55
132
|
set -- $(suppression_from_diff_type "${latest_diff_type}" "${majorSuppression}" "${minorSuppression}" "${patchSuppression}")
|
|
56
133
|
latest_suppression_type="$1"
|
|
57
134
|
latest_suppression="$2"
|
|
58
135
|
|
|
136
|
+
# shellcheck disable=SC2046
|
|
59
137
|
set -- $(suppression_from_diff_type "${wanted_diff_type}" "${majorSuppression}" "${minorSuppression}" "${patchSuppression}")
|
|
60
138
|
wanted_suppression_type="$1"
|
|
61
139
|
wanted_suppression="$2"
|
|
@@ -81,17 +159,45 @@ yarn outdated --json | jq -r -s -c 'map(select(.type == "table").data.body) | .[
|
|
|
81
159
|
fi
|
|
82
160
|
fi
|
|
83
161
|
|
|
162
|
+
suppress_outdated=""
|
|
163
|
+
if [ -e "${d}/suppress-outdated" ]; then
|
|
164
|
+
suppress_outdated="${d}/suppress-outdated"
|
|
165
|
+
elif [ -e "${d}/suppress-outdated.sh" ]; then
|
|
166
|
+
suppress_outdated="${d}/suppress-outdated.sh"
|
|
167
|
+
fi
|
|
168
|
+
if [ -z "${suppress_outdated}" ]; then
|
|
169
|
+
echo "ERROR: Unable to find suppress-outdated" 1>&2
|
|
170
|
+
exit 1
|
|
171
|
+
fi
|
|
84
172
|
if [ -z "${suppression}" ]; then
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
173
|
+
if [ -n "${accept}" ]; then
|
|
174
|
+
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${latest_diff_type} accepted]"
|
|
175
|
+
"${suppress_outdated}" --suppression "${cadence}" --"${latest_diff_type}" "${package_name}"
|
|
176
|
+
else
|
|
177
|
+
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${outdated_diff_type} outdated]"
|
|
178
|
+
new=1
|
|
179
|
+
fi
|
|
180
|
+
elif [ -n "${accept}${refresh}" ]; then
|
|
181
|
+
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${suppression_type} suppression refreshed]"
|
|
182
|
+
"${suppress_outdated}" --suppression "${cadence}" --"${suppression_type}" "${package_name}"
|
|
183
|
+
elif [ "$(date '+%s')" -gt "${suppression}" ]; then
|
|
88
184
|
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${outdated_diff_type} suppression expired]"
|
|
89
185
|
new=1
|
|
90
186
|
else
|
|
91
187
|
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${outdated_diff_type} suppressed]"
|
|
92
188
|
fi
|
|
93
189
|
done
|
|
94
|
-
|
|
190
|
+
|
|
191
|
+
# If we're not within cadence and there are new outdated dependencies
|
|
192
|
+
# then fail
|
|
193
|
+
if [ -z "${within_cadence}" -a -n "${new}" ]; then
|
|
95
194
|
exit 1
|
|
96
195
|
fi
|
|
196
|
+
|
|
197
|
+
# If there a no outdated dependencies and we're tracking last success then
|
|
198
|
+
# refresh the last success timestamp.
|
|
199
|
+
if [ -z "${new}" -a -n "${last}" ]; then
|
|
200
|
+
mkdir -p "${last}"
|
|
201
|
+
date +%s > "${last}/last_success"
|
|
202
|
+
fi
|
|
97
203
|
)
|
package/bin/suppress-outdated.sh
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
# Insert a package name to suppress in outdated checks.
|
|
4
4
|
#
|
|
5
5
|
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
usage() {
|
|
9
|
+
echo "Usage: suppress-outdated.sh [--suppression <number-of-days>] {--major|--minor|--patch} <package name> ..."
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
suppression=30
|
|
13
|
+
if [ "$1" = "--suppression" ]; then
|
|
14
|
+
if [ -z "$2" ]; then
|
|
15
|
+
echo "ERROR: --suppression argument must specify a number of days argument" 1>&2
|
|
16
|
+
usage 1>&2
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
shift
|
|
20
|
+
suppression="$1"
|
|
21
|
+
shift
|
|
22
|
+
fi
|
|
23
|
+
|
|
6
24
|
case "$1" in
|
|
7
25
|
--major)
|
|
8
26
|
root=".outdatedSuppressions.major"
|
|
@@ -15,19 +33,28 @@ case "$1" in
|
|
|
15
33
|
;;
|
|
16
34
|
*)
|
|
17
35
|
echo "suppress-outdated.sh: Unrecognized option: '$1'" 1>&2
|
|
18
|
-
|
|
36
|
+
usage 1>&2
|
|
19
37
|
exit 1
|
|
20
38
|
;;
|
|
21
39
|
esac
|
|
40
|
+
shift
|
|
22
41
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if [ -z "$package_name" ]; then
|
|
27
|
-
echo "Usage: yarn suppress-outdated {--major|--minor|--patch} <package name>"
|
|
42
|
+
if [ -z "$1" ]; then
|
|
43
|
+
echo "suppress-outdated.sh: No package names specified" 1>&2
|
|
44
|
+
usage 1>&2
|
|
28
45
|
exit 1
|
|
29
46
|
fi
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
suppression_seconds=$((suppression * 24 * 3600))
|
|
49
|
+
|
|
50
|
+
PACKAGE_JSON="package.json"
|
|
51
|
+
cp "$PACKAGE_JSON" "$PACKAGE_JSON.old"
|
|
52
|
+
|
|
53
|
+
while [ -n "$1" ]; do
|
|
54
|
+
package_name="$1"
|
|
55
|
+
|
|
56
|
+
jq < "$PACKAGE_JSON" "${root}.\"${package_name}\" = (now | floor | . + ${suppression_seconds})" > "$PACKAGE_JSON.staging"
|
|
57
|
+
mv "$PACKAGE_JSON.staging" "$PACKAGE_JSON"
|
|
58
|
+
|
|
59
|
+
shift
|
|
60
|
+
done
|