@sudoplatform/sudo-common 5.6.0 → 5.9.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 +5 -1
- package/bin/yarn-audit-with-suppression.sh +1 -1
- package/dependencies-report.json +2 -2
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +57 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/{images/icons.png → icons.png} +0 -0
- package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1384 -0
- package/docs/assets/{images/widgets.png → widgets.png} +0 -0
- package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
- package/docs/classes/AccountLockedError.html +7 -332
- package/docs/classes/AuthenticationError.html +8 -339
- package/docs/classes/Base64.html +3 -283
- package/docs/classes/Buffer.html +3 -324
- package/docs/classes/ConfigurationNotSetError.html +8 -333
- package/docs/classes/ConfigurationSetNotFoundError.html +7 -338
- package/docs/classes/DecodeError.html +7 -338
- package/docs/classes/DefaultConfigurationManager.html +18 -333
- package/docs/classes/DefaultLogger.html +19 -417
- package/docs/classes/DefaultSudoKeyArchive.html +61 -598
- package/docs/classes/DefaultSudoKeyManager.html +60 -1110
- package/docs/classes/FatalError.html +8 -339
- package/docs/classes/IllegalArgumentError.html +7 -338
- package/docs/classes/IllegalStateError.html +8 -339
- package/docs/classes/InsufficientEntitlementsError.html +8 -333
- package/docs/classes/InvalidOwnershipProofError.html +7 -332
- package/docs/classes/InvalidTokenError.html +7 -332
- package/docs/classes/KeyArchiveDecodingError.html +7 -338
- package/docs/classes/KeyArchiveIncorrectPasswordError.html +7 -338
- package/docs/classes/KeyArchiveMissingError.html +7 -338
- package/docs/classes/KeyArchiveNoPasswordRequiredError.html +7 -338
- package/docs/classes/KeyArchivePasswordRequiredError.html +7 -338
- package/docs/classes/KeyArchiveTypeError.html +7 -338
- package/docs/classes/KeyArchiveUnknownKeyTypeError.html +7 -338
- package/docs/classes/KeyArchiveVersionError.html +7 -338
- package/docs/classes/KeyNotFoundError.html +7 -338
- package/docs/classes/KeyStoreNotExportableError.html +7 -338
- package/docs/classes/LimitExceededError.html +8 -333
- package/docs/classes/NoEntitlementsError.html +7 -332
- package/docs/classes/NotAuthorizedError.html +8 -339
- package/docs/classes/NotRegisteredError.html +7 -338
- package/docs/classes/NotSignedInError.html +8 -333
- package/docs/classes/OperationNotImplementedError.html +7 -338
- package/docs/classes/RegisterError.html +8 -339
- package/docs/classes/RequestFailedError.html +12 -380
- package/docs/classes/ServiceError.html +9 -340
- package/docs/classes/SignOutError.html +7 -338
- package/docs/classes/SudoCryptoProviderDefaults.html +1 -224
- package/docs/classes/UnknownGraphQLError.html +7 -338
- package/docs/classes/UnrecognizedAlgorithmError.html +7 -0
- package/docs/classes/UserNotConfirmedError.html +8 -333
- package/docs/classes/VersionMismatchError.html +10 -335
- package/docs/enums/CachePolicy.html +4 -170
- package/docs/enums/EncryptionAlgorithm.html +5 -171
- package/docs/enums/KeyArchiveKeyType.html +4 -198
- package/docs/enums/KeyDataKeyFormat.html +18 -202
- package/docs/enums/KeyDataKeyType.html +3 -197
- package/docs/enums/ListOperationResultStatus.html +10 -0
- package/docs/enums/PublicKeyFormat.html +1 -162
- package/docs/index.html +14 -369
- package/docs/interfaces/AsymmetricEncryptionOptions.html +3 -163
- package/docs/interfaces/BooleanFilter.html +3 -177
- package/docs/interfaces/ConfigurationManager.html +37 -349
- package/docs/interfaces/KeyData.html +8 -236
- package/docs/interfaces/ListOperationFailureResult.html +5 -0
- package/docs/interfaces/ListOperationPartialResult.html +10 -0
- package/docs/interfaces/ListOperationSuccessResult.html +7 -0
- package/docs/interfaces/ListOutput.html +3 -185
- package/docs/interfaces/Logger.html +39 -401
- package/docs/interfaces/Owner.html +1 -170
- package/docs/interfaces/PublicKey.html +1 -170
- package/docs/interfaces/StringFilter.html +3 -191
- package/docs/interfaces/SudoCryptoProvider.html +172 -1305
- package/docs/interfaces/SudoKeyArchive.html +54 -490
- package/docs/interfaces/SudoKeyManager.html +167 -1298
- package/docs/interfaces/SymmetricEncryptionOptions.html +3 -177
- package/docs/modules.html +33 -895
- package/github/CHANGELOG.md +5 -1
- package/github/bin/yarn-audit-with-suppression.sh +1 -1
- package/github/docs/.nojekyll +1 -0
- package/github/docs/assets/highlight.css +57 -0
- package/github/docs/assets/icons.css +1043 -0
- package/github/docs/assets/{images/icons.png → icons.png} +0 -0
- package/github/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
- package/github/docs/assets/main.js +52 -0
- package/github/docs/assets/search.js +1 -0
- package/github/docs/assets/style.css +1384 -0
- package/github/docs/assets/{images/widgets.png → widgets.png} +0 -0
- package/github/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
- package/github/docs/classes/AccountLockedError.html +7 -332
- package/github/docs/classes/AuthenticationError.html +8 -339
- package/github/docs/classes/Base64.html +3 -283
- package/github/docs/classes/Buffer.html +3 -324
- package/github/docs/classes/ConfigurationNotSetError.html +8 -333
- package/github/docs/classes/ConfigurationSetNotFoundError.html +7 -338
- package/github/docs/classes/DecodeError.html +7 -338
- package/github/docs/classes/DefaultConfigurationManager.html +18 -333
- package/github/docs/classes/DefaultLogger.html +19 -417
- package/github/docs/classes/DefaultSudoKeyArchive.html +61 -598
- package/github/docs/classes/DefaultSudoKeyManager.html +60 -1110
- package/github/docs/classes/FatalError.html +8 -339
- package/github/docs/classes/IllegalArgumentError.html +7 -338
- package/github/docs/classes/IllegalStateError.html +8 -339
- package/github/docs/classes/InsufficientEntitlementsError.html +8 -333
- package/github/docs/classes/InvalidOwnershipProofError.html +7 -332
- package/github/docs/classes/InvalidTokenError.html +7 -332
- package/github/docs/classes/KeyArchiveDecodingError.html +7 -338
- package/github/docs/classes/KeyArchiveIncorrectPasswordError.html +7 -338
- package/github/docs/classes/KeyArchiveMissingError.html +7 -338
- package/github/docs/classes/KeyArchiveNoPasswordRequiredError.html +7 -338
- package/github/docs/classes/KeyArchivePasswordRequiredError.html +7 -338
- package/github/docs/classes/KeyArchiveTypeError.html +7 -338
- package/github/docs/classes/KeyArchiveUnknownKeyTypeError.html +7 -338
- package/github/docs/classes/KeyArchiveVersionError.html +7 -338
- package/github/docs/classes/KeyNotFoundError.html +7 -338
- package/github/docs/classes/KeyStoreNotExportableError.html +7 -338
- package/github/docs/classes/LimitExceededError.html +8 -333
- package/github/docs/classes/NoEntitlementsError.html +7 -332
- package/github/docs/classes/NotAuthorizedError.html +8 -339
- package/github/docs/classes/NotRegisteredError.html +7 -338
- package/github/docs/classes/NotSignedInError.html +8 -333
- package/github/docs/classes/OperationNotImplementedError.html +7 -338
- package/github/docs/classes/RegisterError.html +8 -339
- package/github/docs/classes/RequestFailedError.html +12 -380
- package/github/docs/classes/ServiceError.html +9 -340
- package/github/docs/classes/SignOutError.html +7 -338
- package/github/docs/classes/SudoCryptoProviderDefaults.html +1 -224
- package/github/docs/classes/UnknownGraphQLError.html +7 -338
- package/github/docs/classes/UnrecognizedAlgorithmError.html +7 -0
- package/github/docs/classes/UserNotConfirmedError.html +8 -333
- package/github/docs/classes/VersionMismatchError.html +10 -335
- package/github/docs/enums/CachePolicy.html +4 -170
- package/github/docs/enums/EncryptionAlgorithm.html +5 -171
- package/github/docs/enums/KeyArchiveKeyType.html +4 -198
- package/github/docs/enums/KeyDataKeyFormat.html +18 -202
- package/github/docs/enums/KeyDataKeyType.html +3 -197
- package/github/docs/enums/ListOperationResultStatus.html +10 -0
- package/github/docs/enums/PublicKeyFormat.html +1 -162
- package/github/docs/index.html +14 -369
- package/github/docs/interfaces/AsymmetricEncryptionOptions.html +3 -163
- package/github/docs/interfaces/BooleanFilter.html +3 -177
- package/github/docs/interfaces/ConfigurationManager.html +37 -349
- package/github/docs/interfaces/KeyData.html +8 -236
- package/github/docs/interfaces/ListOperationFailureResult.html +5 -0
- package/github/docs/interfaces/ListOperationPartialResult.html +10 -0
- package/github/docs/interfaces/ListOperationSuccessResult.html +7 -0
- package/github/docs/interfaces/ListOutput.html +3 -185
- package/github/docs/interfaces/Logger.html +39 -401
- package/github/docs/interfaces/Owner.html +1 -170
- package/github/docs/interfaces/PublicKey.html +1 -170
- package/github/docs/interfaces/StringFilter.html +3 -191
- package/github/docs/interfaces/SudoCryptoProvider.html +172 -1305
- package/github/docs/interfaces/SudoKeyArchive.html +54 -490
- package/github/docs/interfaces/SudoKeyManager.html +167 -1298
- package/github/docs/interfaces/SymmetricEncryptionOptions.html +3 -177
- package/github/docs/modules.html +33 -895
- package/github/package.json +19 -16
- package/github/src/errors/error.ts +10 -0
- package/github/src/sudoKeyArchive/sudoKeyArchive.ts +1 -1
- package/github/src/sudoKeyManager/sudoCryptoProvider.ts +12 -0
- package/github/src/sudoKeyManager/sudoKeyManager.ts +12 -0
- package/github/src/types/types.ts +78 -0
- package/github/test/utils/listOperationResult.spec.ts +84 -0
- package/github/yarn.lock +871 -1264
- package/lib/errors/error.d.ts +6 -0
- package/lib/errors/error.js +16 -2
- package/lib/logging/bunyanLogger.js +1 -1
- package/lib/sudoKeyArchive/keyArchive.js +2 -2
- package/lib/sudoKeyArchive/keyInfo.js +1 -1
- package/lib/sudoKeyArchive/sudoKeyArchive.d.ts +1 -2
- package/lib/sudoKeyArchive/sudoKeyArchive.js +1 -1
- package/lib/sudoKeyManager/keyData.js +1 -1
- package/lib/sudoKeyManager/sudoCryptoProvider.d.ts +12 -0
- package/lib/sudoKeyManager/sudoKeyManager.d.ts +12 -0
- package/lib/types/types.d.ts +71 -0
- package/lib/types/types.js +14 -2
- package/package.json +20 -17
- package/src/errors/error.ts +10 -0
- package/src/sudoKeyArchive/sudoKeyArchive.ts +1 -1
- package/src/sudoKeyManager/sudoCryptoProvider.ts +12 -0
- package/src/sudoKeyManager/sudoKeyManager.ts +12 -0
- package/src/types/types.ts +78 -0
- package/test/utils/listOperationResult.spec.ts +84 -0
- package/yarn.lock +871 -1264
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/github/docs/assets/css/main.css +0 -2660
- package/github/docs/assets/js/main.js +0 -248
- package/github/docs/assets/js/search.js +0 -1
- package/github/src/sudoKeyManager/encryptionAlgorithmTransformer.ts +0 -21
- package/lib/sudoKeyManager/encryptionAlgorithmTransformer.d.ts +0 -9
- package/lib/sudoKeyManager/encryptionAlgorithmTransformer.js +0 -28
- package/src/sudoKeyManager/encryptionAlgorithmTransformer.ts +0 -21
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ListOperationResult,
|
|
3
|
+
ListOperationResultStatus,
|
|
4
|
+
} from '../../src/types/types'
|
|
5
|
+
|
|
6
|
+
type Item = {
|
|
7
|
+
id: string
|
|
8
|
+
createdAt: Date
|
|
9
|
+
updatedAt: Date
|
|
10
|
+
} & SealedAttributes
|
|
11
|
+
type SealedAttributes = {
|
|
12
|
+
secret: string
|
|
13
|
+
}
|
|
14
|
+
type ListItemResult = ListOperationResult<Item, SealedAttributes>
|
|
15
|
+
|
|
16
|
+
describe('ListOperationResult', () => {
|
|
17
|
+
it('should successfully assign success result', () => {
|
|
18
|
+
const obj: ListItemResult = {
|
|
19
|
+
status: ListOperationResultStatus.Success,
|
|
20
|
+
items: [
|
|
21
|
+
{
|
|
22
|
+
id: 'dummy_id',
|
|
23
|
+
createdAt: new Date(1),
|
|
24
|
+
updatedAt: new Date(2),
|
|
25
|
+
secret: 'dummy_secret',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
nextToken: 'dummy_token',
|
|
29
|
+
}
|
|
30
|
+
expect(obj.status).toBe('Success')
|
|
31
|
+
expect(obj.nextToken).toBe('dummy_token')
|
|
32
|
+
expect(obj.items.length).toBe(1)
|
|
33
|
+
expect(obj.items[0].id).toBe('dummy_id')
|
|
34
|
+
expect(obj.items[0].createdAt).toEqual(new Date(1))
|
|
35
|
+
expect(obj.items[0].updatedAt).toEqual(new Date(2))
|
|
36
|
+
expect(obj.items[0].secret).toBe('dummy_secret')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('should successfully assign failure result', () => {
|
|
40
|
+
const obj: ListItemResult = {
|
|
41
|
+
status: ListOperationResultStatus.Failure,
|
|
42
|
+
cause: new Error('dummy_error'),
|
|
43
|
+
}
|
|
44
|
+
expect(obj.status).toBe('Failure')
|
|
45
|
+
expect(obj.cause.message).toBe('dummy_error')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('should successfully assign partial result', () => {
|
|
49
|
+
const obj: ListItemResult = {
|
|
50
|
+
status: ListOperationResultStatus.Partial,
|
|
51
|
+
items: [
|
|
52
|
+
{
|
|
53
|
+
id: 'dummy_id',
|
|
54
|
+
createdAt: new Date(1),
|
|
55
|
+
updatedAt: new Date(2),
|
|
56
|
+
secret: 'dummy_secret',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
failed: [
|
|
60
|
+
{
|
|
61
|
+
item: {
|
|
62
|
+
id: 'dummy_id',
|
|
63
|
+
createdAt: new Date(1),
|
|
64
|
+
updatedAt: new Date(2),
|
|
65
|
+
},
|
|
66
|
+
cause: new Error('dummy_error'),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
nextToken: 'dummy_token',
|
|
70
|
+
}
|
|
71
|
+
expect(obj.status).toBe('Partial')
|
|
72
|
+
expect(obj.nextToken).toBe('dummy_token')
|
|
73
|
+
expect(obj.items.length).toBe(1)
|
|
74
|
+
expect(obj.items[0].id).toBe('dummy_id')
|
|
75
|
+
expect(obj.items[0].createdAt).toEqual(new Date(1))
|
|
76
|
+
expect(obj.items[0].updatedAt).toEqual(new Date(2))
|
|
77
|
+
expect(obj.items[0].secret).toBe('dummy_secret')
|
|
78
|
+
expect(obj.items.length).toBe(1)
|
|
79
|
+
expect(obj.failed[0].item.id).toBe('dummy_id')
|
|
80
|
+
expect(obj.failed[0].item.createdAt).toEqual(new Date(1))
|
|
81
|
+
expect(obj.failed[0].item.updatedAt).toEqual(new Date(2))
|
|
82
|
+
expect(obj.failed[0].cause.message).toBe('dummy_error')
|
|
83
|
+
})
|
|
84
|
+
})
|