@azure/data-tables 12.1.3-alpha.20211015.2 → 12.2.0-alpha.20211027.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/CHANGELOG.md +6 -1
- package/README.md +32 -0
- package/dist/index.js +74 -26
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js +25 -21
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/serialization.js +15 -2
- package/dist-esm/src/serialization.js.map +1 -1
- package/dist-esm/src/utils/bufferSerializer.browser.js +8 -3
- package/dist-esm/src/utils/bufferSerializer.browser.js.map +1 -1
- package/dist-esm/src/utils/bufferSerializer.js +8 -3
- package/dist-esm/src/utils/bufferSerializer.js.map +1 -1
- package/dist-esm/src/utils/continuationToken.js +29 -0
- package/dist-esm/src/utils/continuationToken.js.map +1 -0
- package/dist-esm/src/utils/internalModels.js.map +1 -1
- package/package.json +1 -1
- package/types/3.1/data-tables.d.ts +10 -2
- package/types/latest/data-tables.d.ts +11 -2
- package/types/latest/tsdoc-metadata.json +1 -1
|
@@ -6,7 +6,7 @@ import { isNamedKeyCredential, isSASCredential, isTokenCredential } from "@azure
|
|
|
6
6
|
import { tablesNamedKeyCredentialPolicy } from "./tablesNamedCredentialPolicy";
|
|
7
7
|
import "@azure/core-paging";
|
|
8
8
|
import { GeneratedClient } from "./generated";
|
|
9
|
-
import { deserialize, deserializeObjectsArray, deserializeSignedIdentifier, serialize, serializeSignedIdentifiers } from "./serialization";
|
|
9
|
+
import { deserialize, deserializeObjectsArray, deserializeSignedIdentifier, serialize, serializeQueryOptions, serializeSignedIdentifiers } from "./serialization";
|
|
10
10
|
import { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from "./utils/constants";
|
|
11
11
|
import { logger } from "./logger";
|
|
12
12
|
import { createSpan } from "./utils/tracing";
|
|
@@ -18,6 +18,7 @@ import { isCredential } from "./utils/isCredential";
|
|
|
18
18
|
import { tablesSASTokenPolicy } from "./tablesSASTokenPolicy";
|
|
19
19
|
import { isCosmosEndpoint } from "./utils/isCosmosEndpoint";
|
|
20
20
|
import { cosmosPatchPolicy } from "./cosmosPathPolicy";
|
|
21
|
+
import { decodeContinuationToken, encodeContinuationToken } from "./utils/continuationToken";
|
|
21
22
|
/**
|
|
22
23
|
* A TableClient represents a Client to the Azure Tables service allowing you
|
|
23
24
|
* to perform operations on a single table.
|
|
@@ -183,7 +184,7 @@ export class TableClient {
|
|
|
183
184
|
}
|
|
184
185
|
try {
|
|
185
186
|
const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = __rest(_a, ["disableTypeConversion", "queryOptions"]);
|
|
186
|
-
await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, partitionKey, rowKey, Object.assign(Object.assign({}, getEntityOptions), { queryOptions:
|
|
187
|
+
await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, partitionKey, rowKey, Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
|
|
187
188
|
const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
|
|
188
189
|
return tableEntity;
|
|
189
190
|
}
|
|
@@ -239,6 +240,9 @@ export class TableClient {
|
|
|
239
240
|
},
|
|
240
241
|
byPage: (settings) => {
|
|
241
242
|
const pageOptions = Object.assign(Object.assign({}, options), { queryOptions: Object.assign(Object.assign({}, options.queryOptions), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize }) });
|
|
243
|
+
if (settings === null || settings === void 0 ? void 0 : settings.continuationToken) {
|
|
244
|
+
pageOptions.continuationToken = settings.continuationToken;
|
|
245
|
+
}
|
|
242
246
|
return this.listEntitiesPage(tableName, pageOptions);
|
|
243
247
|
}
|
|
244
248
|
};
|
|
@@ -247,11 +251,9 @@ export class TableClient {
|
|
|
247
251
|
return __asyncGenerator(this, arguments, function* listEntitiesAll_1() {
|
|
248
252
|
var e_1, _a;
|
|
249
253
|
const firstPage = yield __await(this._listEntities(tableName, options));
|
|
250
|
-
const { nextPartitionKey, nextRowKey } = firstPage;
|
|
251
254
|
yield __await(yield* __asyncDelegator(__asyncValues(firstPage)));
|
|
252
|
-
if (
|
|
253
|
-
const optionsWithContinuation = Object.assign(Object.assign({}, options), {
|
|
254
|
-
nextRowKey });
|
|
255
|
+
if (firstPage.continuationToken) {
|
|
256
|
+
const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: firstPage.continuationToken });
|
|
255
257
|
try {
|
|
256
258
|
for (var _b = __asyncValues(this.listEntitiesPage(tableName, optionsWithContinuation)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
257
259
|
const page = _c.value;
|
|
@@ -274,8 +276,8 @@ export class TableClient {
|
|
|
274
276
|
try {
|
|
275
277
|
let result = yield __await(this._listEntities(tableName, updatedOptions));
|
|
276
278
|
yield yield __await(result);
|
|
277
|
-
while (result.
|
|
278
|
-
const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), {
|
|
279
|
+
while (result.continuationToken) {
|
|
280
|
+
const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
|
|
279
281
|
result = yield __await(this._listEntities(tableName, optionsWithContinuation));
|
|
280
282
|
yield yield __await(result);
|
|
281
283
|
}
|
|
@@ -294,13 +296,23 @@ export class TableClient {
|
|
|
294
296
|
}
|
|
295
297
|
async _listEntities(tableName, options = {}) {
|
|
296
298
|
const { disableTypeConversion = false } = options;
|
|
297
|
-
const queryOptions =
|
|
298
|
-
const
|
|
299
|
+
const queryOptions = serializeQueryOptions(options.queryOptions || {});
|
|
300
|
+
const listEntitiesOptions = Object.assign(Object.assign({}, options), { queryOptions });
|
|
301
|
+
// If a continuation token is used, decode it and set the next row and partition key
|
|
302
|
+
if (options.continuationToken) {
|
|
303
|
+
const continuationToken = decodeContinuationToken(options.continuationToken);
|
|
304
|
+
listEntitiesOptions.nextRowKey = continuationToken.nextRowKey;
|
|
305
|
+
listEntitiesOptions.nextPartitionKey = continuationToken.nextPartitionKey;
|
|
306
|
+
}
|
|
307
|
+
const { xMsContinuationNextPartitionKey: nextPartitionKey, xMsContinuationNextRowKey: nextRowKey, value } = await this.table.queryEntities(tableName, listEntitiesOptions);
|
|
299
308
|
const tableEntities = deserializeObjectsArray(value !== null && value !== void 0 ? value : [], disableTypeConversion);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
309
|
+
// Encode nextPartitionKey and nextRowKey as a single continuation token and add it as a
|
|
310
|
+
// property to the page.
|
|
311
|
+
const continuationToken = encodeContinuationToken(nextPartitionKey, nextRowKey);
|
|
312
|
+
const page = Object.assign([...tableEntities], {
|
|
313
|
+
continuationToken
|
|
303
314
|
});
|
|
315
|
+
return page;
|
|
304
316
|
}
|
|
305
317
|
/**
|
|
306
318
|
* Insert entity in the table.
|
|
@@ -609,14 +621,6 @@ export class TableClient {
|
|
|
609
621
|
}
|
|
610
622
|
return this.transactionClient.submitTransaction();
|
|
611
623
|
}
|
|
612
|
-
convertQueryOptions(query) {
|
|
613
|
-
const { select } = query, queryOptions = __rest(query, ["select"]);
|
|
614
|
-
const mappedQuery = Object.assign({}, queryOptions);
|
|
615
|
-
if (select) {
|
|
616
|
-
mappedQuery.select = select.join(",");
|
|
617
|
-
}
|
|
618
|
-
return mappedQuery;
|
|
619
|
-
}
|
|
620
624
|
/**
|
|
621
625
|
*
|
|
622
626
|
* Creates an instance of TableClient from connection string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableClient.js","sourceRoot":"","sources":["../../src/TableClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AA0BlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,eA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AAW,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 {\n TableEntity,\n ListTableEntitiesOptions,\n GetTableEntityResponse,\n UpdateTableEntityOptions,\n DeleteTableEntityOptions,\n GetTableEntityOptions,\n UpdateMode,\n CreateTableEntityResponse,\n TableEntityQueryOptions,\n TableServiceClientOptions as TableClientOptions,\n TableEntityResult,\n TransactionAction,\n TableTransactionResponse,\n SignedIdentifier,\n GetAccessPolicyResponse\n} from \"./models\";\nimport {\n UpdateEntityResponse,\n UpsertEntityResponse,\n DeleteTableEntityResponse,\n SetAccessPolicyResponse\n} from \"./generatedModels\";\nimport { QueryOptions as GeneratedQueryOptions } from \"./generated/models\";\nimport { getClientParamsFromConnectionString } from \"./utils/connectionString\";\nimport {\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n NamedKeyCredential,\n SASCredential,\n TokenCredential\n} from \"@azure/core-auth\";\nimport { tablesNamedKeyCredentialPolicy } from \"./tablesNamedCredentialPolicy\";\nimport \"@azure/core-paging\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { GeneratedClient, TableDeleteEntityOptionalParams } from \"./generated\";\nimport {\n deserialize,\n deserializeObjectsArray,\n deserializeSignedIdentifier,\n serialize,\n serializeSignedIdentifiers\n} from \"./serialization\";\nimport { Table } from \"./generated/operationsInterfaces\";\nimport { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from \"./utils/constants\";\nimport {\n FullOperationResponse,\n InternalClientPipelineOptions,\n OperationOptions\n} from \"@azure/core-client\";\nimport { logger } from \"./logger\";\nimport { createSpan } from \"./utils/tracing\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { InternalTableTransaction } from \"./TableTransaction\";\nimport { ListEntitiesResponse } from \"./utils/internalModels\";\nimport { Uuid } from \"./utils/uuid\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { isCredential } from \"./utils/isCredential\";\nimport { tablesSASTokenPolicy } from \"./tablesSASTokenPolicy\";\nimport { isCosmosEndpoint } from \"./utils/isCosmosEndpoint\";\nimport { cosmosPatchPolicy } from \"./cosmosPathPolicy\";\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 credential?: NamedKeyCredential | SASCredential | TokenCredential;\n private transactionClient?: InternalTableTransaction;\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 const clientOptions =\n (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};\n\n this.allowInsecureConnection = clientOptions.allowInsecureConnection ?? false;\n clientOptions.endpoint = clientOptions.endpoint || this.url;\n\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...clientOptions,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames]\n },\n deserializationOptions: {\n parseXML\n },\n serializationOptions: {\n stringifyXML\n },\n ...(isTokenCredential(this.credential) && {\n credential: this.credential,\n credentialScopes: STORAGE_SCOPE\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 (isCosmosEndpoint(this.url)) {\n generatedClient.pipeline.addPolicy(cosmosPatchPolicy());\n }\n\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 async deleteTable(options: OperationOptions = {}): Promise<void> {\n const { span, updatedOptions } = createSpan(\"TableClient-deleteTable\", options);\n try {\n await this.table.delete(this.tableName, updatedOptions);\n } catch (e) {\n if (e.statusCode === 404) {\n logger.info(\"TableClient-deleteTable: Table doesn't exist\");\n } else {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n }\n } finally {\n span.end();\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 fail.\n * await client.createTable();\n * ```\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n public async createTable(options: OperationOptions = {}): Promise<void> {\n const { span, updatedOptions } = createSpan(\"TableClient-createTable\", options);\n try {\n await this.table.create({ name: this.tableName }, updatedOptions);\n } catch (e) {\n if (e.statusCode === 409) {\n logger.info(\"TableClient-createTable: Table Already Exists\");\n } else {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n }\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(\"TableClient-getEntity\", options);\n\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\n try {\n const { disableTypeConversion, queryOptions, ...getEntityOptions } = updatedOptions || {};\n await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, partitionKey, rowKey, {\n ...getEntityOptions,\n queryOptions: this.convertQueryOptions(queryOptions || {}),\n onResponse\n });\n const tableEntity = deserialize<TableEntityResult<T>>(\n parsedBody,\n disableTypeConversion ?? false\n );\n\n return tableEntity;\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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>, TableEntityResult<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 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 const { nextPartitionKey, nextRowKey } = firstPage;\n yield* firstPage;\n if (nextRowKey && nextPartitionKey) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...options,\n nextPartitionKey,\n nextRowKey\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 const { span, updatedOptions } = createSpan(\"TableClient-listEntitiesPage\", options);\n\n try {\n let result = await this._listEntities<T>(tableName, updatedOptions);\n\n yield result;\n\n while (result.nextPartitionKey && result.nextRowKey) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...updatedOptions,\n nextPartitionKey: result.nextPartitionKey,\n nextRowKey: result.nextRowKey\n };\n result = await this._listEntities(tableName, optionsWithContinuation);\n\n yield result;\n }\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private async _listEntities<T extends object>(\n tableName: string,\n options: InternalListTableEntitiesOptions = {}\n ): Promise<ListEntitiesResponse<TableEntityResult<T>>> {\n const { disableTypeConversion = false } = options;\n const queryOptions = this.convertQueryOptions(options.queryOptions || {});\n const {\n xMsContinuationNextPartitionKey: nextPartitionKey,\n xMsContinuationNextRowKey: nextRowKey,\n value\n } = await this.table.queryEntities(tableName, {\n ...options,\n queryOptions\n });\n\n const tableEntities = deserializeObjectsArray<TableEntityResult<T>>(\n value ?? [],\n disableTypeConversion\n );\n\n return Object.assign([...tableEntities], {\n nextPartitionKey,\n nextRowKey\n });\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 async 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 const { span, updatedOptions } = createSpan(\"TableClient-createEntity\", options);\n\n try {\n const { ...createTableEntity } = updatedOptions || {};\n return await this.table.insertEntity(this.tableName, {\n ...createTableEntity,\n tableEntityProperties: serialize(entity),\n responsePreference: \"return-no-content\"\n });\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(\"TableClient-deleteEntity\", options);\n\n try {\n const { etag = \"*\", ...rest } = updatedOptions || {};\n const deleteOptions: TableDeleteEntityOptionalParams = {\n ...rest\n };\n return await this.table.deleteEntity(\n this.tableName,\n partitionKey,\n rowKey,\n etag,\n deleteOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);\n\n try {\n if (!entity.partitionKey || !entity.rowKey) {\n throw new Error(\"partitionKey and rowKey must be defined\");\n }\n\n const { etag = \"*\", ...updateEntityOptions } = updatedOptions || {};\n if (mode === \"Merge\") {\n return await this.table.mergeEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions\n });\n }\n if (mode === \"Replace\") {\n return await this.table.updateEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions\n });\n }\n\n throw new Error(`Unexpected value for update mode: ${mode}`);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);\n\n try {\n if (!entity.partitionKey || !entity.rowKey) {\n throw new Error(\"partitionKey and rowKey must be defined\");\n }\n\n if (mode === \"Merge\") {\n return await this.table.mergeEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions\n });\n }\n\n if (mode === \"Replace\") {\n return await this.table.updateEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions\n });\n }\n throw new Error(`Unexpected value for update mode: ${mode}`);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async getAccessPolicy(options: OperationOptions = {}): Promise<GetAccessPolicyResponse> {\n const { span, updatedOptions } = createSpan(\"TableClient-getAccessPolicy\", options);\n try {\n const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);\n return deserializeSignedIdentifier(signedIdentifiers);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async setAccessPolicy(\n tableAcl: SignedIdentifier[],\n options: OperationOptions = {}\n ): Promise<SetAccessPolicyResponse> {\n const { span, updatedOptions } = createSpan(\"TableClient-setAccessPolicy\", options);\n try {\n const serlializedAcl = serializeSignedIdentifiers(tableAcl);\n return await this.table.setAccessPolicy(this.tableName, {\n ...updatedOptions,\n tableAcl: serlializedAcl\n });\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 if (!this.transactionClient) {\n // Add pipeline\n this.transactionClient = new InternalTableTransaction(\n this.url,\n partitionKey,\n transactionId,\n changesetId,\n new TableClient(this.url, this.tableName),\n this.credential,\n this.allowInsecureConnection\n );\n } else {\n this.transactionClient.reset(transactionId, changesetId, partitionKey);\n }\n\n for (const item of actions) {\n const [action, entity, updateMode = \"Merge\"] = item;\n switch (action) {\n case \"create\":\n this.transactionClient.createEntity(entity);\n break;\n case \"delete\":\n this.transactionClient.deleteEntity(entity.partitionKey, entity.rowKey);\n break;\n case \"update\":\n this.transactionClient.updateEntity(entity, updateMode);\n break;\n case \"upsert\":\n this.transactionClient.upsertEntity(entity, updateMode);\n }\n }\n\n return this.transactionClient.submitTransaction();\n }\n\n private convertQueryOptions(query: TableEntityQueryOptions): GeneratedQueryOptions {\n const { select, ...queryOptions } = query;\n const mappedQuery: GeneratedQueryOptions = { ...queryOptions };\n if (select) {\n mappedQuery.select = select.join(\",\");\n }\n return mappedQuery;\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 { url, options: clientOptions, credential } = getClientParamsFromConnectionString(\n connectionString,\n options\n );\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 nextPartitionKey?: string;\n /**\n * An entity query continuation token from a previous call.\n */\n nextRowKey?: 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
|
+
{"version":3,"file":"TableClient.js","sourceRoot":"","sources":["../../src/TableClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AA2BlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EAIlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAmC,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,2BAA2B,EAC3B,SAAS,EACT,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAMnF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,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C,YAAY,CAAC,MAAM,CAAC,CAAC;oBAC5C,MAAM;gBACR,KAAK,QAAQ;oBACX,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;oBACxE,MAAM;gBACR,KAAK,QAAQ;oBACX,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;oBACxD,MAAM;gBACR,KAAK,QAAQ;oBACX,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;aAC3D;SACF;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;IACpD,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,oBAAoB,CAChC,gBAAwB,EACxB,SAAiB;IACjB,8DAA8D;IAC9D,OAA4B;QAE5B,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,mCAAmC,CACrF,gBAAgB,EAChB,OAAO,CACR,CAAC;QACF,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 {\n TableEntity,\n ListTableEntitiesOptions,\n GetTableEntityResponse,\n UpdateTableEntityOptions,\n DeleteTableEntityOptions,\n GetTableEntityOptions,\n UpdateMode,\n CreateTableEntityResponse,\n TableEntityQueryOptions,\n TableServiceClientOptions as TableClientOptions,\n TableEntityResult,\n TransactionAction,\n TableTransactionResponse,\n SignedIdentifier,\n GetAccessPolicyResponse,\n TableEntityResultPage\n} from \"./models\";\nimport {\n UpdateEntityResponse,\n UpsertEntityResponse,\n DeleteTableEntityResponse,\n SetAccessPolicyResponse\n} from \"./generatedModels\";\nimport { TableQueryEntitiesOptionalParams } from \"./generated/models\";\nimport { getClientParamsFromConnectionString } from \"./utils/connectionString\";\nimport {\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n NamedKeyCredential,\n SASCredential,\n TokenCredential\n} from \"@azure/core-auth\";\nimport { tablesNamedKeyCredentialPolicy } from \"./tablesNamedCredentialPolicy\";\nimport \"@azure/core-paging\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { GeneratedClient, TableDeleteEntityOptionalParams } from \"./generated\";\nimport {\n deserialize,\n deserializeObjectsArray,\n deserializeSignedIdentifier,\n serialize,\n serializeQueryOptions,\n serializeSignedIdentifiers\n} from \"./serialization\";\nimport { Table } from \"./generated/operationsInterfaces\";\nimport { STORAGE_SCOPE, TablesLoggingAllowedHeaderNames } from \"./utils/constants\";\nimport {\n FullOperationResponse,\n InternalClientPipelineOptions,\n OperationOptions\n} from \"@azure/core-client\";\nimport { logger } from \"./logger\";\nimport { createSpan } from \"./utils/tracing\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { InternalTableTransaction } from \"./TableTransaction\";\nimport { ListEntitiesResponse } from \"./utils/internalModels\";\nimport { Uuid } from \"./utils/uuid\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { isCredential } from \"./utils/isCredential\";\nimport { tablesSASTokenPolicy } from \"./tablesSASTokenPolicy\";\nimport { isCosmosEndpoint } from \"./utils/isCosmosEndpoint\";\nimport { cosmosPatchPolicy } from \"./cosmosPathPolicy\";\nimport { decodeContinuationToken, encodeContinuationToken } from \"./utils/continuationToken\";\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 credential?: NamedKeyCredential | SASCredential | TokenCredential;\n private transactionClient?: InternalTableTransaction;\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 const clientOptions =\n (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};\n\n this.allowInsecureConnection = clientOptions.allowInsecureConnection ?? false;\n clientOptions.endpoint = clientOptions.endpoint || this.url;\n\n const internalPipelineOptions: InternalClientPipelineOptions = {\n ...clientOptions,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames]\n },\n deserializationOptions: {\n parseXML\n },\n serializationOptions: {\n stringifyXML\n },\n ...(isTokenCredential(this.credential) && {\n credential: this.credential,\n credentialScopes: STORAGE_SCOPE\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 (isCosmosEndpoint(this.url)) {\n generatedClient.pipeline.addPolicy(cosmosPatchPolicy());\n }\n\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 async deleteTable(options: OperationOptions = {}): Promise<void> {\n const { span, updatedOptions } = createSpan(\"TableClient-deleteTable\", options);\n try {\n await this.table.delete(this.tableName, updatedOptions);\n } catch (e) {\n if (e.statusCode === 404) {\n logger.info(\"TableClient-deleteTable: Table doesn't exist\");\n } else {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n }\n } finally {\n span.end();\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 fail.\n * await client.createTable();\n * ```\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n public async createTable(options: OperationOptions = {}): Promise<void> {\n const { span, updatedOptions } = createSpan(\"TableClient-createTable\", options);\n try {\n await this.table.create({ name: this.tableName }, updatedOptions);\n } catch (e) {\n if (e.statusCode === 409) {\n logger.info(\"TableClient-createTable: Table Already Exists\");\n } else {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n }\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(\"TableClient-getEntity\", options);\n\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\n try {\n const { disableTypeConversion, queryOptions, ...getEntityOptions } = updatedOptions || {};\n await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, partitionKey, rowKey, {\n ...getEntityOptions,\n queryOptions: serializeQueryOptions(queryOptions || {}),\n onResponse\n });\n const tableEntity = deserialize<TableEntityResult<T>>(\n parsedBody,\n disableTypeConversion ?? false\n );\n\n return tableEntity;\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 const { span, updatedOptions } = createSpan(\"TableClient-listEntitiesPage\", options);\n\n try {\n let result = await this._listEntities<T>(tableName, updatedOptions);\n\n yield result;\n\n while (result.continuationToken) {\n const optionsWithContinuation: InternalListTableEntitiesOptions = {\n ...updatedOptions,\n continuationToken: result.continuationToken\n };\n\n result = await this._listEntities(tableName, optionsWithContinuation);\n\n yield result;\n }\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(\"TableClient-createEntity\", options);\n\n try {\n const { ...createTableEntity } = updatedOptions || {};\n return await this.table.insertEntity(this.tableName, {\n ...createTableEntity,\n tableEntityProperties: serialize(entity),\n responsePreference: \"return-no-content\"\n });\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(\"TableClient-deleteEntity\", options);\n\n try {\n const { etag = \"*\", ...rest } = updatedOptions || {};\n const deleteOptions: TableDeleteEntityOptionalParams = {\n ...rest\n };\n return await this.table.deleteEntity(\n this.tableName,\n partitionKey,\n rowKey,\n etag,\n deleteOptions\n );\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);\n\n try {\n if (!entity.partitionKey || !entity.rowKey) {\n throw new Error(\"partitionKey and rowKey must be defined\");\n }\n\n const { etag = \"*\", ...updateEntityOptions } = updatedOptions || {};\n if (mode === \"Merge\") {\n return await this.table.mergeEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions\n });\n }\n if (mode === \"Replace\") {\n return await this.table.updateEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ifMatch: etag,\n ...updateEntityOptions\n });\n }\n\n throw new Error(`Unexpected value for update mode: ${mode}`);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async 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 const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);\n\n try {\n if (!entity.partitionKey || !entity.rowKey) {\n throw new Error(\"partitionKey and rowKey must be defined\");\n }\n\n if (mode === \"Merge\") {\n return await this.table.mergeEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions\n });\n }\n\n if (mode === \"Replace\") {\n return await this.table.updateEntity(this.tableName, entity.partitionKey, entity.rowKey, {\n tableEntityProperties: serialize(entity),\n ...updatedOptions\n });\n }\n throw new Error(`Unexpected value for update mode: ${mode}`);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async getAccessPolicy(options: OperationOptions = {}): Promise<GetAccessPolicyResponse> {\n const { span, updatedOptions } = createSpan(\"TableClient-getAccessPolicy\", options);\n try {\n const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);\n return deserializeSignedIdentifier(signedIdentifiers);\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 async setAccessPolicy(\n tableAcl: SignedIdentifier[],\n options: OperationOptions = {}\n ): Promise<SetAccessPolicyResponse> {\n const { span, updatedOptions } = createSpan(\"TableClient-setAccessPolicy\", options);\n try {\n const serlializedAcl = serializeSignedIdentifiers(tableAcl);\n return await this.table.setAccessPolicy(this.tableName, {\n ...updatedOptions,\n tableAcl: serlializedAcl\n });\n } catch (e) {\n span.setStatus({ code: SpanStatusCode.ERROR, message: e.message });\n throw e;\n } finally {\n span.end();\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 if (!this.transactionClient) {\n // Add pipeline\n this.transactionClient = new InternalTableTransaction(\n this.url,\n partitionKey,\n transactionId,\n changesetId,\n new TableClient(this.url, this.tableName),\n this.credential,\n this.allowInsecureConnection\n );\n } else {\n this.transactionClient.reset(transactionId, changesetId, partitionKey);\n }\n\n for (const item of actions) {\n const [action, entity, updateMode = \"Merge\"] = item;\n switch (action) {\n case \"create\":\n this.transactionClient.createEntity(entity);\n break;\n case \"delete\":\n this.transactionClient.deleteEntity(entity.partitionKey, entity.rowKey);\n break;\n case \"update\":\n this.transactionClient.updateEntity(entity, updateMode);\n break;\n case \"upsert\":\n this.transactionClient.upsertEntity(entity, updateMode);\n }\n }\n\n return this.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 { url, options: clientOptions, credential } = getClientParamsFromConnectionString(\n connectionString,\n options\n );\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"]}
|
|
@@ -24,7 +24,7 @@ export class GeneratedClientContext extends coreClient.ServiceClient {
|
|
|
24
24
|
const defaults = {
|
|
25
25
|
requestContentType: "application/json; charset=utf-8"
|
|
26
26
|
};
|
|
27
|
-
const packageDetails = `azsdk-js-data-tables/12.
|
|
27
|
+
const packageDetails = `azsdk-js-data-tables/12.2.0`;
|
|
28
28
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
29
29
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
30
30
|
: `${packageDetails}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatedClientContext.js","sourceRoot":"","sources":["../../../src/generated/generatedClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,gBAAgB;AAChB,MAAM,OAAO,sBAAuB,SAAQ,UAAU,CAAC,aAAa;IAIlE;;;;OAIG;IACH,YAAY,GAAW,EAAE,OAAuC;QAC9D,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACzC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAkC;YAC9C,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,6BAA6B,CAAC;QACrD,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,iDACpB,QAAQ,GACR,OAAO,KACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB,EACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,GACrC,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,wBAAwB;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,0CAA0C;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport { GeneratedClientOptionalParams } from \"./models\";\n\n/** @internal */\nexport class GeneratedClientContext extends coreClient.ServiceClient {\n url: string;\n version: string;\n\n /**\n * Initializes a new instance of the GeneratedClientContext class.\n * @param url The URL of the service account or table that is the target of the desired operation.\n * @param options The parameter options\n */\n constructor(url: string, options?: GeneratedClientOptionalParams) {\n if (url === undefined) {\n throw new Error(\"'url' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: GeneratedClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-data-tables/12.
|
|
1
|
+
{"version":3,"file":"generatedClientContext.js","sourceRoot":"","sources":["../../../src/generated/generatedClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,gBAAgB;AAChB,MAAM,OAAO,sBAAuB,SAAQ,UAAU,CAAC,aAAa;IAIlE;;;;OAIG;IACH,YAAY,GAAW,EAAE,OAAuC;QAC9D,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACzC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAkC;YAC9C,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,6BAA6B,CAAC;QACrD,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,iDACpB,QAAQ,GACR,OAAO,KACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB,EACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,GACrC,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,wBAAwB;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,0CAA0C;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport { GeneratedClientOptionalParams } from \"./models\";\n\n/** @internal */\nexport class GeneratedClientContext extends coreClient.ServiceClient {\n url: string;\n version: string;\n\n /**\n * Initializes a new instance of the GeneratedClientContext class.\n * @param url The URL of the service account or table that is the target of the desired operation.\n * @param options The parameter options\n */\n constructor(url: string, options?: GeneratedClientOptionalParams) {\n if (url === undefined) {\n throw new Error(\"'url' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: GeneratedClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-data-tables/12.2.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint || \"{url}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.url = url;\n\n // Assigning values to Constant parameters\n this.version = options.version || \"2019-02-02\";\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 { TableGetAccessPolicyHeaders, TableInsertEntityHeaders } from \"./generated/models\";\nimport { OperationOptions, CommonClientOptions } from \"@azure/core-client\";\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\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 * 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 ? Uint8Array\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 * 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"]}
|
|
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 { TableGetAccessPolicyHeaders, TableInsertEntityHeaders } from \"./generated/models\";\nimport { OperationOptions, CommonClientOptions } from \"@azure/core-client\";\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\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 ? Uint8Array\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 * 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"]}
|
|
@@ -67,7 +67,7 @@ function serializeObject(obj) {
|
|
|
67
67
|
return serializedValue;
|
|
68
68
|
}
|
|
69
69
|
function getSerializedValue(value) {
|
|
70
|
-
if (typeof value === "object" && (value === null || value === void 0 ? void 0 : value.value) && (value === null || value === void 0 ? void 0 : value.type)) {
|
|
70
|
+
if (typeof value === "object" && (value === null || value === void 0 ? void 0 : value.value) !== undefined && (value === null || value === void 0 ? void 0 : value.type) !== undefined) {
|
|
71
71
|
return serializeObject(value);
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
@@ -158,7 +158,7 @@ function inferTypedObject(propertyName, value) {
|
|
|
158
158
|
*/
|
|
159
159
|
function getTypedNumber(value) {
|
|
160
160
|
const valueStr = String(value);
|
|
161
|
-
if (Number.
|
|
161
|
+
if (Number.isSafeInteger(value)) {
|
|
162
162
|
return { value: valueStr, type: "Int32" };
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
@@ -202,4 +202,17 @@ export function deserializeSignedIdentifier(signedIdentifiers) {
|
|
|
202
202
|
};
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
+
export function serializeQueryOptions(query) {
|
|
206
|
+
const { select } = query, queryOptions = __rest(query, ["select"]);
|
|
207
|
+
const mappedQuery = Object.assign({}, queryOptions);
|
|
208
|
+
// Properties that are always returned by the service but are not allowed in select
|
|
209
|
+
const excludeFromSelect = ["etag", "odata.etag"];
|
|
210
|
+
if (select) {
|
|
211
|
+
mappedQuery.select = select
|
|
212
|
+
.filter((p) => !excludeFromSelect.includes(p))
|
|
213
|
+
.map(translatePropertyNameForSerialization)
|
|
214
|
+
.join(",");
|
|
215
|
+
}
|
|
216
|
+
return mappedQuery;
|
|
217
|
+
}
|
|
205
218
|
//# sourceMappingURL=serialization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../src/serialization.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAiB;IACnE,CAAC,cAAc,EAAE,cAAc,CAAC;IAChC,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,YAAY,EAAE,MAAM,CAAC;IACtB,CAAC,WAAW,EAAE,WAAW,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG;IACV,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;CACZ,CAAC;AASX,SAAS,kBAAkB,CAAC,KAAU;IACpC,MAAM,eAAe,GAAmB,EAAE,KAAK,EAAE,CAAC;IAClD,IACE,KAAK,KAAK,SAAS;QACnB,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ,EACzB;QACA,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC;KAC/B;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QACzC,eAAe,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;KAClC;SAAM,IAAI,KAAK,YAAY,IAAI,EAAE;QAChC,eAAe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,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,iBAA8C;IAE9C,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QAClC,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;QAChC,MAAM,KAAgC,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,EAAlD,EAAE,KAAK,EAAE,MAAM,OAAmC,EAA9B,OAAO,cAA3B,mBAA6B,CAAqB,CAAC;QACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEjE,OAAO;YACL,EAAE;YACF,YAAY,gDACP,CAAC,kBAAkB,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,GACtD,CAAC,iBAAiB,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,GACnD,OAAO,CACX;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { base64Encode, base64Decode } from \"./utils/bufferSerializer\";\nimport { EdmTypes, SignedIdentifier } from \"./models\";\nimport { truncatedISO8061Date } from \"./utils/truncateISO8061Date\";\nimport { SignedIdentifier as GeneratedSignedIdentifier } from \"./generated/models\";\n\nconst propertyCaseMap: Map<string, string> = new Map<string, string>([\n [\"PartitionKey\", \"partitionKey\"],\n [\"RowKey\", \"rowKey\"],\n [\"odata.etag\", \"etag\"],\n [\"Timestamp\", \"timestamp\"]\n]);\n\nconst Edm = {\n Binary: \"Edm.Binary\",\n Boolean: \"Edm.Boolean\",\n DateTime: \"Edm.DateTime\",\n Double: \"Edm.Double\",\n Guid: \"Edm.Guid\",\n Int32: \"Edm.Int32\",\n Int64: \"Edm.Int64\",\n String: \"Edm.String\"\n} as const;\n\ntype supportedTypes = boolean | string | number | Date | Uint8Array | bigint;\n\ntype serializedType = {\n value: supportedTypes;\n type?: string;\n};\n\nfunction serializePrimitive(value: any): serializedType {\n const serializedValue: serializedType = { value };\n if (\n value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"string\" ||\n typeof value === \"number\"\n ) {\n serializedValue.value = value;\n } else if (typeof value === \"bigint\") {\n serializedValue.value = value.toString();\n serializedValue.type = Edm.Int64;\n } else if (value instanceof Date) {\n serializedValue.value = value;\n serializedValue.type = Edm.DateTime;\n } else if (value instanceof Uint8Array) {\n serializedValue.value = base64Encode(value);\n serializedValue.type = Edm.Binary;\n } else {\n throw new Error(`Unknown EDM type ${typeof value}`);\n }\n\n return serializedValue;\n}\n\nfunction serializeObject(obj: { value: any; type: EdmTypes }): serializedType {\n const serializedValue: serializedType = { value: obj.value };\n if (\n obj.type === \"Boolean\" ||\n obj.type === \"DateTime\" ||\n obj.type === \"Double\" ||\n obj.type === \"Guid\" ||\n obj.type === \"Int32\" ||\n obj.type === \"Int64\" ||\n obj.type === \"String\"\n ) {\n serializedValue.value = obj.value;\n serializedValue.type = Edm[obj.type];\n } else if (obj.type === \"Binary\") {\n serializedValue.value = base64Encode(obj.value);\n serializedValue.type = Edm.Binary;\n } else {\n throw new Error(`Unknown EDM type ${typeof obj.value}`);\n }\n\n return serializedValue;\n}\n\nfunction getSerializedValue(value: any): serializedType {\n if (typeof value === \"object\" && value?.value && value?.type) {\n return serializeObject(value);\n } else {\n return serializePrimitive(value);\n }\n}\n\nfunction translatePropertyNameForSerialization(propertyName: string): string {\n for (const [original, internal] of propertyCaseMap) {\n if (internal === propertyName) {\n return original;\n }\n }\n\n return propertyName;\n}\n\nexport function serialize(obj: object): Record<string, Record<string, unknown>> {\n const serialized: any = {};\n for (const [propertyName, propertyValue] of Object.entries(obj)) {\n const transformedKey = translatePropertyNameForSerialization(propertyName);\n const serializedVal = getSerializedValue(propertyValue);\n serialized[transformedKey] = serializedVal.value;\n if (serializedVal.type) {\n serialized[`${transformedKey}@odata.type`] = serializedVal.type;\n }\n }\n return serialized;\n}\n\nfunction getTypedObject(value: any, type: string, disableTypeConversion: boolean): any {\n switch (type) {\n case Edm.Boolean:\n return disableTypeConversion ? { value, type: \"Boolean\" } : value;\n case Edm.Double:\n return disableTypeConversion ? { value, type: \"Double\" } : value;\n case Edm.Int32:\n return disableTypeConversion ? { value, type: \"Int32\" } : value;\n case Edm.String:\n return disableTypeConversion ? { value, type: \"String\" } : value;\n case Edm.DateTime:\n return disableTypeConversion ? { value, type: \"DateTime\" } : new Date(value);\n case Edm.Int64:\n return disableTypeConversion ? { value, type: \"Int64\" } : BigInt(value);\n case Edm.Guid:\n return { value, type: \"Guid\" };\n case Edm.Binary:\n return disableTypeConversion ? { value, type: \"Binary\" } : base64Decode(value);\n default:\n throw new Error(`Unknown EDM type ${type}`);\n }\n}\n\nexport function deserialize<T extends object = Record<string, any>>(\n obj: object,\n disableTypeConversion: boolean = false\n): T {\n const deserialized: any = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key.indexOf(\"@odata.type\") === -1) {\n const transformedKey = propertyCaseMap.get(key) ?? key;\n let typedValue = value;\n if (`${key}@odata.type` in obj) {\n const type = (obj as any)[`${key}@odata.type`];\n typedValue = getTypedObject(value, type, disableTypeConversion);\n } else if (disableTypeConversion && [\"number\", \"string\", \"boolean\"].includes(typeof value)) {\n // The service, doesn't return type metadata for number, strings or booleans\n // if automatic type conversion is disabled we'll infer the EDM object\n typedValue = inferTypedObject(key, value);\n }\n\n deserialized[transformedKey] = typedValue;\n }\n }\n return deserialized;\n}\n\nfunction inferTypedObject(propertyName: string, value: number | string | boolean) {\n // We need to skip service metadata fields such as partitionKey and rowKey and use the same value returned by the service\n if (propertyCaseMap.has(propertyName)) {\n return value;\n }\n\n switch (typeof value) {\n case \"boolean\":\n return { value: String(value), type: \"Boolean\" };\n case \"number\":\n return getTypedNumber(value);\n case \"string\":\n return { value, type: \"String\" };\n default:\n return value;\n }\n}\n\n/**\n * Returns the number when typeConversion is enabled or the EDM object with the correct number format Double or Int32 if disabled\n */\nfunction getTypedNumber(value: number): { value: string; type: \"Int32\" | \"Double\" } {\n const valueStr = String(value);\n if (Number.isInteger(value)) {\n return { value: valueStr, type: \"Int32\" };\n } else {\n return { value: valueStr, type: \"Double\" };\n }\n}\n\nexport function deserializeObjectsArray<T extends object>(\n objArray: object[],\n disableTypeConversion: boolean\n): T[] {\n return objArray.map((obj) => deserialize<T>(obj, disableTypeConversion));\n}\n\n/**\n * For ACL endpoints the Tables Service takes an ISO Date without decimals however\n * serializing a JavaScript date gives us a date with decimals 2021-07-08T09:10:09.000Z\n * which makes the XML request body invalid, these 2 functions serialize and deserialize the\n * dates so that they are in the expected format\n */\nexport function serializeSignedIdentifiers(\n signedIdentifiers: SignedIdentifier[]\n): GeneratedSignedIdentifier[] {\n return signedIdentifiers.map((acl) => {\n const { id, accessPolicy } = acl;\n const { start, expiry, ...rest } = accessPolicy ?? {};\n const serializedStart = start\n ? truncatedISO8061Date(start, false /** withMilliseconds */)\n : undefined;\n const serializedExpiry = expiry\n ? truncatedISO8061Date(expiry, false /** withMilliseconds */)\n : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(serializedExpiry && { expiry: serializedExpiry }),\n ...(serializedStart && { start: serializedStart }),\n ...rest\n }\n };\n });\n}\n\nexport function deserializeSignedIdentifier(\n signedIdentifiers: GeneratedSignedIdentifier[]\n): SignedIdentifier[] {\n return signedIdentifiers.map((si) => {\n const { id, accessPolicy } = si;\n const { start, expiry, ...restAcl } = accessPolicy ?? {};\n const deserializedStart = start ? new Date(start) : undefined;\n const deserializedExpiry = expiry ? new Date(expiry) : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(deserializedExpiry && { expiry: deserializedExpiry }),\n ...(deserializedStart && { start: deserializedStart }),\n ...restA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CAAC;KACd;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { base64Encode, base64Decode } from \"./utils/bufferSerializer\";\nimport { EdmTypes, SignedIdentifier, TableEntityQueryOptions } from \"./models\";\nimport { truncatedISO8061Date } from \"./utils/truncateISO8061Date\";\nimport {\n SignedIdentifier as GeneratedSignedIdentifier,\n QueryOptions as GeneratedQueryOptions\n} from \"./generated/models\";\n\nconst propertyCaseMap: Map<string, string> = new Map<string, string>([\n [\"PartitionKey\", \"partitionKey\"],\n [\"RowKey\", \"rowKey\"],\n [\"odata.etag\", \"etag\"],\n [\"Timestamp\", \"timestamp\"]\n]);\n\nconst Edm = {\n Binary: \"Edm.Binary\",\n Boolean: \"Edm.Boolean\",\n DateTime: \"Edm.DateTime\",\n Double: \"Edm.Double\",\n Guid: \"Edm.Guid\",\n Int32: \"Edm.Int32\",\n Int64: \"Edm.Int64\",\n String: \"Edm.String\"\n} as const;\n\ntype supportedTypes = boolean | string | number | Date | Uint8Array | bigint;\n\ntype serializedType = {\n value: supportedTypes;\n type?: string;\n};\n\nfunction serializePrimitive(value: any): serializedType {\n const serializedValue: serializedType = { value };\n if (\n value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"string\" ||\n typeof value === \"number\"\n ) {\n serializedValue.value = value;\n } else if (typeof value === \"bigint\") {\n serializedValue.value = value.toString();\n serializedValue.type = Edm.Int64;\n } else if (value instanceof Date) {\n serializedValue.value = value;\n serializedValue.type = Edm.DateTime;\n } else if (value instanceof Uint8Array) {\n serializedValue.value = base64Encode(value);\n serializedValue.type = Edm.Binary;\n } else {\n throw new Error(`Unknown EDM type ${typeof value}`);\n }\n\n return serializedValue;\n}\n\nfunction serializeObject(obj: { value: any; type: EdmTypes }): serializedType {\n const serializedValue: serializedType = { value: obj.value };\n if (\n obj.type === \"Boolean\" ||\n obj.type === \"DateTime\" ||\n obj.type === \"Double\" ||\n obj.type === \"Guid\" ||\n obj.type === \"Int32\" ||\n obj.type === \"Int64\" ||\n obj.type === \"String\"\n ) {\n serializedValue.value = obj.value;\n serializedValue.type = Edm[obj.type];\n } else if (obj.type === \"Binary\") {\n serializedValue.value = base64Encode(obj.value);\n serializedValue.type = Edm.Binary;\n } else {\n throw new Error(`Unknown EDM type ${typeof obj.value}`);\n }\n\n return serializedValue;\n}\n\nfunction getSerializedValue(value: any): serializedType {\n if (typeof value === \"object\" && value?.value !== undefined && value?.type !== undefined) {\n return serializeObject(value);\n } else {\n return serializePrimitive(value);\n }\n}\n\nfunction translatePropertyNameForSerialization(propertyName: string): string {\n for (const [original, internal] of propertyCaseMap) {\n if (internal === propertyName) {\n return original;\n }\n }\n\n return propertyName;\n}\n\nexport function serialize(obj: object): Record<string, Record<string, unknown>> {\n const serialized: any = {};\n for (const [propertyName, propertyValue] of Object.entries(obj)) {\n const transformedKey = translatePropertyNameForSerialization(propertyName);\n const serializedVal = getSerializedValue(propertyValue);\n serialized[transformedKey] = serializedVal.value;\n if (serializedVal.type) {\n serialized[`${transformedKey}@odata.type`] = serializedVal.type;\n }\n }\n return serialized;\n}\n\nfunction getTypedObject(value: any, type: string, disableTypeConversion: boolean): any {\n switch (type) {\n case Edm.Boolean:\n return disableTypeConversion ? { value, type: \"Boolean\" } : value;\n case Edm.Double:\n return disableTypeConversion ? { value, type: \"Double\" } : value;\n case Edm.Int32:\n return disableTypeConversion ? { value, type: \"Int32\" } : value;\n case Edm.String:\n return disableTypeConversion ? { value, type: \"String\" } : value;\n case Edm.DateTime:\n return disableTypeConversion ? { value, type: \"DateTime\" } : new Date(value);\n case Edm.Int64:\n return disableTypeConversion ? { value, type: \"Int64\" } : BigInt(value);\n case Edm.Guid:\n return { value, type: \"Guid\" };\n case Edm.Binary:\n return disableTypeConversion ? { value, type: \"Binary\" } : base64Decode(value);\n default:\n throw new Error(`Unknown EDM type ${type}`);\n }\n}\n\nexport function deserialize<T extends object = Record<string, any>>(\n obj: object,\n disableTypeConversion: boolean = false\n): T {\n const deserialized: any = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key.indexOf(\"@odata.type\") === -1) {\n const transformedKey = propertyCaseMap.get(key) ?? key;\n let typedValue = value;\n if (`${key}@odata.type` in obj) {\n const type = (obj as any)[`${key}@odata.type`];\n typedValue = getTypedObject(value, type, disableTypeConversion);\n } else if (disableTypeConversion && [\"number\", \"string\", \"boolean\"].includes(typeof value)) {\n // The service, doesn't return type metadata for number, strings or booleans\n // if automatic type conversion is disabled we'll infer the EDM object\n typedValue = inferTypedObject(key, value);\n }\n\n deserialized[transformedKey] = typedValue;\n }\n }\n return deserialized;\n}\n\nfunction inferTypedObject(propertyName: string, value: number | string | boolean) {\n // We need to skip service metadata fields such as partitionKey and rowKey and use the same value returned by the service\n if (propertyCaseMap.has(propertyName)) {\n return value;\n }\n\n switch (typeof value) {\n case \"boolean\":\n return { value: String(value), type: \"Boolean\" };\n case \"number\":\n return getTypedNumber(value);\n case \"string\":\n return { value, type: \"String\" };\n default:\n return value;\n }\n}\n\n/**\n * Returns the number when typeConversion is enabled or the EDM object with the correct number format Double or Int32 if disabled\n */\nfunction getTypedNumber(value: number): { value: string; type: \"Int32\" | \"Double\" } {\n const valueStr = String(value);\n if (Number.isSafeInteger(value)) {\n return { value: valueStr, type: \"Int32\" };\n } else {\n return { value: valueStr, type: \"Double\" };\n }\n}\n\nexport function deserializeObjectsArray<T extends object>(\n objArray: object[],\n disableTypeConversion: boolean\n): T[] {\n return objArray.map((obj) => deserialize<T>(obj, disableTypeConversion));\n}\n\n/**\n * For ACL endpoints the Tables Service takes an ISO Date without decimals however\n * serializing a JavaScript date gives us a date with decimals 2021-07-08T09:10:09.000Z\n * which makes the XML request body invalid, these 2 functions serialize and deserialize the\n * dates so that they are in the expected format\n */\nexport function serializeSignedIdentifiers(\n signedIdentifiers: SignedIdentifier[]\n): GeneratedSignedIdentifier[] {\n return signedIdentifiers.map((acl) => {\n const { id, accessPolicy } = acl;\n const { start, expiry, ...rest } = accessPolicy ?? {};\n const serializedStart = start\n ? truncatedISO8061Date(start, false /** withMilliseconds */)\n : undefined;\n const serializedExpiry = expiry\n ? truncatedISO8061Date(expiry, false /** withMilliseconds */)\n : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(serializedExpiry && { expiry: serializedExpiry }),\n ...(serializedStart && { start: serializedStart }),\n ...rest\n }\n };\n });\n}\n\nexport function deserializeSignedIdentifier(\n signedIdentifiers: GeneratedSignedIdentifier[]\n): SignedIdentifier[] {\n return signedIdentifiers.map((si) => {\n const { id, accessPolicy } = si;\n const { start, expiry, ...restAcl } = accessPolicy ?? {};\n const deserializedStart = start ? new Date(start) : undefined;\n const deserializedExpiry = expiry ? new Date(expiry) : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(deserializedExpiry && { expiry: deserializedExpiry }),\n ...(deserializedStart && { start: deserializedStart }),\n ...restAcl\n }\n };\n });\n}\n\nexport function serializeQueryOptions(query: TableEntityQueryOptions): GeneratedQueryOptions {\n const { select, ...queryOptions } = query;\n const mappedQuery: GeneratedQueryOptions = { ...queryOptions };\n // Properties that are always returned by the service but are not allowed in select\n const excludeFromSelect = [\"etag\", \"odata.etag\"];\n if (select) {\n mappedQuery.select = select\n .filter((p) => !excludeFromSelect.includes(p))\n .map(translatePropertyNameForSerialization)\n .join(\",\");\n }\n return mappedQuery;\n}\n"]}
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
4
|
* Encodes a byte array in base64 format.
|
|
5
|
-
* @param value - The Uint8Aray to encode
|
|
5
|
+
* @param value - The Uint8Aray or string to encode
|
|
6
6
|
*/
|
|
7
7
|
export function base64Encode(value) {
|
|
8
8
|
let str = "";
|
|
9
|
-
|
|
10
|
-
str
|
|
9
|
+
if (typeof value === "string") {
|
|
10
|
+
str = value;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
for (let i = 0; i < value.length; i++) {
|
|
14
|
+
str += String.fromCharCode(value[i]);
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
17
|
return btoa(str);
|
|
13
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bufferSerializer.browser.js","sourceRoot":"","sources":["../../../src/utils/bufferSerializer.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"bufferSerializer.browser.js","sourceRoot":"","sources":["../../../src/utils/bufferSerializer.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAA0B;IACrD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,GAAG,GAAG,KAAK,CAAC;KACb;SAAM;QACL,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACtC;KACF;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,SAAS,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACzC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - The Uint8Aray or string to encode\n */\nexport function base64Encode(value: Uint8Array | string): string {\n let str = \"\";\n if (typeof value === \"string\") {\n str = value;\n } else {\n for (let i = 0; i < value.length; i++) {\n str += String.fromCharCode(value[i]);\n }\n }\n return btoa(str);\n}\n\n/**\n * Decodes a base64 string into a byte array.\n * @param value - The base64 string to decode\n */\nexport function base64Decode(value: string): Uint8Array {\n const byteString = atob(value);\n const byteArray = new Uint8Array(byteString.length);\n for (let i = 0; i < byteString.length; i++) {\n byteArray[i] = byteString.charCodeAt(i);\n }\n return byteArray;\n}\n"]}
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
4
|
* Encodes a byte array in base64 format.
|
|
5
|
-
* @param value - The Uint8Aray to encode
|
|
5
|
+
* @param value - The Uint8Aray or string to encode
|
|
6
6
|
*/
|
|
7
7
|
export function base64Encode(value) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (value instanceof Uint8Array) {
|
|
9
|
+
const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
|
|
10
|
+
return bufferValue.toString("base64");
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return Buffer.from(value).toString("base64");
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
/**
|
|
12
17
|
* Decodes a base64 string into a byte array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bufferSerializer.js","sourceRoot":"","sources":["../../../src/utils/bufferSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"bufferSerializer.js","sourceRoot":"","sources":["../../../src/utils/bufferSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAA0B;IACrD,IAAI,KAAK,YAAY,UAAU,EAAE;QAC/B,MAAM,WAAW,GAAG,KAAK,YAAY,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAChF,OAAO,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACvC;SAAM;QACL,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC9C;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - The Uint8Aray or string to encode\n */\nexport function base64Encode(value: Uint8Array | string): string {\n if (value instanceof Uint8Array) {\n const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);\n return bufferValue.toString(\"base64\");\n } else {\n return Buffer.from(value).toString(\"base64\");\n }\n}\n\n/**\n * Decodes a base64 string into a byte array.\n * @param value - The base64 string to decode\n */\nexport function base64Decode(value: string): Uint8Array {\n return Buffer.from(value, \"base64\");\n}\n"]}
|