@azure/data-tables 13.2.3-alpha.20240108.1 → 13.2.3-alpha.20240112.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/TablePolicies.js.map +1 -1
- package/dist-esm/src/TableServiceClient.js.map +1 -1
- package/dist-esm/src/TableTransaction.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/sas/accountSasSignatureValues.js.map +1 -1
- package/dist-esm/src/sas/generateAccountSas.js.map +1 -1
- package/dist-esm/src/sas/generateTableSas.js.map +1 -1
- package/dist-esm/src/sas/sasQueryParameters.js.map +1 -1
- package/dist-esm/src/sas/tableSasSignatureValues.js.map +1 -1
- package/dist-esm/src/serialization.js.map +1 -1
- package/dist-esm/src/tablesNamedCredentialPolicy.browser.js.map +1 -1
- package/dist-esm/src/tablesNamedCredentialPolicy.js.map +1 -1
- package/dist-esm/src/utils/accountConnectionString.browser.js.map +1 -1
- package/dist-esm/src/utils/accountConnectionString.js.map +1 -1
- package/dist-esm/src/utils/challengeAuthenticationUtils.js.map +1 -1
- package/dist-esm/src/utils/connectionString.js.map +1 -1
- package/dist-esm/src/utils/continuationToken.js.map +1 -1
- package/dist-esm/src/utils/errorHelpers.js.map +1 -1
- package/dist-esm/src/utils/internalModels.js.map +1 -1
- package/dist-esm/src/utils/isCredential.js.map +1 -1
- package/dist-esm/src/utils/transactionHelpers.js.map +1 -1
- package/package.json +3 -4
- package/types/latest/tsdoc-metadata.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableClient.js","sourceRoot":"","sources":["../../src/TableClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,oBAAoB,CAAC;AAiC5B,OAAO,EAAE,eAAe,EAAmC,MAAM,aAAa,CAAC;AAC/E,OAAO,EAIL,oBAAoB,EACp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E,MAAM,EAAE,UAAU,GAAG,OAAO,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC;YACnE,QAAQ,MAAM,EAAE;gBACd,KAAK,QAAQ;oBACX,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;oBACvC,MAAM;gBACR,KAAK,QAAQ;oBACX,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;oBACnE,MAAM;gBACR,KAAK,QAAQ;oBACX,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;oBAClE,MAAM;gBACR,KAAK,QAAQ;oBACX,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;aACtD;SACF;QAED,OAAO,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,oBAAoB,CAChC,gBAAwB,EACxB,SAAiB;IACjB,8DAA8D;IAC9D,OAA4B;QAE5B,MAAM,EACJ,GAAG,EACH,OAAO,EAAE,aAAa,EACtB,UAAU,GACX,GAAG,mCAAmC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QACnE,IAAI,UAAU,EAAE;YACd,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;SACnE;aAAM;YACL,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;SACvD;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport \"@azure/core-paging\";\n\nimport {\n CreateTableEntityResponse,\n DeleteTableEntityOptions,\n GetAccessPolicyResponse,\n GetTableEntityOptions,\n GetTableEntityResponse,\n ListTableEntitiesOptions,\n SignedIdentifier,\n TableServiceClientOptions as TableClientOptions,\n TableEntity,\n TableEntityQueryOptions,\n TableEntityResult,\n TableEntityResultPage,\n TableTransactionResponse,\n TransactionAction,\n UpdateMode,\n UpdateTableEntityOptions,\n} from \"./models\";\nimport {\n DeleteTableEntityResponse,\n SetAccessPolicyResponse,\n UpdateEntityResponse,\n UpsertEntityResponse,\n} from \"./generatedModels\";\nimport {\n FullOperationResponse,\n InternalClientPipelineOptions,\n OperationOptions,\n ServiceClient,\n ServiceClientOptions,\n} from \"@azure/core-client\";\nimport { GeneratedClient, TableDeleteEntityOptionalParams } from \"./generated\";\nimport {\n NamedKeyCredential,\n SASCredential,\n TokenCredential,\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n} from \"@azure/core-auth\";\nimport { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from \"./utils/constants\";\nimport { decodeContinuationToken, encodeContinuationToken } from \"./utils/continuationToken\";\nimport {\n deserialize,\n deserializeObjectsArray,\n deserializeSignedIdentifier,\n serialize,\n serializeQueryOptions,\n serializeSignedIdentifiers,\n} from \"./serialization\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\n\nimport { InternalTableTransaction } from \"./TableTransaction\";\nimport { ListEntitiesResponse } from \"./utils/internalModels\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { Table } from \"./generated/operationsInterfaces\";\nimport { TableQueryEntitiesOptionalParams } from \"./generated/models\";\nimport { Uuid } from \"./utils/uuid\";\nimport { apiVersionPolicy } from \"./utils/apiVersionPolicy\";\nimport { cosmosPatchPolicy } from \"./cosmosPathPolicy\";\nimport { escapeQuotes } from \"./odata\";\nimport { getClientParamsFromConnectionString } from \"./utils/connectionString\";\nimport { handleTableAlreadyExists } from \"./utils/errorHelpers\";\nimport { isCosmosEndpoint } from \"./utils/isCosmosEndpoint\";\nimport { isCredential } from \"./utils/isCredential\";\nimport { logger } from \"./logger\";\nimport { setTokenChallengeAuthenticationPolicy } from \"./utils/challengeAuthenticationUtils\";\nimport { tablesNamedKeyCredentialPolicy } from \"./tablesNamedCredentialPolicy\";\nimport { tablesSASTokenPolicy } from \"./tablesSASTokenPolicy\";\nimport { tracingClient } from \"./utils/tracing\";\n\n/**\n * A TableClient represents a Client to the Azure Tables service allowing you\n * to perform operations on a single table.\n */\nexport class TableClient {\n /**\n * Table Account URL\n */\n public url: string;\n /**\n * Represents a pipeline for making a HTTP request to a URL.\n * Pipelines can have multiple policies to manage manipulating each request before and after it is made to the server.\n */\n public pipeline: Pipeline;\n private table: Table;\n private generatedClient: ServiceClient;\n private credential?: NamedKeyCredential | SASCredential | TokenCredential;\n private clientOptions: TableClientOptions;\n private readonly allowInsecureConnection: boolean;\n\n /**\n * Name of the table to perform operations on.\n */\n public readonly tableName: string;\n\n /**\n * Creates a new instance of the TableClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation, such as \"https://myaccount.table.core.windows.net\".\n * @param tableName - the name of the table\n * @param credential - NamedKeyCredential used to authenticate requests. Only Supported for Node\n * @param options - Optional. Options to configure the HTTP pipeline.\n *\n *\n * ### Example using an account name/key:\n *\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * tableName,\n * sharedKeyCredential\n * );\n * ```\n */\n constructor(\n url: string,\n tableName: string,\n credential: NamedKeyCredential,\n options?: TableClientOptions\n );\n /**\n * Creates a new instance of the TableClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation, such as \"https://myaccount.table.core.windows.net\".\n * @param tableName - the name of the table\n * @param credential - SASCredential used to authenticate requests\n * @param options - Optional. Options to configure the HTTP pipeline.\n *\n *\n * ### Example using a SAS Token:\n *\n * ```js\n * const { AzureSASCredential, TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const sasToken = \"<sas-token>\";\n * const tableName = \"<table name>\";\n * const sasCredential = new AzureSASCredential(sasToken);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * tableName,\n * sasCredential\n * );\n * ```\n */\n constructor(\n url: string,\n tableName: string,\n credential: SASCredential,\n options?: TableClientOptions\n );\n /**\n * Creates a new instance of the TableClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation, such as \"https://myaccount.table.core.windows.net\".\n * @param tableName - the name of the table\n * @param credential - Azure Active Directory credential used to authenticate requests\n * @param options - Optional. Options to configure the HTTP pipeline.\n *\n *\n * ### Example using an Azure Active Directory credential:\n *\n * ```js\n * cons { DefaultAzureCredential } = require(\"@azure/identity\");\n * const { AzureSASCredential, TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const sasToken = \"<sas-token>\";\n * const tableName = \"<table name>\";\n * const credential = new DefaultAzureCredential();\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * tableName,\n * credential\n * );\n * ```\n */\n constructor(\n url: string,\n tableName: string,\n credential: TokenCredential,\n options?: TableClientOptions\n );\n /**\n * Creates an instance of TableClient.\n *\n * @param url - A Client string pointing to Azure Storage table service, such as\n * \"https://myaccount.table.core.windows.net\". You can append a SAS,\n * such as \"https://myaccount.table.core.windows.net?sasString\".\n * @param tableName - the name of the table\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example appending a SAS token:\n *\n * ```js\n * const { TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const sasToken = \"<SAS token>\";\n * const tableName = \"<table name>\";\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net?${sasToken}`,\n * `${tableName}`\n * );\n * ```\n */\n constructor(url: string, tableName: string, options?: TableClientOptions);\n constructor(\n url: string,\n tableName: string,\n credentialOrOptions?: NamedKeyCredential | SASCredential | TableClientOptions | TokenCredential,\n options: TableClientOptions = {}\n ) {\n this.url = url;\n this.tableName = tableName;\n\n const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;\n this.credential = credential;\n\n this.clientOptions = (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};\n\n this.allowInsecureConnection = this.clientOptions.allowInsecureConnection ?? false;\n\n const internalPipelineOptions: ServiceClientOptions & InternalClientPipelineOptions = {\n ...this.clientOptions,\n endpoint: this.clientOptions.endpoint || this.url,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],\n },\n deserializationOptions: {\n parseXML,\n },\n serializationOptions: {\n stringifyXML,\n },\n };\n\n const generatedClient = new GeneratedClient(this.url, internalPipelineOptions);\n if (isNamedKeyCredential(credential)) {\n generatedClient.pipeline.addPolicy(tablesNamedKeyCredentialPolicy(credential));\n } else if (isSASCredential(credential)) {\n generatedClient.pipeline.addPolicy(tablesSASTokenPolicy(credential));\n }\n\n if (isTokenCredential(credential)) {\n setTokenChallengeAuthenticationPolicy(generatedClient.pipeline, credential, STORAGE_SCOPE);\n }\n\n if (isCosmosEndpoint(this.url)) {\n generatedClient.pipeline.addPolicy(cosmosPatchPolicy());\n }\n\n if (options.version) {\n generatedClient.pipeline.addPolicy(apiVersionPolicy(options.version));\n }\n\n this.generatedClient = generatedClient;\n this.table = generatedClient.table;\n this.pipeline = generatedClient.pipeline;\n }\n\n /**\n * Permanently deletes the current table with all of its entities.\n * @param options - The options parameters.\n *\n * ### Example deleting a table\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // calling deleteTable will delete the table used\n * // to instantiate the TableClient.\n * // Note: If the table doesn't exist this function doesn't fail.\n * await client.deleteTable();\n * ```\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n public deleteTable(options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\"TableClient.deleteTable\", options, async (updatedOptions) => {\n try {\n await this.table.delete(this.tableName, updatedOptions);\n } catch (e: any) {\n if (e.statusCode === 404) {\n logger.info(\"TableClient.deleteTable: Table doesn't exist\");\n } else {\n throw e;\n }\n }\n });\n }\n\n /**\n * Creates a table with the tableName passed to the client constructor\n * @param options - The options parameters.\n *\n * ### Example creating a table\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // calling create table will create the table used\n * // to instantiate the TableClient.\n * // Note: If the table already\n * // exists this function doesn't throw.\n * await client.createTable();\n * ```\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n public createTable(options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\"TableClient.createTable\", options, async (updatedOptions) => {\n try {\n await this.table.create({ name: this.tableName }, updatedOptions);\n } catch (e: any) {\n handleTableAlreadyExists(e, { ...updatedOptions, logger, tableName: this.tableName });\n }\n });\n }\n\n /**\n * Returns a single entity in the table.\n * @param partitionKey - The partition key of the entity.\n * @param rowKey - The row key of the entity.\n * @param options - The options parameters.\n *\n * ### Example getting an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // getEntity will get a single entity stored in the service that\n * // matches exactly the partitionKey and rowKey used as parameters\n * // to the method.\n * const entity = await client.getEntity(\"<partitionKey>\", \"<rowKey>\");\n * console.log(entity);\n * ```\n */\n public getEntity<T extends object = Record<string, unknown>>(\n partitionKey: string,\n rowKey: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: GetTableEntityOptions = {}\n ): Promise<GetTableEntityResponse<TableEntityResult<T>>> {\n return tracingClient.withSpan(\"TableClient.getEntity\", options, async (updatedOptions) => {\n let parsedBody: any;\n function onResponse(rawResponse: FullOperationResponse, flatResponse: unknown): void {\n parsedBody = rawResponse.parsedBody;\n if (updatedOptions.onResponse) {\n updatedOptions.onResponse(rawResponse, flatResponse);\n }\n }\n const { disableTypeConversion, queryOptions, ...getEntityOptions } = updatedOptions;\n await this.table.queryEntitiesWithPartitionAndRowKey(\n this.tableName,\n escapeQuotes(partitionKey),\n escapeQuotes(rowKey),\n {\n ...getEntityOptions,\n queryOptions: serializeQueryOptions(queryOptions || {}),\n onResponse,\n }\n );\n const tableEntity = deserialize<TableEntityResult<T>>(\n parsedBody,\n disableTypeConversion ?? false\n );\n\n return tableEntity;\n });\n }\n\n /**\n * Queries entities in a table.\n * @param options - The options parameters.\n *\n * Example listing entities\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // list entities returns a AsyncIterableIterator\n * // this helps consuming paginated responses by\n * // automatically handling getting the next pages\n * const entities = client.listEntities();\n *\n * // this loop will get all the entities from all the pages\n * // returned by the service\n * for await (const entity of entities) {\n * console.log(entity);\n * }\n * ```\n */\n public listEntities<T extends object = Record<string, unknown>>(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: ListTableEntitiesOptions = {}\n ): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>> {\n const tableName = this.tableName;\n const iter = this.listEntitiesAll<T>(tableName, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings) => {\n const pageOptions: InternalListTableEntitiesOptions = {\n ...options,\n queryOptions: { ...options.queryOptions, top: settings?.maxPageSize },\n };\n\n if (settings?.continuationToken) {\n pageOptions.continuationToken = settings.continuationToken;\n }\n\n return this.listEntitiesPage(tableName, pageOptions);\n },\n };\n }\n\n private async *listEntitiesAll<T extends object>(\n tableName: string,\n options?: InternalListTableEntitiesOptions\n ): AsyncIterableIterator<TableEntityResult<T>> {\n const firstPage = await this._listEntities<T>(tableName, options);\n yield* firstPage;\n if (firstPage.continuationToken) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...options,\n continuationToken: firstPage.continuationToken,\n };\n for await (const page of this.listEntitiesPage<T>(tableName, optionsWithContinuation)) {\n yield* page;\n }\n }\n }\n\n private async *listEntitiesPage<T extends object>(\n tableName: string,\n options: InternalListTableEntitiesOptions = {}\n ): AsyncIterableIterator<ListEntitiesResponse<TableEntityResult<T>>> {\n let result = await tracingClient.withSpan(\n \"TableClient.listEntitiesPage\",\n options,\n (updatedOptions) => this._listEntities<T>(tableName, updatedOptions)\n );\n\n yield result;\n\n while (result.continuationToken) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...options,\n continuationToken: result.continuationToken,\n };\n\n result = await tracingClient.withSpan(\n \"TableClient.listEntitiesPage\",\n optionsWithContinuation,\n (updatedOptions, span) => {\n span.setAttribute(\"continuationToken\", result.continuationToken);\n return this._listEntities<T>(tableName, updatedOptions);\n }\n );\n yield result;\n }\n }\n\n private async _listEntities<T extends object>(\n tableName: string,\n options: InternalListTableEntitiesOptions = {}\n ): Promise<TableEntityResultPage<T>> {\n const { disableTypeConversion = false } = options;\n const queryOptions = serializeQueryOptions(options.queryOptions || {});\n const listEntitiesOptions: TableQueryEntitiesOptionalParams = {\n ...options,\n queryOptions,\n };\n\n // If a continuation token is used, decode it and set the next row and partition key\n if (options.continuationToken) {\n const continuationToken = decodeContinuationToken(options.continuationToken);\n listEntitiesOptions.nextRowKey = continuationToken.nextRowKey;\n listEntitiesOptions.nextPartitionKey = continuationToken.nextPartitionKey;\n }\n\n const {\n xMsContinuationNextPartitionKey: nextPartitionKey,\n xMsContinuationNextRowKey: nextRowKey,\n value,\n } = await this.table.queryEntities(tableName, listEntitiesOptions);\n\n const tableEntities = deserializeObjectsArray<TableEntityResult<T>>(\n value ?? [],\n disableTypeConversion\n );\n\n // Encode nextPartitionKey and nextRowKey as a single continuation token and add it as a\n // property to the page.\n const continuationToken = encodeContinuationToken(nextPartitionKey, nextRowKey);\n const page: TableEntityResultPage<T> = Object.assign([...tableEntities], {\n continuationToken,\n });\n\n return page;\n }\n\n /**\n * Insert entity in the table.\n * @param entity - The properties for the table entity.\n * @param options - The options parameters.\n *\n * ### Example creating an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // partitionKey and rowKey are required properties of the entity to create\n * // and accepts any other properties\n * await client.createEntity({partitionKey: \"p1\", rowKey: \"r1\", foo: \"Hello!\"});\n * ```\n */\n public createEntity<T extends object>(\n entity: TableEntity<T>,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: OperationOptions = {}\n ): Promise<CreateTableEntityResponse> {\n return tracingClient.withSpan(\"TableClient.createEntity\", options, (updatedOptions) => {\n const { ...createTableEntity } = updatedOptions || {};\n return this.table.insertEntity(this.tableName, {\n ...createTableEntity,\n tableEntityProperties: serialize(entity),\n responsePreference: \"return-no-content\",\n });\n });\n }\n\n /**\n * Deletes the specified entity in the table.\n * @param partitionKey - The partition key of the entity.\n * @param rowKey - The row key of the entity.\n * @param options - The options parameters.\n *\n * ### Example deleting an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // deleteEntity deletes the entity that matches\n * // exactly the partitionKey and rowKey passed as parameters\n * await client.deleteEntity(\"<partitionKey>\", \"<rowKey>\")\n * ```\n */\n public deleteEntity(\n partitionKey: string,\n rowKey: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: DeleteTableEntityOptions = {}\n ): Promise<DeleteTableEntityResponse> {\n return tracingClient.withSpan(\"TableClient.deleteEntity\", options, (updatedOptions) => {\n const { etag = \"*\", ...rest } = updatedOptions;\n const deleteOptions: TableDeleteEntityOptionalParams = {\n ...rest,\n };\n return this.table.deleteEntity(\n this.tableName,\n escapeQuotes(partitionKey),\n escapeQuotes(rowKey),\n etag,\n deleteOptions\n );\n });\n }\n\n /**\n * Update an entity in the table.\n * @param entity - The properties of the entity to be updated.\n * @param mode - The different modes for updating the entity:\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n * @param options - The options parameters.\n *\n * ### Example updating an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * const entity = {partitionKey: \"p1\", rowKey: \"r1\", bar: \"updatedBar\"};\n *\n * // Update uses update mode \"Merge\" as default\n * // merge means that update will match a stored entity\n * // that has the same partitionKey and rowKey as the entity\n * // passed to the method and then will only update the properties present in it.\n * // Any other properties that are not defined in the entity passed to updateEntity\n * // will remain as they are in the service\n * await client.updateEntity(entity)\n *\n * // We can also set the update mode to Replace, which will match the entity passed\n * // to updateEntity with one stored in the service and replace with the new one.\n * // If there are any missing properties in the entity passed to updateEntity, they\n * // will be removed from the entity stored in the service\n * await client.updateEntity(entity, \"Replace\")\n * ```\n */\n public updateEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode = \"Merge\",\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: UpdateTableEntityOptions = {}\n ): Promise<UpdateEntityResponse> {\n return tracingClient.withSpan(\n \"TableClient.updateEntity\",\n options,\n async (updatedOptions) => {\n const partitionKey = escapeQuotes(entity.partitionKey);\n const rowKey = escapeQuotes(entity.rowKey);\n\n const { etag = \"*\", ...updateEntityOptions } = updatedOptions || {};\n if (mode === \"Merge\") {\n return this.table.mergeEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions,\n });\n }\n if (mode === \"Replace\") {\n return this.table.updateEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions,\n });\n }\n\n throw new Error(`Unexpected value for update mode: ${mode}`);\n },\n {\n spanAttributes: {\n updateEntityMode: mode,\n },\n }\n );\n }\n\n /**\n * Upsert an entity in the table.\n * @param entity - The properties for the table entity.\n * @param mode - The different modes for updating the entity:\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n * @param options - The options parameters.\n *\n * ### Example upserting an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * const entity = {partitionKey: \"p1\", rowKey: \"r1\", bar: \"updatedBar\"};\n *\n * // Upsert uses update mode \"Merge\" as default.\n * // This behaves similarly to update but creates the entity\n * // if it doesn't exist in the service\n * await client.upsertEntity(entity)\n *\n * // We can also set the update mode to Replace.\n * // This behaves similarly to update but creates the entity\n * // if it doesn't exist in the service\n * await client.upsertEntity(entity, \"Replace\")\n * ```\n */\n public upsertEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode = \"Merge\",\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: OperationOptions = {}\n ): Promise<UpsertEntityResponse> {\n return tracingClient.withSpan(\n \"TableClient.upsertEntity\",\n options,\n async (updatedOptions) => {\n const partitionKey = escapeQuotes(entity.partitionKey);\n const rowKey = escapeQuotes(entity.rowKey);\n\n if (mode === \"Merge\") {\n return this.table.mergeEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions,\n });\n }\n\n if (mode === \"Replace\") {\n return this.table.updateEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions,\n });\n }\n throw new Error(`Unexpected value for update mode: ${mode}`);\n },\n {\n spanAttributes: {\n upsertEntityMode: mode,\n },\n }\n );\n }\n\n /**\n * Retrieves details about any stored access policies specified on the table that may be used with\n * Shared Access Signatures.\n * @param options - The options parameters.\n */\n public getAccessPolicy(options: OperationOptions = {}): Promise<GetAccessPolicyResponse> {\n return tracingClient.withSpan(\n \"TableClient.getAccessPolicy\",\n options,\n async (updatedOptions) => {\n const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);\n return deserializeSignedIdentifier(signedIdentifiers);\n }\n );\n }\n\n /**\n * Sets stored access policies for the table that may be used with Shared Access Signatures.\n * @param tableAcl - The Access Control List for the table.\n * @param options - The options parameters.\n */\n public setAccessPolicy(\n tableAcl: SignedIdentifier[],\n options: OperationOptions = {}\n ): Promise<SetAccessPolicyResponse> {\n return tracingClient.withSpan(\"TableClient.setAccessPolicy\", options, (updatedOptions) => {\n const serlializedAcl = serializeSignedIdentifiers(tableAcl);\n return this.table.setAccessPolicy(this.tableName, {\n ...updatedOptions,\n tableAcl: serlializedAcl,\n });\n });\n }\n\n /**\n * Submits a Transaction which is composed of a set of actions. You can provide the actions as a list\n * or you can use {@link TableTransaction} to help building the transaction.\n *\n * Example usage:\n * ```typescript\n * const { TableClient } = require(\"@azure/data-tables\");\n * const connectionString = \"<connection-string>\"\n * const tableName = \"<tableName>\"\n * const client = TableClient.fromConnectionString(connectionString, tableName);\n * const actions = [\n * [\"create\", {partitionKey: \"p1\", rowKey: \"1\", data: \"test1\"}],\n * [\"delete\", {partitionKey: \"p1\", rowKey: \"2\"}],\n * [\"update\", {partitionKey: \"p1\", rowKey: \"3\", data: \"newTest\"}, \"Merge\"]\n * ]\n * const result = await client.submitTransaction(actions);\n * ```\n *\n * Example usage with TableTransaction:\n * ```js\n * const { TableClient } = require(\"@azure/data-tables\");\n * const connectionString = \"<connection-string>\"\n * const tableName = \"<tableName>\"\n * const client = TableClient.fromConnectionString(connectionString, tableName);\n * const transaction = new TableTransaction();\n * // Call the available action in the TableTransaction object\n * transaction.create({partitionKey: \"p1\", rowKey: \"1\", data: \"test1\"});\n * transaction.delete(\"p1\", \"2\");\n * transaction.update({partitionKey: \"p1\", rowKey: \"3\", data: \"newTest\"}, \"Merge\")\n * // submitTransaction with the actions list on the transaction.\n * const result = await client.submitTransaction(transaction.actions);\n * ```\n *\n * @param actions - tuple that contains the action to perform, and the entity to perform the action with\n */\n public async submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse> {\n const partitionKey = actions[0][1].partitionKey;\n const transactionId = Uuid.generateUuid();\n const changesetId = Uuid.generateUuid();\n\n // Add pipeline\n const transactionClient = new InternalTableTransaction(\n this.url,\n partitionKey,\n transactionId,\n changesetId,\n this.generatedClient,\n new TableClient(this.url, this.tableName),\n this.credential,\n this.allowInsecureConnection\n );\n\n for (const item of actions) {\n const [action, entity, updateMode = \"Merge\", updateOptions] = item;\n switch (action) {\n case \"create\":\n transactionClient.createEntity(entity);\n break;\n case \"delete\":\n transactionClient.deleteEntity(entity.partitionKey, entity.rowKey);\n break;\n case \"update\":\n transactionClient.updateEntity(entity, updateMode, updateOptions);\n break;\n case \"upsert\":\n transactionClient.upsertEntity(entity, updateMode);\n }\n }\n\n return transactionClient.submitTransaction();\n }\n\n /**\n *\n * Creates an instance of TableClient from connection string.\n *\n * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.\n * [ Note - Account connection string can only be used in NODE.JS runtime. ]\n * Account connection string example -\n * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`\n * SAS connection string example -\n * `BlobEndpoint=https://myaccount.table.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`\n * @param options - Options to configure the HTTP pipeline.\n * @returns A new TableClient from the given connection string.\n */\n public static fromConnectionString(\n connectionString: string,\n tableName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: TableClientOptions\n ): TableClient {\n const {\n url,\n options: clientOptions,\n credential,\n } = getClientParamsFromConnectionString(connectionString, options);\n if (credential) {\n return new TableClient(url, tableName, credential, clientOptions);\n } else {\n return new TableClient(url, tableName, clientOptions);\n }\n }\n}\n\ntype InternalQueryOptions = TableEntityQueryOptions & { top?: number };\ninterface InternalListTableEntitiesOptions extends ListTableEntitiesOptions {\n queryOptions?: InternalQueryOptions;\n /**\n * An entity query continuation token from a previous call.\n */\n continuationToken?: string;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n}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) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport \"@azure/core-paging\";\n\nimport {\n CreateTableEntityResponse,\n DeleteTableEntityOptions,\n GetAccessPolicyResponse,\n GetTableEntityOptions,\n GetTableEntityResponse,\n ListTableEntitiesOptions,\n SignedIdentifier,\n TableServiceClientOptions as TableClientOptions,\n TableEntity,\n TableEntityQueryOptions,\n TableEntityResult,\n TableEntityResultPage,\n TableTransactionResponse,\n TransactionAction,\n UpdateMode,\n UpdateTableEntityOptions,\n} from \"./models\";\nimport {\n DeleteTableEntityResponse,\n SetAccessPolicyResponse,\n UpdateEntityResponse,\n UpsertEntityResponse,\n} from \"./generatedModels\";\nimport {\n FullOperationResponse,\n InternalClientPipelineOptions,\n OperationOptions,\n ServiceClient,\n ServiceClientOptions,\n} from \"@azure/core-client\";\nimport { GeneratedClient, TableDeleteEntityOptionalParams } from \"./generated\";\nimport {\n NamedKeyCredential,\n SASCredential,\n TokenCredential,\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n} from \"@azure/core-auth\";\nimport { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from \"./utils/constants\";\nimport { decodeContinuationToken, encodeContinuationToken } from \"./utils/continuationToken\";\nimport {\n deserialize,\n deserializeObjectsArray,\n deserializeSignedIdentifier,\n serialize,\n serializeQueryOptions,\n serializeSignedIdentifiers,\n} from \"./serialization\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\n\nimport { InternalTableTransaction } from \"./TableTransaction\";\nimport { ListEntitiesResponse } from \"./utils/internalModels\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { Table } from \"./generated/operationsInterfaces\";\nimport { TableQueryEntitiesOptionalParams } from \"./generated/models\";\nimport { Uuid } from \"./utils/uuid\";\nimport { apiVersionPolicy } from \"./utils/apiVersionPolicy\";\nimport { cosmosPatchPolicy } from \"./cosmosPathPolicy\";\nimport { escapeQuotes } from \"./odata\";\nimport { getClientParamsFromConnectionString } from \"./utils/connectionString\";\nimport { handleTableAlreadyExists } from \"./utils/errorHelpers\";\nimport { isCosmosEndpoint } from \"./utils/isCosmosEndpoint\";\nimport { isCredential } from \"./utils/isCredential\";\nimport { logger } from \"./logger\";\nimport { setTokenChallengeAuthenticationPolicy } from \"./utils/challengeAuthenticationUtils\";\nimport { tablesNamedKeyCredentialPolicy } from \"./tablesNamedCredentialPolicy\";\nimport { tablesSASTokenPolicy } from \"./tablesSASTokenPolicy\";\nimport { tracingClient } from \"./utils/tracing\";\n\n/**\n * A TableClient represents a Client to the Azure Tables service allowing you\n * to perform operations on a single table.\n */\nexport class TableClient {\n /**\n * Table Account URL\n */\n public url: string;\n /**\n * Represents a pipeline for making a HTTP request to a URL.\n * Pipelines can have multiple policies to manage manipulating each request before and after it is made to the server.\n */\n public pipeline: Pipeline;\n private table: Table;\n private generatedClient: ServiceClient;\n private credential?: NamedKeyCredential | SASCredential | TokenCredential;\n private clientOptions: TableClientOptions;\n private readonly allowInsecureConnection: boolean;\n\n /**\n * Name of the table to perform operations on.\n */\n public readonly tableName: string;\n\n /**\n * Creates a new instance of the TableClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation, such as \"https://myaccount.table.core.windows.net\".\n * @param tableName - the name of the table\n * @param credential - NamedKeyCredential used to authenticate requests. Only Supported for Node\n * @param options - Optional. Options to configure the HTTP pipeline.\n *\n *\n * ### Example using an account name/key:\n *\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * tableName,\n * sharedKeyCredential\n * );\n * ```\n */\n constructor(\n url: string,\n tableName: string,\n credential: NamedKeyCredential,\n options?: TableClientOptions,\n );\n /**\n * Creates a new instance of the TableClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation, such as \"https://myaccount.table.core.windows.net\".\n * @param tableName - the name of the table\n * @param credential - SASCredential used to authenticate requests\n * @param options - Optional. Options to configure the HTTP pipeline.\n *\n *\n * ### Example using a SAS Token:\n *\n * ```js\n * const { AzureSASCredential, TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const sasToken = \"<sas-token>\";\n * const tableName = \"<table name>\";\n * const sasCredential = new AzureSASCredential(sasToken);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * tableName,\n * sasCredential\n * );\n * ```\n */\n constructor(\n url: string,\n tableName: string,\n credential: SASCredential,\n options?: TableClientOptions,\n );\n /**\n * Creates a new instance of the TableClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation, such as \"https://myaccount.table.core.windows.net\".\n * @param tableName - the name of the table\n * @param credential - Azure Active Directory credential used to authenticate requests\n * @param options - Optional. Options to configure the HTTP pipeline.\n *\n *\n * ### Example using an Azure Active Directory credential:\n *\n * ```js\n * cons { DefaultAzureCredential } = require(\"@azure/identity\");\n * const { AzureSASCredential, TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const sasToken = \"<sas-token>\";\n * const tableName = \"<table name>\";\n * const credential = new DefaultAzureCredential();\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * tableName,\n * credential\n * );\n * ```\n */\n constructor(\n url: string,\n tableName: string,\n credential: TokenCredential,\n options?: TableClientOptions,\n );\n /**\n * Creates an instance of TableClient.\n *\n * @param url - A Client string pointing to Azure Storage table service, such as\n * \"https://myaccount.table.core.windows.net\". You can append a SAS,\n * such as \"https://myaccount.table.core.windows.net?sasString\".\n * @param tableName - the name of the table\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example appending a SAS token:\n *\n * ```js\n * const { TableClient } = require(\"@azure/data-tables\");\n * const account = \"<storage account name>\";\n * const sasToken = \"<SAS token>\";\n * const tableName = \"<table name>\";\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net?${sasToken}`,\n * `${tableName}`\n * );\n * ```\n */\n constructor(url: string, tableName: string, options?: TableClientOptions);\n constructor(\n url: string,\n tableName: string,\n credentialOrOptions?: NamedKeyCredential | SASCredential | TableClientOptions | TokenCredential,\n options: TableClientOptions = {},\n ) {\n this.url = url;\n this.tableName = tableName;\n\n const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;\n this.credential = credential;\n\n this.clientOptions = (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};\n\n this.allowInsecureConnection = this.clientOptions.allowInsecureConnection ?? false;\n\n const internalPipelineOptions: ServiceClientOptions & InternalClientPipelineOptions = {\n ...this.clientOptions,\n endpoint: this.clientOptions.endpoint || this.url,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],\n },\n deserializationOptions: {\n parseXML,\n },\n serializationOptions: {\n stringifyXML,\n },\n };\n\n const generatedClient = new GeneratedClient(this.url, internalPipelineOptions);\n if (isNamedKeyCredential(credential)) {\n generatedClient.pipeline.addPolicy(tablesNamedKeyCredentialPolicy(credential));\n } else if (isSASCredential(credential)) {\n generatedClient.pipeline.addPolicy(tablesSASTokenPolicy(credential));\n }\n\n if (isTokenCredential(credential)) {\n setTokenChallengeAuthenticationPolicy(generatedClient.pipeline, credential, STORAGE_SCOPE);\n }\n\n if (isCosmosEndpoint(this.url)) {\n generatedClient.pipeline.addPolicy(cosmosPatchPolicy());\n }\n\n if (options.version) {\n generatedClient.pipeline.addPolicy(apiVersionPolicy(options.version));\n }\n\n this.generatedClient = generatedClient;\n this.table = generatedClient.table;\n this.pipeline = generatedClient.pipeline;\n }\n\n /**\n * Permanently deletes the current table with all of its entities.\n * @param options - The options parameters.\n *\n * ### Example deleting a table\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // calling deleteTable will delete the table used\n * // to instantiate the TableClient.\n * // Note: If the table doesn't exist this function doesn't fail.\n * await client.deleteTable();\n * ```\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n public deleteTable(options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\"TableClient.deleteTable\", options, async (updatedOptions) => {\n try {\n await this.table.delete(this.tableName, updatedOptions);\n } catch (e: any) {\n if (e.statusCode === 404) {\n logger.info(\"TableClient.deleteTable: Table doesn't exist\");\n } else {\n throw e;\n }\n }\n });\n }\n\n /**\n * Creates a table with the tableName passed to the client constructor\n * @param options - The options parameters.\n *\n * ### Example creating a table\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // calling create table will create the table used\n * // to instantiate the TableClient.\n * // Note: If the table already\n * // exists this function doesn't throw.\n * await client.createTable();\n * ```\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n public createTable(options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\"TableClient.createTable\", options, async (updatedOptions) => {\n try {\n await this.table.create({ name: this.tableName }, updatedOptions);\n } catch (e: any) {\n handleTableAlreadyExists(e, { ...updatedOptions, logger, tableName: this.tableName });\n }\n });\n }\n\n /**\n * Returns a single entity in the table.\n * @param partitionKey - The partition key of the entity.\n * @param rowKey - The row key of the entity.\n * @param options - The options parameters.\n *\n * ### Example getting an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // getEntity will get a single entity stored in the service that\n * // matches exactly the partitionKey and rowKey used as parameters\n * // to the method.\n * const entity = await client.getEntity(\"<partitionKey>\", \"<rowKey>\");\n * console.log(entity);\n * ```\n */\n public getEntity<T extends object = Record<string, unknown>>(\n partitionKey: string,\n rowKey: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: GetTableEntityOptions = {},\n ): Promise<GetTableEntityResponse<TableEntityResult<T>>> {\n return tracingClient.withSpan(\"TableClient.getEntity\", options, async (updatedOptions) => {\n let parsedBody: any;\n function onResponse(rawResponse: FullOperationResponse, flatResponse: unknown): void {\n parsedBody = rawResponse.parsedBody;\n if (updatedOptions.onResponse) {\n updatedOptions.onResponse(rawResponse, flatResponse);\n }\n }\n const { disableTypeConversion, queryOptions, ...getEntityOptions } = updatedOptions;\n await this.table.queryEntitiesWithPartitionAndRowKey(\n this.tableName,\n escapeQuotes(partitionKey),\n escapeQuotes(rowKey),\n {\n ...getEntityOptions,\n queryOptions: serializeQueryOptions(queryOptions || {}),\n onResponse,\n },\n );\n const tableEntity = deserialize<TableEntityResult<T>>(\n parsedBody,\n disableTypeConversion ?? false,\n );\n\n return tableEntity;\n });\n }\n\n /**\n * Queries entities in a table.\n * @param options - The options parameters.\n *\n * Example listing entities\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // list entities returns a AsyncIterableIterator\n * // this helps consuming paginated responses by\n * // automatically handling getting the next pages\n * const entities = client.listEntities();\n *\n * // this loop will get all the entities from all the pages\n * // returned by the service\n * for await (const entity of entities) {\n * console.log(entity);\n * }\n * ```\n */\n public listEntities<T extends object = Record<string, unknown>>(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: ListTableEntitiesOptions = {},\n ): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>> {\n const tableName = this.tableName;\n const iter = this.listEntitiesAll<T>(tableName, options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings) => {\n const pageOptions: InternalListTableEntitiesOptions = {\n ...options,\n queryOptions: { ...options.queryOptions, top: settings?.maxPageSize },\n };\n\n if (settings?.continuationToken) {\n pageOptions.continuationToken = settings.continuationToken;\n }\n\n return this.listEntitiesPage(tableName, pageOptions);\n },\n };\n }\n\n private async *listEntitiesAll<T extends object>(\n tableName: string,\n options?: InternalListTableEntitiesOptions,\n ): AsyncIterableIterator<TableEntityResult<T>> {\n const firstPage = await this._listEntities<T>(tableName, options);\n yield* firstPage;\n if (firstPage.continuationToken) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...options,\n continuationToken: firstPage.continuationToken,\n };\n for await (const page of this.listEntitiesPage<T>(tableName, optionsWithContinuation)) {\n yield* page;\n }\n }\n }\n\n private async *listEntitiesPage<T extends object>(\n tableName: string,\n options: InternalListTableEntitiesOptions = {},\n ): AsyncIterableIterator<ListEntitiesResponse<TableEntityResult<T>>> {\n let result = await tracingClient.withSpan(\n \"TableClient.listEntitiesPage\",\n options,\n (updatedOptions) => this._listEntities<T>(tableName, updatedOptions),\n );\n\n yield result;\n\n while (result.continuationToken) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...options,\n continuationToken: result.continuationToken,\n };\n\n result = await tracingClient.withSpan(\n \"TableClient.listEntitiesPage\",\n optionsWithContinuation,\n (updatedOptions, span) => {\n span.setAttribute(\"continuationToken\", result.continuationToken);\n return this._listEntities<T>(tableName, updatedOptions);\n },\n );\n yield result;\n }\n }\n\n private async _listEntities<T extends object>(\n tableName: string,\n options: InternalListTableEntitiesOptions = {},\n ): Promise<TableEntityResultPage<T>> {\n const { disableTypeConversion = false } = options;\n const queryOptions = serializeQueryOptions(options.queryOptions || {});\n const listEntitiesOptions: TableQueryEntitiesOptionalParams = {\n ...options,\n queryOptions,\n };\n\n // If a continuation token is used, decode it and set the next row and partition key\n if (options.continuationToken) {\n const continuationToken = decodeContinuationToken(options.continuationToken);\n listEntitiesOptions.nextRowKey = continuationToken.nextRowKey;\n listEntitiesOptions.nextPartitionKey = continuationToken.nextPartitionKey;\n }\n\n const {\n xMsContinuationNextPartitionKey: nextPartitionKey,\n xMsContinuationNextRowKey: nextRowKey,\n value,\n } = await this.table.queryEntities(tableName, listEntitiesOptions);\n\n const tableEntities = deserializeObjectsArray<TableEntityResult<T>>(\n value ?? [],\n disableTypeConversion,\n );\n\n // Encode nextPartitionKey and nextRowKey as a single continuation token and add it as a\n // property to the page.\n const continuationToken = encodeContinuationToken(nextPartitionKey, nextRowKey);\n const page: TableEntityResultPage<T> = Object.assign([...tableEntities], {\n continuationToken,\n });\n\n return page;\n }\n\n /**\n * Insert entity in the table.\n * @param entity - The properties for the table entity.\n * @param options - The options parameters.\n *\n * ### Example creating an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // partitionKey and rowKey are required properties of the entity to create\n * // and accepts any other properties\n * await client.createEntity({partitionKey: \"p1\", rowKey: \"r1\", foo: \"Hello!\"});\n * ```\n */\n public createEntity<T extends object>(\n entity: TableEntity<T>,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: OperationOptions = {},\n ): Promise<CreateTableEntityResponse> {\n return tracingClient.withSpan(\"TableClient.createEntity\", options, (updatedOptions) => {\n const { ...createTableEntity } = updatedOptions || {};\n return this.table.insertEntity(this.tableName, {\n ...createTableEntity,\n tableEntityProperties: serialize(entity),\n responsePreference: \"return-no-content\",\n });\n });\n }\n\n /**\n * Deletes the specified entity in the table.\n * @param partitionKey - The partition key of the entity.\n * @param rowKey - The row key of the entity.\n * @param options - The options parameters.\n *\n * ### Example deleting an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * // deleteEntity deletes the entity that matches\n * // exactly the partitionKey and rowKey passed as parameters\n * await client.deleteEntity(\"<partitionKey>\", \"<rowKey>\")\n * ```\n */\n public deleteEntity(\n partitionKey: string,\n rowKey: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: DeleteTableEntityOptions = {},\n ): Promise<DeleteTableEntityResponse> {\n return tracingClient.withSpan(\"TableClient.deleteEntity\", options, (updatedOptions) => {\n const { etag = \"*\", ...rest } = updatedOptions;\n const deleteOptions: TableDeleteEntityOptionalParams = {\n ...rest,\n };\n return this.table.deleteEntity(\n this.tableName,\n escapeQuotes(partitionKey),\n escapeQuotes(rowKey),\n etag,\n deleteOptions,\n );\n });\n }\n\n /**\n * Update an entity in the table.\n * @param entity - The properties of the entity to be updated.\n * @param mode - The different modes for updating the entity:\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n * @param options - The options parameters.\n *\n * ### Example updating an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * const entity = {partitionKey: \"p1\", rowKey: \"r1\", bar: \"updatedBar\"};\n *\n * // Update uses update mode \"Merge\" as default\n * // merge means that update will match a stored entity\n * // that has the same partitionKey and rowKey as the entity\n * // passed to the method and then will only update the properties present in it.\n * // Any other properties that are not defined in the entity passed to updateEntity\n * // will remain as they are in the service\n * await client.updateEntity(entity)\n *\n * // We can also set the update mode to Replace, which will match the entity passed\n * // to updateEntity with one stored in the service and replace with the new one.\n * // If there are any missing properties in the entity passed to updateEntity, they\n * // will be removed from the entity stored in the service\n * await client.updateEntity(entity, \"Replace\")\n * ```\n */\n public updateEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode = \"Merge\",\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: UpdateTableEntityOptions = {},\n ): Promise<UpdateEntityResponse> {\n return tracingClient.withSpan(\n \"TableClient.updateEntity\",\n options,\n async (updatedOptions) => {\n const partitionKey = escapeQuotes(entity.partitionKey);\n const rowKey = escapeQuotes(entity.rowKey);\n\n const { etag = \"*\", ...updateEntityOptions } = updatedOptions || {};\n if (mode === \"Merge\") {\n return this.table.mergeEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions,\n });\n }\n if (mode === \"Replace\") {\n return this.table.updateEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions,\n });\n }\n\n throw new Error(`Unexpected value for update mode: ${mode}`);\n },\n {\n spanAttributes: {\n updateEntityMode: mode,\n },\n },\n );\n }\n\n /**\n * Upsert an entity in the table.\n * @param entity - The properties for the table entity.\n * @param mode - The different modes for updating the entity:\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n * @param options - The options parameters.\n *\n * ### Example upserting an entity\n * ```js\n * const { AzureNamedKeyCredential, TableClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\";\n * const accountKey = \"<account key>\"\n * const tableName = \"<table name>\";\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, accountKey);\n *\n * const client = new TableClient(\n * `https://${account}.table.core.windows.net`,\n * `${tableName}`,\n * sharedKeyCredential\n * );\n *\n * const entity = {partitionKey: \"p1\", rowKey: \"r1\", bar: \"updatedBar\"};\n *\n * // Upsert uses update mode \"Merge\" as default.\n * // This behaves similarly to update but creates the entity\n * // if it doesn't exist in the service\n * await client.upsertEntity(entity)\n *\n * // We can also set the update mode to Replace.\n * // This behaves similarly to update but creates the entity\n * // if it doesn't exist in the service\n * await client.upsertEntity(entity, \"Replace\")\n * ```\n */\n public upsertEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode = \"Merge\",\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: OperationOptions = {},\n ): Promise<UpsertEntityResponse> {\n return tracingClient.withSpan(\n \"TableClient.upsertEntity\",\n options,\n async (updatedOptions) => {\n const partitionKey = escapeQuotes(entity.partitionKey);\n const rowKey = escapeQuotes(entity.rowKey);\n\n if (mode === \"Merge\") {\n return this.table.mergeEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions,\n });\n }\n\n if (mode === \"Replace\") {\n return this.table.updateEntity(this.tableName, partitionKey, rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions,\n });\n }\n throw new Error(`Unexpected value for update mode: ${mode}`);\n },\n {\n spanAttributes: {\n upsertEntityMode: mode,\n },\n },\n );\n }\n\n /**\n * Retrieves details about any stored access policies specified on the table that may be used with\n * Shared Access Signatures.\n * @param options - The options parameters.\n */\n public getAccessPolicy(options: OperationOptions = {}): Promise<GetAccessPolicyResponse> {\n return tracingClient.withSpan(\n \"TableClient.getAccessPolicy\",\n options,\n async (updatedOptions) => {\n const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);\n return deserializeSignedIdentifier(signedIdentifiers);\n },\n );\n }\n\n /**\n * Sets stored access policies for the table that may be used with Shared Access Signatures.\n * @param tableAcl - The Access Control List for the table.\n * @param options - The options parameters.\n */\n public setAccessPolicy(\n tableAcl: SignedIdentifier[],\n options: OperationOptions = {},\n ): Promise<SetAccessPolicyResponse> {\n return tracingClient.withSpan(\"TableClient.setAccessPolicy\", options, (updatedOptions) => {\n const serlializedAcl = serializeSignedIdentifiers(tableAcl);\n return this.table.setAccessPolicy(this.tableName, {\n ...updatedOptions,\n tableAcl: serlializedAcl,\n });\n });\n }\n\n /**\n * Submits a Transaction which is composed of a set of actions. You can provide the actions as a list\n * or you can use {@link TableTransaction} to help building the transaction.\n *\n * Example usage:\n * ```typescript\n * const { TableClient } = require(\"@azure/data-tables\");\n * const connectionString = \"<connection-string>\"\n * const tableName = \"<tableName>\"\n * const client = TableClient.fromConnectionString(connectionString, tableName);\n * const actions = [\n * [\"create\", {partitionKey: \"p1\", rowKey: \"1\", data: \"test1\"}],\n * [\"delete\", {partitionKey: \"p1\", rowKey: \"2\"}],\n * [\"update\", {partitionKey: \"p1\", rowKey: \"3\", data: \"newTest\"}, \"Merge\"]\n * ]\n * const result = await client.submitTransaction(actions);\n * ```\n *\n * Example usage with TableTransaction:\n * ```js\n * const { TableClient } = require(\"@azure/data-tables\");\n * const connectionString = \"<connection-string>\"\n * const tableName = \"<tableName>\"\n * const client = TableClient.fromConnectionString(connectionString, tableName);\n * const transaction = new TableTransaction();\n * // Call the available action in the TableTransaction object\n * transaction.create({partitionKey: \"p1\", rowKey: \"1\", data: \"test1\"});\n * transaction.delete(\"p1\", \"2\");\n * transaction.update({partitionKey: \"p1\", rowKey: \"3\", data: \"newTest\"}, \"Merge\")\n * // submitTransaction with the actions list on the transaction.\n * const result = await client.submitTransaction(transaction.actions);\n * ```\n *\n * @param actions - tuple that contains the action to perform, and the entity to perform the action with\n */\n public async submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse> {\n const partitionKey = actions[0][1].partitionKey;\n const transactionId = Uuid.generateUuid();\n const changesetId = Uuid.generateUuid();\n\n // Add pipeline\n const transactionClient = new InternalTableTransaction(\n this.url,\n partitionKey,\n transactionId,\n changesetId,\n this.generatedClient,\n new TableClient(this.url, this.tableName),\n this.credential,\n this.allowInsecureConnection,\n );\n\n for (const item of actions) {\n const [action, entity, updateMode = \"Merge\", updateOptions] = item;\n switch (action) {\n case \"create\":\n transactionClient.createEntity(entity);\n break;\n case \"delete\":\n transactionClient.deleteEntity(entity.partitionKey, entity.rowKey);\n break;\n case \"update\":\n transactionClient.updateEntity(entity, updateMode, updateOptions);\n break;\n case \"upsert\":\n transactionClient.upsertEntity(entity, updateMode);\n }\n }\n\n return transactionClient.submitTransaction();\n }\n\n /**\n *\n * Creates an instance of TableClient from connection string.\n *\n * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.\n * [ Note - Account connection string can only be used in NODE.JS runtime. ]\n * Account connection string example -\n * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`\n * SAS connection string example -\n * `BlobEndpoint=https://myaccount.table.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`\n * @param options - Options to configure the HTTP pipeline.\n * @returns A new TableClient from the given connection string.\n */\n public static fromConnectionString(\n connectionString: string,\n tableName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: TableClientOptions,\n ): TableClient {\n const {\n url,\n options: clientOptions,\n credential,\n } = getClientParamsFromConnectionString(connectionString, options);\n if (credential) {\n return new TableClient(url, tableName, credential, clientOptions);\n } else {\n return new TableClient(url, tableName, clientOptions);\n }\n }\n}\n\ntype InternalQueryOptions = TableEntityQueryOptions & { top?: number };\ninterface InternalListTableEntitiesOptions extends ListTableEntitiesOptions {\n queryOptions?: InternalQueryOptions;\n /**\n * An entity query continuation token from a previous call.\n */\n continuationToken?: string;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePolicies.js","sourceRoot":"","sources":["../../src/TablePolicies.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,eAAe,EACf,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,CAAC,MAAM,oCAAoC,GAAG,kCAAkC,CAAC;AAEvF,MAAM,aAAa,GAAqB;IACtC,OAAO,EAAE,qBAAqB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAC/C,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,iBAAiB,EAAE;CAC7B,CAAC;AAEF,MAAM,UAAU,gCAAgC,CAC9C,SAAmB,EACnB,WAAmB;IAEnB,OAAO;QACL,IAAI,EAAE,oCAAoC;QAC1C,KAAK,CAAC,WAAW,CAAC,OAAwB;YACxC,MAAM,UAAU,GAAG,yBAAyB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YACnE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3B,uCAAuC;YACvC,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AAEjF,MAAM,UAAU,6BAA6B;IAC3C,OAAO;QACL,IAAI,EAAE,iCAAiC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,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;KACtC;IAED,0BAA0B;IAC1B,UAAU,CAAC,IAAI,CAAC,GAAG,4BAA4B,EAAE,CAAC,CAAC,CAAC,oDAAoD;IACxG,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KACvC;IAED,qCAAqC;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AACvD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HeaderConstants,\n TRANSACTION_HTTP_LINE_ENDING,\n TRANSACTION_HTTP_VERSION_1_1,\n} from \"./utils/constants\";\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n createHttpHeaders,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { getChangeSetBoundary } from \"./utils/transactionHelpers\";\n\nexport const transactionRequestAssemblePolicyName = \"transactionRequestAssemblePolicy\";\n\nconst dummyResponse: PipelineResponse = {\n request: createPipelineRequest({ url: \"FAKE\" }),\n status: 200,\n headers: createHttpHeaders(),\n};\n\nexport function transactionRequestAssemblePolicy(\n bodyParts: string[],\n changesetId: string
|
|
1
|
+
{"version":3,"file":"TablePolicies.js","sourceRoot":"","sources":["../../src/TablePolicies.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,eAAe,EACf,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,CAAC,MAAM,oCAAoC,GAAG,kCAAkC,CAAC;AAEvF,MAAM,aAAa,GAAqB;IACtC,OAAO,EAAE,qBAAqB,CAA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iB,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC5D,MAAM,gBAAgB,GAAG,KAAK,iBAAiB,GAAG,4BAA4B,GAAG,eAAe,CAAC,YAAY,qBAAqB,4BAA4B,GAAG,eAAe,CAAC,yBAAyB,UAAU,CAAC;IAErN,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpD,gCAAgC;IAChC,MAAM,UAAU,GAAG;QACjB,gBAAgB;QAChB,EAAE;QACF,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,aAAa,IAAI,4BAA4B,EAAE,EAAE,sCAAsC;KACxH,CAAC;IAEF,uBAAuB;IACvB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE;QAC3C,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;KACtC;IAED,0BAA0B;IAC1B,UAAU,CAAC,IAAI,CAAC,GAAG,4BAA4B,EAAE,CAAC,CAAC,CAAC,oDAAoD;IACxG,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KACvC;IAED,qCAAqC;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AACvD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HeaderConstants,\n TRANSACTION_HTTP_LINE_ENDING,\n TRANSACTION_HTTP_VERSION_1_1,\n} from \"./utils/constants\";\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n createHttpHeaders,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { getChangeSetBoundary } from \"./utils/transactionHelpers\";\n\nexport const transactionRequestAssemblePolicyName = \"transactionRequestAssemblePolicy\";\n\nconst dummyResponse: PipelineResponse = {\n request: createPipelineRequest({ url: \"FAKE\" }),\n status: 200,\n headers: createHttpHeaders(),\n};\n\nexport function transactionRequestAssemblePolicy(\n bodyParts: string[],\n changesetId: string,\n): PipelinePolicy {\n return {\n name: transactionRequestAssemblePolicyName,\n async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n const subRequest = getNextSubrequestBodyPart(request, changesetId);\n bodyParts.push(subRequest);\n // Intercept request from going to wire\n return dummyResponse;\n },\n };\n}\n\nexport const transactionHeaderFilterPolicyName = \"transactionHeaderFilterPolicy\";\n\nexport function transactionHeaderFilterPolicy(): PipelinePolicy {\n return {\n name: transactionHeaderFilterPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // The subrequests should not have the x-ms-version header.\n request.headers.delete(HeaderConstants.X_MS_VERSION);\n return next(request);\n },\n };\n}\n\nfunction getSubRequestUrl(url: string): string {\n const sasTokenParts = [\"sv\", \"ss\", \"srt\", \"sp\", \"se\", \"st\", \"spr\", \"sig\"];\n const urlParsed = new URL(url);\n sasTokenParts.forEach((part) => urlParsed.searchParams.delete(part));\n return urlParsed.toString();\n}\n\nfunction getNextSubrequestBodyPart(request: PipelineRequest, changesetId: string) {\n const changesetBoundary = getChangeSetBoundary(changesetId);\n const subRequestPrefix = `--${changesetBoundary}${TRANSACTION_HTTP_LINE_ENDING}${HeaderConstants.CONTENT_TYPE}: application/http${TRANSACTION_HTTP_LINE_ENDING}${HeaderConstants.CONTENT_TRANSFER_ENCODING}: binary`;\n\n const subRequestUrl = getSubRequestUrl(request.url);\n // Start to assemble sub request\n const subRequest = [\n subRequestPrefix, // sub request constant prefix\n \"\", // empty line after sub request's content ID\n `${request.method.toString()} ${subRequestUrl} ${TRANSACTION_HTTP_VERSION_1_1}`, // sub request start line with method,\n ];\n\n // Add required headers\n for (const [name, value] of request.headers) {\n subRequest.push(`${name}: ${value}`);\n }\n\n // Append sub-request body\n subRequest.push(`${TRANSACTION_HTTP_LINE_ENDING}`); // sub request's headers need end with an empty line\n if (request.body) {\n subRequest.push(String(request.body));\n }\n\n // Add subrequest to transaction body\n return subRequest.join(TRANSACTION_HTTP_LINE_ENDING);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableServiceClient.js","sourceRoot":"","sources":["../../src/TableServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,oBAAoB,CAAC;AAoB5B,OAAO,EAIL,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAgG7B,YACE,GAAW,EACX,mBAI6B,EAC7B,OAAmC;QAEnC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,M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MAAM,CAAA,CAAC;aACd;QACH,CAAC;KAAA;IAEO,KAAK,CAAC,WAAW,CAAC,UAAqC,EAAE;QAC/D,MAAM,EAAE,iBAAiB,EAAE,aAAa,KAAqB,OAAO,EAAvB,WAAW,UAAK,OAAO,EAA9D,qBAAoD,CAAU,CAAC;QACrE,MAAM,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,iCACzF,WAAW,KACd,aAAa,IACb,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,oBAAoB,CAChC,gBAAwB;IACxB,8DAA8D;IAC9D,OAAmC;QAEnC,MAAM,EACJ,GAAG,EACH,OAAO,EAAE,aAAa,EACtB,UAAU,GACX,GAAG,mCAAmC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAEnE,IAAI,UAAU,EAAE;YACd,OAAO,IAAI,kBAAkB,CAAC,GAAG,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;SAC/D;aAAM;YACL,OAAO,IAAI,kBAAkB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;SACnD;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport \"@azure/core-paging\";\n\nimport {\n GetPropertiesResponse,\n GetStatisticsResponse,\n ServiceProperties,\n SetPropertiesOptions,\n SetPropertiesResponse,\n} from \"./generatedModels\";\nimport {\n InternalClientPipelineOptions,\n OperationOptions,\n ServiceClientOptions,\n} from \"@azure/core-client\";\nimport {\n ListTableItemsOptions,\n TableItem,\n TableQueryOptions,\n TableServiceClientOptions,\n} from \"./models\";\nimport {\n NamedKeyCredential,\n SASCredential,\n TokenCredential,\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n} from \"@azure/core-auth\";\nimport { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from \"./utils/constants\";\nimport { Service, Table } from \"./generated\";\nimport {\n injectSecondaryEndpointHeader,\n tablesSecondaryEndpointPolicy,\n} from \"./secondaryEndpointPolicy\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\n\nimport { GeneratedClient } from \"./generated/generatedClient\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { TableItemResultPage } from \"./models\";\nimport { apiVersionPolicy } from \"./utils/apiVersionPolicy\";\nimport { getClientParamsFromConnectionString } from \"./utils/connectionString\";\nimport { handleTableAlreadyExists } from \"./utils/errorHelpers\";\nimport { isCredential } from \"./utils/isCredential\";\nimport { logger } from \"./logger\";\nimport { setTokenChallengeAuthenticationPolicy } from \"./utils/challengeAuthenticationUtils\";\nimport { tablesNamedKeyCredentialPolicy } from \"./tablesNamedCredentialPolicy\";\nimport { tablesSASTokenPolicy } from \"./tablesSASTokenPolicy\";\nimport { tracingClient } from \"./utils/tracing\";\n\n/**\n * A TableServiceClient represents a Client to the Azure Tables service allowing you\n * to perform operations on the tables and the entities.\n */\nexport class TableServiceClient {\n /**\n * Table Account URL\n */\n public url: string;\n /**\n * Represents a pipeline for making a HTTP request to a URL.\n * Pipelines can have multiple policies to manage manipulating each request before and after it is made to the server.\n */\n public pipeline: Pipeline;\n private table: Table;\n private service: Service;\n\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as \"https://myaccount.table.core.windows.net\".\n * @param credential - NamedKeyCredential | SASCredential used to authenticate requests. Only Supported for Node\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example using an account name/key:\n *\n * ```js\n * const { AzureNamedKeyCredential, TableServiceClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\"\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, \"<account key>\");\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net`,\n * sharedKeyCredential\n * );\n * ```\n */\n constructor(url: string, credential: NamedKeyCredential, options?: TableServiceClientOptions);\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as \"https://myaccount.table.core.windows.net\".\n * @param credential - SASCredential used to authenticate requests\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example using a SAS Token.\n *\n * ```js\n * const { AzureSASCredential, TableServiceClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\"\n * const sasCredential = new AzureSASCredential(account, \"<account key>\");\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net`,\n * sasCredential\n * );\n * ```\n */\n constructor(url: string, credential: SASCredential, options?: TableServiceClientOptions);\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as \"https://myaccount.table.core.windows.net\".\n * @param credential - Azure Active Directory credential used to authenticate requests\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example using an Azure Active Directory credential:\n *\n * ```js\n * cons { DefaultAzureCredential } = require(\"@azure/identity\");\n * const { TableServiceClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\"\n * const credential = new DefaultAzureCredential();\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net`,\n * credential\n * );\n * ```\n */\n constructor(url: string, credential: TokenCredential, options?: TableServiceClientOptions);\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as\n * \"https://myaccount.table.core.windows.net\". You can append a SAS,\n * such as \"https://myaccount.table.core.windows.net?sasString\".\n * @param options - Options to configure the HTTP pipeline.\n * Example appending a SAS token:\n *\n * ```js\n * const account = \"<storage account name>\";\n * const sasToken = \"<SAS token>\";\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net?${sasToken}`,\n * );\n * ```\n */\n constructor(url: string, options?: TableServiceClientOptions);\n constructor(\n url: string,\n credentialOrOptions?:\n | NamedKeyCredential\n | SASCredential\n | TokenCredential\n | TableServiceClientOptions,\n options?: TableServiceClientOptions\n ) {\n this.url = url;\n const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;\n const clientOptions =\n (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};\n\n const internalPipelineOptions: ServiceClientOptions & InternalClientPipelineOptions = {\n ...clientOptions,\n endpoint: clientOptions.endpoint || this.url,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],\n },\n deserializationOptions: {\n parseXML,\n },\n serializationOptions: {\n stringifyXML,\n },\n };\n const client = new GeneratedClient(this.url, internalPipelineOptions);\n client.pipeline.addPolicy(tablesSecondaryEndpointPolicy);\n\n if (isNamedKeyCredential(credential)) {\n client.pipeline.addPolicy(tablesNamedKeyCredentialPolicy(credential));\n } else if (isSASCredential(credential)) {\n client.pipeline.addPolicy(tablesSASTokenPolicy(credential));\n }\n\n if (isTokenCredential(credential)) {\n setTokenChallengeAuthenticationPolicy(client.pipeline, credential, STORAGE_SCOPE);\n }\n\n if (options?.version) {\n client.pipeline.addPolicy(apiVersionPolicy(options.version));\n }\n\n this.pipeline = client.pipeline;\n this.table = client.table;\n this.service = client.service;\n }\n\n /**\n * Retrieves statistics related to replication for the Table service. It is only available on the\n * secondary location endpoint when read-access geo-redundant replication is enabled for the account.\n * @param options - The options parameters.\n */\n public async getStatistics(options: OperationOptions = {}): Promise<GetStatisticsResponse> {\n return tracingClient.withSpan(\"TableServiceClient.getStatistics\", options, (updatedOptions) =>\n this.service.getStatistics(injectSecondaryEndpointHeader(updatedOptions))\n );\n }\n\n /**\n * Gets the properties of an account's Table service, including properties for Analytics and CORS\n * (Cross-Origin Resource Sharing) rules.\n * @param options - The options parameters.\n */\n public getProperties(options: OperationOptions = {}): Promise<GetPropertiesResponse> {\n return tracingClient.withSpan(\"TableServiceClient.getProperties\", options, (updatedOptions) =>\n this.service.getProperties(updatedOptions)\n );\n }\n\n /**\n * Sets properties for an account's Table service endpoint, including properties for Analytics and CORS\n * (Cross-Origin Resource Sharing) rules.\n * @param properties - The Table Service properties.\n * @param options - The options parameters.\n */\n public setProperties(\n properties: ServiceProperties,\n options: SetPropertiesOptions = {}\n ): Promise<SetPropertiesResponse> {\n return tracingClient.withSpan(\"TableServiceClient.setProperties\", options, (updatedOptions) =>\n this.service.setProperties(properties, updatedOptions)\n );\n }\n\n /**\n * Creates a new table under the given account.\n * @param name - The name of the table.\n * @param options - The options parameters.\n */\n public createTable(name: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"TableServiceClient.createTable\",\n options,\n async (updatedOptions) => {\n try {\n await this.table.create({ name }, updatedOptions);\n } catch (e: any) {\n handleTableAlreadyExists(e, { ...updatedOptions, logger, tableName: name });\n }\n }\n );\n }\n\n /**\n * Operation permanently deletes the specified table.\n * @param name - The name of the table.\n * @param options - The options parameters.\n */\n public deleteTable(name: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"TableServiceClient.deleteTable\",\n options,\n async (updatedOptions) => {\n try {\n await this.table.delete(name, updatedOptions);\n } catch (e: any) {\n if (e.statusCode === 404) {\n logger.info(\"TableServiceClient.deleteTable: Table doesn't exist\");\n } else {\n throw e;\n }\n }\n }\n );\n }\n\n /**\n * Queries tables under the given account.\n * @param options - The options parameters.\n */\n public listTables(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ListTableItemsOptions\n ): PagedAsyncIterableIterator<TableItem, TableItemResultPage> {\n const iter = this.listTablesAll(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings) => {\n const pageOptions: InternalListTablesOptions = {\n ...options,\n queryOptions: { ...options?.queryOptions, top: settings?.maxPageSize },\n };\n\n if (settings?.continuationToken) {\n pageOptions.continuationToken = settings.continuationToken;\n }\n\n return this.listTablesPage(pageOptions);\n },\n };\n }\n\n private async *listTablesAll(\n options?: InternalListTablesOptions\n ): AsyncIterableIterator<TableItem> {\n const firstPage = await this._listTables(options);\n const { continuationToken } = firstPage;\n yield* firstPage;\n if (continuationToken) {\n const optionsWithContinuation: InternalListTablesOptions = {\n ...options,\n continuationToken,\n };\n for await (const page of this.listTablesPage(optionsWithContinuation)) {\n yield* page;\n }\n }\n }\n\n private async *listTablesPage(\n options: InternalListTablesOptions = {}\n ): AsyncIterableIterator<TableItemResultPage> {\n let result = await tracingClient.withSpan(\n \"TableServiceClient.listTablesPage\",\n options,\n (updatedOptions) => this._listTables(updatedOptions)\n );\n\n yield result;\n\n while (result.continuationToken) {\n const optionsWithContinuation: InternalListTablesOptions = {\n ...options,\n continuationToken: result.continuationToken,\n };\n result = await tracingClient.withSpan(\n \"TableServiceClient.listTablesPage\",\n optionsWithContinuation,\n async (updatedOptions, span) => {\n span.setAttribute(\"continuationToken\", updatedOptions.continuationToken);\n return this._listTables(updatedOptions);\n }\n );\n yield result;\n }\n }\n\n private async _listTables(options: InternalListTablesOptions = {}): Promise<TableItemResultPage> {\n const { continuationToken: nextTableName, ...listOptions } = options;\n const { xMsContinuationNextTableName: continuationToken, value = [] } = await this.table.query({\n ...listOptions,\n nextTableName,\n });\n return Object.assign([...value], { continuationToken });\n }\n\n /**\n *\n * Creates an instance of TableServiceClient from connection string.\n *\n * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.\n * [ Note - Account connection string can only be used in NODE.JS runtime. ]\n * Account connection string example -\n * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`\n * SAS connection string example -\n * `BlobEndpoint=https://myaccount.table.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`\n * @param options - Options to configure the HTTP pipeline.\n * @returns A new TableServiceClient from the given connection string.\n */\n public static fromConnectionString(\n connectionString: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: TableServiceClientOptions\n ): TableServiceClient {\n const {\n url,\n options: clientOptions,\n credential,\n } = getClientParamsFromConnectionString(connectionString, options);\n\n if (credential) {\n return new TableServiceClient(url, credential, clientOptions);\n } else {\n return new TableServiceClient(url, clientOptions);\n }\n }\n}\n\ntype InternalListTablesOptions = ListTableItemsOptions & {\n queryOptions?: TableQueryOptions & { top?: number };\n /**\n * A table query continuation token from a previous call.\n */\n continuationToken?: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"TableServiceClient.js","sourceRoot":"","sources":["../../src/TableServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,oBAAoB,CAAC;AAoB5B,OAAO,EAIL,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wB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AE,IAAI,EAAE,EAAE;oBAC7B,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;oBACzE,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;gBAC1C,CAAC,CACF,CAAA,CAAC;gBACF,oBAAM,MAAM,CAAA,CAAC;aACd;QACH,CAAC;KAAA;IAEO,KAAK,CAAC,WAAW,CAAC,UAAqC,EAAE;QAC/D,MAAM,EAAE,iBAAiB,EAAE,aAAa,KAAqB,OAAO,EAAvB,WAAW,UAAK,OAAO,EAA9D,qBAAoD,CAAU,CAAC;QACrE,MAAM,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,iCACzF,WAAW,KACd,aAAa,IACb,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,oBAAoB,CAChC,gBAAwB;IACxB,8DAA8D;IAC9D,OAAmC;QAEnC,MAAM,EACJ,GAAG,EACH,OAAO,EAAE,aAAa,EACtB,UAAU,GACX,GAAG,mCAAmC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAEnE,IAAI,UAAU,EAAE;YACd,OAAO,IAAI,kBAAkB,CAAC,GAAG,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;SAC/D;aAAM;YACL,OAAO,IAAI,kBAAkB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;SACnD;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport \"@azure/core-paging\";\n\nimport {\n GetPropertiesResponse,\n GetStatisticsResponse,\n ServiceProperties,\n SetPropertiesOptions,\n SetPropertiesResponse,\n} from \"./generatedModels\";\nimport {\n InternalClientPipelineOptions,\n OperationOptions,\n ServiceClientOptions,\n} from \"@azure/core-client\";\nimport {\n ListTableItemsOptions,\n TableItem,\n TableQueryOptions,\n TableServiceClientOptions,\n} from \"./models\";\nimport {\n NamedKeyCredential,\n SASCredential,\n TokenCredential,\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n} from \"@azure/core-auth\";\nimport { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from \"./utils/constants\";\nimport { Service, Table } from \"./generated\";\nimport {\n injectSecondaryEndpointHeader,\n tablesSecondaryEndpointPolicy,\n} from \"./secondaryEndpointPolicy\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\n\nimport { GeneratedClient } from \"./generated/generatedClient\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { TableItemResultPage } from \"./models\";\nimport { apiVersionPolicy } from \"./utils/apiVersionPolicy\";\nimport { getClientParamsFromConnectionString } from \"./utils/connectionString\";\nimport { handleTableAlreadyExists } from \"./utils/errorHelpers\";\nimport { isCredential } from \"./utils/isCredential\";\nimport { logger } from \"./logger\";\nimport { setTokenChallengeAuthenticationPolicy } from \"./utils/challengeAuthenticationUtils\";\nimport { tablesNamedKeyCredentialPolicy } from \"./tablesNamedCredentialPolicy\";\nimport { tablesSASTokenPolicy } from \"./tablesSASTokenPolicy\";\nimport { tracingClient } from \"./utils/tracing\";\n\n/**\n * A TableServiceClient represents a Client to the Azure Tables service allowing you\n * to perform operations on the tables and the entities.\n */\nexport class TableServiceClient {\n /**\n * Table Account URL\n */\n public url: string;\n /**\n * Represents a pipeline for making a HTTP request to a URL.\n * Pipelines can have multiple policies to manage manipulating each request before and after it is made to the server.\n */\n public pipeline: Pipeline;\n private table: Table;\n private service: Service;\n\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as \"https://myaccount.table.core.windows.net\".\n * @param credential - NamedKeyCredential | SASCredential used to authenticate requests. Only Supported for Node\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example using an account name/key:\n *\n * ```js\n * const { AzureNamedKeyCredential, TableServiceClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\"\n * const sharedKeyCredential = new AzureNamedKeyCredential(account, \"<account key>\");\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net`,\n * sharedKeyCredential\n * );\n * ```\n */\n constructor(url: string, credential: NamedKeyCredential, options?: TableServiceClientOptions);\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as \"https://myaccount.table.core.windows.net\".\n * @param credential - SASCredential used to authenticate requests\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example using a SAS Token.\n *\n * ```js\n * const { AzureSASCredential, TableServiceClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\"\n * const sasCredential = new AzureSASCredential(account, \"<account key>\");\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net`,\n * sasCredential\n * );\n * ```\n */\n constructor(url: string, credential: SASCredential, options?: TableServiceClientOptions);\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as \"https://myaccount.table.core.windows.net\".\n * @param credential - Azure Active Directory credential used to authenticate requests\n * @param options - Options to configure the HTTP pipeline.\n *\n * ### Example using an Azure Active Directory credential:\n *\n * ```js\n * cons { DefaultAzureCredential } = require(\"@azure/identity\");\n * const { TableServiceClient } = require(\"@azure/data-tables\")\n * const account = \"<storage account name>\"\n * const credential = new DefaultAzureCredential();\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net`,\n * credential\n * );\n * ```\n */\n constructor(url: string, credential: TokenCredential, options?: TableServiceClientOptions);\n /**\n * Creates a new instance of the TableServiceClient class.\n *\n * @param url - The URL of the service account that is the target of the desired operation., such as\n * \"https://myaccount.table.core.windows.net\". You can append a SAS,\n * such as \"https://myaccount.table.core.windows.net?sasString\".\n * @param options - Options to configure the HTTP pipeline.\n * Example appending a SAS token:\n *\n * ```js\n * const account = \"<storage account name>\";\n * const sasToken = \"<SAS token>\";\n *\n * const tableServiceClient = new TableServiceClient(\n * `https://${account}.table.core.windows.net?${sasToken}`,\n * );\n * ```\n */\n constructor(url: string, options?: TableServiceClientOptions);\n constructor(\n url: string,\n credentialOrOptions?:\n | NamedKeyCredential\n | SASCredential\n | TokenCredential\n | TableServiceClientOptions,\n options?: TableServiceClientOptions,\n ) {\n this.url = url;\n const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;\n const clientOptions =\n (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};\n\n const internalPipelineOptions: ServiceClientOptions & InternalClientPipelineOptions = {\n ...clientOptions,\n endpoint: clientOptions.endpoint || this.url,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],\n },\n deserializationOptions: {\n parseXML,\n },\n serializationOptions: {\n stringifyXML,\n },\n };\n const client = new GeneratedClient(this.url, internalPipelineOptions);\n client.pipeline.addPolicy(tablesSecondaryEndpointPolicy);\n\n if (isNamedKeyCredential(credential)) {\n client.pipeline.addPolicy(tablesNamedKeyCredentialPolicy(credential));\n } else if (isSASCredential(credential)) {\n client.pipeline.addPolicy(tablesSASTokenPolicy(credential));\n }\n\n if (isTokenCredential(credential)) {\n setTokenChallengeAuthenticationPolicy(client.pipeline, credential, STORAGE_SCOPE);\n }\n\n if (options?.version) {\n client.pipeline.addPolicy(apiVersionPolicy(options.version));\n }\n\n this.pipeline = client.pipeline;\n this.table = client.table;\n this.service = client.service;\n }\n\n /**\n * Retrieves statistics related to replication for the Table service. It is only available on the\n * secondary location endpoint when read-access geo-redundant replication is enabled for the account.\n * @param options - The options parameters.\n */\n public async getStatistics(options: OperationOptions = {}): Promise<GetStatisticsResponse> {\n return tracingClient.withSpan(\"TableServiceClient.getStatistics\", options, (updatedOptions) =>\n this.service.getStatistics(injectSecondaryEndpointHeader(updatedOptions)),\n );\n }\n\n /**\n * Gets the properties of an account's Table service, including properties for Analytics and CORS\n * (Cross-Origin Resource Sharing) rules.\n * @param options - The options parameters.\n */\n public getProperties(options: OperationOptions = {}): Promise<GetPropertiesResponse> {\n return tracingClient.withSpan(\"TableServiceClient.getProperties\", options, (updatedOptions) =>\n this.service.getProperties(updatedOptions),\n );\n }\n\n /**\n * Sets properties for an account's Table service endpoint, including properties for Analytics and CORS\n * (Cross-Origin Resource Sharing) rules.\n * @param properties - The Table Service properties.\n * @param options - The options parameters.\n */\n public setProperties(\n properties: ServiceProperties,\n options: SetPropertiesOptions = {},\n ): Promise<SetPropertiesResponse> {\n return tracingClient.withSpan(\"TableServiceClient.setProperties\", options, (updatedOptions) =>\n this.service.setProperties(properties, updatedOptions),\n );\n }\n\n /**\n * Creates a new table under the given account.\n * @param name - The name of the table.\n * @param options - The options parameters.\n */\n public createTable(name: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"TableServiceClient.createTable\",\n options,\n async (updatedOptions) => {\n try {\n await this.table.create({ name }, updatedOptions);\n } catch (e: any) {\n handleTableAlreadyExists(e, { ...updatedOptions, logger, tableName: name });\n }\n },\n );\n }\n\n /**\n * Operation permanently deletes the specified table.\n * @param name - The name of the table.\n * @param options - The options parameters.\n */\n public deleteTable(name: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"TableServiceClient.deleteTable\",\n options,\n async (updatedOptions) => {\n try {\n await this.table.delete(name, updatedOptions);\n } catch (e: any) {\n if (e.statusCode === 404) {\n logger.info(\"TableServiceClient.deleteTable: Table doesn't exist\");\n } else {\n throw e;\n }\n }\n },\n );\n }\n\n /**\n * Queries tables under the given account.\n * @param options - The options parameters.\n */\n public listTables(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ListTableItemsOptions,\n ): PagedAsyncIterableIterator<TableItem, TableItemResultPage> {\n const iter = this.listTablesAll(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings) => {\n const pageOptions: InternalListTablesOptions = {\n ...options,\n queryOptions: { ...options?.queryOptions, top: settings?.maxPageSize },\n };\n\n if (settings?.continuationToken) {\n pageOptions.continuationToken = settings.continuationToken;\n }\n\n return this.listTablesPage(pageOptions);\n },\n };\n }\n\n private async *listTablesAll(\n options?: InternalListTablesOptions,\n ): AsyncIterableIterator<TableItem> {\n const firstPage = await this._listTables(options);\n const { continuationToken } = firstPage;\n yield* firstPage;\n if (continuationToken) {\n const optionsWithContinuation: InternalListTablesOptions = {\n ...options,\n continuationToken,\n };\n for await (const page of this.listTablesPage(optionsWithContinuation)) {\n yield* page;\n }\n }\n }\n\n private async *listTablesPage(\n options: InternalListTablesOptions = {},\n ): AsyncIterableIterator<TableItemResultPage> {\n let result = await tracingClient.withSpan(\n \"TableServiceClient.listTablesPage\",\n options,\n (updatedOptions) => this._listTables(updatedOptions),\n );\n\n yield result;\n\n while (result.continuationToken) {\n const optionsWithContinuation: InternalListTablesOptions = {\n ...options,\n continuationToken: result.continuationToken,\n };\n result = await tracingClient.withSpan(\n \"TableServiceClient.listTablesPage\",\n optionsWithContinuation,\n async (updatedOptions, span) => {\n span.setAttribute(\"continuationToken\", updatedOptions.continuationToken);\n return this._listTables(updatedOptions);\n },\n );\n yield result;\n }\n }\n\n private async _listTables(options: InternalListTablesOptions = {}): Promise<TableItemResultPage> {\n const { continuationToken: nextTableName, ...listOptions } = options;\n const { xMsContinuationNextTableName: continuationToken, value = [] } = await this.table.query({\n ...listOptions,\n nextTableName,\n });\n return Object.assign([...value], { continuationToken });\n }\n\n /**\n *\n * Creates an instance of TableServiceClient from connection string.\n *\n * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.\n * [ Note - Account connection string can only be used in NODE.JS runtime. ]\n * Account connection string example -\n * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`\n * SAS connection string example -\n * `BlobEndpoint=https://myaccount.table.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`\n * @param options - Options to configure the HTTP pipeline.\n * @returns A new TableServiceClient from the given connection string.\n */\n public static fromConnectionString(\n connectionString: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: TableServiceClientOptions,\n ): TableServiceClient {\n const {\n url,\n options: clientOptions,\n credential,\n } = getClientParamsFromConnectionString(connectionString, options);\n\n if (credential) {\n return new TableServiceClient(url, credential, clientOptions);\n } else {\n return new TableServiceClient(url, clientOptions);\n }\n }\n}\n\ntype InternalListTablesOptions = ListTableItemsOptions & {\n queryOptions?: TableQueryOptions & { top?: number };\n /**\n * A table query continuation token from a previous call.\n */\n continuationToken?: string;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableTransaction.js","sourceRoot":"","sources":["../../src/TableTransaction.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAGL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,SAAS,EACT,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,M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.\n// Licensed under the MIT license.\n\nimport {\n DeleteTableEntityOptions,\n TableEntity,\n TableTransactionEntityResponse,\n TableTransactionResponse,\n TransactionAction,\n UpdateMode,\n UpdateTableEntityOptions,\n} from \"./models\";\nimport { NamedKeyCredential, SASCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n OperationOptions,\n ServiceClient,\n serializationPolicy,\n serializationPolicyName,\n} from \"@azure/core-client\";\nimport {\n Pipeline,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createHttpHeaders,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n getInitialTransactionBody,\n getTransactionHttpRequestBody,\n} from \"./utils/transactionHelpers\";\nimport {\n transactionHeaderFilterPolicy,\n transactionHeaderFilterPolicyName,\n transactionRequestAssemblePolicy,\n transactionRequestAssemblePolicyName,\n} from \"./TablePolicies\";\n\nimport { TableClientLike } from \"./utils/internalModels\";\nimport { TableServiceErrorOdataError } from \"./generated\";\nimport { cosmosPatchPolicy } from \"./cosmosPathPolicy\";\nimport { getTransactionHeaders } from \"./utils/transactionHeaders\";\nimport { isCosmosEndpoint } from \"./utils/isCosmosEndpoint\";\nimport { tracingClient } from \"./utils/tracing\";\n\n/**\n * Helper to build a list of transaction actions\n */\nexport class TableTransaction {\n /**\n * List of actions to perform in a transaction\n */\n public actions: TransactionAction[];\n\n constructor(actions?: TransactionAction[]) {\n this.actions = actions ?? [];\n }\n\n /**\n * Adds a create action to the transaction\n * @param entity - entity to create\n */\n createEntity<T extends object = Record<string, unknown>>(entity: TableEntity<T>): void {\n this.actions.push([\"create\", entity]);\n }\n\n /**\n * Adds a delete action to the transaction\n * @param partitionKey - partition key of the entity to delete\n * @param rowKey - rowKey of the entity to delete\n */\n deleteEntity(partitionKey: string, rowKey: string): void {\n this.actions.push([\"delete\", { partitionKey, rowKey }]);\n }\n\n /**\n * Adds an update action to the transaction\n * @param entity - entity to update\n * @param updateOptions - options for the update operation\n */\n updateEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateOptions?: UpdateTableEntityOptions\n ): void;\n\n /**\n * Adds an update action to the transaction\n * @param entity - entity to update\n * @param updateMode - update mode\n * @param updateOptions - options for the update operation\n */\n updateEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateMode: UpdateMode,\n updateOptions?: UpdateTableEntityOptions\n ): void;\n\n /**\n * Adds an update action to the transaction\n * @param entity - entity to update\n * @param updateModeOrOptions - update mode or update options\n * @param updateOptions - options for the update operation\n */\n updateEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateModeOrOptions: UpdateMode | UpdateTableEntityOptions | undefined,\n updateOptions?: UpdateTableEntityOptions\n ): void {\n // UpdateMode is a string union\n const realUpdateMode: UpdateMode | undefined =\n typeof updateModeOrOptions === \"string\" ? updateModeOrOptions : undefined;\n const realUpdateOptions: UpdateTableEntityOptions | undefined =\n typeof updateModeOrOptions === \"object\" ? updateModeOrOptions : updateOptions;\n this.actions.push([\"update\", entity, realUpdateMode ?? \"Merge\", realUpdateOptions ?? {}]);\n }\n\n /**\n * Adds an upsert action to the transaction, which inserts if the entity doesn't exist or updates the existing one\n * @param entity - entity to upsert\n * @param updateMode - update mode\n */\n upsertEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateMode: UpdateMode = \"Merge\"\n ): void {\n this.actions.push([\"upsert\", entity, updateMode]);\n }\n}\n\n/**\n * TableTransaction collects sub-operations that can be submitted together via submitTransaction\n */\nexport class InternalTableTransaction {\n /**\n * Table Account URL\n */\n public url: string;\n /**\n * State that holds the information about a particular transation\n */\n private state: {\n transactionId: string;\n changesetId: string;\n pendingOperations: Promise<any>[];\n bodyParts: string[];\n partitionKey: string;\n };\n private interceptClient: TableClientLike;\n private allowInsecureConnection: boolean;\n private client: ServiceClient;\n\n /**\n * @param url - Tables account url\n * @param partitionKey - partition key\n * @param credential - credential to authenticate the transaction request\n */\n constructor(\n url: string,\n partitionKey: string,\n transactionId: string,\n changesetId: string,\n client: ServiceClient,\n interceptClient: TableClientLike,\n credential?: NamedKeyCredential | SASCredential | TokenCredential,\n allowInsecureConnection: boolean = false\n ) {\n this.client = client;\n this.url = url;\n this.interceptClient = interceptClient;\n this.allowInsecureConnection = allowInsecureConnection;\n\n // Initialize the state\n this.state = this.initializeState(transactionId, changesetId, partitionKey);\n\n // Depending on the auth method used we need to build the url\n if (!credential) {\n // When the SAS token is provided as part of the URL we need to move it after $batch\n const urlParts = url.split(\"?\");\n this.url = urlParts[0];\n const sas = urlParts.length > 1 ? `?${urlParts[1]}` : \"\";\n this.url = `${this.getUrlWithSlash()}$batch${sas}`;\n } else {\n // When using a SharedKey credential no SAS token is needed\n this.url = `${this.getUrlWithSlash()}$batch`;\n }\n }\n\n private initializeState(transactionId: string, changesetId: string, partitionKey: string) {\n const pendingOperations: Promise<any>[] = [];\n const bodyParts = getInitialTransactionBody(transactionId, changesetId);\n const isCosmos = isCosmosEndpoint(this.url);\n prepateTransactionPipeline(this.interceptClient.pipeline, bodyParts, changesetId, isCosmos);\n\n return {\n transactionId,\n changesetId,\n partitionKey,\n pendingOperations,\n bodyParts,\n };\n }\n\n /**\n * Adds a createEntity operation to the transaction\n * @param entity - Entity to create\n */\n public createEntity<T extends object>(entity: TableEntity<T>): void {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.createEntity(entity));\n }\n\n /**\n * Adds a createEntity operation to the transaction per each entity in the entities array\n * @param entities - Array of entities to create\n */\n public createEntities<T extends object>(entities: TableEntity<T>[]): void {\n for (const entity of entities) {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.createEntity(entity));\n }\n }\n\n /**\n * Adds a deleteEntity operation to the transaction\n * @param partitionKey - Partition key of the entity to delete\n * @param rowKey - Row key of the entity to delete\n * @param options - Options for the delete operation\n */\n public deleteEntity(\n partitionKey: string,\n rowKey: string,\n options?: DeleteTableEntityOptions\n ): void {\n this.checkPartitionKey(partitionKey);\n this.state.pendingOperations.push(\n this.interceptClient.deleteEntity(partitionKey, rowKey, options)\n );\n }\n\n /**\n * Adds an updateEntity operation to the transaction\n * @param entity - Entity to update\n * @param mode - Update mode (Merge or Replace)\n * @param options - Options for the update operation\n */\n public updateEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode,\n options?: UpdateTableEntityOptions\n ): void {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.updateEntity(entity, mode, options));\n }\n\n /**\n * Adds an upsertEntity operation to the transaction\n * @param entity - The properties for the table entity.\n * @param mode - The different modes for updating the entity:\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n * @param options - The options parameters.\n */\n public upsertEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode,\n options?: OperationOptions\n ): void {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.upsertEntity(entity, mode, options));\n }\n\n /**\n * Submits the operations in the transaction\n */\n public async submitTransaction(): Promise<TableTransactionResponse> {\n await Promise.all(this.state.pendingOperations);\n const body = getTransactionHttpRequestBody(\n this.state.bodyParts,\n this.state.transactionId,\n this.state.changesetId\n );\n\n const headers = getTransactionHeaders(this.state.transactionId);\n\n return tracingClient.withSpan(\n \"TableTransaction.submitTransaction\",\n {} as OperationOptions,\n async (updatedOptions) => {\n const request = createPipelineRequest({\n url: this.url,\n method: \"POST\",\n body,\n headers: createHttpHeaders(headers),\n tracingOptions: updatedOptions.tracingOptions,\n allowInsecureConnection: this.allowInsecureConnection,\n });\n\n const rawTransactionResponse = await this.client.sendRequest(request);\n return parseTransactionResponse(rawTransactionResponse);\n }\n );\n }\n\n private checkPartitionKey(partitionKey: string): void {\n if (this.state.partitionKey !== partitionKey) {\n throw new Error(\"All operations in a transaction must target the same partitionKey\");\n }\n }\n\n private getUrlWithSlash(): string {\n return this.url.endsWith(\"/\") ? this.url : `${this.url}/`;\n }\n}\n\nexport function parseTransactionResponse(\n transactionResponse: PipelineResponse\n): TableTransactionResponse {\n const subResponsePrefix = `--changesetresponse_`;\n const status = transactionResponse.status;\n const rawBody = transactionResponse.bodyAsText || \"\";\n const splitBody = rawBody.split(subResponsePrefix);\n const isSuccessByStatus = 200 <= status && status < 300;\n\n if (!isSuccessByStatus) {\n handleBodyError(rawBody, status, transactionResponse.request, transactionResponse);\n }\n\n // Dropping the first and last elements as they are the boundaries\n // we just care about sub request content\n const subResponses = splitBody.slice(1, splitBody.length - 1);\n\n const responses: TableTransactionEntityResponse[] = subResponses.map((subResponse) => {\n const statusMatch = subResponse.match(/HTTP\\/1.1 ([0-9]*)/);\n if (statusMatch?.length !== 2) {\n throw new Error(`Couldn't extract status from sub-response:\\n ${subResponse}`);\n }\n const subResponseStatus = Number.parseInt(statusMatch[1]);\n if (!Number.isInteger(subResponseStatus)) {\n throw new Error(`Expected sub-response status to be an integer ${subResponseStatus}`);\n }\n\n const bodyMatch = subResponse.match(/\\{(.*)\\}/);\n if (bodyMatch?.length === 2) {\n handleBodyError(\n bodyMatch[0],\n subResponseStatus,\n transactionResponse.request,\n transactionResponse\n );\n }\n\n const etagMatch = subResponse.match(/ETag: (.*)/);\n const rowKeyMatch = subResponse.match(/RowKey='(.*)'/);\n\n return {\n status: subResponseStatus,\n ...(rowKeyMatch?.length === 2 && { rowKey: rowKeyMatch[1] }),\n ...(etagMatch?.length === 2 && { etag: etagMatch[1] }),\n };\n });\n\n return {\n status,\n subResponses: responses,\n getResponseForEntity: (rowKey: string) => responses.find((r) => r.rowKey === rowKey),\n };\n}\n\nfunction handleBodyError(\n bodyAsText: string,\n statusCode: number,\n request: PipelineRequest,\n response: PipelineResponse\n) {\n let parsedError;\n\n try {\n parsedError = JSON.parse(bodyAsText);\n } catch {\n parsedError = {};\n }\n\n let message = \"Transaction Failed\";\n let code: string | undefined;\n // Only transaction sub-responses return body\n if (parsedError && parsedError[\"odata.error\"]) {\n const error: TableServiceErrorOdataError = parsedError[\"odata.error\"];\n message = error.message?.value ?? message;\n code = error.code;\n }\n\n throw new RestError(message, {\n code,\n statusCode,\n request,\n response,\n });\n}\n\n/**\n * Prepares the transaction pipeline to intercept operations\n * @param pipeline - Client pipeline\n */\nexport function prepateTransactionPipeline(\n pipeline: Pipeline,\n bodyParts: string[],\n changesetId: string,\n isCosmos: boolean\n): void {\n // Fist, we need to clear all the existing policies to make sure we start\n // with a fresh state.\n const policies = pipeline.getOrderedPolicies();\n for (const policy of policies) {\n pipeline.removePolicy({\n name: policy.name,\n });\n }\n\n // With the clear state we now initialize the pipelines required for intercepting the requests.\n // Use transaction assemble policy to assemble request and intercept request from going to wire\n\n pipeline.addPolicy(serializationPolicy(), { phase: \"Serialize\" });\n pipeline.addPolicy(transactionHeaderFilterPolicy());\n pipeline.addPolicy(transactionRequestAssemblePolicy(bodyParts, changesetId));\n if (isCosmos) {\n pipeline.addPolicy(cosmosPatchPolicy(), {\n afterPolicies: [transactionHeaderFilterPolicyName],\n beforePolicies: [serializationPolicyName, transactionRequestAssemblePolicyName],\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TableTransaction.js","sourceRoot":"","sources":["../../src/TableTransaction.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAGL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,SAAS,EACT,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BA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AE,oCAAoC,CAAC;SAChF,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DeleteTableEntityOptions,\n TableEntity,\n TableTransactionEntityResponse,\n TableTransactionResponse,\n TransactionAction,\n UpdateMode,\n UpdateTableEntityOptions,\n} from \"./models\";\nimport { NamedKeyCredential, SASCredential, TokenCredential } from \"@azure/core-auth\";\nimport {\n OperationOptions,\n ServiceClient,\n serializationPolicy,\n serializationPolicyName,\n} from \"@azure/core-client\";\nimport {\n Pipeline,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createHttpHeaders,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n getInitialTransactionBody,\n getTransactionHttpRequestBody,\n} from \"./utils/transactionHelpers\";\nimport {\n transactionHeaderFilterPolicy,\n transactionHeaderFilterPolicyName,\n transactionRequestAssemblePolicy,\n transactionRequestAssemblePolicyName,\n} from \"./TablePolicies\";\n\nimport { TableClientLike } from \"./utils/internalModels\";\nimport { TableServiceErrorOdataError } from \"./generated\";\nimport { cosmosPatchPolicy } from \"./cosmosPathPolicy\";\nimport { getTransactionHeaders } from \"./utils/transactionHeaders\";\nimport { isCosmosEndpoint } from \"./utils/isCosmosEndpoint\";\nimport { tracingClient } from \"./utils/tracing\";\n\n/**\n * Helper to build a list of transaction actions\n */\nexport class TableTransaction {\n /**\n * List of actions to perform in a transaction\n */\n public actions: TransactionAction[];\n\n constructor(actions?: TransactionAction[]) {\n this.actions = actions ?? [];\n }\n\n /**\n * Adds a create action to the transaction\n * @param entity - entity to create\n */\n createEntity<T extends object = Record<string, unknown>>(entity: TableEntity<T>): void {\n this.actions.push([\"create\", entity]);\n }\n\n /**\n * Adds a delete action to the transaction\n * @param partitionKey - partition key of the entity to delete\n * @param rowKey - rowKey of the entity to delete\n */\n deleteEntity(partitionKey: string, rowKey: string): void {\n this.actions.push([\"delete\", { partitionKey, rowKey }]);\n }\n\n /**\n * Adds an update action to the transaction\n * @param entity - entity to update\n * @param updateOptions - options for the update operation\n */\n updateEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateOptions?: UpdateTableEntityOptions,\n ): void;\n\n /**\n * Adds an update action to the transaction\n * @param entity - entity to update\n * @param updateMode - update mode\n * @param updateOptions - options for the update operation\n */\n updateEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateMode: UpdateMode,\n updateOptions?: UpdateTableEntityOptions,\n ): void;\n\n /**\n * Adds an update action to the transaction\n * @param entity - entity to update\n * @param updateModeOrOptions - update mode or update options\n * @param updateOptions - options for the update operation\n */\n updateEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateModeOrOptions: UpdateMode | UpdateTableEntityOptions | undefined,\n updateOptions?: UpdateTableEntityOptions,\n ): void {\n // UpdateMode is a string union\n const realUpdateMode: UpdateMode | undefined =\n typeof updateModeOrOptions === \"string\" ? updateModeOrOptions : undefined;\n const realUpdateOptions: UpdateTableEntityOptions | undefined =\n typeof updateModeOrOptions === \"object\" ? updateModeOrOptions : updateOptions;\n this.actions.push([\"update\", entity, realUpdateMode ?? \"Merge\", realUpdateOptions ?? {}]);\n }\n\n /**\n * Adds an upsert action to the transaction, which inserts if the entity doesn't exist or updates the existing one\n * @param entity - entity to upsert\n * @param updateMode - update mode\n */\n upsertEntity<T extends object = Record<string, unknown>>(\n entity: TableEntity<T>,\n updateMode: UpdateMode = \"Merge\",\n ): void {\n this.actions.push([\"upsert\", entity, updateMode]);\n }\n}\n\n/**\n * TableTransaction collects sub-operations that can be submitted together via submitTransaction\n */\nexport class InternalTableTransaction {\n /**\n * Table Account URL\n */\n public url: string;\n /**\n * State that holds the information about a particular transation\n */\n private state: {\n transactionId: string;\n changesetId: string;\n pendingOperations: Promise<any>[];\n bodyParts: string[];\n partitionKey: string;\n };\n private interceptClient: TableClientLike;\n private allowInsecureConnection: boolean;\n private client: ServiceClient;\n\n /**\n * @param url - Tables account url\n * @param partitionKey - partition key\n * @param credential - credential to authenticate the transaction request\n */\n constructor(\n url: string,\n partitionKey: string,\n transactionId: string,\n changesetId: string,\n client: ServiceClient,\n interceptClient: TableClientLike,\n credential?: NamedKeyCredential | SASCredential | TokenCredential,\n allowInsecureConnection: boolean = false,\n ) {\n this.client = client;\n this.url = url;\n this.interceptClient = interceptClient;\n this.allowInsecureConnection = allowInsecureConnection;\n\n // Initialize the state\n this.state = this.initializeState(transactionId, changesetId, partitionKey);\n\n // Depending on the auth method used we need to build the url\n if (!credential) {\n // When the SAS token is provided as part of the URL we need to move it after $batch\n const urlParts = url.split(\"?\");\n this.url = urlParts[0];\n const sas = urlParts.length > 1 ? `?${urlParts[1]}` : \"\";\n this.url = `${this.getUrlWithSlash()}$batch${sas}`;\n } else {\n // When using a SharedKey credential no SAS token is needed\n this.url = `${this.getUrlWithSlash()}$batch`;\n }\n }\n\n private initializeState(transactionId: string, changesetId: string, partitionKey: string) {\n const pendingOperations: Promise<any>[] = [];\n const bodyParts = getInitialTransactionBody(transactionId, changesetId);\n const isCosmos = isCosmosEndpoint(this.url);\n prepateTransactionPipeline(this.interceptClient.pipeline, bodyParts, changesetId, isCosmos);\n\n return {\n transactionId,\n changesetId,\n partitionKey,\n pendingOperations,\n bodyParts,\n };\n }\n\n /**\n * Adds a createEntity operation to the transaction\n * @param entity - Entity to create\n */\n public createEntity<T extends object>(entity: TableEntity<T>): void {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.createEntity(entity));\n }\n\n /**\n * Adds a createEntity operation to the transaction per each entity in the entities array\n * @param entities - Array of entities to create\n */\n public createEntities<T extends object>(entities: TableEntity<T>[]): void {\n for (const entity of entities) {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.createEntity(entity));\n }\n }\n\n /**\n * Adds a deleteEntity operation to the transaction\n * @param partitionKey - Partition key of the entity to delete\n * @param rowKey - Row key of the entity to delete\n * @param options - Options for the delete operation\n */\n public deleteEntity(\n partitionKey: string,\n rowKey: string,\n options?: DeleteTableEntityOptions,\n ): void {\n this.checkPartitionKey(partitionKey);\n this.state.pendingOperations.push(\n this.interceptClient.deleteEntity(partitionKey, rowKey, options),\n );\n }\n\n /**\n * Adds an updateEntity operation to the transaction\n * @param entity - Entity to update\n * @param mode - Update mode (Merge or Replace)\n * @param options - Options for the update operation\n */\n public updateEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode,\n options?: UpdateTableEntityOptions,\n ): void {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.updateEntity(entity, mode, options));\n }\n\n /**\n * Adds an upsertEntity operation to the transaction\n * @param entity - The properties for the table entity.\n * @param mode - The different modes for updating the entity:\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n * @param options - The options parameters.\n */\n public upsertEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode,\n options?: OperationOptions,\n ): void {\n this.checkPartitionKey(entity.partitionKey);\n this.state.pendingOperations.push(this.interceptClient.upsertEntity(entity, mode, options));\n }\n\n /**\n * Submits the operations in the transaction\n */\n public async submitTransaction(): Promise<TableTransactionResponse> {\n await Promise.all(this.state.pendingOperations);\n const body = getTransactionHttpRequestBody(\n this.state.bodyParts,\n this.state.transactionId,\n this.state.changesetId,\n );\n\n const headers = getTransactionHeaders(this.state.transactionId);\n\n return tracingClient.withSpan(\n \"TableTransaction.submitTransaction\",\n {} as OperationOptions,\n async (updatedOptions) => {\n const request = createPipelineRequest({\n url: this.url,\n method: \"POST\",\n body,\n headers: createHttpHeaders(headers),\n tracingOptions: updatedOptions.tracingOptions,\n allowInsecureConnection: this.allowInsecureConnection,\n });\n\n const rawTransactionResponse = await this.client.sendRequest(request);\n return parseTransactionResponse(rawTransactionResponse);\n },\n );\n }\n\n private checkPartitionKey(partitionKey: string): void {\n if (this.state.partitionKey !== partitionKey) {\n throw new Error(\"All operations in a transaction must target the same partitionKey\");\n }\n }\n\n private getUrlWithSlash(): string {\n return this.url.endsWith(\"/\") ? this.url : `${this.url}/`;\n }\n}\n\nexport function parseTransactionResponse(\n transactionResponse: PipelineResponse,\n): TableTransactionResponse {\n const subResponsePrefix = `--changesetresponse_`;\n const status = transactionResponse.status;\n const rawBody = transactionResponse.bodyAsText || \"\";\n const splitBody = rawBody.split(subResponsePrefix);\n const isSuccessByStatus = 200 <= status && status < 300;\n\n if (!isSuccessByStatus) {\n handleBodyError(rawBody, status, transactionResponse.request, transactionResponse);\n }\n\n // Dropping the first and last elements as they are the boundaries\n // we just care about sub request content\n const subResponses = splitBody.slice(1, splitBody.length - 1);\n\n const responses: TableTransactionEntityResponse[] = subResponses.map((subResponse) => {\n const statusMatch = subResponse.match(/HTTP\\/1.1 ([0-9]*)/);\n if (statusMatch?.length !== 2) {\n throw new Error(`Couldn't extract status from sub-response:\\n ${subResponse}`);\n }\n const subResponseStatus = Number.parseInt(statusMatch[1]);\n if (!Number.isInteger(subResponseStatus)) {\n throw new Error(`Expected sub-response status to be an integer ${subResponseStatus}`);\n }\n\n const bodyMatch = subResponse.match(/\\{(.*)\\}/);\n if (bodyMatch?.length === 2) {\n handleBodyError(\n bodyMatch[0],\n subResponseStatus,\n transactionResponse.request,\n transactionResponse,\n );\n }\n\n const etagMatch = subResponse.match(/ETag: (.*)/);\n const rowKeyMatch = subResponse.match(/RowKey='(.*)'/);\n\n return {\n status: subResponseStatus,\n ...(rowKeyMatch?.length === 2 && { rowKey: rowKeyMatch[1] }),\n ...(etagMatch?.length === 2 && { etag: etagMatch[1] }),\n };\n });\n\n return {\n status,\n subResponses: responses,\n getResponseForEntity: (rowKey: string) => responses.find((r) => r.rowKey === rowKey),\n };\n}\n\nfunction handleBodyError(\n bodyAsText: string,\n statusCode: number,\n request: PipelineRequest,\n response: PipelineResponse,\n) {\n let parsedError;\n\n try {\n parsedError = JSON.parse(bodyAsText);\n } catch {\n parsedError = {};\n }\n\n let message = \"Transaction Failed\";\n let code: string | undefined;\n // Only transaction sub-responses return body\n if (parsedError && parsedError[\"odata.error\"]) {\n const error: TableServiceErrorOdataError = parsedError[\"odata.error\"];\n message = error.message?.value ?? message;\n code = error.code;\n }\n\n throw new RestError(message, {\n code,\n statusCode,\n request,\n response,\n });\n}\n\n/**\n * Prepares the transaction pipeline to intercept operations\n * @param pipeline - Client pipeline\n */\nexport function prepateTransactionPipeline(\n pipeline: Pipeline,\n bodyParts: string[],\n changesetId: string,\n isCosmos: boolean,\n): void {\n // Fist, we need to clear all the existing policies to make sure we start\n // with a fresh state.\n const policies = pipeline.getOrderedPolicies();\n for (const policy of policies) {\n pipeline.removePolicy({\n name: policy.name,\n });\n }\n\n // With the clear state we now initialize the pipelines required for intercepting the requests.\n // Use transaction assemble policy to assemble request and intercept request from going to wire\n\n pipeline.addPolicy(serializationPolicy(), { phase: \"Serialize\" });\n pipeline.addPolicy(transactionHeaderFilterPolicy());\n pipeline.addPolicy(transactionRequestAssemblePolicy(bodyParts, changesetId));\n if (isCosmos) {\n pipeline.addPolicy(cosmosPatchPolicy(), {\n afterPolicies: [transactionHeaderFilterPolicyName],\n beforePolicies: [serializationPolicyName, transactionRequestAssemblePolicyName],\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport { TableGetAccessPolicyHeaders, TableInsertEntityHeaders } from \"./generated/models\";\n\n/**\n * Represents the Create or Delete Entity operation to be included in a Transaction request\n */\nexport type CreateDeleteEntityAction = [\"create\" | \"delete\", TableEntity];\n\n/**\n * Represents the Update or Upsert Entity operation to be included in a Transaction request\n */\nexport type UpdateEntityAction =\n | [\"update\" | \"upsert\", TableEntity]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\"]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\", UpdateTableEntityOptions | undefined];\n\n/**\n * Represents the union of all the available transactional actions\n */\nexport type TransactionAction = CreateDeleteEntityAction | UpdateEntityAction;\n\n/**\n * Client options used to configure Tables Api requests\n */\nexport type TableServiceClientOptions = CommonClientOptions & {\n endpoint?: string;\n version?: string;\n};\n\n/**\n * Contains response data for the createEntity operation.\n */\nexport type CreateTableEntityResponse = TableInsertEntityHeaders;\n\n/**\n * Contains response data for the listEntities operation.\n */\nexport type GetTableEntityResponse<T extends object> = TableEntityResult<T>;\n\n/**\n * Optional parameters for DeleteTableEntity operation\n */\nexport type DeleteTableEntityOptions = OperationOptions & {\n /**\n * UTC date/time value generated by the service that indicates the time at which the response was initiated\n */\n etag?: string;\n};\n\n/** The properties for the table item. */\nexport interface TableItem {\n /** The name of the table. */\n name?: string;\n}\n\n/**\n * OData Query options to limit the set of tables returned.\n */\nexport interface TableQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n}\n\n/**\n * OData Query options to limit the set of entities returned.\n */\nexport interface TableEntityQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n /**\n * A select expression limits the properties on each entity to just those requested.\n */\n select?: string[];\n}\n\n/**\n * List tables optional parameters.\n */\nexport type ListTableItemsOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableQueryOptions;\n};\n\n/**\n * Output type for query operations\n */\nexport type TableEntityResult<T> = T & {\n /**\n * etag property. Always returned by the service\n */\n etag: string;\n /**\n * Partition key property. Omitted if a select filter is set and this property is not requested\n */\n partitionKey?: string;\n /**\n * Row key property. Omitted if a select filter is set and this property is not requested\n */\n rowKey?: string;\n /**\n * Timestamp property. This property is assinged by the service on entity creation\n * Omitted if a select filter is set and this property is not requested\n */\n timestamp?: string;\n};\n\n/**\n * Output page type for query operations\n */\nexport type TableEntityResultPage<T> = Array<TableEntityResult<T>> & {\n /**\n * Continuation token to get the next page\n */\n continuationToken?: string;\n};\n\n/**\n * List entities optional parameters.\n */\nexport type ListTableEntitiesOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * GetEntity optional parameters.\n */\nexport type GetTableEntityOptions = OperationOptions & {\n /**\n * Parameter group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * Update entity optional parameters.\n */\nexport type UpdateTableEntityOptions = OperationOptions & {\n /**\n * Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update, set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a replace will be performed if an existing entity is found.\n */\n etag?: string;\n};\n\n/**\n * A set of key-value pairs representing the table entity.\n */\nexport type TableEntity<T extends object = Record<string, unknown>> = T & {\n /**\n * The PartitionKey property of the entity.\n */\n partitionKey: string;\n /**\n * The RowKey property of the entity.\n */\n rowKey: string;\n};\n\n/**\n * Supported EDM Types by Azure Tables.\n */\nexport type EdmTypes =\n | \"Binary\"\n | \"Boolean\"\n | \"DateTime\"\n | \"Double\"\n | \"Guid\"\n | \"Int32\"\n | \"Int64\"\n | \"String\";\n\n/**\n * Entity Data Model representation for an entity property.\n */\nexport interface Edm<T extends EdmTypes> {\n /**\n * The value of the entity property\n */\n value: T extends \"Binary\"\n ? string\n : T extends \"Boolean\"\n
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport { TableGetAccessPolicyHeaders, TableInsertEntityHeaders } from \"./generated/models\";\n\n/**\n * Represents the Create or Delete Entity operation to be included in a Transaction request\n */\nexport type CreateDeleteEntityAction = [\"create\" | \"delete\", TableEntity];\n\n/**\n * Represents the Update or Upsert Entity operation to be included in a Transaction request\n */\nexport type UpdateEntityAction =\n | [\"update\" | \"upsert\", TableEntity]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\"]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\", UpdateTableEntityOptions | undefined];\n\n/**\n * Represents the union of all the available transactional actions\n */\nexport type TransactionAction = CreateDeleteEntityAction | UpdateEntityAction;\n\n/**\n * Client options used to configure Tables Api requests\n */\nexport type TableServiceClientOptions = CommonClientOptions & {\n endpoint?: string;\n version?: string;\n};\n\n/**\n * Contains response data for the createEntity operation.\n */\nexport type CreateTableEntityResponse = TableInsertEntityHeaders;\n\n/**\n * Contains response data for the listEntities operation.\n */\nexport type GetTableEntityResponse<T extends object> = TableEntityResult<T>;\n\n/**\n * Optional parameters for DeleteTableEntity operation\n */\nexport type DeleteTableEntityOptions = OperationOptions & {\n /**\n * UTC date/time value generated by the service that indicates the time at which the response was initiated\n */\n etag?: string;\n};\n\n/** The properties for the table item. */\nexport interface TableItem {\n /** The name of the table. */\n name?: string;\n}\n\n/**\n * OData Query options to limit the set of tables returned.\n */\nexport interface TableQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n}\n\n/**\n * OData Query options to limit the set of entities returned.\n */\nexport interface TableEntityQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n /**\n * A select expression limits the properties on each entity to just those requested.\n */\n select?: string[];\n}\n\n/**\n * List tables optional parameters.\n */\nexport type ListTableItemsOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableQueryOptions;\n};\n\n/**\n * Output type for query operations\n */\nexport type TableEntityResult<T> = T & {\n /**\n * etag property. Always returned by the service\n */\n etag: string;\n /**\n * Partition key property. Omitted if a select filter is set and this property is not requested\n */\n partitionKey?: string;\n /**\n * Row key property. Omitted if a select filter is set and this property is not requested\n */\n rowKey?: string;\n /**\n * Timestamp property. This property is assinged by the service on entity creation\n * Omitted if a select filter is set and this property is not requested\n */\n timestamp?: string;\n};\n\n/**\n * Output page type for query operations\n */\nexport type TableEntityResultPage<T> = Array<TableEntityResult<T>> & {\n /**\n * Continuation token to get the next page\n */\n continuationToken?: string;\n};\n\n/**\n * List entities optional parameters.\n */\nexport type ListTableEntitiesOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * GetEntity optional parameters.\n */\nexport type GetTableEntityOptions = OperationOptions & {\n /**\n * Parameter group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * Update entity optional parameters.\n */\nexport type UpdateTableEntityOptions = OperationOptions & {\n /**\n * Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update, set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a replace will be performed if an existing entity is found.\n */\n etag?: string;\n};\n\n/**\n * A set of key-value pairs representing the table entity.\n */\nexport type TableEntity<T extends object = Record<string, unknown>> = T & {\n /**\n * The PartitionKey property of the entity.\n */\n partitionKey: string;\n /**\n * The RowKey property of the entity.\n */\n rowKey: string;\n};\n\n/**\n * Supported EDM Types by Azure Tables.\n */\nexport type EdmTypes =\n | \"Binary\"\n | \"Boolean\"\n | \"DateTime\"\n | \"Double\"\n | \"Guid\"\n | \"Int32\"\n | \"Int64\"\n | \"String\";\n\n/**\n * Entity Data Model representation for an entity property.\n */\nexport interface Edm<T extends EdmTypes> {\n /**\n * The value of the entity property\n */\n value: T extends \"Binary\"\n ? string\n : T extends \"Boolean\"\n ? boolean\n : T extends \"Double\"\n ? number\n : T extends \"Int32\"\n ? number\n : string;\n /**\n * The type of the entity property\n */\n type: T;\n}\n\n/**\n * The different modes for Update and Upsert methods\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n */\nexport type UpdateMode = \"Merge\" | \"Replace\";\n\n/**\n * Represents the response of a Transaction operation\n */\nexport interface TableTransactionResponse {\n /**\n * Collection of sub responses\n */\n subResponses: TableTransactionEntityResponse[];\n /**\n * Main Transaction request status code\n */\n status: number;\n /**\n * Gets a specific response given a row key\n */\n getResponseForEntity: (rowKey: string) => TableTransactionEntityResponse | undefined;\n}\n\n/** The properties for the table query response. */\nexport interface TableQueryResponse {\n /** List of tables. */\n value?: TableItem[];\n}\n\n/**\n * Output page type for table query operations\n */\nexport interface TableItemResultPage extends Array<TableItem> {\n /**\n * Continuation token to get the next TableItem page\n */\n continuationToken?: string;\n}\n\n/**\n * Represents a sub-response of a Transaction operation\n */\nexport interface TableTransactionEntityResponse {\n /**\n * Entity's etag\n */\n etag?: string;\n /**\n * Entity's rowKey\n */\n rowKey?: string;\n /**\n * Sub-response status\n */\n status: number;\n}\n\n/** A signed identifier. */\nexport interface SignedIdentifier {\n /** A unique id. */\n id: string;\n /** The access policy. */\n accessPolicy?: AccessPolicy;\n}\n\n/** An Access policy. */\nexport interface AccessPolicy {\n /** The start datetime from which the policy is active. */\n start?: Date;\n /** The datetime that the policy expires. */\n expiry?: Date;\n /** The permissions for the acl policy. */\n permission?: string;\n}\n\n/** Contains response data for the getAccessPolicy operation. */\nexport type GetAccessPolicyResponse = TableGetAccessPolicyHeaders & SignedIdentifier[];\n"]}
|
|
@@ -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E,KAAK,CAAC;YACjE,CAAC,CAAC,EAAE;QACN,oBAAoB,CAAC,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC;QAChE,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3F,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAC5E,OAAO;QACP,EAAE,EAAE,uDAAuD;KAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAW,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1E,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;QACzC,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,mBAAmB;QAClC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,SAAS,EAAE,yBAAyB,CAAC,SAAS;QAC9C,OAAO,EAAE,yBAAyB,CAAC,OAAO;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccountSasPermissions, accountSasPermissionsToString } from \"./accountSasPermissions\";\nimport { SasIPRange, ipRangeToString } from \"./sasIPRange\";\nimport { SasProtocol, SasQueryParameters } from \"./sasQueryParameters\";\nimport {\n accountSasResourceTypesFromString,\n accountSasResourceTypesToString,\n} from \"./accountSasResourceTypes\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once\n * all the values here are set appropriately, call {@link generateAccountSasQueryParameters} to obtain a representation\n * of the SAS which can actually be applied to table urls. Note: that both this class and {@link SasQueryParameters}\n * exist because the former is mutable and a logical representation while the latter is immutable and used to generate\n * actual REST requests.\n *\n * @see https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n * for descriptions of the parameters, including which are required\n */\nexport interface AccountSasSignatureValues {\n /**\n * If not provided, this defaults to the service version targeted by this version of the library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * The time after which the SAS will no longer work.\n */\n expiresOn: Date;\n\n /**\n * Specifies which operations the SAS user may perform. Please refer to {@link AccountSasPermissions} for help\n * constructing the permissions string.\n */\n permissions: AccountSasPermissions;\n\n /**\n * Optional. IP range allowed.\n */\n ipRange?: SasIPRange;\n\n /**\n * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSasServices} to\n * construct this value.\n */\n services: string;\n\n /**\n * The values that indicate the resource types accessible with this SAS. Please refer\n * to {@link AccountSasResourceTypes} to construct this value.\n */\n resourceTypes: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual\n * REST request.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n * @param accountSasSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateAccountSasQueryParameters(\n accountSasSignatureValues: AccountSasSignatureValues,\n credential: NamedKeyCredential
|
|
1
|
+
{"version":3,"file":"accountSasSignatureValues.js","sourceRoot":"","sources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,CAAC,SAAS,EAAE,KAAK,CAAC;QAChE,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3F,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAC5E,OAAO;QACP,EAAE,EAAE,uDAAuD;KAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAW,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1E,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;QACzC,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,mBAAmB;QAClC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,SAAS,EAAE,yBAAyB,CAAC,SAAS;QAC9C,OAAO,EAAE,yBAAyB,CAAC,OAAO;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccountSasPermissions, accountSasPermissionsToString } from \"./accountSasPermissions\";\nimport { SasIPRange, ipRangeToString } from \"./sasIPRange\";\nimport { SasProtocol, SasQueryParameters } from \"./sasQueryParameters\";\nimport {\n accountSasResourceTypesFromString,\n accountSasResourceTypesToString,\n} from \"./accountSasResourceTypes\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once\n * all the values here are set appropriately, call {@link generateAccountSasQueryParameters} to obtain a representation\n * of the SAS which can actually be applied to table urls. Note: that both this class and {@link SasQueryParameters}\n * exist because the former is mutable and a logical representation while the latter is immutable and used to generate\n * actual REST requests.\n *\n * @see https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n * for descriptions of the parameters, including which are required\n */\nexport interface AccountSasSignatureValues {\n /**\n * If not provided, this defaults to the service version targeted by this version of the library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * The time after which the SAS will no longer work.\n */\n expiresOn: Date;\n\n /**\n * Specifies which operations the SAS user may perform. Please refer to {@link AccountSasPermissions} for help\n * constructing the permissions string.\n */\n permissions: AccountSasPermissions;\n\n /**\n * Optional. IP range allowed.\n */\n ipRange?: SasIPRange;\n\n /**\n * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSasServices} to\n * construct this value.\n */\n services: string;\n\n /**\n * The values that indicate the resource types accessible with this SAS. Please refer\n * to {@link AccountSasResourceTypes} to construct this value.\n */\n resourceTypes: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual\n * REST request.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n * @param accountSasSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateAccountSasQueryParameters(\n accountSasSignatureValues: AccountSasSignatureValues,\n credential: NamedKeyCredential,\n): SasQueryParameters {\n const version = accountSasSignatureValues.version\n ? accountSasSignatureValues.version\n : SERVICE_VERSION;\n\n const parsedPermissions = accountSasPermissionsToString(accountSasSignatureValues.permissions);\n const parsedServices = accountSasServicesToString(\n accountSasServicesFromString(accountSasSignatureValues.services),\n );\n // to and from string to guarantee the correct order of resoruce types is generated\n const parsedResourceTypes = accountSasResourceTypesToString(\n accountSasResourceTypesFromString(accountSasSignatureValues.resourceTypes),\n );\n\n const stringToSign = [\n credential.name,\n parsedPermissions,\n parsedServices,\n parsedResourceTypes,\n accountSasSignatureValues.startsOn\n ? truncatedISO8061Date(accountSasSignatureValues.startsOn, false)\n : \"\",\n truncatedISO8061Date(accountSasSignatureValues.expiresOn, false),\n accountSasSignatureValues.ipRange ? ipRangeToString(accountSasSignatureValues.ipRange) : \"\",\n accountSasSignatureValues.protocol ? accountSasSignatureValues.protocol : \"\",\n version,\n \"\", // Account SAS requires an additional newline character\n ].join(\"\\n\");\n\n const signature: string = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: parsedPermissions.toString(),\n services: parsedServices,\n resourceTypes: parsedResourceTypes,\n protocol: accountSasSignatureValues.protocol,\n startsOn: accountSasSignatureValues.startsOn,\n expiresOn: accountSasSignatureValues.expiresOn,\n ipRange: accountSasSignatureValues.ipRange,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateAccountSas.js","sourceRoot":"","sources":["../../../src/sas/generateAccountSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAyB,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAEL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,UAA6B,EAAE;IAE/B,MAAM,EACJ,SAAS,EACT,WAAW,GAAG,+BAA+B,CAAC,IAAI,CAAC,EACnD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,KAE1C,OAAO,EADN,IAAI,UACL,OAAO,EANL,yDAML,CAAU,CAAC;IACZ,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE;QACrC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;KACH;IAED,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;KAChD;IAED,MAAM,GAAG,GAAG,iCAAiC,iBAEzC,WAAW,EACX,SAAS,EAAE,MAAM,EACjB,aAAa,EACb,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC,IAC3C,IAAI,GAET,UAAU,CACX,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccountSasPermissions, accountSasPermissionsFromString } from \"./accountSasPermissions\";\nimport {\n AccountSasServices,\n accountSasServicesFromString,\n accountSasServicesToString,\n} from \"./accountSasServices\";\nimport { NamedKeyCredential, isNamedKeyCredential } from \"@azure/core-auth\";\nimport { SasIPRange } from \"./sasIPRange\";\nimport { SasProtocol } from \"./sasQueryParameters\";\nimport { generateAccountSasQueryParameters } from \"./accountSasSignatureValues\";\n\n/**\n * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas\n *\n * @param options - Optional parameters.\n * @returns An account SAS token\n */\nexport function generateAccountSas(\n credential: NamedKeyCredential,\n options: AccountSasOptions = {}
|
|
1
|
+
{"version":3,"file":"generateAccountSas.js","sourceRoot":"","sources":["../../../src/sas/generateAccountSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAyB,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAEL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,UAA6B,EAAE;IAE/B,MAAM,EACJ,SAAS,EACT,WAAW,GAAG,+BAA+B,CAAC,IAAI,CAAC,EACnD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,KAE1C,OAAO,EADN,IAAI,UACL,OAAO,EANL,yDAML,CAAU,CAAC;IACZ,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE;QACrC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;KACH;IAED,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;KAChD;IAED,MAAM,GAAG,GAAG,iCAAiC,iBAEzC,WAAW,EACX,SAAS,EAAE,MAAM,EACjB,aAAa,EACb,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC,IAC3C,IAAI,GAET,UAAU,CACX,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccountSasPermissions, accountSasPermissionsFromString } from \"./accountSasPermissions\";\nimport {\n AccountSasServices,\n accountSasServicesFromString,\n accountSasServicesToString,\n} from \"./accountSasServices\";\nimport { NamedKeyCredential, isNamedKeyCredential } from \"@azure/core-auth\";\nimport { SasIPRange } from \"./sasIPRange\";\nimport { SasProtocol } from \"./sasQueryParameters\";\nimport { generateAccountSasQueryParameters } from \"./accountSasSignatureValues\";\n\n/**\n * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas\n *\n * @param options - Optional parameters.\n * @returns An account SAS token\n */\nexport function generateAccountSas(\n credential: NamedKeyCredential,\n options: AccountSasOptions = {},\n): string {\n const {\n expiresOn,\n permissions = accountSasPermissionsFromString(\"rl\"),\n resourceTypes = \"sco\",\n services = accountSasServicesFromString(\"t\"),\n ...rest\n } = options;\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n let expiry = expiresOn;\n\n if (expiry === undefined) {\n const now = new Date();\n expiry = new Date(now.getTime() + 3600 * 1000);\n }\n\n const sas = generateAccountSasQueryParameters(\n {\n permissions,\n expiresOn: expiry,\n resourceTypes,\n services: accountSasServicesToString(services),\n ...rest,\n },\n credential,\n ).toString();\n\n return sas;\n}\n\n/**\n * Options to configure {@link generateAccountSas} operation.\n */\nexport interface AccountSasOptions {\n /**\n * The time at which the shared access signature becomes invalid. Default to an hour later if not provided.\n */\n expiresOn?: Date;\n /**\n * Specifies the list of permissions to be associated with the SAS.\n */\n permissions?: AccountSasPermissions;\n /**\n * Specifies the resource types associated with the shared access signature.\n */\n resourceTypes?: string;\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * When the SAS will take effect.\n */\n startsOn?: Date;\n /**\n * IP range allowed.\n */\n ipRange?: SasIPRange;\n /**\n * Account services\n */\n services?: AccountSasServices;\n}\n"]}
|