@bentley/bentleyjs-core
Advanced tools
Comparing version 0.190.0 to 0.191.0
@@ -5,2 +5,50 @@ { | ||
{ | ||
"version": "0.191.0", | ||
"tag": "@bentley/bentleyjs-core_v0.191.0", | ||
"date": "Mon, 13 May 2019 15:52:05 GMT", | ||
"comments": { | ||
"none": [ | ||
{ | ||
"comment": "Adds parameter for api-extractor to validate missing release tags" | ||
}, | ||
{ | ||
"comment": "Add a Dictionary-based least-recently-used cache." | ||
}, | ||
{ | ||
"comment": "Fix broken links" | ||
}, | ||
{ | ||
"comment": "LoggerCategory -> BentleyLoggerCategory" | ||
}, | ||
{ | ||
"comment": "Logged the fields in ClientRequestContext" | ||
}, | ||
{ | ||
"comment": "Logging fixes. " | ||
}, | ||
{ | ||
"comment": "Put sourcemap in npm package." | ||
}, | ||
{ | ||
"comment": "Fixed logger to not mutate incoming objects. " | ||
}, | ||
{ | ||
"comment": "Improved performance logging" | ||
}, | ||
{ | ||
"comment": "Added functions for iterating and obtaining the number of elements of a collection of Id64s represented as an Id64Arg." | ||
}, | ||
{ | ||
"comment": "Setup a generic context for tracking client requests, and made various related enhancements to logging, usage tracking and authorization. " | ||
}, | ||
{ | ||
"comment": "Use TextDecoder to decode binary utf-8 strings if supported." | ||
}, | ||
{ | ||
"comment": "Upgrade TypeDoc dependency to 0.14.2" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "0.190.0", | ||
@@ -27,3 +75,3 @@ "tag": "@bentley/bentleyjs-core_v0.190.0", | ||
{ | ||
"comment": "Remove uneeded typedoc plugin depedency" | ||
"comment": "Remove unneeded typedoc plugin dependency" | ||
}, | ||
@@ -30,0 +78,0 @@ { |
# Change Log - @bentley/bentleyjs-core | ||
This log was last generated on Thu, 14 Mar 2019 14:26:49 GMT and should not be manually modified. | ||
This log was last generated on Mon, 13 May 2019 15:52:05 GMT and should not be manually modified. | ||
## 0.191.0 | ||
Mon, 13 May 2019 15:52:05 GMT | ||
### Updates | ||
- Adds parameter for api-extractor to validate missing release tags | ||
- Add a Dictionary-based least-recently-used cache. | ||
- Fix broken links | ||
- LoggerCategory -> BentleyLoggerCategory | ||
- Logged the fields in ClientRequestContext | ||
- Logging fixes. | ||
- Put sourcemap in npm package. | ||
- Fixed logger to not mutate incoming objects. | ||
- Improved performance logging | ||
- Added functions for iterating and obtaining the number of elements of a collection of Id64s represented as an Id64Arg. | ||
- Setup a generic context for tracking client requests, and made various related enhancements to logging, usage tracking and authorization. | ||
- Use TextDecoder to decode binary utf-8 strings if supported. | ||
- Upgrade TypeDoc dependency to 0.14.2 | ||
## 0.190.0 | ||
@@ -18,3 +37,3 @@ Thu, 14 Mar 2019 14:26:49 GMT | ||
- Add release tags to indicate API stability | ||
- Remove uneeded typedoc plugin depedency | ||
- Remove unneeded typedoc plugin dependency | ||
- Save BUILD_SEMVER to globally accessible map | ||
@@ -21,0 +40,0 @@ - upgrade to TypeScript 3.2.2 |
@@ -10,3 +10,3 @@ /** @module Errors */ | ||
*/ | ||
export declare const enum BentleyStatus { | ||
export declare enum BentleyStatus { | ||
SUCCESS = 0, | ||
@@ -19,3 +19,3 @@ ERROR = 32768 | ||
*/ | ||
export declare const enum IModelStatus { | ||
export declare enum IModelStatus { | ||
IMODEL_ERROR_BASE = 65536, | ||
@@ -93,3 +93,3 @@ Success = 0, | ||
*/ | ||
export declare const enum BriefcaseStatus { | ||
export declare enum BriefcaseStatus { | ||
CannotAcquire = 131072, | ||
@@ -115,3 +115,3 @@ CannotDownload = 131073, | ||
*/ | ||
export declare const enum ChangeSetStatus { | ||
export declare enum ChangeSetStatus { | ||
Success = 0, | ||
@@ -173,3 +173,3 @@ CHANGESET_ERROR_BASE = 90112, | ||
*/ | ||
export declare const enum RepositoryStatus { | ||
export declare enum RepositoryStatus { | ||
Success = 0, | ||
@@ -208,3 +208,3 @@ /** The repository server did not respond to a request */ | ||
*/ | ||
export declare const enum HttpStatus { | ||
export declare enum HttpStatus { | ||
/** 2xx Success */ | ||
@@ -224,3 +224,3 @@ Success = 0, | ||
*/ | ||
export declare const enum WSStatus { | ||
export declare enum WSStatus { | ||
Success = 0, | ||
@@ -227,0 +227,0 @@ WSERROR_BASE = 98304, |
@@ -8,2 +8,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const BeSQLite_1 = require("./BeSQLite"); | ||
const Logger_1 = require("./Logger"); | ||
@@ -340,226 +341,226 @@ /** Standard status code. | ||
// IModelStatus cases | ||
case 65537 /* AlreadyLoaded */: return "Already Loaded"; | ||
case 65538 /* AlreadyOpen */: return "Already Open"; | ||
case 65539 /* BadArg */: return "Bad Arg"; | ||
case 65540 /* BadElement */: return "Bad Element"; | ||
case 65541 /* BadModel */: return "Bad Model"; | ||
case 65542 /* BadRequest */: return "Bad Request"; | ||
case 65543 /* BadSchema */: return "Bad Schema"; | ||
case 65544 /* CannotUndo */: return "Can not Undo"; | ||
case 65545 /* CodeNotReserved */: return "Code Not Reserved"; | ||
case 65546 /* DeletionProhibited */: return "Deletion Prohibited"; | ||
case 65547 /* DuplicateCode */: return "Duplicate Code"; | ||
case 65548 /* DuplicateName */: return "Duplicate Name"; | ||
case 65549 /* ElementBlockedChange */: return "Element Blocked Change"; | ||
case 65550 /* FileAlreadyExists */: return "File Already Exists"; | ||
case 65551 /* FileNotFound */: return "File Not Found"; | ||
case 65552 /* FileNotLoaded */: return "File Not Loaded"; | ||
case 65553 /* ForeignKeyConstraint */: return "ForeignKey Constraint"; | ||
case 65554 /* IdExists */: return "Id Exists"; | ||
case 65555 /* InDynamicTransaction */: return "InDynamicTransaction"; | ||
case 65556 /* InvalidCategory */: return "Invalid Category"; | ||
case 65557 /* InvalidCode */: return "Invalid Code"; | ||
case 65558 /* InvalidCodeSpec */: return "Invalid CodeSpec"; | ||
case 65559 /* InvalidId */: return "Invalid Id"; | ||
case 65560 /* InvalidName */: return "Invalid Name"; | ||
case 65561 /* InvalidParent */: return "Invalid Parent"; | ||
case 65562 /* InvalidProfileVersion */: return "Invalid Profile Version"; | ||
case 65563 /* IsCreatingChangeSet */: return "IsCreatingChangeSet"; | ||
case 65564 /* LockNotHeld */: return "Lock Not Held"; | ||
case 65565 /* Mismatch2d3d */: return "Mismatch 2d3d"; | ||
case 65566 /* MismatchGcs */: return "Mismatch Gcs"; | ||
case 65567 /* MissingDomain */: return "Missing Domain"; | ||
case 65568 /* MissingHandler */: return "Missing Handler"; | ||
case 65569 /* MissingId */: return "Missing Id"; | ||
case 65570 /* NoGeometry */: return "No Geometry"; | ||
case 65571 /* NoMultiTxnOperation */: return "NoMultiTxnOperation"; | ||
case 65572 /* NotDgnMarkupProject */: return "NotDgnMarkupProject"; | ||
case 65573 /* NotEnabled */: return "Not Enabled"; | ||
case 65574 /* NotFound */: return "Not Found"; | ||
case 65575 /* NotOpen */: return "Not Open"; | ||
case 65576 /* NotOpenForWrite */: return "Not Open For Write"; | ||
case 65577 /* NotSameUnitBase */: return "Not Same Unit Base"; | ||
case 65578 /* NothingToRedo */: return "Nothing To Redo"; | ||
case 65579 /* NothingToUndo */: return "Nothing To Undo"; | ||
case 65580 /* ParentBlockedChange */: return "Parent Blocked Change"; | ||
case 65581 /* ReadError */: return "Read Error"; | ||
case 65582 /* ReadOnly */: return "ReadOnly"; | ||
case 65583 /* ReadOnlyDomain */: return "ReadOnlyDomain"; | ||
case 65584 /* RepositoryManagerError */: return "RepositoryManagerError"; | ||
case 65585 /* SQLiteError */: return "SQLiteError"; | ||
case 65586 /* TransactionActive */: return "Transaction Active"; | ||
case 65587 /* UnitsMissing */: return "Units Missing"; | ||
case 65588 /* UnknownFormat */: return "Unknown Format"; | ||
case 65589 /* UpgradeFailed */: return "Upgrade Failed"; | ||
case 65590 /* ValidationFailed */: return "Validation Failed"; | ||
case 65591 /* VersionTooNew */: return "Version Too New"; | ||
case 65592 /* VersionTooOld */: return "Version Too Old"; | ||
case 65593 /* ViewNotFound */: return "View Not Found"; | ||
case 65594 /* WriteError */: return "Write Error"; | ||
case 65595 /* WrongClass */: return "Wrong Class"; | ||
case 65596 /* WrongIModel */: return "Wrong IModel"; | ||
case 65597 /* WrongDomain */: return "Wrong Domain"; | ||
case 65598 /* WrongElement */: return "Wrong Element"; | ||
case 65599 /* WrongHandler */: return "Wrong Handler"; | ||
case 65600 /* WrongModel */: return "Wrong Model"; | ||
case IModelStatus.AlreadyLoaded: return "Already Loaded"; | ||
case IModelStatus.AlreadyOpen: return "Already Open"; | ||
case IModelStatus.BadArg: return "Bad Arg"; | ||
case IModelStatus.BadElement: return "Bad Element"; | ||
case IModelStatus.BadModel: return "Bad Model"; | ||
case IModelStatus.BadRequest: return "Bad Request"; | ||
case IModelStatus.BadSchema: return "Bad Schema"; | ||
case IModelStatus.CannotUndo: return "Can not Undo"; | ||
case IModelStatus.CodeNotReserved: return "Code Not Reserved"; | ||
case IModelStatus.DeletionProhibited: return "Deletion Prohibited"; | ||
case IModelStatus.DuplicateCode: return "Duplicate Code"; | ||
case IModelStatus.DuplicateName: return "Duplicate Name"; | ||
case IModelStatus.ElementBlockedChange: return "Element Blocked Change"; | ||
case IModelStatus.FileAlreadyExists: return "File Already Exists"; | ||
case IModelStatus.FileNotFound: return "File Not Found"; | ||
case IModelStatus.FileNotLoaded: return "File Not Loaded"; | ||
case IModelStatus.ForeignKeyConstraint: return "ForeignKey Constraint"; | ||
case IModelStatus.IdExists: return "Id Exists"; | ||
case IModelStatus.InDynamicTransaction: return "InDynamicTransaction"; | ||
case IModelStatus.InvalidCategory: return "Invalid Category"; | ||
case IModelStatus.InvalidCode: return "Invalid Code"; | ||
case IModelStatus.InvalidCodeSpec: return "Invalid CodeSpec"; | ||
case IModelStatus.InvalidId: return "Invalid Id"; | ||
case IModelStatus.InvalidName: return "Invalid Name"; | ||
case IModelStatus.InvalidParent: return "Invalid Parent"; | ||
case IModelStatus.InvalidProfileVersion: return "Invalid Profile Version"; | ||
case IModelStatus.IsCreatingChangeSet: return "IsCreatingChangeSet"; | ||
case IModelStatus.LockNotHeld: return "Lock Not Held"; | ||
case IModelStatus.Mismatch2d3d: return "Mismatch 2d3d"; | ||
case IModelStatus.MismatchGcs: return "Mismatch Gcs"; | ||
case IModelStatus.MissingDomain: return "Missing Domain"; | ||
case IModelStatus.MissingHandler: return "Missing Handler"; | ||
case IModelStatus.MissingId: return "Missing Id"; | ||
case IModelStatus.NoGeometry: return "No Geometry"; | ||
case IModelStatus.NoMultiTxnOperation: return "NoMultiTxnOperation"; | ||
case IModelStatus.NotDgnMarkupProject: return "NotDgnMarkupProject"; | ||
case IModelStatus.NotEnabled: return "Not Enabled"; | ||
case IModelStatus.NotFound: return "Not Found"; | ||
case IModelStatus.NotOpen: return "Not Open"; | ||
case IModelStatus.NotOpenForWrite: return "Not Open For Write"; | ||
case IModelStatus.NotSameUnitBase: return "Not Same Unit Base"; | ||
case IModelStatus.NothingToRedo: return "Nothing To Redo"; | ||
case IModelStatus.NothingToUndo: return "Nothing To Undo"; | ||
case IModelStatus.ParentBlockedChange: return "Parent Blocked Change"; | ||
case IModelStatus.ReadError: return "Read Error"; | ||
case IModelStatus.ReadOnly: return "ReadOnly"; | ||
case IModelStatus.ReadOnlyDomain: return "ReadOnlyDomain"; | ||
case IModelStatus.RepositoryManagerError: return "RepositoryManagerError"; | ||
case IModelStatus.SQLiteError: return "SQLiteError"; | ||
case IModelStatus.TransactionActive: return "Transaction Active"; | ||
case IModelStatus.UnitsMissing: return "Units Missing"; | ||
case IModelStatus.UnknownFormat: return "Unknown Format"; | ||
case IModelStatus.UpgradeFailed: return "Upgrade Failed"; | ||
case IModelStatus.ValidationFailed: return "Validation Failed"; | ||
case IModelStatus.VersionTooNew: return "Version Too New"; | ||
case IModelStatus.VersionTooOld: return "Version Too Old"; | ||
case IModelStatus.ViewNotFound: return "View Not Found"; | ||
case IModelStatus.WriteError: return "Write Error"; | ||
case IModelStatus.WrongClass: return "Wrong Class"; | ||
case IModelStatus.WrongIModel: return "Wrong IModel"; | ||
case IModelStatus.WrongDomain: return "Wrong Domain"; | ||
case IModelStatus.WrongElement: return "Wrong Element"; | ||
case IModelStatus.WrongHandler: return "Wrong Handler"; | ||
case IModelStatus.WrongModel: return "Wrong Model"; | ||
// DbResult cases | ||
case 1 /* BE_SQLITE_ERROR */: return "BE_SQLITE_ERROR"; | ||
case 2 /* BE_SQLITE_INTERNAL */: return "BE_SQLITE_INTERNAL"; | ||
case 3 /* BE_SQLITE_PERM */: return "BE_SQLITE_PERM"; | ||
case 4 /* BE_SQLITE_ABORT */: return "BE_SQLITE_ABORT"; | ||
case 5 /* BE_SQLITE_BUSY */: return "Db is busy"; | ||
case 6 /* BE_SQLITE_LOCKED */: return "Db is Locked"; | ||
case 7 /* BE_SQLITE_NOMEM */: return "BE_SQLITE_NOMEM"; | ||
case 8 /* BE_SQLITE_READONLY */: return "Readonly"; | ||
case 9 /* BE_SQLITE_INTERRUPT */: return "BE_SQLITE_INTERRUPT"; | ||
case 10 /* BE_SQLITE_IOERR */: return "BE_SQLITE_IOERR"; | ||
case 11 /* BE_SQLITE_CORRUPT */: return "BE_SQLITE_CORRUPT"; | ||
case 12 /* BE_SQLITE_NOTFOUND */: return "Not Found"; | ||
case 13 /* BE_SQLITE_FULL */: return "BE_SQLITE_FULL"; | ||
case 14 /* BE_SQLITE_CANTOPEN */: return "Can't open"; | ||
case 15 /* BE_SQLITE_PROTOCOL */: return "BE_SQLITE_PROTOCOL"; | ||
case 16 /* BE_SQLITE_EMPTY */: return "BE_SQLITE_EMPTY"; | ||
case 17 /* BE_SQLITE_SCHEMA */: return "BE_SQLITE_SCHEMA"; | ||
case 18 /* BE_SQLITE_TOOBIG */: return "BE_SQLITE_TOOBIG"; | ||
case 20 /* BE_SQLITE_MISMATCH */: return "BE_SQLITE_MISMATCH"; | ||
case 21 /* BE_SQLITE_MISUSE */: return "BE_SQLITE_MISUSE"; | ||
case 22 /* BE_SQLITE_NOLFS */: return "BE_SQLITE_NOLFS"; | ||
case 23 /* BE_SQLITE_AUTH */: return "BE_SQLITE_AUTH"; | ||
case 24 /* BE_SQLITE_FORMAT */: return "BE_SQLITE_FORMAT"; | ||
case 25 /* BE_SQLITE_RANGE */: return "BE_SQLITE_RANGE"; | ||
case 26 /* BE_SQLITE_NOTADB */: return "Not a Database"; | ||
case 266 /* BE_SQLITE_IOERR_READ */: return "BE_SQLITE_IOERR_READ"; | ||
case 522 /* BE_SQLITE_IOERR_SHORT_READ */: return "BE_SQLITE_IOERR_SHORT_READ"; | ||
case 778 /* BE_SQLITE_IOERR_WRITE */: return "BE_SQLITE_IOERR_WRITE"; | ||
case 1034 /* BE_SQLITE_IOERR_FSYNC */: return "BE_SQLITE_IOERR_FSYNC"; | ||
case 1290 /* BE_SQLITE_IOERR_DIR_FSYNC */: return "BE_SQLITE_IOERR_DIR_FSYNC"; | ||
case 1546 /* BE_SQLITE_IOERR_TRUNCATE */: return "BE_SQLITE_IOERR_TRUNCATE"; | ||
case 1802 /* BE_SQLITE_IOERR_FSTAT */: return "BE_SQLITE_IOERR_FSTAT"; | ||
case 2058 /* BE_SQLITE_IOERR_UNLOCK */: return "BE_SQLITE_IOERR_UNLOCK"; | ||
case 2314 /* BE_SQLITE_IOERR_RDLOCK */: return "BE_SQLITE_IOERR_RDLOCK"; | ||
case 2570 /* BE_SQLITE_IOERR_DELETE */: return "BE_SQLITE_IOERR_DELETE"; | ||
case 2826 /* BE_SQLITE_IOERR_BLOCKED */: return "BE_SQLITE_IOERR_BLOCKED"; | ||
case 3082 /* BE_SQLITE_IOERR_NOMEM */: return "BE_SQLITE_IOERR_NOMEM"; | ||
case 3338 /* BE_SQLITE_IOERR_ACCESS */: return "BE_SQLITE_IOERR_ACCESS"; | ||
case 3594 /* BE_SQLITE_IOERR_CHECKRESERVEDLOCK */: return "BE_SQLITE_IOERR_CHECKRESERVEDLOCK"; | ||
case 3850 /* BE_SQLITE_IOERR_LOCK */: return "BE_SQLITE_IOERR_LOCK"; | ||
case 4106 /* BE_SQLITE_IOERR_CLOSE */: return "BE_SQLITE_IOERR_CLOSE"; | ||
case 4362 /* BE_SQLITE_IOERR_DIR_CLOSE */: return "BE_SQLITE_IOERR_DIR_CLOSE"; | ||
case 4618 /* BE_SQLITE_IOERR_SHMOPEN */: return "BE_SQLITE_IOERR_SHMOPEN"; | ||
case 4874 /* BE_SQLITE_IOERR_SHMSIZE */: return "BE_SQLITE_IOERR_SHMSIZE"; | ||
case 5130 /* BE_SQLITE_IOERR_SHMLOCK */: return "BE_SQLITE_IOERR_SHMLOCK"; | ||
case 5386 /* BE_SQLITE_IOERR_SHMMAP */: return "BE_SQLITE_IOERR_SHMMAP"; | ||
case 5642 /* BE_SQLITE_IOERR_SEEK */: return "BE_SQLITE_IOERR_SEEK"; | ||
case 5898 /* BE_SQLITE_IOERR_DELETE_NOENT */: return "BE_SQLITE_IOERR_DELETE_NOENT"; | ||
case 16777226 /* BE_SQLITE_ERROR_FileExists */: return "File Exists"; | ||
case 33554442 /* BE_SQLITE_ERROR_AlreadyOpen */: return "Already Open"; | ||
case 50331658 /* BE_SQLITE_ERROR_NoPropertyTable */: return "No Property Table"; | ||
case 67108874 /* BE_SQLITE_ERROR_FileNotFound */: return "File Not Found"; | ||
case 83886090 /* BE_SQLITE_ERROR_NoTxnActive */: return "No Txn Active"; | ||
case 100663306 /* BE_SQLITE_ERROR_BadDbProfile */: return "Bad Db Profile"; | ||
case 117440522 /* BE_SQLITE_ERROR_InvalidProfileVersion */: return "Invalid Profile Version"; | ||
case 134217738 /* BE_SQLITE_ERROR_ProfileUpgradeFailed */: return "Profile Upgrade Failed"; | ||
case 150994954 /* BE_SQLITE_ERROR_ProfileTooOldForReadWrite */: return "Profile Too Old For ReadWrite"; | ||
case 167772170 /* BE_SQLITE_ERROR_ProfileTooOld */: return "Profile Too Old"; | ||
case 184549386 /* BE_SQLITE_ERROR_ProfileTooNewForReadWrite */: return "Profile Too New For ReadWrite"; | ||
case 201326602 /* BE_SQLITE_ERROR_ProfileTooNew */: return "Profile Too New"; | ||
case 218103818 /* BE_SQLITE_ERROR_ChangeTrackError */: return "ChangeTrack Error"; | ||
case 234881034 /* BE_SQLITE_ERROR_InvalidChangeSetVersion */: return "Invalid ChangeSet Version"; | ||
case 251658250 /* BE_SQLITE_ERROR_SchemaUpgradeRequired */: return "Schema Upgrade Required"; | ||
case 268435466 /* BE_SQLITE_ERROR_SchemaTooNew */: return "Schema Too New"; | ||
case 285212682 /* BE_SQLITE_ERROR_SchemaTooOld */: return "Schema Too Old"; | ||
case 301989898 /* BE_SQLITE_ERROR_SchemaLockFailed */: return "Schema Lock Failed"; | ||
case 318767114 /* BE_SQLITE_ERROR_SchemaUpgradeFailed */: return "Schema Upgrade Failed"; | ||
case 335544330 /* BE_SQLITE_ERROR_SchemaImportFailed */: return "Schema Import Failed"; | ||
case 352321546 /* BE_SQLITE_ERROR_CouldNotAcquireLocksOrCodes */: return "Could Not Acquire Locks Or Codes"; | ||
case 262 /* BE_SQLITE_LOCKED_SHAREDCACHE */: return "BE_SQLITE_LOCKED_SHAREDCACHE"; | ||
case 261 /* BE_SQLITE_BUSY_RECOVERY */: return "BE_SQLITE_BUSY_RECOVERY"; | ||
case 270 /* BE_SQLITE_CANTOPEN_NOTEMPDIR */: return "SQLite No Temp Dir"; | ||
case 526 /* BE_SQLITE_CANTOPEN_ISDIR */: return "BE_SQLITE_CANTOPEN_ISDIR"; | ||
case 782 /* BE_SQLITE_CANTOPEN_FULLPATH */: return "BE_SQLITE_CANTOPEN_FULLPATH"; | ||
case 267 /* BE_SQLITE_CORRUPT_VTAB */: return "BE_SQLITE_CORRUPT_VTAB"; | ||
case 264 /* BE_SQLITE_READONLY_RECOVERY */: return "BE_SQLITE_READONLY_RECOVERY"; | ||
case 520 /* BE_SQLITE_READONLY_CANTLOCK */: return "BE_SQLITE_READONLY_CANTLOCK"; | ||
case 776 /* BE_SQLITE_READONLY_ROLLBACK */: return "BE_SQLITE_READONLY_ROLLBACK"; | ||
case 516 /* BE_SQLITE_ABORT_ROLLBACK */: return "BE_SQLITE_ABORT_ROLLBACK"; | ||
case 275 /* BE_SQLITE_CONSTRAINT_CHECK */: return "BE_SQLITE_CONSTRAINT_CHECK"; | ||
case 531 /* BE_SQLITE_CONSTRAINT_COMMITHOOK */: return "CommitHook Constraint Error"; | ||
case 787 /* BE_SQLITE_CONSTRAINT_FOREIGNKEY */: return "Foreign Key Constraint Error"; | ||
case 1043 /* BE_SQLITE_CONSTRAINT_FUNCTION */: return "Function Constraint Error"; | ||
case 1299 /* BE_SQLITE_CONSTRAINT_NOTNULL */: return "NotNull Constraint Error"; | ||
case 1555 /* BE_SQLITE_CONSTRAINT_PRIMARYKEY */: return "Primary Key Constraint Error"; | ||
case 1811 /* BE_SQLITE_CONSTRAINT_TRIGGER */: return "Trigger Constraint Error"; | ||
case 2067 /* BE_SQLITE_CONSTRAINT_UNIQUE */: return "Unique Constraint Error"; | ||
case 2323 /* BE_SQLITE_CONSTRAINT_VTAB */: return "VTable Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR: return "BE_SQLITE_ERROR"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_INTERNAL: return "BE_SQLITE_INTERNAL"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_PERM: return "BE_SQLITE_PERM"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ABORT: return "BE_SQLITE_ABORT"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_BUSY: return "Db is busy"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_LOCKED: return "Db is Locked"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_NOMEM: return "BE_SQLITE_NOMEM"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_READONLY: return "Readonly"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_INTERRUPT: return "BE_SQLITE_INTERRUPT"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR: return "BE_SQLITE_IOERR"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CORRUPT: return "BE_SQLITE_CORRUPT"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_NOTFOUND: return "Not Found"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_FULL: return "BE_SQLITE_FULL"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CANTOPEN: return "Can't open"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_PROTOCOL: return "BE_SQLITE_PROTOCOL"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_EMPTY: return "BE_SQLITE_EMPTY"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_SCHEMA: return "BE_SQLITE_SCHEMA"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_TOOBIG: return "BE_SQLITE_TOOBIG"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_MISMATCH: return "BE_SQLITE_MISMATCH"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_MISUSE: return "BE_SQLITE_MISUSE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_NOLFS: return "BE_SQLITE_NOLFS"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_AUTH: return "BE_SQLITE_AUTH"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_FORMAT: return "BE_SQLITE_FORMAT"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_RANGE: return "BE_SQLITE_RANGE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_NOTADB: return "Not a Database"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_READ: return "BE_SQLITE_IOERR_READ"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_SHORT_READ: return "BE_SQLITE_IOERR_SHORT_READ"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_WRITE: return "BE_SQLITE_IOERR_WRITE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_FSYNC: return "BE_SQLITE_IOERR_FSYNC"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_DIR_FSYNC: return "BE_SQLITE_IOERR_DIR_FSYNC"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_TRUNCATE: return "BE_SQLITE_IOERR_TRUNCATE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_FSTAT: return "BE_SQLITE_IOERR_FSTAT"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_UNLOCK: return "BE_SQLITE_IOERR_UNLOCK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_RDLOCK: return "BE_SQLITE_IOERR_RDLOCK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_DELETE: return "BE_SQLITE_IOERR_DELETE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_BLOCKED: return "BE_SQLITE_IOERR_BLOCKED"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_NOMEM: return "BE_SQLITE_IOERR_NOMEM"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_ACCESS: return "BE_SQLITE_IOERR_ACCESS"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_CHECKRESERVEDLOCK: return "BE_SQLITE_IOERR_CHECKRESERVEDLOCK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_LOCK: return "BE_SQLITE_IOERR_LOCK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_CLOSE: return "BE_SQLITE_IOERR_CLOSE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_DIR_CLOSE: return "BE_SQLITE_IOERR_DIR_CLOSE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_SHMOPEN: return "BE_SQLITE_IOERR_SHMOPEN"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_SHMSIZE: return "BE_SQLITE_IOERR_SHMSIZE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_SHMLOCK: return "BE_SQLITE_IOERR_SHMLOCK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_SHMMAP: return "BE_SQLITE_IOERR_SHMMAP"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_SEEK: return "BE_SQLITE_IOERR_SEEK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_IOERR_DELETE_NOENT: return "BE_SQLITE_IOERR_DELETE_NOENT"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_FileExists: return "File Exists"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_AlreadyOpen: return "Already Open"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_NoPropertyTable: return "No Property Table"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_FileNotFound: return "File Not Found"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_NoTxnActive: return "No Txn Active"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_BadDbProfile: return "Bad Db Profile"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_InvalidProfileVersion: return "Invalid Profile Version"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_ProfileUpgradeFailed: return "Profile Upgrade Failed"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_ProfileTooOldForReadWrite: return "Profile Too Old For ReadWrite"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_ProfileTooOld: return "Profile Too Old"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_ProfileTooNewForReadWrite: return "Profile Too New For ReadWrite"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_ProfileTooNew: return "Profile Too New"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_ChangeTrackError: return "ChangeTrack Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_InvalidChangeSetVersion: return "Invalid ChangeSet Version"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_SchemaUpgradeRequired: return "Schema Upgrade Required"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_SchemaTooNew: return "Schema Too New"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_SchemaTooOld: return "Schema Too Old"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_SchemaLockFailed: return "Schema Lock Failed"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_SchemaUpgradeFailed: return "Schema Upgrade Failed"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_SchemaImportFailed: return "Schema Import Failed"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ERROR_CouldNotAcquireLocksOrCodes: return "Could Not Acquire Locks Or Codes"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_LOCKED_SHAREDCACHE: return "BE_SQLITE_LOCKED_SHAREDCACHE"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_BUSY_RECOVERY: return "BE_SQLITE_BUSY_RECOVERY"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CANTOPEN_NOTEMPDIR: return "SQLite No Temp Dir"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CANTOPEN_ISDIR: return "BE_SQLITE_CANTOPEN_ISDIR"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CANTOPEN_FULLPATH: return "BE_SQLITE_CANTOPEN_FULLPATH"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CORRUPT_VTAB: return "BE_SQLITE_CORRUPT_VTAB"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_READONLY_RECOVERY: return "BE_SQLITE_READONLY_RECOVERY"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_READONLY_CANTLOCK: return "BE_SQLITE_READONLY_CANTLOCK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_READONLY_ROLLBACK: return "BE_SQLITE_READONLY_ROLLBACK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_ABORT_ROLLBACK: return "BE_SQLITE_ABORT_ROLLBACK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_CHECK: return "BE_SQLITE_CONSTRAINT_CHECK"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_COMMITHOOK: return "CommitHook Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_FOREIGNKEY: return "Foreign Key Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_FUNCTION: return "Function Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_NOTNULL: return "NotNull Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_PRIMARYKEY: return "Primary Key Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_TRIGGER: return "Trigger Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_UNIQUE: return "Unique Constraint Error"; | ||
case BeSQLite_1.DbResult.BE_SQLITE_CONSTRAINT_VTAB: return "VTable Constraint Error"; | ||
// BentleyStatus cases | ||
case 32768 /* ERROR */: return "Error"; | ||
case BentleyStatus.ERROR: return "Error"; | ||
// BriefcaseStatus | ||
case 131072 /* CannotAcquire */: return "CannotAcquire"; | ||
case 131073 /* CannotDownload */: return "CannotDownload"; | ||
case 131075 /* CannotCopy */: return "CannotCopy"; | ||
case 131076 /* CannotDelete */: return "CannotDelete"; | ||
case 131077 /* VersionNotFound */: return "VersionNotFound"; | ||
case BriefcaseStatus.CannotAcquire: return "CannotAcquire"; | ||
case BriefcaseStatus.CannotDownload: return "CannotDownload"; | ||
case BriefcaseStatus.CannotCopy: return "CannotCopy"; | ||
case BriefcaseStatus.CannotDelete: return "CannotDelete"; | ||
case BriefcaseStatus.VersionNotFound: return "VersionNotFound"; | ||
// RpcInterface | ||
case RpcInterfaceStatus.IncompatibleVersion: return "RpcInterfaceStatus.IncompatibleVersion"; | ||
// ChangeSetStatus | ||
case 90113 /* ApplyError */: return "Error applying a change set when reversing or reinstating it"; | ||
case 90114 /* ChangeTrackingNotEnabled */: return "Change tracking has not been enabled. The ChangeSet API mandates this"; | ||
case 90115 /* CorruptedChangeStream */: return "Contents of the change stream are corrupted and does not match the ChangeSet"; | ||
case 90116 /* FileNotFound */: return "File containing the changes to the change set is not found"; | ||
case 90117 /* FileWriteError */: return "Error writing the contents of the change set to the backing change stream file"; | ||
case 90118 /* HasLocalChanges */: return "Cannot perform the operation since the Db has local changes"; | ||
case 90119 /* HasUncommittedChanges */: return "Cannot perform the operation since current transaction has uncommitted changes"; | ||
case 90120 /* InvalidId */: return "Invalid ChangeSet Id"; | ||
case 90121 /* InvalidVersion */: return "Invalid version of the change set"; | ||
case 90122 /* InDynamicTransaction */: return "Cannot perform the operation since system is in the middle of a dynamic transaction"; | ||
case 90123 /* IsCreatingChangeSet */: return "Cannot perform operation since system is in the middle of a creating a change set"; | ||
case 90124 /* IsNotCreatingChangeSet */: return "Cannot perform operation since the system is not creating a change set"; | ||
case 90125 /* MergePropagationError */: return "Error propagating the changes after the merge"; | ||
case 90126 /* NothingToMerge */: return "No change sets to merge"; | ||
case 90127 /* NoTransactions */: return "No transactions are available to create a change set"; | ||
case 90128 /* ParentMismatch */: return "Parent change set of the Db does not match the parent id of the change set"; | ||
case 90129 /* SQLiteError */: return "Error performing a SQLite operation on the Db"; | ||
case 90130 /* WrongDgnDb */: return "ChangeSet originated in a different Db"; | ||
case 90131 /* CouldNotOpenDgnDb */: return "Could not open the DgnDb to merge change set"; | ||
case 90132 /* MergeSchemaChangesOnOpen */: return "Cannot merge changes in in an open DgnDb. Close the DgnDb, and process the operation when it is opened"; | ||
case 90133 /* ReverseOrReinstateSchemaChangesOnOpen */: return "Cannot reverse or reinstate schema changes in an open DgnDb. Close the DgnDb, and process the operation when it is opened"; | ||
case 90134 /* ProcessSchemaChangesOnOpen */: return "Cannot process changes schema changes in an open DgnDb. Close the DgnDb, and process the operation when it is opened"; | ||
case 90135 /* CannotMergeIntoReadonly */: return "Cannot merge changes into a Readonly DgnDb"; | ||
case 90136 /* CannotMergeIntoMaster */: return "Cannot merge changes into a Master DgnDb"; | ||
case 90137 /* CannotMergeIntoReversed */: return "Cannot merge changes into a DgnDb that has reversed change sets"; | ||
case ChangeSetStatus.ApplyError: return "Error applying a change set when reversing or reinstating it"; | ||
case ChangeSetStatus.ChangeTrackingNotEnabled: return "Change tracking has not been enabled. The ChangeSet API mandates this"; | ||
case ChangeSetStatus.CorruptedChangeStream: return "Contents of the change stream are corrupted and does not match the ChangeSet"; | ||
case ChangeSetStatus.FileNotFound: return "File containing the changes to the change set is not found"; | ||
case ChangeSetStatus.FileWriteError: return "Error writing the contents of the change set to the backing change stream file"; | ||
case ChangeSetStatus.HasLocalChanges: return "Cannot perform the operation since the Db has local changes"; | ||
case ChangeSetStatus.HasUncommittedChanges: return "Cannot perform the operation since current transaction has uncommitted changes"; | ||
case ChangeSetStatus.InvalidId: return "Invalid ChangeSet Id"; | ||
case ChangeSetStatus.InvalidVersion: return "Invalid version of the change set"; | ||
case ChangeSetStatus.InDynamicTransaction: return "Cannot perform the operation since system is in the middle of a dynamic transaction"; | ||
case ChangeSetStatus.IsCreatingChangeSet: return "Cannot perform operation since system is in the middle of a creating a change set"; | ||
case ChangeSetStatus.IsNotCreatingChangeSet: return "Cannot perform operation since the system is not creating a change set"; | ||
case ChangeSetStatus.MergePropagationError: return "Error propagating the changes after the merge"; | ||
case ChangeSetStatus.NothingToMerge: return "No change sets to merge"; | ||
case ChangeSetStatus.NoTransactions: return "No transactions are available to create a change set"; | ||
case ChangeSetStatus.ParentMismatch: return "Parent change set of the Db does not match the parent id of the change set"; | ||
case ChangeSetStatus.SQLiteError: return "Error performing a SQLite operation on the Db"; | ||
case ChangeSetStatus.WrongDgnDb: return "ChangeSet originated in a different Db"; | ||
case ChangeSetStatus.CouldNotOpenDgnDb: return "Could not open the DgnDb to merge change set"; | ||
case ChangeSetStatus.MergeSchemaChangesOnOpen: return "Cannot merge changes in in an open DgnDb. Close the DgnDb, and process the operation when it is opened"; | ||
case ChangeSetStatus.ReverseOrReinstateSchemaChangesOnOpen: return "Cannot reverse or reinstate schema changes in an open DgnDb. Close the DgnDb, and process the operation when it is opened"; | ||
case ChangeSetStatus.ProcessSchemaChangesOnOpen: return "Cannot process changes schema changes in an open DgnDb. Close the DgnDb, and process the operation when it is opened"; | ||
case ChangeSetStatus.CannotMergeIntoReadonly: return "Cannot merge changes into a Readonly DgnDb"; | ||
case ChangeSetStatus.CannotMergeIntoMaster: return "Cannot merge changes into a Master DgnDb"; | ||
case ChangeSetStatus.CannotMergeIntoReversed: return "Cannot merge changes into a DgnDb that has reversed change sets"; | ||
// RepositoryStatus | ||
case 86017 /* ServerUnavailable */: return "ServerUnavailable"; | ||
case 86018 /* LockAlreadyHeld */: return "LockAlreadyHeld"; | ||
case 86019 /* SyncError */: return "SyncError"; | ||
case 86020 /* InvalidResponse */: return "InvalidResponse"; | ||
case 86021 /* PendingTransactions */: return "PendingTransactions"; | ||
case 86022 /* LockUsed */: return "LockUsed"; | ||
case 86023 /* CannotCreateChangeSet */: return "CannotCreateChangeSet"; | ||
case 86024 /* InvalidRequest */: return "InvalidRequest"; | ||
case 86025 /* ChangeSetRequired */: return "ChangeSetRequired"; | ||
case 86026 /* CodeUnavailable */: return "CodeUnavailable"; | ||
case 86027 /* CodeNotReserved */: return "CodeNotReserved"; | ||
case 86028 /* CodeUsed */: return "CodeUsed"; | ||
case 86029 /* LockNotHeld */: return "LockNotHeld"; | ||
case 86030 /* RepositoryIsLocked */: return "RepositoryIsLocked"; | ||
case RepositoryStatus.ServerUnavailable: return "ServerUnavailable"; | ||
case RepositoryStatus.LockAlreadyHeld: return "LockAlreadyHeld"; | ||
case RepositoryStatus.SyncError: return "SyncError"; | ||
case RepositoryStatus.InvalidResponse: return "InvalidResponse"; | ||
case RepositoryStatus.PendingTransactions: return "PendingTransactions"; | ||
case RepositoryStatus.LockUsed: return "LockUsed"; | ||
case RepositoryStatus.CannotCreateChangeSet: return "CannotCreateChangeSet"; | ||
case RepositoryStatus.InvalidRequest: return "InvalidRequest"; | ||
case RepositoryStatus.ChangeSetRequired: return "ChangeSetRequired"; | ||
case RepositoryStatus.CodeUnavailable: return "CodeUnavailable"; | ||
case RepositoryStatus.CodeNotReserved: return "CodeNotReserved"; | ||
case RepositoryStatus.CodeUsed: return "CodeUsed"; | ||
case RepositoryStatus.LockNotHeld: return "LockNotHeld"; | ||
case RepositoryStatus.RepositoryIsLocked: return "RepositoryIsLocked"; | ||
// HTTP Status | ||
case 94209 /* Info */: return "HTTP Info"; | ||
case 94210 /* Redirection */: return "HTTP Redirection"; | ||
case 94211 /* ClientError */: return "HTTP Client error"; | ||
case 94212 /* ServerError */: return "HTTP Server error"; | ||
case HttpStatus.Info: return "HTTP Info"; | ||
case HttpStatus.Redirection: return "HTTP Redirection"; | ||
case HttpStatus.ClientError: return "HTTP Client error"; | ||
case HttpStatus.ServerError: return "HTTP Server error"; | ||
// WSStatus | ||
case 98305 /* Unknown */: return "Unknown error"; | ||
case 98311 /* ClassNotFound */: return "Class not found"; | ||
case 98314 /* FileNotFound */: return "File not found"; | ||
case 98313 /* InstanceNotFound */: return "Instance not found"; | ||
case 98306 /* LoginFailed */: return "Login failed"; | ||
case 98317 /* NoClientLicense */: return "No client license"; | ||
case 98316 /* NoServerLicense */: return "No server license"; | ||
case 98308 /* NotEnoughRights */: return "Not enough rights"; | ||
case 98315 /* NotSupported */: return "Not supported"; | ||
case 98312 /* PropertyNotFound */: return "Property not found"; | ||
case 98309 /* RepositoryNotFound */: return "Repository not found"; | ||
case 98310 /* SchemaNotFound */: return "Schema not found"; | ||
case 98307 /* SslRequired */: return "SSL required"; | ||
case 98318 /* TooManyBadLoginAttempts */: return "Too many bad login attempts"; | ||
case WSStatus.Unknown: return "Unknown error"; | ||
case WSStatus.ClassNotFound: return "Class not found"; | ||
case WSStatus.FileNotFound: return "File not found"; | ||
case WSStatus.InstanceNotFound: return "Instance not found"; | ||
case WSStatus.LoginFailed: return "Login failed"; | ||
case WSStatus.NoClientLicense: return "No client license"; | ||
case WSStatus.NoServerLicense: return "No server license"; | ||
case WSStatus.NotEnoughRights: return "Not enough rights"; | ||
case WSStatus.NotSupported: return "Not supported"; | ||
case WSStatus.PropertyNotFound: return "Property not found"; | ||
case WSStatus.RepositoryNotFound: return "Repository not found"; | ||
case WSStatus.SchemaNotFound: return "Schema not found"; | ||
case WSStatus.SslRequired: return "SSL required"; | ||
case WSStatus.TooManyBadLoginAttempts: return "Too many bad login attempts"; | ||
// IModelHubStatus | ||
@@ -619,7 +620,7 @@ case IModelHubStatus.Unknown: return "Unknown error"; | ||
// Unexpected cases | ||
case 0 /* Success */: | ||
case 0 /* BE_SQLITE_OK */: | ||
case 100 /* BE_SQLITE_ROW */: | ||
case 101 /* BE_SQLITE_DONE */: | ||
case 0 /* SUCCESS */: | ||
case IModelStatus.Success: | ||
case BeSQLite_1.DbResult.BE_SQLITE_OK: | ||
case BeSQLite_1.DbResult.BE_SQLITE_ROW: | ||
case BeSQLite_1.DbResult.BE_SQLITE_DONE: | ||
case BentleyStatus.SUCCESS: | ||
return "Success"; | ||
@@ -626,0 +627,0 @@ default: |
@@ -12,3 +12,4 @@ export * from "./Assert"; | ||
export * from "./Logger"; | ||
export * from "./ActivityLoggingContext"; | ||
export * from "./BentleyLoggerCategory"; | ||
export * from "./ClientRequestContext"; | ||
export * from "./LRUMap"; | ||
@@ -15,0 +16,0 @@ export * from "./SortedArray"; |
@@ -21,3 +21,4 @@ "use strict"; | ||
__export(require("./Logger")); | ||
__export(require("./ActivityLoggingContext")); | ||
__export(require("./BentleyLoggerCategory")); | ||
__export(require("./ClientRequestContext")); | ||
__export(require("./LRUMap")); | ||
@@ -24,0 +25,0 @@ __export(require("./SortedArray")); |
@@ -5,3 +5,3 @@ /** @module BeSQLite */ | ||
*/ | ||
export declare const enum OpenMode { | ||
export declare enum OpenMode { | ||
Readonly = 1, | ||
@@ -13,3 +13,3 @@ ReadWrite = 2 | ||
*/ | ||
export declare const enum DbOpcode { | ||
export declare enum DbOpcode { | ||
/** A row was deleted. */ | ||
@@ -25,3 +25,3 @@ Delete = 9, | ||
*/ | ||
export declare const enum DbResult { | ||
export declare enum DbResult { | ||
/** Success */ | ||
@@ -28,0 +28,0 @@ BE_SQLITE_OK = 0, |
@@ -38,2 +38,4 @@ /** @module Utils */ | ||
export declare function compareStringsOrUndefined(lhs?: string, rhs?: string): number; | ||
/** @public */ | ||
export declare function compareNumbersOrUndefined(lhs?: number, rhs?: number): number; | ||
//# sourceMappingURL=Compare.d.ts.map |
@@ -43,2 +43,5 @@ "use strict"; | ||
exports.compareStringsOrUndefined = compareStringsOrUndefined; | ||
/** @public */ | ||
function compareNumbersOrUndefined(lhs, rhs) { return comparePossiblyUndefined(compareNumbers, lhs, rhs); } | ||
exports.compareNumbersOrUndefined = compareNumbersOrUndefined; | ||
//# sourceMappingURL=Compare.js.map |
@@ -42,3 +42,3 @@ /** @module Collections */ | ||
/** The number of entries in the dictionary. */ | ||
readonly length: number; | ||
readonly size: number; | ||
/** Returns an iterator over the key-value pairs in the Dictionary suitable for use in `for-of` loops. Entries are returned in sorted order by key. */ | ||
@@ -55,2 +55,8 @@ [Symbol.iterator](): Iterator<DictionaryEntry<K, V>>; | ||
/** | ||
* Determines if an entry exists for the specified key | ||
* @param key The key to search for | ||
* @returns true if an entry exists in this dictionary corresponding to the specified key. | ||
*/ | ||
has(key: K): boolean; | ||
/** | ||
* Deletes a value using its key. | ||
@@ -57,0 +63,0 @@ * @param key The key to delete |
@@ -60,3 +60,3 @@ "use strict"; | ||
/** The number of entries in the dictionary. */ | ||
get length() { return this._keys.length; } | ||
get size() { return this._keys.length; } | ||
/** Returns an iterator over the key-value pairs in the Dictionary suitable for use in `for-of` loops. Entries are returned in sorted order by key. */ | ||
@@ -79,2 +79,10 @@ [Symbol.iterator]() { return new DictionaryIterator(this._keys, this._values); } | ||
/** | ||
* Determines if an entry exists for the specified key | ||
* @param key The key to search for | ||
* @returns true if an entry exists in this dictionary corresponding to the specified key. | ||
*/ | ||
has(key) { | ||
return this.lowerBound(key).equal; | ||
} | ||
/** | ||
* Deletes a value using its key. | ||
@@ -132,3 +140,3 @@ * @param key The key to delete | ||
const pairs = []; | ||
for (let i = 0; i < this.length; i++) | ||
for (let i = 0; i < this.size; i++) | ||
pairs.push({ key: this._keys[i], value: this._values[i] }); | ||
@@ -153,3 +161,3 @@ this.clear(); | ||
forEach(func) { | ||
for (let i = 0; i < this.length; i++) | ||
for (let i = 0; i < this.size; i++) | ||
func(this._keys[i], this._values[i]); | ||
@@ -156,0 +164,0 @@ } |
@@ -66,3 +66,3 @@ /** @module Ids */ | ||
function fromUint32Pair(lowBytes: number, highBytes: number): Id64String; | ||
/** @hidden */ | ||
/** @internal */ | ||
function isValidUint32Pair(lowBytes: number, highBytes: number): boolean; | ||
@@ -90,4 +90,24 @@ /** Represents an unsigned 64-bit integer as a pair of unsigned 32-bit integers. | ||
* ``` | ||
* | ||
* Alternatively, to avoid allocating a new Id64Set, use [[Id64.forEach]] or [[Id64.iterate]]. | ||
* | ||
* @param arg The Ids to convert to an Id64Set. | ||
* @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input. | ||
* @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg. | ||
*/ | ||
function toIdSet(arg: Id64Arg): Id64Set; | ||
function toIdSet(arg: Id64Arg, makeCopy?: boolean): Id64Set; | ||
/** Execute a function on each [[Id64String]] of an [[Id64Arg]]. | ||
* @param arg The Id(s) to iterate. | ||
* @param callback The function to invoke on each Id. | ||
* @see [[Id64.iterate]] for a similar function which allows iteration to be halted before it completes. | ||
*/ | ||
function forEach(arg: Id64Arg, callback: (id: Id64String) => void): void; | ||
/** Execute a function on each [[Id64String]] of an [[Id64Arg]], optionally terminating before iteration completes. | ||
* @param arg The Id(s) to iterate. | ||
* @param callback The function to invoke on each Id. The function returns false to terminate iteration, or true to continue iteration. | ||
* @returns True if all Ids were iterated, or false if iteration was terminated due to the callback returning false. | ||
*/ | ||
function iterate(arg: Id64Arg, callback: (id: Id64String) => boolean): boolean; | ||
/** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */ | ||
function sizeOf(arg: Id64Arg): number; | ||
/** The string representation of an invalid Id. */ | ||
@@ -142,2 +162,6 @@ const invalid = "0"; | ||
protected readonly _map: Map<number, Set<number>>; | ||
/** Construct a new Uint32Set. | ||
* @param ids If supplied, all of the specified Ids will be added to the new set. | ||
*/ | ||
constructor(ids?: Id64Arg); | ||
/** Remove all contents of this set. */ | ||
@@ -161,2 +185,4 @@ clear(): void; | ||
toId64Set(): Id64Set; | ||
/** Execute a function against each Id in this set. */ | ||
forEach(func: (lo: number, hi: number) => void): void; | ||
} | ||
@@ -183,2 +209,4 @@ /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code. | ||
readonly size: number; | ||
/** Execute a function against each entry in this map. */ | ||
forEach(func: (lo: number, hi: number, value: T) => void): void; | ||
} | ||
@@ -185,0 +213,0 @@ } |
@@ -213,3 +213,3 @@ "use strict"; | ||
Id64.fromUint32Pair = fromUint32Pair; | ||
/** @hidden */ | ||
/** @internal */ | ||
function isValidUint32Pair(lowBytes, highBytes) { | ||
@@ -251,6 +251,12 @@ // Detect local ID of zero | ||
* ``` | ||
* | ||
* Alternatively, to avoid allocating a new Id64Set, use [[Id64.forEach]] or [[Id64.iterate]]. | ||
* | ||
* @param arg The Ids to convert to an Id64Set. | ||
* @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input. | ||
* @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg. | ||
*/ | ||
function toIdSet(arg) { | ||
function toIdSet(arg, makeCopy = false) { | ||
if (arg instanceof Set) | ||
return arg; | ||
return makeCopy ? new Set(arg) : arg; | ||
const ids = new Set(); | ||
@@ -268,2 +274,38 @@ if (typeof arg === "string") | ||
Id64.toIdSet = toIdSet; | ||
/** Execute a function on each [[Id64String]] of an [[Id64Arg]]. | ||
* @param arg The Id(s) to iterate. | ||
* @param callback The function to invoke on each Id. | ||
* @see [[Id64.iterate]] for a similar function which allows iteration to be halted before it completes. | ||
*/ | ||
function forEach(arg, callback) { | ||
Id64.iterate(arg, (id) => { | ||
callback(id); | ||
return true; | ||
}); | ||
} | ||
Id64.forEach = forEach; | ||
/** Execute a function on each [[Id64String]] of an [[Id64Arg]], optionally terminating before iteration completes. | ||
* @param arg The Id(s) to iterate. | ||
* @param callback The function to invoke on each Id. The function returns false to terminate iteration, or true to continue iteration. | ||
* @returns True if all Ids were iterated, or false if iteration was terminated due to the callback returning false. | ||
*/ | ||
function iterate(arg, callback) { | ||
if (typeof arg === "string") | ||
return callback(arg); | ||
for (const id of arg) | ||
if (!callback(id)) | ||
return false; | ||
return true; | ||
} | ||
Id64.iterate = iterate; | ||
/** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */ | ||
function sizeOf(arg) { | ||
if (typeof arg === "string") | ||
return 1; | ||
else if (Array.isArray(arg)) | ||
return arg.length; | ||
else | ||
return arg.size; | ||
} | ||
Id64.sizeOf = sizeOf; | ||
/** The string representation of an invalid Id. */ | ||
@@ -358,4 +400,9 @@ Id64.invalid = "0"; | ||
class Uint32Set { | ||
constructor() { | ||
/** Construct a new Uint32Set. | ||
* @param ids If supplied, all of the specified Ids will be added to the new set. | ||
*/ | ||
constructor(ids) { | ||
this._map = new Map(); | ||
if (undefined !== ids) | ||
Id64.forEach(ids, (id) => this.addId(id)); | ||
} | ||
@@ -407,2 +454,8 @@ /** Remove all contents of this set. */ | ||
} | ||
/** Execute a function against each Id in this set. */ | ||
forEach(func) { | ||
for (const entry of this._map) | ||
for (const lo of entry[1]) | ||
func(lo, entry[0]); | ||
} | ||
} | ||
@@ -447,2 +500,8 @@ Id64.Uint32Set = Uint32Set; | ||
} | ||
/** Execute a function against each entry in this map. */ | ||
forEach(func) { | ||
for (const outerEntry of this._map) | ||
for (const innerEntry of outerEntry[1]) | ||
func(innerEntry[0], outerEntry[0], innerEntry[1]); | ||
} | ||
} | ||
@@ -449,0 +508,0 @@ Id64.Uint32Map = Uint32Map; |
@@ -56,2 +56,12 @@ /** @module Utils */ | ||
function setOrRemoveBoolean(json: any, key: string, val: boolean, defaultVal: boolean): void; | ||
/** Determine if a Javascript object is equivalent to `{}`. | ||
* @param json The JSON object to test. | ||
* @returns true if `json` is an Object with no keys. | ||
*/ | ||
function isEmptyObject(json: any): boolean; | ||
/** Determine if the input is undefined or an empty Javascript object. | ||
* @param json The JSON object to test. | ||
* @returns true if `json` is undefined or is an Object with no keys (equivalent to `{}`). | ||
*/ | ||
function isEmptyObjectOrUndefined(json: any): boolean; | ||
/** | ||
@@ -58,0 +68,0 @@ * Convert the input object into a "pure" JavaScript object, with only instances of "object" or primitives in the returned value. |
@@ -77,2 +77,18 @@ "use strict"; | ||
JsonUtils.setOrRemoveBoolean = setOrRemoveBoolean; | ||
/** Determine if a Javascript object is equivalent to `{}`. | ||
* @param json The JSON object to test. | ||
* @returns true if `json` is an Object with no keys. | ||
*/ | ||
function isEmptyObject(json) { | ||
return "object" === typeof json && 0 === Object.keys(json).length; | ||
} | ||
JsonUtils.isEmptyObject = isEmptyObject; | ||
/** Determine if the input is undefined or an empty Javascript object. | ||
* @param json The JSON object to test. | ||
* @returns true if `json` is undefined or is an Object with no keys (equivalent to `{}`). | ||
*/ | ||
function isEmptyObjectOrUndefined(json) { | ||
return undefined === json || isEmptyObject(json); | ||
} | ||
JsonUtils.isEmptyObjectOrUndefined = isEmptyObjectOrUndefined; | ||
function isNullOrUndefined(json) { return null === json || undefined === json; } | ||
@@ -79,0 +95,0 @@ /** |
/** @module Logging */ | ||
import { GetMetaDataFunction } from "./BentleyError"; | ||
import { IDisposable } from "./Disposable"; | ||
import { ClientRequestContext } from "./ClientRequestContext"; | ||
/** Defines the *signature* for a log function. | ||
@@ -53,4 +54,7 @@ * @public | ||
static initializeToConsole(): void; | ||
/** Add the currently registered activityId, if any, to the specified metadata. */ | ||
static addActivityId(mdata: any): void; | ||
private static addClientRequestContext; | ||
/** @internal used by addon */ | ||
static getCurrentClientRequestContext(): ClientRequestContext; | ||
/** @internal used by addon */ | ||
static setCurrentClientRequestContext(obj: any): void; | ||
/** Should the callstack be included when an exception is logged? */ | ||
@@ -132,7 +136,8 @@ /** Should the callstack be included when an exception is logged? */ | ||
export declare class PerfLogger implements IDisposable { | ||
private static _loggerName; | ||
private static _severity; | ||
private _routine; | ||
private _operation; | ||
private _metaData?; | ||
private _startTimeStamp; | ||
constructor(routine: string); | ||
constructor(operation: string, metaData?: GetMetaDataFunction); | ||
private logMessage; | ||
dispose(): void; | ||
@@ -139,0 +144,0 @@ } |
@@ -9,3 +9,4 @@ "use strict"; | ||
const BentleyError_1 = require("./BentleyError"); | ||
const ActivityLoggingContext_1 = require("./ActivityLoggingContext"); | ||
const ClientRequestContext_1 = require("./ClientRequestContext"); | ||
const BentleyLoggerCategory_1 = require("./BentleyLoggerCategory"); | ||
/** Use to categorize logging messages by severity. | ||
@@ -46,10 +47,26 @@ * @public | ||
} | ||
/** Add the currently registered activityId, if any, to the specified metadata. */ | ||
static addActivityId(mdata) { | ||
if ((ActivityLoggingContext_1.ActivityLoggingContext.current.activityId === "") || mdata.hasOwnProperty("ActivityId")) | ||
return; | ||
const activityId = ActivityLoggingContext_1.ActivityLoggingContext.current.activityId; | ||
if (activityId !== "") | ||
mdata.ActivityId = activityId; | ||
// WIP: This modifies the incoming Object! | ||
static addClientRequestContext(metaData) { | ||
const requestContext = ClientRequestContext_1.ClientRequestContext.current; | ||
metaData.ActivityId = requestContext.activityId; | ||
metaData.SessionId = requestContext.sessionId; | ||
metaData.ApplicationId = requestContext.applicationId; | ||
metaData.ApplicationVersion = requestContext.applicationVersion; | ||
} | ||
/** @internal used by addon */ | ||
static getCurrentClientRequestContext() { | ||
return ClientRequestContext_1.ClientRequestContext.current; | ||
} | ||
/** @internal used by addon */ | ||
static setCurrentClientRequestContext(obj) { | ||
if (obj === undefined) { | ||
if (ClientRequestContext_1.ClientRequestContext.current.activityId !== "") | ||
new ClientRequestContext_1.ClientRequestContext("").enter(); | ||
} | ||
else { | ||
if (!(obj instanceof ClientRequestContext_1.ClientRequestContext)) | ||
throw new TypeError(`${JSON.stringify(obj)} -- this is not an instance of ClientRequestContext`); | ||
obj.enter(); | ||
} | ||
} | ||
/** Should the callstack be included when an exception is logged? */ | ||
@@ -65,11 +82,9 @@ static set logExceptionCallstacks(b) { | ||
static makeMetaData(getMetaData) { | ||
if (!getMetaData && (ActivityLoggingContext_1.ActivityLoggingContext.current.activityId === "")) | ||
return; | ||
const mdata = getMetaData ? getMetaData() : {}; | ||
Logger.addActivityId(mdata); | ||
return mdata; | ||
const metaData = getMetaData ? Object.assign({}, getMetaData()) : {}; // Copy object to avoid mutating the original | ||
Logger.addClientRequestContext(metaData); | ||
return metaData; | ||
} | ||
/** Format the metadata for a log message. */ | ||
static formatMetaData(getMetaData) { | ||
if (!getMetaData && (ActivityLoggingContext_1.ActivityLoggingContext.current.activityId === "")) | ||
if (!getMetaData) | ||
return ""; | ||
@@ -121,6 +136,6 @@ return " " + JSON.stringify(Logger.makeMetaData(getMetaData)); | ||
if (!validProps.includes(prop)) | ||
throw new BentleyError_1.BentleyError(65539 /* BadArg */, "LoggerLevelsConfig - unrecognized property: " + prop); | ||
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig - unrecognized property: " + prop); | ||
if (prop === "defaultLevel") { | ||
if (!Logger.isLogLevel(config.defaultLevel)) | ||
throw new BentleyError_1.BentleyError(65539 /* BadArg */, "LoggerLevelsConfig.defaultLevel must be a LogLevel. Invalid value: " + JSON.stringify(config.defaultLevel)); | ||
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.defaultLevel must be a LogLevel. Invalid value: " + JSON.stringify(config.defaultLevel)); | ||
} | ||
@@ -130,8 +145,8 @@ else if (prop === "categoryLevels") { | ||
if (!Array.isArray(value)) | ||
throw new BentleyError_1.BentleyError(65539 /* BadArg */, "LoggerLevelsConfig.categoryLevels must be an array. Invalid value: " + JSON.stringify(value)); | ||
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.categoryLevels must be an array. Invalid value: " + JSON.stringify(value)); | ||
for (const item of config[prop]) { | ||
if (!item.hasOwnProperty("category") || !item.hasOwnProperty("logLevel")) | ||
throw new BentleyError_1.BentleyError(65539 /* BadArg */, "LoggerLevelsConfig.categoryLevels - each item must be a LoggerCategoryAndLevel {category: logLevel:}. Invalid value: " + JSON.stringify(item)); | ||
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.categoryLevels - each item must be a LoggerCategoryAndLevel {category: logLevel:}. Invalid value: " + JSON.stringify(item)); | ||
if (!Logger.isLogLevel(item.logLevel)) | ||
throw new BentleyError_1.BentleyError(65539 /* BadArg */, "LoggerLevelsConfig.categoryLevels - each item's logLevel property must be a LogLevel. Invalid value: " + JSON.stringify(item.logLevel)); | ||
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.categoryLevels - each item's logLevel property must be a LogLevel. Invalid value: " + JSON.stringify(item.logLevel)); | ||
} | ||
@@ -243,19 +258,25 @@ } | ||
class PerfLogger { | ||
constructor(routine) { | ||
this._routine = routine; | ||
if (!Logger.isEnabled(PerfLogger._loggerName, PerfLogger._severity)) { | ||
constructor(operation, metaData) { | ||
this._operation = operation; | ||
this._metaData = metaData; | ||
if (!Logger.isEnabled(BentleyLoggerCategory_1.BentleyLoggerCategory.Performance, PerfLogger._severity)) { | ||
this._startTimeStamp = 0; | ||
return; | ||
} | ||
Logger.logInfo(PerfLogger._loggerName, `${this._routine},START`); | ||
Logger.logInfo(BentleyLoggerCategory_1.BentleyLoggerCategory.Performance, `${this._operation},START`, this._metaData); | ||
this._startTimeStamp = new Date().getTime(); // take timestamp | ||
} | ||
dispose() { | ||
logMessage() { | ||
const endTimeStamp = new Date().getTime(); | ||
if (!Logger.isEnabled(PerfLogger._loggerName, PerfLogger._severity)) | ||
if (!Logger.isEnabled(BentleyLoggerCategory_1.BentleyLoggerCategory.Performance, PerfLogger._severity)) | ||
return; | ||
Logger.logInfo(PerfLogger._loggerName, `${this._routine},END,${endTimeStamp - this._startTimeStamp} ms`); | ||
Logger.logInfo(BentleyLoggerCategory_1.BentleyLoggerCategory.Performance, `${this._operation},END`, () => { | ||
const mdata = this._metaData ? this._metaData() : {}; | ||
return Object.assign({}, mdata, { TimeElapsed: endTimeStamp - this._startTimeStamp }); | ||
}); | ||
} | ||
dispose() { | ||
this.logMessage(); | ||
} | ||
} | ||
PerfLogger._loggerName = "Performance"; | ||
PerfLogger._severity = LogLevel.Info; | ||
@@ -262,0 +283,0 @@ exports.PerfLogger = PerfLogger; |
/** @module Collections */ | ||
import { OrderedComparator } from "./Compare"; | ||
/** An entry holds the key and value, and pointers to any older and newer entries. | ||
@@ -12,6 +13,18 @@ * @public | ||
} | ||
/** The interface that must be satisified by the underlying container type used by a LRUCache. | ||
* Compatible with a [[Dictionary]] or a standard Map. | ||
* @public | ||
*/ | ||
export interface EntryContainer<K, V> { | ||
readonly size: number; | ||
clear(): void; | ||
get(key: K): Entry<K, V> | undefined; | ||
set(key: K, value: Entry<K, V>): void; | ||
has(key: K): boolean; | ||
delete(key: K): void; | ||
} | ||
/** | ||
* A Map of a key/value pairs, where the size of the map can be limited. | ||
* A mapping of a key/value pairs, where the size of the cache can be limited. | ||
* | ||
* When entries are inserted, if the map is "full", the | ||
* When entries are inserted, if the cache is "full", the | ||
* least-recently-used (LRU) value is dropped. When entries are retrieved, they are moved to the front of the LRU list. | ||
@@ -33,18 +46,18 @@ * | ||
*/ | ||
export declare class LRUMap<K, V> { | ||
private _keymap; | ||
export declare class LRUCache<K, V> { | ||
private _container; | ||
/** Current number of items */ | ||
size: number; | ||
/** Maximum number of items this map can hold */ | ||
/** Maximum number of items this cache can hold */ | ||
limit: number; | ||
/** Least recently-used entry. Invalidated when map is modified. */ | ||
/** Least recently-used entry. Invalidated when cache is modified. */ | ||
oldest?: Entry<K, V>; | ||
/** Most recently-used entry. Invalidated when map is modified. */ | ||
/** Most recently-used entry. Invalidated when cache is modified. */ | ||
newest?: Entry<K, V>; | ||
/** | ||
* Construct a new LRUMap to hold up to limit entries. | ||
* Construct a new LRUCache to hold up to `limit` entries. | ||
*/ | ||
constructor(limit: number); | ||
constructor(limit: number, container: EntryContainer<K, V>); | ||
private markEntryAsUsed; | ||
/** Replace all values in this map with key-value pairs (2-element Arrays) from provided iterable. */ | ||
/** Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable. */ | ||
assign(entries: Iterable<[K, V]>): void; | ||
@@ -58,3 +71,3 @@ /** Get and register recent use of <key>. | ||
*/ | ||
set(key: K, value: V): LRUMap<K, V>; | ||
set(key: K, value: V): LRUCache<K, V>; | ||
/** Purge the least recently used (oldest) entry from the cache. | ||
@@ -65,3 +78,3 @@ * @returns The removed entry or undefined if the cache was empty. | ||
/** Access value for `key` without registering recent use. Useful if you do not | ||
* want to change the state of the map, but only "peek" at it. | ||
* want to change the state of the cache, but only "peek" at it. | ||
* @returns The value associated with `key` if found, or undefined if not found. | ||
@@ -85,3 +98,3 @@ */ | ||
/** Call `fun` for each entry, starting with the oldest entry. */ | ||
forEach(fun: (value: V, key: K, m: LRUMap<K, V>) => void, thisObj?: any): void; | ||
forEach(fun: (value: V, key: K, m: LRUCache<K, V>) => void, thisObj?: any): void; | ||
/** Returns a JSON (array) representation */ | ||
@@ -95,2 +108,22 @@ toJSON(): Array<{ | ||
} | ||
/** A [[LRUCache]] using a standard Map as its internal storage. | ||
* @public | ||
*/ | ||
export declare class LRUMap<K, V> extends LRUCache<K, V> { | ||
/** | ||
* Construct a new LRUMap to hold up to `limit` entries. | ||
*/ | ||
constructor(limit: number); | ||
} | ||
/** A [[LRUCache]] using a [[Dictionary]] as its internal storage, permitting custom key comparison logic. | ||
* @public | ||
*/ | ||
export declare class LRUDictionary<K, V> extends LRUCache<K, V> { | ||
/** | ||
* Construct a new LRUDictionary to hold up to `limit` entries. | ||
* @param limit The maximum number of entries permitted in the dictionary. | ||
* @param compareKeys The function used to compare keys within the dictionary. | ||
*/ | ||
constructor(limit: number, compareKeys: OrderedComparator<K>); | ||
} | ||
//# sourceMappingURL=LRUMap.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Dictionary_1 = require("./Dictionary"); | ||
/* | ||
@@ -62,5 +63,5 @@ * Derived from: | ||
/** | ||
* A Map of a key/value pairs, where the size of the map can be limited. | ||
* A mapping of a key/value pairs, where the size of the cache can be limited. | ||
* | ||
* When entries are inserted, if the map is "full", the | ||
* When entries are inserted, if the cache is "full", the | ||
* least-recently-used (LRU) value is dropped. When entries are retrieved, they are moved to the front of the LRU list. | ||
@@ -82,11 +83,11 @@ * | ||
*/ | ||
class LRUMap { | ||
class LRUCache { | ||
/** | ||
* Construct a new LRUMap to hold up to limit entries. | ||
* Construct a new LRUCache to hold up to `limit` entries. | ||
*/ | ||
constructor(limit) { | ||
constructor(limit, container) { | ||
this.size = 0; | ||
this.limit = limit; | ||
this.oldest = this.newest = undefined; | ||
this._keymap = new Map(); | ||
this._container = container; | ||
} | ||
@@ -116,11 +117,11 @@ markEntryAsUsed(entry) { | ||
} | ||
/** Replace all values in this map with key-value pairs (2-element Arrays) from provided iterable. */ | ||
/** Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable. */ | ||
assign(entries) { | ||
let entry; | ||
let limit = this.limit || Number.MAX_VALUE; | ||
this._keymap.clear(); | ||
this._container.clear(); | ||
const it = entries[Symbol.iterator](); | ||
for (let itv = it.next(); !itv.done; itv = it.next()) { | ||
const e = new Entry(itv.value[0], itv.value[1]); | ||
this._keymap.set(e.key, e); | ||
this._container.set(e.key, e); | ||
if (!entry) { | ||
@@ -139,3 +140,3 @@ this.oldest = e; | ||
this.newest = entry; | ||
this.size = this._keymap.size; | ||
this.size = this._container.size; | ||
} | ||
@@ -147,3 +148,3 @@ /** Get and register recent use of <key>. | ||
// First, find our cache entry | ||
const entry = this._keymap.get(key); | ||
const entry = this._container.get(key); | ||
if (!entry) | ||
@@ -159,3 +160,3 @@ return; // Not cached. Sorry. | ||
set(key, value) { | ||
let entry = this._keymap.get(key); | ||
let entry = this._container.get(key); | ||
if (entry) { | ||
@@ -168,3 +169,3 @@ // update existing | ||
// new entry | ||
this._keymap.set(key, (entry = new Entry(key, value))); | ||
this._container.set(key, (entry = new Entry(key, value))); | ||
if (this.newest) { | ||
@@ -207,3 +208,3 @@ // link previous tail to the new tail (entry) | ||
entry.newer = entry.older = undefined; | ||
this._keymap.delete(entry.key); | ||
this._container.delete(entry.key); | ||
--this.size; | ||
@@ -215,7 +216,7 @@ return [entry.key, entry.value]; | ||
/** Access value for `key` without registering recent use. Useful if you do not | ||
* want to change the state of the map, but only "peek" at it. | ||
* want to change the state of the cache, but only "peek" at it. | ||
* @returns The value associated with `key` if found, or undefined if not found. | ||
*/ | ||
find(key) { | ||
const e = this._keymap.get(key); | ||
const e = this._container.get(key); | ||
return e ? e.value : undefined; | ||
@@ -225,3 +226,3 @@ } | ||
has(key) { | ||
return this._keymap.has(key); | ||
return this._container.has(key); | ||
} | ||
@@ -232,6 +233,6 @@ /** Remove entry `key` from cache and return its value. | ||
delete(key) { | ||
const entry = this._keymap.get(key); | ||
const entry = this._container.get(key); | ||
if (!entry) | ||
return; | ||
this._keymap.delete(entry.key); | ||
this._container.delete(entry.key); | ||
if (entry.newer && entry.older) { | ||
@@ -265,3 +266,3 @@ // re-link the older entry with the newer entry | ||
this.size = 0; | ||
this._keymap.clear(); | ||
this._container.clear(); | ||
} | ||
@@ -316,3 +317,29 @@ /** Returns an iterator over all keys, starting with the oldest. */ | ||
} | ||
exports.LRUCache = LRUCache; | ||
/** A [[LRUCache]] using a standard Map as its internal storage. | ||
* @public | ||
*/ | ||
class LRUMap extends LRUCache { | ||
/** | ||
* Construct a new LRUMap to hold up to `limit` entries. | ||
*/ | ||
constructor(limit) { | ||
super(limit, new Map()); | ||
} | ||
} | ||
exports.LRUMap = LRUMap; | ||
/** A [[LRUCache]] using a [[Dictionary]] as its internal storage, permitting custom key comparison logic. | ||
* @public | ||
*/ | ||
class LRUDictionary extends LRUCache { | ||
/** | ||
* Construct a new LRUDictionary to hold up to `limit` entries. | ||
* @param limit The maximum number of entries permitted in the dictionary. | ||
* @param compareKeys The function used to compare keys within the dictionary. | ||
*/ | ||
constructor(limit, compareKeys) { | ||
super(limit, new Dictionary_1.Dictionary(compareKeys)); | ||
} | ||
} | ||
exports.LRUDictionary = LRUDictionary; | ||
//# sourceMappingURL=LRUMap.js.map |
/** @module Utils */ | ||
/** Exposed only for testing the fall-back used when TextDecoder is unsupported. | ||
* @internal | ||
*/ | ||
export declare function utf8ToStringPolyfill(utf8: Uint8Array): string | undefined; | ||
/** Given an array of bytes containing a utf-8 string, convert to a string. | ||
* @param utf8: An array of utf-8 characters as a byte array | ||
* @returns An equivalent string, or undefined if the array does not contain a valid utf-8 string. | ||
* @note This function uses Javascript's TextDecoder if supported by the browser; otherwise, it | ||
* falls back to a less efficient polyfill. | ||
* @public | ||
@@ -6,0 +12,0 @@ */ |
@@ -9,3 +9,2 @@ "use strict"; | ||
// TextDecoder is not supported on all platforms - this is an alternative for utf-8. | ||
// ###TODO use TextDecoder where available | ||
// From https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/getStringFromTypedArray.js | ||
@@ -104,11 +103,32 @@ // which is itself inspired by https://github.com/inexorabletash/text-encoding | ||
})(Utf8ToString || (Utf8ToString = {})); | ||
/** Exposed only for testing the fall-back used when TextDecoder is unsupported. | ||
* @internal | ||
*/ | ||
function utf8ToStringPolyfill(utf8) { | ||
return Utf8ToString.decodeWithFromCharCode(utf8); | ||
} | ||
exports.utf8ToStringPolyfill = utf8ToStringPolyfill; | ||
// TextDecoder unsupported in Edge at time of writing. | ||
let textDecoderSupported = true; | ||
/** Given an array of bytes containing a utf-8 string, convert to a string. | ||
* @param utf8: An array of utf-8 characters as a byte array | ||
* @returns An equivalent string, or undefined if the array does not contain a valid utf-8 string. | ||
* @note This function uses Javascript's TextDecoder if supported by the browser; otherwise, it | ||
* falls back to a less efficient polyfill. | ||
* @public | ||
*/ | ||
function utf8ToString(utf8) { | ||
// ###TODO: if available: const decoder = new TextDecoder("utf-8"); | ||
// ###TODO: if available: return decoder.decode(utf8); | ||
return Utf8ToString.decodeWithFromCharCode(utf8); | ||
let decoder; | ||
if (textDecoderSupported) { | ||
try { | ||
decoder = new TextDecoder("utf-8"); | ||
} | ||
catch (_ex) { | ||
textDecoderSupported = false; | ||
} | ||
} | ||
if (undefined !== decoder) | ||
return decoder.decode(utf8); | ||
else | ||
return utf8ToStringPolyfill(utf8); | ||
} | ||
@@ -115,0 +135,0 @@ exports.utf8ToString = utf8ToString; |
{ | ||
"name": "@bentley/bentleyjs-core", | ||
"version": "0.190.0", | ||
"version": "0.191.0", | ||
"description": "Bentley JavaScript core components", | ||
@@ -42,7 +42,7 @@ "main": "lib/bentleyjs-core.js", | ||
"devDependencies": { | ||
"@bentley/build-tools": "0.190.0", | ||
"@bentley/webpack-tools": "0.190.0", | ||
"@bentley/build-tools": "0.191.0", | ||
"@bentley/webpack-tools": "0.191.0", | ||
"@types/chai": "^4.1.4", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "10.12.18", | ||
"@types/node": "10.14.1", | ||
"chai": "^4.1.2", | ||
@@ -52,6 +52,7 @@ "mocha": "^5.2.0", | ||
"tslint": "^5.11.0", | ||
"typedoc": "^0.11.1", | ||
"tslint-etc": "^1.5.2", | ||
"typedoc": "^0.14.2", | ||
"typescript": "~3.2.2", | ||
"ts-node": "^7.0.1", | ||
"nyc": "^13.0.1" | ||
"nyc": "^14.0.0" | ||
}, | ||
@@ -58,0 +59,0 @@ "nyc": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
736387
49
9824
14