@keetanetwork/keetanet-client 0.18.0 → 0.18.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.
Files changed (128) hide show
  1. package/client/builder.d.ts +23 -10
  2. package/client/index-browser.d.ts +1 -1
  3. package/client/index-browser.js +208 -81
  4. package/client/index.d.ts +1 -1
  5. package/client/index.js +146 -43
  6. package/docs/assets/hierarchy.js +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
  9. package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
  10. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
  11. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +1 -1
  12. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +1 -1
  13. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +1 -1
  14. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
  15. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
  16. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
  17. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
  18. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  19. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  20. package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +1 -4
  21. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
  22. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
  23. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
  24. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
  25. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
  26. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
  27. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
  28. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
  29. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
  30. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
  31. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
  32. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
  33. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
  34. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
  35. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
  36. package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +1 -1
  37. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
  38. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
  39. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +1 -1
  40. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
  41. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +1 -1
  42. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
  43. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
  44. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
  45. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
  46. package/docs/classes/KeetaNetSDK.Referenced.Log.html +2 -2
  47. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
  48. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +1 -1
  49. package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +1 -1
  50. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
  51. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
  52. package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
  53. package/docs/classes/KeetaNetSDK.Referenced.UnsignedBlock.html +1 -1
  54. package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +1 -1
  55. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +1 -1
  56. package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
  57. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  58. package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +1 -1
  59. package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
  60. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
  61. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
  62. package/docs/classes/KeetaNetSDK.UserClient.html +2 -2
  63. package/docs/hierarchy.html +1 -1
  64. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  65. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  66. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  67. package/docs/interfaces/KeetaNetSDK.Referenced.AccountACLRow.html +1 -1
  68. package/docs/interfaces/KeetaNetSDK.Referenced.BaseACLRow.html +1 -1
  69. package/docs/interfaces/KeetaNetSDK.Referenced.BaseAccountInfo.html +1 -1
  70. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  71. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
  72. package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierAccountInfo.html +1 -1
  73. package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
  74. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  75. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
  76. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
  77. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  78. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  79. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  80. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  81. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  82. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  83. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  84. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
  85. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
  86. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateACLRow.html +1 -1
  87. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  88. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
  89. package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256K1AccountInfo.html +1 -1
  90. package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256R1AccountInfo.html +1 -1
  91. package/docs/interfaces/KeetaNetSDK.Referenced.ED25519AccountInfo.html +1 -1
  92. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  93. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  94. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
  95. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
  98. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  99. package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
  100. package/docs/interfaces/KeetaNetSDK.Referenced.MultisigAccountInfo.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
  102. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  103. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  104. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
  106. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +2 -2
  107. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +2 -2
  108. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  109. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  110. package/docs/interfaces/KeetaNetSDK.Referenced.StorageAccountInfo.html +1 -1
  111. package/docs/interfaces/KeetaNetSDK.Referenced.TokenAccountInfo.html +1 -1
  112. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  113. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  114. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  115. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  116. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  117. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  118. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Struct.html +1 -1
  120. package/docs/types/KeetaNetSDK.Referenced.LogOptions.html +13 -3
  121. package/lib/log/common.d.ts +1 -1
  122. package/lib/log/index.d.ts +21 -6
  123. package/lib/utils/certificate.d.ts +0 -1
  124. package/lib/utils/external-keys/passkey-prf.js +100 -21
  125. package/lib/utils/helper_testing.d.ts +10 -0
  126. package/npm-shrinkwrap.json +10 -17
  127. package/package.json +2 -2
  128. package/version.d.ts +1 -1
@@ -3,7 +3,7 @@ import { Account, AccountKeyAlgorithm } from '../lib/account';
3
3
  import type { AdjustMethod, BlockHash } from '../lib/block';
4
4
  import { Block } from '../lib/block';
5
5
  import type { IdentifierCreateArguments, BlockJSONOperations } from '../lib/block/operations';
6
- import type { AccountInfo, AccountInfoWithoutAccount } from '../lib/ledger/types';
6
+ import type { AccountInfo, AccountInfoWithoutAccount, ACLRow } from '../lib/ledger/types';
7
7
  import type { AcceptedPermissionTypes } from '../lib/permissions';
8
8
  import type { UserClient, Client } from '.';
9
9
  import { Permissions } from '../lib/permissions';
@@ -87,10 +87,15 @@ export interface PendingOperations {
87
87
  certificate: Certificate;
88
88
  intermediateCertificates: CertificateBundle | null;
89
89
  }[];
90
- permissionsChanges?: PerAccount<PerAccount<{
91
- method: AdjustMethod;
92
- permissions: Permissions;
93
- }[]>>;
90
+ permissionsChanges?: {
91
+ [principalOrCertificate: string]: {
92
+ principal: ACLRow['principal'];
93
+ targets: PerAccount<{
94
+ method: AdjustMethod;
95
+ permissions: Permissions;
96
+ }[]>;
97
+ };
98
+ };
94
99
  info?: AccountInfoWithoutAccount;
95
100
  setRep?: Account;
96
101
  }
@@ -123,10 +128,18 @@ export interface PendingOperationsJSON {
123
128
  certificate: string;
124
129
  intermediateCertificates: string | null;
125
130
  }[];
126
- permissionsChanges?: PerAccount<PerAccount<{
127
- method: AdjustMethod;
128
- permissions: [string, string];
129
- }[]>>;
131
+ permissionsChanges?: {
132
+ [principalOrCertificate: string]: {
133
+ principal: string | {
134
+ certificate: string;
135
+ certificateAccount: string;
136
+ };
137
+ targets: PerAccount<{
138
+ method: AdjustMethod;
139
+ permissions: [string, string];
140
+ }[]>;
141
+ };
142
+ };
130
143
  info?: Pick<AccountInfo, 'name' | 'description' | 'metadata'> & {
131
144
  defaultPermission?: [string, string];
132
145
  };
@@ -183,7 +196,7 @@ export declare class UserClientBuilder {
183
196
  computeBlocks(renderOptions: RenderOptions): Promise<ComputeBlocksResponse>;
184
197
  send(recipient: AccountOrPending, amount: bigint, token: TokenOrPending, external?: string, options?: BuilderBlockOptions): void;
185
198
  receive(from: AccountOrPending, amount: bigint, token: TokenOrPending, exact?: boolean, forward?: GenericAccount, options?: BuilderBlockOptions): void;
186
- updatePermissions(principal: GenericAccount, permissions: AcceptedPermissionTypes, target?: GenericAccount, method?: AdjustMethod, options?: BuilderBlockOptions): void;
199
+ updatePermissions(principal: ACLRow['principal'], permissions: AcceptedPermissionTypes, target?: GenericAccount, method?: AdjustMethod, options?: BuilderBlockOptions): void;
187
200
  modifyCertificate(method: ManageCertificateMethod, certificate: Certificate, intermediateCertificates?: CertificateBundle | null, options?: BuilderBlockOptions): void;
188
201
  modifyTokenSupply(amount: bigint, options?: BuilderBlockOptions): void;
189
202
  modifyTokenBalance(token: TokenOrPending, amount: bigint, isSet?: boolean, options?: BuilderBlockOptions): void;
@@ -1204,7 +1204,7 @@ export declare class UserClient {
1204
1204
  * @param options The options to use for the request
1205
1205
  * @return The vote staple that was generated and whether it was able to be published
1206
1206
  */
1207
- updatePermissions(principal: GenericAccount | string, permissions: AcceptedPermissionTypes, target?: GenericAccount | string, method?: AdjustMethod, options?: UserClientOptions): Promise<{
1207
+ updatePermissions(principal: GenericAccount | string | ACLRow['principal'], permissions: AcceptedPermissionTypes, target?: GenericAccount | string, method?: AdjustMethod, options?: UserClientOptions): Promise<{
1208
1208
  voteStaple: VoteStaple;
1209
1209
  publish: boolean;
1210
1210
  from: "direct";
@@ -117365,7 +117365,22 @@ class src_client_Certificate {
117365
117365
  * Verify against a given certificate store
117366
117366
  */
117367
117367
 
117368
- verifyChain(store, _ignore_seenCerts) {
117368
+ /** @internal */
117369
+
117370
+ verifyChain(store) {
117371
+ let seenHashes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new src_client_CertificateHash.Set();
117372
+ /**
117373
+ * Loop detection: reject any certificate already on the current
117374
+ * verification path, per RFC 4158 Section 2.4.1 (no certificate may
117375
+ * repeat in a path) and Section 5.2 (detection guidance).
117376
+ *
117377
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc4158#section-5.2 RFC 4158 Section 5.2}
117378
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc4158#section-2.4.1 RFC 4158 Section 2.4.1}
117379
+ */
117380
+ if (seenHashes.has(client_certificate_assertClassBrand(client_Certificate_brand, this, client_computeHash).call(this))) {
117381
+ return null;
117382
+ }
117383
+
117369
117384
  /*
117370
117385
  * Check to see if the certificate is signed by any of the Root CAs
117371
117386
  */
@@ -117397,6 +117412,8 @@ class src_client_Certificate {
117397
117412
  * Check to see if the certificate is signed by any of the specified intermediates
117398
117413
  */
117399
117414
  if (store.intermediate !== undefined) {
117415
+ const nextSeen = new src_client_CertificateHash.Set(seenHashes);
117416
+ nextSeen.add(client_certificate_assertClassBrand(client_Certificate_brand, this, client_computeHash).call(this));
117400
117417
  store.intermediate.forEach(intermediateCertificate => {
117401
117418
  if (retval !== null) {
117402
117419
  return;
@@ -117404,7 +117421,7 @@ class src_client_Certificate {
117404
117421
  const checkIssued = client_certificate_assertClassBrand(client_Certificate_brand, this, client_checkIssued).call(this, intermediateCertificate);
117405
117422
  if (checkIssued.issued) {
117406
117423
  if (intermediateCertificate.checkValid(this.moment)) {
117407
- const moreChain = intermediateCertificate.verifyChain(store, undefined /* seenCerts XXX:TODO */);
117424
+ const moreChain = intermediateCertificate.verifyChain(store, nextSeen);
117408
117425
  if (moreChain !== null) {
117409
117426
  const checkRetval = [...moreChain, intermediateCertificate];
117410
117427
  const validChain = src_client_Certificate.verifyChainDepth([...checkRetval, this]);
@@ -117581,12 +117598,13 @@ class src_client_Certificate {
117581
117598
  */
117582
117599
  hash() {
117583
117600
  this.assertConstructed();
117584
- if (!client_certificate_classPrivateFieldGet(client_hash, this)) {
117585
- client_certificate_classPrivateFieldSet(client_hash, this, src_client_CertificateHash.fromData(client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(client_raw2, this))));
117586
- }
117587
- return client_certificate_classPrivateFieldGet(client_hash, this);
117601
+ return client_certificate_assertClassBrand(client_Certificate_brand, this, client_computeHash).call(this);
117588
117602
  }
117589
117603
 
117604
+ /*
117605
+ * Compute the hash without asserting full construction.
117606
+ */
117607
+
117590
117608
  /**
117591
117609
  * Get a JSON representation of the certificate
117592
117610
  */
@@ -117890,6 +117908,12 @@ function client_checkIssued(issuer) {
117890
117908
  issued: true
117891
117909
  };
117892
117910
  }
117911
+ function client_computeHash() {
117912
+ if (!client_certificate_classPrivateFieldGet(client_hash, this)) {
117913
+ client_certificate_classPrivateFieldSet(client_hash, this, src_client_CertificateHash.fromData(client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(client_raw2, this))));
117914
+ }
117915
+ return client_certificate_classPrivateFieldGet(client_hash, this);
117916
+ }
117893
117917
  /**
117894
117918
  * The Certificate Builder
117895
117919
  */
@@ -118301,11 +118325,14 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
118301
118325
  }
118302
118326
  }
118303
118327
  }
118304
- if (prefetchPromises.length > 70) {
118328
+
118329
+ // Process promises in batches to avoid spanner's 100 concurrent read per session limit
118330
+ if (prefetchPromises.length > 50) {
118305
118331
  const toAwait = prefetchPromises.splice(0);
118306
118332
  await Promise.all(toAwait);
118307
118333
  }
118308
118334
  }
118335
+ // Wait for the final batch to complete
118309
118336
  await Promise.all(prefetchPromises);
118310
118337
  const supplies = {};
118311
118338
  const balances = {};
@@ -127079,6 +127106,48 @@ class client_LedgerRequestCache {
127079
127106
  }
127080
127107
  }
127081
127108
  /* harmony default export */ const client_cache = (client_LedgerRequestCache);
127109
+ ;// ./src/lib/log/common.ts
127110
+ const client_numericLogLevels = {
127111
+ DEBUG: 0,
127112
+ INFO: 1,
127113
+ WARN: 2,
127114
+ ERROR: 3
127115
+ };
127116
+
127117
+ /* XXX:TODO -- Do something with this */
127118
+
127119
+ function client_canLogForLevel(level, currentLevel) {
127120
+ return client_numericLogLevels[level] >= client_numericLogLevels[currentLevel];
127121
+ }
127122
+ function client_canLogForTargetLevel(level, targetLevel) {
127123
+ if (targetLevel === 'ALL') {
127124
+ return true;
127125
+ }
127126
+ if (targetLevel === 'NONE') {
127127
+ return false;
127128
+ }
127129
+ return client_canLogForLevel(level, targetLevel);
127130
+ }
127131
+ function client_filterLog(target, message) {
127132
+ var _message$options$user, _message$options$curr, _message$options$curr2;
127133
+ if (!client_canLogForTargetLevel(message.level, target.logLevel)) {
127134
+ return null;
127135
+ }
127136
+ if (target.filter && !target.filter.test(message.from)) {
127137
+ return null;
127138
+ }
127139
+ return {
127140
+ ...message,
127141
+ options: {
127142
+ userVisible: (_message$options$user = message.options.userVisible) !== null && _message$options$user !== void 0 ? _message$options$user : true,
127143
+ currentRequestInfo: {
127144
+ id: (_message$options$curr = (_message$options$curr2 = message.options.currentRequestInfo) === null || _message$options$curr2 === void 0 ? void 0 : _message$options$curr2.id) !== null && _message$options$curr !== void 0 ? _message$options$curr : '<NO_REQUEST_ID>',
127145
+ ...message.options.currentRequestInfo
127146
+ },
127147
+ ...message.options
127148
+ }
127149
+ };
127150
+ }
127082
127151
  // EXTERNAL MODULE: ./node_modules/typia/lib/internal/_assertGuard.js
127083
127152
  var client_assertGuard = __webpack_require__(7422);
127084
127153
  ;// ./src/lib/log/helper.generated.ts
@@ -127156,48 +127225,6 @@ const client_assertLogTargetLevel = (() => {
127156
127225
  return input;
127157
127226
  };
127158
127227
  })();
127159
- ;// ./src/lib/log/common.ts
127160
- const client_numericLogLevels = {
127161
- DEBUG: 0,
127162
- INFO: 1,
127163
- WARN: 2,
127164
- ERROR: 3
127165
- };
127166
-
127167
- /* XXX:TODO -- Do something with this */
127168
-
127169
- function client_canLogForLevel(level, currentLevel) {
127170
- return client_numericLogLevels[level] >= client_numericLogLevels[currentLevel];
127171
- }
127172
- function client_canLogForTargetLevel(level, targetLevel) {
127173
- if (targetLevel === 'ALL') {
127174
- return true;
127175
- }
127176
- if (targetLevel === 'NONE') {
127177
- return false;
127178
- }
127179
- return client_canLogForLevel(level, targetLevel);
127180
- }
127181
- function client_filterLog(target, message) {
127182
- var _message$options$user, _message$options$curr, _message$options$curr2;
127183
- if (!client_canLogForTargetLevel(message.level, target.logLevel)) {
127184
- return null;
127185
- }
127186
- if (target.filter && !target.filter.test(message.from)) {
127187
- return null;
127188
- }
127189
- return {
127190
- ...message,
127191
- options: {
127192
- userVisible: (_message$options$user = message.options.userVisible) !== null && _message$options$user !== void 0 ? _message$options$user : true,
127193
- currentRequestInfo: {
127194
- id: (_message$options$curr = (_message$options$curr2 = message.options.currentRequestInfo) === null || _message$options$curr2 === void 0 ? void 0 : _message$options$curr2.id) !== null && _message$options$curr !== void 0 ? _message$options$curr : '<NO_REQUEST_ID>',
127195
- ...message.options.currentRequestInfo
127196
- },
127197
- ...message.options
127198
- }
127199
- };
127200
- }
127201
127228
  ;// ./src/lib/log/target_console.ts
127202
127229
  function client_target_console_classPrivateFieldInitSpec(e, t, a) { client_target_console_checkPrivateRedeclaration(e, t), t.set(e, a); }
127203
127230
  function client_target_console_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -127260,11 +127287,13 @@ function client_log_checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new Ty
127260
127287
  function client_log_defineProperty(e, r, t) { return (r = client_log_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
127261
127288
  function client_log_toPropertyKey(t) { var i = client_log_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
127262
127289
  function client_log_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
127290
+ function client_log_classPrivateGetter(s, r, a) { return a(client_log_assertClassBrand(s, r)); }
127263
127291
  function client_log_classPrivateFieldSet(s, a, r) { return s.set(client_log_assertClassBrand(s, a), r), r; }
127264
127292
  function client_log_classPrivateFieldGet(s, a) { return s.get(client_log_assertClassBrand(s, a)); }
127265
127293
  function client_log_assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
127266
127294
 
127267
127295
 
127296
+
127268
127297
  /**
127269
127298
  * Maximum number of logs to enqueue when there are no targets assigned to a
127270
127299
  * Log instance
@@ -127290,6 +127319,8 @@ var client_destroyed = /*#__PURE__*/new WeakMap();
127290
127319
  var client_emitOnLog = /*#__PURE__*/new WeakMap();
127291
127320
  var client_logDebugTracing = /*#__PURE__*/new WeakMap();
127292
127321
  var client_targets = /*#__PURE__*/new WeakMap();
127322
+ var client_filter = /*#__PURE__*/new WeakMap();
127323
+ var client_logLevel = /*#__PURE__*/new WeakMap();
127293
127324
  var client_Log_brand = /*#__PURE__*/new WeakSet();
127294
127325
  class client_Log {
127295
127326
  /**
@@ -127379,19 +127410,37 @@ class client_Log {
127379
127410
  /**
127380
127411
  * Whether or not to generate debug tracing information for each log entry
127381
127412
  */
127382
- client_log_classPrivateFieldInitSpec(this, client_logDebugTracing, false);
127413
+ client_log_classPrivateFieldInitSpec(this, client_logDebugTracing, void 0);
127414
+ /**
127415
+ * Registered log targets (sinks) to send logs to, keyed by a unique
127416
+ * ID returned by `registerTarget()`
127417
+ */
127383
127418
  client_log_classPrivateFieldInitSpec(this, client_targets, new Map());
127384
127419
  /**
127385
- * The maximum number of log entries to send to each target at a time
127420
+ * Filter to apply before sending to targets
127386
127421
  */
127387
- client_log_defineProperty(this, "batchSize", 10);
127422
+ client_log_classPrivateFieldInitSpec(this, client_filter, void 0);
127423
+ /**
127424
+ * Log-level to filter for at the logger level
127425
+ */
127426
+ client_log_classPrivateFieldInitSpec(this, client_logLevel, void 0);
127388
127427
  /**
127389
127428
  * Parent logger, if any -- used for creating hierarchical loggers
127390
127429
  */
127391
127430
  client_log_defineProperty(this, "parent", null);
127431
+ /**
127432
+ * The maximum number of log entries to send to each target at a time
127433
+ */
127434
+ client_log_defineProperty(this, "batchSize", 10);
127392
127435
  if ((_options === null || _options === void 0 ? void 0 : _options.logDebugTracing) !== undefined) {
127393
127436
  client_log_classPrivateFieldSet(client_logDebugTracing, this, _options.logDebugTracing);
127394
127437
  }
127438
+ if ((_options === null || _options === void 0 ? void 0 : _options.filter) !== undefined) {
127439
+ client_log_classPrivateFieldSet(client_filter, this, _options.filter);
127440
+ }
127441
+ if ((_options === null || _options === void 0 ? void 0 : _options.logLevel) !== undefined) {
127442
+ client_log_classPrivateFieldSet(client_logLevel, this, _options.logLevel);
127443
+ }
127395
127444
  }
127396
127445
  log() {
127397
127446
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -127504,6 +127553,7 @@ class client_Log {
127504
127553
  }
127505
127554
  return Array.from(client_log_classPrivateFieldGet(client_targets, this).values());
127506
127555
  }
127556
+
127507
127557
  /**
127508
127558
  * Create a child logger instance that shares the same targets as this instance
127509
127559
  * but has its own log queue, this is useful for creating hierarchical loggers
@@ -127512,11 +127562,9 @@ class client_Log {
127512
127562
  * Since the child shares the same targets, registering or unregistering targets
127513
127563
  * from either the parent or child will affect both.
127514
127564
  */
127515
- createChild() {
127565
+ createChild(options) {
127516
127566
  var _this$parent;
127517
- const child = new client_Log({
127518
- logDebugTracing: client_log_classPrivateFieldGet(client_logDebugTracing, this)
127519
- });
127567
+ const child = new client_Log(options);
127520
127568
 
127521
127569
  /**
127522
127570
  * Attach child nodes to our own parent to collapse
@@ -127642,6 +127690,33 @@ class client_Log {
127642
127690
  client_log_classPrivateFieldSet(client_destroyed, this, true);
127643
127691
  }
127644
127692
  }
127693
+ function client_get_logDebugTracing(_this) {
127694
+ if (client_log_classPrivateFieldGet(client_logDebugTracing, _this) !== undefined) {
127695
+ return client_log_classPrivateFieldGet(client_logDebugTracing, _this);
127696
+ }
127697
+ if (_this.parent) {
127698
+ return client_log_classPrivateGetter(client_Log_brand, _this.parent, client_get_logDebugTracing);
127699
+ }
127700
+ return false;
127701
+ }
127702
+ function client_get_filter(_this2) {
127703
+ if (client_log_classPrivateFieldGet(client_filter, _this2) !== undefined) {
127704
+ return client_log_classPrivateFieldGet(client_filter, _this2);
127705
+ }
127706
+ if (_this2.parent) {
127707
+ return client_log_classPrivateGetter(client_Log_brand, _this2.parent, client_get_filter);
127708
+ }
127709
+ return null;
127710
+ }
127711
+ function client_get_logLevel(_this3) {
127712
+ if (client_log_classPrivateFieldGet(client_logLevel, _this3) !== undefined) {
127713
+ return client_log_classPrivateFieldGet(client_logLevel, _this3);
127714
+ }
127715
+ if (_this3.parent) {
127716
+ return client_log_classPrivateGetter(client_Log_brand, _this3.parent, client_get_logLevel);
127717
+ }
127718
+ return 'ALL';
127719
+ }
127645
127720
  function client_log_log(level, options, from) {
127646
127721
  if (client_log_classPrivateFieldGet(client_destroyed, this)) {
127647
127722
  return;
@@ -127655,7 +127730,13 @@ function client_log_log(level, options, from) {
127655
127730
  from,
127656
127731
  args
127657
127732
  };
127658
- if (client_log_classPrivateFieldGet(client_logDebugTracing, this)) {
127733
+ if (client_filterLog({
127734
+ logLevel: client_log_classPrivateGetter(client_Log_brand, this, client_get_logLevel),
127735
+ filter: client_log_classPrivateGetter(client_Log_brand, this, client_get_filter)
127736
+ }, log) === null) {
127737
+ return;
127738
+ }
127739
+ if (client_log_classPrivateGetter(client_Log_brand, this, client_get_logDebugTracing)) {
127659
127740
  var _Error$stack$split$sl, _Error$stack;
127660
127741
  log.trace = (_Error$stack$split$sl = (_Error$stack = new Error().stack) === null || _Error$stack === void 0 ? void 0 : _Error$stack.split('\n').slice(2).join('\n')) !== null && _Error$stack$split$sl !== void 0 ? _Error$stack$split$sl : '[No stack trace available]';
127661
127742
  }
@@ -129477,13 +129558,18 @@ async function client_checkPermissionRequirements(effects) {
129477
129558
  throw new client_ledger_KeetaNetLedgerError('LEDGER_INVALID_PERMISSIONS', `Quorum of ${foundInfo.multisigQuorum} not reached for ${multisigPubKey} -- got ${foundSingerLength}`);
129478
129559
  }
129479
129560
  }
129480
- const checkPromises = [];
129481
- for (const principalPubKey in requirementsByPrincipal) {
129482
- const accountRequirements = requirementsByPrincipal[principalPubKey];
129483
- const principal = client_lib_account.fromPublicKeyString(principalPubKey);
129484
- checkPromises.push(client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_checkSingleAccountPermissions).call(this, principal, accountRequirements, foundAccountInfo));
129561
+
129562
+ // Process promises in batches to avoid spanner's 100 concurrent read per session limit
129563
+ const batchSize = 50;
129564
+ const principalPubKeys = Object.keys(requirementsByPrincipal);
129565
+ for (let i = 0; i < principalPubKeys.length; i += batchSize) {
129566
+ const batch = principalPubKeys.slice(i, i + batchSize).map(principalPubKey => {
129567
+ const accountRequirements = requirementsByPrincipal[principalPubKey];
129568
+ const principal = client_lib_account.fromPublicKeyString(principalPubKey);
129569
+ return client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_checkSingleAccountPermissions).call(this, principal, accountRequirements, foundAccountInfo);
129570
+ });
129571
+ await Promise.all(batch);
129485
129572
  }
129486
- await Promise.all(checkPromises);
129487
129573
  return {
129488
129574
  newOwners
129489
129575
  };
@@ -130232,7 +130318,7 @@ client_lib_ledger_defineProperty(src_client_Ledger, "isInstance", client_checkab
130232
130318
  // EXTERNAL MODULE: ws (ignored)
130233
130319
  var client_ws_ignored_ = __webpack_require__(4708);
130234
130320
  ;// ./src/version.ts
130235
- const client_version = '0.18.0+g5417d9af948be899fcebb75694edb492ff971891';
130321
+ const client_version = '0.18.2+gac0baac4139da80613edd4a1ebc7532f37fc834a';
130236
130322
  /* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
130237
130323
  ;// ./src/lib/p2p.ts
130238
130324
  /* provided dependency */ var client_p2p_Buffer = __webpack_require__(8287)["Buffer"];
@@ -133131,20 +133217,33 @@ class src_client_UserClientBuilder {
133131
133217
  }
133132
133218
  if (operations.permissionsChanges !== undefined) {
133133
133219
  pendingOperations.permissionsChanges = {};
133134
- for (const accountPubKey in operations.permissionsChanges) {
133135
- pendingOperations.permissionsChanges[accountPubKey] = {};
133136
- for (const targetPubKey in operations.permissionsChanges[accountPubKey]) {
133220
+ for (const [certificateOrAccountKey, changes] of Object.entries(operations.permissionsChanges)) {
133221
+ pendingOperations.permissionsChanges[certificateOrAccountKey] = {
133222
+ principal: (() => {
133223
+ if (typeof changes.principal === 'string') {
133224
+ return src_client_Account.toAccount(changes.principal);
133225
+ } else {
133226
+ return {
133227
+ usingCertificate: true,
133228
+ certificate: new src_client_Certificate.Hash(changes.principal.certificate),
133229
+ certificateAccount: src_client_Account.toAccount(changes.principal.certificateAccount)
133230
+ };
133231
+ }
133232
+ })(),
133233
+ targets: {}
133234
+ };
133235
+ for (const targetPubKey in changes.targets) {
133137
133236
  const updateArray = [];
133138
133237
  for (const {
133139
133238
  method,
133140
133239
  permissions
133141
- } of operations.permissionsChanges[accountPubKey][targetPubKey]) {
133240
+ } of changes.targets[targetPubKey]) {
133142
133241
  updateArray.push({
133143
133242
  method,
133144
133243
  permissions: client_permissions_Permissions.FromAcceptedTypes(permissions)
133145
133244
  });
133146
133245
  }
133147
- pendingOperations.permissionsChanges[accountPubKey][targetPubKey] = updateArray;
133246
+ pendingOperations.permissionsChanges[certificateOrAccountKey].targets[targetPubKey] = updateArray;
133148
133247
  }
133149
133248
  }
133150
133249
  }
@@ -133594,9 +133693,13 @@ class src_client_UserClientBuilder {
133594
133693
  amount: amount
133595
133694
  });
133596
133695
  }
133597
- for (const principalPubKey in pending.permissionsChanges) {
133598
- for (const targetPubKey in pending.permissionsChanges[principalPubKey]) {
133599
- for (const change of pending.permissionsChanges[principalPubKey][targetPubKey]) {
133696
+ for (const {
133697
+ targets,
133698
+ principal
133699
+ } of Object.values((_pending$permissionsC = pending.permissionsChanges) !== null && _pending$permissionsC !== void 0 ? _pending$permissionsC : {})) {
133700
+ var _pending$permissionsC;
133701
+ for (const targetPubKey in targets) {
133702
+ for (const change of targets[targetPubKey]) {
133600
133703
  const {
133601
133704
  method,
133602
133705
  permissions
@@ -133607,7 +133710,17 @@ class src_client_UserClientBuilder {
133607
133710
  }
133608
133711
  operations.push({
133609
133712
  type: src_client_Block.OperationType.MODIFY_PERMISSIONS,
133610
- principal: src_client_Account.fromPublicKeyString(principalPubKey),
133713
+ principal: (() => {
133714
+ if (src_client_Account.isInstance(principal)) {
133715
+ return principal;
133716
+ } else {
133717
+ return {
133718
+ usingCertificate: true,
133719
+ certificateHash: principal.certificate,
133720
+ certificateAccount: principal.certificateAccount
133721
+ };
133722
+ }
133723
+ })(),
133611
133724
  target: target,
133612
133725
  method: method,
133613
133726
  permissions: permissions
@@ -133673,18 +133786,26 @@ class src_client_UserClientBuilder {
133673
133786
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
133674
133787
  client_builder_assertClassBrand(client_UserClientBuilder_brand, this, client_useOptions).call(this, options);
133675
133788
  method = method !== null && method !== void 0 ? method : src_client_Block.AdjustMethod.SET;
133676
- const principalPubKey = principal.publicKeyString.get();
133677
- const targetPubKey = (target !== null && target !== void 0 ? target : client_builder_classPrivateFieldGet(client_pendingOptions, this).account).publicKeyString.get();
133789
+ let principalKey;
133790
+ if (typeof principal === 'string' || src_client_Account.isInstance(principal)) {
133791
+ principalKey = src_client_Account.toAccount(principal).publicKeyString.get();
133792
+ } else {
133793
+ principalKey = principal.certificate.toString();
133794
+ }
133678
133795
  if (!client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges) {
133679
133796
  client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges = {};
133680
133797
  }
133681
- if (!client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalPubKey]) {
133682
- client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalPubKey] = {};
133798
+ if (!client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalKey]) {
133799
+ client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalKey] = {
133800
+ principal,
133801
+ targets: {}
133802
+ };
133683
133803
  }
133684
- if (!client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalPubKey][targetPubKey]) {
133685
- client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalPubKey][targetPubKey] = [];
133804
+ const targetPubKey = (target !== null && target !== void 0 ? target : client_builder_classPrivateFieldGet(client_pendingOptions, this).account).publicKeyString.get();
133805
+ if (!client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalKey].targets[targetPubKey]) {
133806
+ client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalKey].targets[targetPubKey] = [];
133686
133807
  }
133687
- client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalPubKey][targetPubKey].push({
133808
+ client_builder_classPrivateFieldGet(client_pendingOperations, this).permissionsChanges[principalKey].targets[targetPubKey].push({
133688
133809
  method: method,
133689
133810
  permissions: client_permissions_Permissions.FromAcceptedTypes(permissions)
133690
133811
  });
@@ -136710,7 +136831,13 @@ class src_client_UserClient {
136710
136831
  async updatePermissions(principal, permissions, target, method) {
136711
136832
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
136712
136833
  const builder = this.initBuilder(options);
136713
- builder.updatePermissions(client_lib_account.toAccount(principal), permissions, client_lib_account.toAccount(target), method, options);
136834
+ let principalValue;
136835
+ if (typeof principal === 'string' || client_lib_account.isInstance(principal)) {
136836
+ principalValue = client_lib_account.toAccount(principal);
136837
+ } else {
136838
+ principalValue = principal;
136839
+ }
136840
+ builder.updatePermissions(principalValue, permissions, client_lib_account.toAccount(target), method, options);
136714
136841
  return await this.publishBuilder(builder);
136715
136842
  }
136716
136843
 
package/client/index.d.ts CHANGED
@@ -1204,7 +1204,7 @@ export declare class UserClient {
1204
1204
  * @param options The options to use for the request
1205
1205
  * @return The vote staple that was generated and whether it was able to be published
1206
1206
  */
1207
- updatePermissions(principal: GenericAccount | string, permissions: AcceptedPermissionTypes, target?: GenericAccount | string, method?: AdjustMethod, options?: UserClientOptions): Promise<{
1207
+ updatePermissions(principal: GenericAccount | string | ACLRow['principal'], permissions: AcceptedPermissionTypes, target?: GenericAccount | string, method?: AdjustMethod, options?: UserClientOptions): Promise<{
1208
1208
  voteStaple: VoteStaple;
1209
1209
  publish: boolean;
1210
1210
  from: "direct";