@bentley/imodeljs-native 4.1.10 → 4.1.11

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.
@@ -47,6 +47,10 @@ export declare namespace NativeCloudSqlite {
47
47
  readonly transactions: boolean;
48
48
  /** the state of this database. Indicates whether the database is new or deleted since last upload */
49
49
  readonly state: "" | "copied" | "deleted";
50
+ /** current number of clients that have this database open. */
51
+ readonly nClient: number;
52
+ /** current number of ongoing prefetches on this database. */
53
+ readonly nPrefetch: number;
50
54
  }
51
55
  /** Returned from 'CloudContainer.queryHttpLog' describing a row in the bcv_http_log table. */
52
56
  interface BcvHttpLog {
@@ -1 +1 @@
1
- {"version":3,"file":"NativeCloudSqlite.d.ts","sourceRoot":"","sources":["../src/NativeCloudSqlite.ts"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,KAAK,aAAa,MAAM,eAAe,CAAC;AAM/C;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,yBAAiB,iBAAiB,CAAC;IAEjC,WAAkB,OAAO;QACvB,QAAQ,IAAS;QAAE,UAAU,IAAS;QAAE,WAAW,IAAS;QAAE,SAAS,IAAS;KACjF;IAED,sCAAsC;IACtC,UAAiB,cAAc;QAC7B,4BAA4B;QAC5B,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC;QACvC,8BAA8B;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,iCAAiC;QACjC,WAAW,EAAE,MAAM,CAAC;QACpB,4DAA4D;QAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,oIAAoI;QACpI,WAAW,EAAE,MAAM,CAAC;QACpB,+HAA+H;QAC/H,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,6GAA6G;QAC7G,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,uEAAuE;QACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,oHAAoH;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,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YACtC,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;gBAChC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,SAAS;gBACjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;YAChD,IAAI,KAAK,CAAC,GAAG;gBACX,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YACpC,IAAI,KAAK,CAAC,YAAY;gBACpB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC7B,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;gBACjC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,sDAAsD;YAC3E,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC,CAAC;QACnH,CAAC;KACF;IA7BY,wBAAM,SA6BlB,CAAA;AAEH,CAAC,EAvKgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAuKjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport * as child_process from \"child_process\";\r\nimport * as fs from \"fs\";\r\nimport * as os from \"os\";\r\nimport * as path from \"path\";\r\nimport { NativeLibrary } from \"./NativeLibrary\";\r\n\r\n/**\r\n * @note This package may only have **dev** dependencies on @itwin packages, so they are *not* available at runtime. Therefore we can only import **types** from them.\r\n */\r\nimport type { LocalFileName } from \"@itwin/core-common\";\r\n\r\n// cspell:ignore polltime cachesize notimestamps deletetime gctime retrytime nwrite ndelete prefetch httptimeout\r\n/* eslint-disable no-restricted-syntax */\r\n\r\nexport namespace NativeCloudSqlite {\r\n\r\n export const enum LogMask {\r\n LOG_HTTP = 0x0001, LOG_UPLOAD = 0x0002, LOG_CLEANUP = 0x0004, LOG_EVENT = 0x0008\r\n }\r\n\r\n /** Properties of a CloudContainer. */\r\n export interface ContainerProps {\r\n /** blob storage provider */\r\n storageType: \"azure\" | \"google\" | \"s3\";\r\n /** base URI for container. */\r\n baseUri: string;\r\n /** the name of the container. */\r\n containerId: string;\r\n /** an alias for the container. Defaults to `containerId` */\r\n alias?: string;\r\n /** token that grants access to the container. For sas=1 `storageType`s, this is the sasToken. For sas=0, this is the account key */\r\n accessToken: string;\r\n /** if true, container is attached with write permissions, and accessToken must provide write access to the cloud container. */\r\n writeable?: boolean;\r\n /** if true, container is attached in \"secure\" mode (blocks are encrypted). Only supported in daemon mode. */\r\n secure?: boolean;\r\n /** true if the container is public (doesn't require authentication) */\r\n isPublic?: boolean;\r\n /** string attached to log messages from CloudSQLite. This is most useful for identifying usage from daemon mode. */\r\n logId?: string;\r\n }\r\n\r\n /** Returned from `CloudContainer.queryDatabase` describing one database in the container */\r\n export interface CachedDbProps {\r\n /** The total of (4Mb) blocks in the database. */\r\n readonly totalBlocks: number;\r\n /** the number of blocks of the database that have been downloaded into the CloudCache */\r\n readonly localBlocks: number;\r\n /** the number of blocks from this database that have been modified in the CloudCache and need to be uploaded. */\r\n readonly dirtyBlocks: number;\r\n /** If true, the database currently has transactions in the WAL file and may not be uploaded until they have been checkPointed. */\r\n readonly transactions: boolean;\r\n /** the state of this database. Indicates whether the database is new or deleted since last upload */\r\n readonly state: \"\" | \"copied\" | \"deleted\";\r\n }\r\n\r\n /** Returned from 'CloudContainer.queryHttpLog' describing a row in the bcv_http_log table. */\r\n export interface BcvHttpLog {\r\n /** Unique, monotonically increasing id value */\r\n readonly id: number;\r\n /** Time request was made, as iso-8601 */\r\n readonly startTime: string;\r\n /** Time reply received, as iso-8601 (or NULL) */\r\n readonly endTime: string | undefined;\r\n /** \"PUT\", \"GET\", etc. */\r\n readonly method: string;\r\n /** String configured by 'logId' in ContainerProps. Will be \"prefetch\" if request was triggered by a prefetch. */\r\n readonly logId: string;\r\n /** Log message associated with request */\r\n readonly logmsg: string;\r\n /** URI of request */\r\n readonly uri: string;\r\n /** HTTP response code (e.g. 200) */\r\n readonly httpcode: number;\r\n }\r\n\r\n /** Properties for accessing a CloudContainer */\r\n export type ContainerAccessProps = ContainerProps & {\r\n /** Duration for holding write lock, in seconds. After this time the write lock expires if not refreshed. Default is one hour. */\r\n lockExpireSeconds?: number;\r\n };\r\n\r\n /** The name of a CloudSqlite database within a CloudContainer. */\r\n export interface DbNameProp {\r\n /** the name of the database within the CloudContainer.\r\n * @note names of databases within a CloudContainer are always **case sensitive** on all platforms.*/\r\n dbName: string;\r\n }\r\n\r\n /** Properties for accessing a database within a CloudContainer */\r\n export interface DbProps extends DbNameProp {\r\n /** the name of the local file to access the database. */\r\n localFileName: LocalFileName;\r\n }\r\n\r\n export type TransferDirection = \"upload\" | \"download\";\r\n export interface TransferProgress {\r\n /** a user-supplied progress function called during the transfer operation. Return a non-0 value to abort the transfer. */\r\n onProgress?: (loaded: number, total: number) => number;\r\n }\r\n\r\n export interface CloudHttpProps {\r\n /** The number of simultaneous HTTP requests. Default is 6. */\r\n nRequests?: number;\r\n /** The time in seconds to wait without a response before considering a http request as timed out. Default is 60 seconds. */\r\n httpTimeout?: number;\r\n }\r\n\r\n export interface PrefetchProps extends CloudHttpProps {\r\n /** timeout between requests, in milliseconds. Default is 100. */\r\n timeout?: number;\r\n /** The number of prefetch requests to issue while there is foreground activity. Default is 3. */\r\n minRequests?: number;\r\n }\r\n\r\n export type TransferDbProps = DbProps & TransferProgress & CloudHttpProps;\r\n\r\n /** Properties for creating a CloudCache. */\r\n export interface CacheProps extends CloudHttpProps {\r\n /** full path of directory for cache to store its files. Must be on a (preferably fast) local drive, and must be empty when the cache is first created. */\r\n rootDir: string;\r\n /** name of this cache. It is possible to have more than one CloudCache in the same session. */\r\n name: string;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** turn on diagnostics for `curl` (outputs to stderr) */\r\n curlDiagnostics?: boolean;\r\n }\r\n\r\n /** Properties for creating a new instance of a daemon process. */\r\n export interface DaemonProps {\r\n /** full path name of daemon.exe file. Default is to find \"iTwinDaemon.exe\" in the same directory as this library. */\r\n exePath?: string;\r\n /** daemon connection address. Default is \"127.0.0.1\" */\r\n addr?: string;\r\n /** port number. Default 22002 */\r\n portNumber?: number;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** logging options */\r\n log?: string;\r\n /** if true, don't include timestamps in log messages */\r\n noTimeStamps?: boolean;\r\n /** The amount of time, in seconds before an http request made to cloud storage by the daemon times out. Default 600 seconds. */\r\n httptimeout?: number;\r\n /** options for spawn */\r\n spawnOptions?: child_process.SpawnOptions;\r\n }\r\n export type DaemonCommandArg = DbNameProp & CacheProps & ContainerProps;\r\n\r\n export class Daemon {\r\n public static exeName(props: DaemonProps) {\r\n return props.exePath ?? path.join(__dirname, NativeLibrary.archName, os.platform() === \"win32\" ? \"iTwinDaemon.exe\" : \"iTwinDaemon\");\r\n }\r\n public static daemonDir(props: CacheProps) {\r\n return props.rootDir ?? path.join(NativeLibrary.defaultCacheDir, \"itwin-daemon\");\r\n }\r\n\r\n /** Start the Daemon process using the supplied properties. The process will be detached from the current process. */\r\n public static start(props: DaemonProps & CacheProps): child_process.ChildProcess {\r\n const dir = this.daemonDir(props);\r\n fs.mkdirSync(dir, { recursive: true }); // make sure the directory exists before starting the daemon\r\n\r\n const args = [`daemon`];\r\n if (props.addr !== undefined)\r\n args.push(`-addr`, `${props.addr}`);\r\n if (props.portNumber !== undefined)\r\n args.push(`-port`, `${props.portNumber}`);\r\n if (props.cacheSize)\r\n args.push(`-cachesize`, `${props.cacheSize}`);\r\n if (props.log)\r\n args.push(`-log`, `${props.log}`);\r\n if (props.noTimeStamps)\r\n args.push(`-notimestamps`);\r\n if (props.httptimeout !== undefined)\r\n args.push(`-httptimeout`, `${props.httptimeout}`);\r\n args.push(`${dir}`); // This MUST be the last arg when starting the daemon.\r\n return child_process.spawn(this.exeName(props), args, { ...props.spawnOptions, windowsVerbatimArguments: true });\r\n }\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"NativeCloudSqlite.js","sourceRoot":"","sources":["../src/NativeCloudSqlite.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+CAA+C;AAC/C,yBAAyB;AACzB,yBAAyB;AACzB,6BAA6B;AAC7B,mDAAgD;AAOhD,gHAAgH;AAChH,yCAAyC;AAEzC,IAAiB,iBAAiB,CA2KjC;AA3KD,WAAiB,iBAAiB;IA4IhC,MAAa,MAAM;QACV,MAAM,CAAC,OAAO,CAAC,KAAkB;;YACtC,OAAO,MAAA,KAAK,CAAC,OAAO,mCAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QACtI,CAAC;QACM,MAAM,CAAC,SAAS,CAAC,KAAiB;;YACvC,OAAO,MAAA,KAAK,CAAC,OAAO,mCAAI,IAAI,CAAC,IAAI,CAAC,6BAAa,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACnF,CAAC;QAED,qHAAqH;QAC9G,MAAM,CAAC,KAAK,CAAC,KAA+B;YACjD,MAAM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AAjB,yBAAiB,QA2KjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport * as child_process from \"child_process\";\r\nimport * as fs from \"fs\";\r\nimport * as os from \"os\";\r\nimport * as path from \"path\";\r\nimport { NativeLibrary } from \"./NativeLibrary\";\r\n\r\n/**\r\n * @note This package may only have **dev** dependencies on @itwin packages, so they are *not* available at runtime. Therefore we can only import **types** from them.\r\n */\r\nimport type { LocalFileName } from \"@itwin/core-common\";\r\n\r\n// cspell:ignore polltime cachesize notimestamps deletetime gctime retrytime nwrite ndelete prefetch httptimeout\r\n/* eslint-disable no-restricted-syntax */\r\n\r\nexport namespace NativeCloudSqlite {\r\n\r\n export const enum LogMask {\r\n LOG_HTTP = 0x0001, LOG_UPLOAD = 0x0002, LOG_CLEANUP = 0x0004, LOG_EVENT = 0x0008\r\n }\r\n\r\n /** Properties of a CloudContainer. */\r\n export interface ContainerProps {\r\n /** blob storage provider */\r\n storageType: \"azure\" | \"google\" | \"s3\";\r\n /** base URI for container. */\r\n baseUri: string;\r\n /** the name of the container. */\r\n containerId: string;\r\n /** an alias for the container. Defaults to `containerId` */\r\n alias?: string;\r\n /** token that grants access to the container. For sas=1 `storageType`s, this is the sasToken. For sas=0, this is the account key */\r\n accessToken: string;\r\n /** if true, container is attached with write permissions, and accessToken must provide write access to the cloud container. */\r\n writeable?: boolean;\r\n /** if true, container is attached in \"secure\" mode (blocks are encrypted). Only supported in daemon mode. */\r\n secure?: boolean;\r\n /** true if the container is public (doesn't require authentication) */\r\n isPublic?: boolean;\r\n /** string attached to log messages from CloudSQLite. This is most useful for identifying usage from daemon mode. */\r\n logId?: string;\r\n }\r\n\r\n /** Returned from `CloudContainer.queryDatabase` describing one database in the container */\r\n export interface CachedDbProps {\r\n /** The total of (4Mb) blocks in the database. */\r\n readonly totalBlocks: number;\r\n /** the number of blocks of the database that have been downloaded into the CloudCache */\r\n readonly localBlocks: number;\r\n /** the number of blocks from this database that have been modified in the CloudCache and need to be uploaded. */\r\n readonly dirtyBlocks: number;\r\n /** If true, the database currently has transactions in the WAL file and may not be uploaded until they have been checkPointed. */\r\n readonly transactions: boolean;\r\n /** the state of this database. Indicates whether the database is new or deleted since last upload */\r\n readonly state: \"\" | \"copied\" | \"deleted\";\r\n /** current number of clients that have this database open. */\r\n readonly nClient: number;\r\n /** current number of ongoing prefetches on this database. */\r\n readonly nPrefetch: number;\r\n }\r\n\r\n /** Returned from 'CloudContainer.queryHttpLog' describing a row in the bcv_http_log table. */\r\n export interface BcvHttpLog {\r\n /** Unique, monotonically increasing id value */\r\n readonly id: number;\r\n /** Time request was made, as iso-8601 */\r\n readonly startTime: string;\r\n /** Time reply received, as iso-8601 (or NULL) */\r\n readonly endTime: string | undefined;\r\n /** \"PUT\", \"GET\", etc. */\r\n readonly method: string;\r\n /** String configured by 'logId' in ContainerProps. Will be \"prefetch\" if request was triggered by a prefetch. */\r\n readonly logId: string;\r\n /** Log message associated with request */\r\n readonly logmsg: string;\r\n /** URI of request */\r\n readonly uri: string;\r\n /** HTTP response code (e.g. 200) */\r\n readonly httpcode: number;\r\n }\r\n\r\n /** Properties for accessing a CloudContainer */\r\n export type ContainerAccessProps = ContainerProps & {\r\n /** Duration for holding write lock, in seconds. After this time the write lock expires if not refreshed. Default is one hour. */\r\n lockExpireSeconds?: number;\r\n };\r\n\r\n /** The name of a CloudSqlite database within a CloudContainer. */\r\n export interface DbNameProp {\r\n /** the name of the database within the CloudContainer.\r\n * @note names of databases within a CloudContainer are always **case sensitive** on all platforms.*/\r\n dbName: string;\r\n }\r\n\r\n /** Properties for accessing a database within a CloudContainer */\r\n export interface DbProps extends DbNameProp {\r\n /** the name of the local file to access the database. */\r\n localFileName: LocalFileName;\r\n }\r\n\r\n export type TransferDirection = \"upload\" | \"download\";\r\n export interface TransferProgress {\r\n /** a user-supplied progress function called during the transfer operation. Return a non-0 value to abort the transfer. */\r\n onProgress?: (loaded: number, total: number) => number;\r\n }\r\n\r\n export interface CloudHttpProps {\r\n /** The number of simultaneous HTTP requests. Default is 6. */\r\n nRequests?: number;\r\n /** The time in seconds to wait without a response before considering a http request as timed out. Default is 60 seconds. */\r\n httpTimeout?: number;\r\n }\r\n\r\n export interface PrefetchProps extends CloudHttpProps {\r\n /** timeout between requests, in milliseconds. Default is 100. */\r\n timeout?: number;\r\n /** The number of prefetch requests to issue while there is foreground activity. Default is 3. */\r\n minRequests?: number;\r\n }\r\n\r\n export type TransferDbProps = DbProps & TransferProgress & CloudHttpProps;\r\n\r\n /** Properties for creating a CloudCache. */\r\n export interface CacheProps extends CloudHttpProps {\r\n /** full path of directory for cache to store its files. Must be on a (preferably fast) local drive, and must be empty when the cache is first created. */\r\n rootDir: string;\r\n /** name of this cache. It is possible to have more than one CloudCache in the same session. */\r\n name: string;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** turn on diagnostics for `curl` (outputs to stderr) */\r\n curlDiagnostics?: boolean;\r\n }\r\n\r\n /** Properties for creating a new instance of a daemon process. */\r\n export interface DaemonProps {\r\n /** full path name of daemon.exe file. Default is to find \"iTwinDaemon.exe\" in the same directory as this library. */\r\n exePath?: string;\r\n /** daemon connection address. Default is \"127.0.0.1\" */\r\n addr?: string;\r\n /** port number. Default 22002 */\r\n portNumber?: number;\r\n /** maximum cache Size. Must be a number followed by either M (for megabytes) or G (for gigabytes.) Default is 1G */\r\n cacheSize?: string;\r\n /** logging options */\r\n log?: string;\r\n /** if true, don't include timestamps in log messages */\r\n noTimeStamps?: boolean;\r\n /** The amount of time, in seconds before an http request made to cloud storage by the daemon times out. Default 600 seconds. */\r\n httptimeout?: number;\r\n /** options for spawn */\r\n spawnOptions?: child_process.SpawnOptions;\r\n }\r\n export type DaemonCommandArg = DbNameProp & CacheProps & ContainerProps;\r\n\r\n export class Daemon {\r\n public static exeName(props: DaemonProps) {\r\n return props.exePath ?? path.join(__dirname, NativeLibrary.archName, os.platform() === \"win32\" ? \"iTwinDaemon.exe\" : \"iTwinDaemon\");\r\n }\r\n public static daemonDir(props: CacheProps) {\r\n return props.rootDir ?? path.join(NativeLibrary.defaultCacheDir, \"itwin-daemon\");\r\n }\r\n\r\n /** Start the Daemon process using the supplied properties. The process will be detached from the current process. */\r\n public static start(props: DaemonProps & CacheProps): child_process.ChildProcess {\r\n const dir = this.daemonDir(props);\r\n fs.mkdirSync(dir, { recursive: true }); // make sure the directory exists before starting the daemon\r\n\r\n const args = [`daemon`];\r\n if (props.addr !== undefined)\r\n args.push(`-addr`, `${props.addr}`);\r\n if (props.portNumber !== undefined)\r\n args.push(`-port`, `${props.portNumber}`);\r\n if (props.cacheSize)\r\n args.push(`-cachesize`, `${props.cacheSize}`);\r\n if (props.log)\r\n args.push(`-log`, `${props.log}`);\r\n if (props.noTimeStamps)\r\n args.push(`-notimestamps`);\r\n if (props.httptimeout !== undefined)\r\n args.push(`-httptimeout`, `${props.httptimeout}`);\r\n args.push(`${dir}`); // This MUST be the last arg when starting the daemon.\r\n return child_process.spawn(this.exeName(props), args, { ...props.spawnOptions, windowsVerbatimArguments: true });\r\n }\r\n }\r\n\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bentley/imodeljs-native",
3
3
  "license": "SEE LICENSE IN LICENSE.md",
4
- "version": "4.1.10",
4
+ "version": "4.1.11",
5
5
  "main": "imodeljs-native.js",
6
6
  "typings": "imodeljs-native",
7
7
  "keywords": [