import { AnalyticsExecutor } from './analyticsexecutor' ; import { AnalyticsMetaData , AnalyticsQueryOptions , AnalyticsResult , } from './analyticstypes' ; import { Bucket } from './bucket' ; import { Collection } from './collection' ; import { Connection } from './connection' ; import { QueryExecutor } from './queryexecutor' ; import { QueryMetaData , QueryOptions , QueryResult } from './querytypes' ; import { StreamableRowPromise } from './streamablepromises' ; import { Transcoder } from './transcoders' ; import { NodeCallback , PromiseHelper } from './utilities' ; category export class Scope { internal static get DEFAULT_NAME ( ) : string { return '_default' ; } private _bucket : Bucket ; private _name : string ; private _conn : Connection ; internal constructor ( bucket , scopeName ) { this . _bucket = bucket ; this . _name = scopeName ; this . _conn = bucket . conn ; } internal get conn ( ) : Connection { return this . _conn ; } internal get bucket ( ) : Bucket { return this . _bucket ; } internal get transcoder ( ) : Transcoder { return this . _bucket . transcoder ; } /**
     * The name of the scope this Scope object references.
     */ get name ( ) : string { return this . _name ; } param collectionName collection ( collectionName ) { return new Collection ( this , collectionName ) ; } param statement param options param callback query < TRow = any > ( statement , options ? , callback ? ) { if ( options instanceof Function ) { callback = arguments [ 1 ] ; options = undefined ; } if ( ! options ) { options = { } ; } const bucket = this . bucket ; const exec = new QueryExecutor ( bucket . conn ) ; const options_ = options ; return PromiseHelper . wrapAsync ( ( ) => exec . query < TRow > ( statement , { ... options_ , queryContext : `${ bucket . name }.${ this . name }` , } ) , callback ) ; } param statement param options param callback analyticsQuery < TRow = any > ( statement , options ? , callback ? ) { if ( options instanceof Function ) { callback = arguments [ 1 ] ; options = undefined ; } if ( ! options ) { options = { } ; } const bucket = this . bucket ; const exec = new AnalyticsExecutor ( bucket . conn ) ; const options_ = options ; return PromiseHelper . wrapAsync ( ( ) => exec . query < TRow > ( statement , { ... options_ , queryContext : `${ bucket . name }.${ this . name }` , } ) , callback ) ; } }