@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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { base64Encode, base64Decode } from "./bufferSerializer";
|
|
4
|
+
/**
|
|
5
|
+
* Encodes the nextPartitionKey and nextRowKey into a single continuation token
|
|
6
|
+
*/
|
|
7
|
+
export function encodeContinuationToken(nextPartitionKey = "", nextRowKey = "") {
|
|
8
|
+
if (!nextPartitionKey && !nextRowKey) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const continuationToken = JSON.stringify({
|
|
12
|
+
nextPartitionKey,
|
|
13
|
+
nextRowKey
|
|
14
|
+
});
|
|
15
|
+
return base64Encode(continuationToken);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Decodes a continuationToken into an object containing a nextPartitionKey and nextRowKey
|
|
19
|
+
*/
|
|
20
|
+
export function decodeContinuationToken(encodedToken) {
|
|
21
|
+
const decodedToken = base64Decode(encodedToken);
|
|
22
|
+
let tokenStr = "";
|
|
23
|
+
for (const byte of decodedToken) {
|
|
24
|
+
tokenStr += String.fromCharCode(byte);
|
|
25
|
+
}
|
|
26
|
+
const continuationToken = JSON.parse(tokenStr);
|
|
27
|
+
return continuationToken;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=continuationToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuationToken.js","sourceRoot":"","sources":["../../../src/utils/continuationToken.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOhE;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,mBAA2B,EAAE,EAC7B,aAAqB,EAAE;IAEvB,IAAI,CAAC,gBAAgB,IAAI,CAAC,UAAU,EAAE;QACpC,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC;QACvC,gBAAgB;QAChB,UAAU;KACX,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC,iBAAiB,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAoB;IAC1D,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAChD,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE;QAC/B,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;KACvC;IACD,MAAM,iBAAiB,GAAsB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAElE,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { base64Encode, base64Decode } from \"./bufferSerializer\";\n\nexport interface ContinuationToken {\n nextPartitionKey: string;\n nextRowKey: string;\n}\n\n/**\n * Encodes the nextPartitionKey and nextRowKey into a single continuation token\n */\nexport function encodeContinuationToken(\n nextPartitionKey: string = \"\",\n nextRowKey: string = \"\"\n): string | undefined {\n if (!nextPartitionKey && !nextRowKey) {\n return undefined;\n }\n\n const continuationToken = JSON.stringify({\n nextPartitionKey,\n nextRowKey\n });\n\n return base64Encode(continuationToken);\n}\n\n/**\n * Decodes a continuationToken into an object containing a nextPartitionKey and nextRowKey\n */\nexport function decodeContinuationToken(encodedToken: string): ContinuationToken {\n const decodedToken = base64Decode(encodedToken);\n let tokenStr = \"\";\n\n for (const byte of decodedToken) {\n tokenStr += String.fromCharCode(byte);\n }\n const continuationToken: ContinuationToken = JSON.parse(tokenStr);\n\n return continuationToken;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalModels.js","sourceRoot":"","sources":["../../../src/utils/internalModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TableServiceClientOptions,\n TableEntity,\n CreateTableEntityResponse,\n DeleteTableEntityOptions,\n GetTableEntityOptions,\n GetTableEntityResponse,\n ListTableEntitiesOptions,\n UpdateMode,\n UpdateTableEntityOptions,\n TableEntityResult,\n TableItem,\n TransactionAction,\n TableTransactionResponse\n} from \"../models\";\nimport { Pipeline, PipelineRequest } from \"@azure/core-rest-pipeline\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { DeleteTableEntityResponse, UpdateEntityResponse, UpsertEntityResponse } from \"..\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { OperationOptions } from \"@azure/core-client\";\n\nexport interface ConnectionString {\n kind: \"AccountConnString\" | \"SASConnString\";\n url: string;\n accountName: string;\n accountKey?: any;\n accountSas?: string;\n}\n\n/**\n * Contains response data for the listTable operation.\n */\nexport type ListTableItemsResponse = Array<TableItem> & {\n /**\n * This header contains the continuation token value.\n */\n nextTableName?: string;\n};\n\n/**\n * Contains response data for the getEntity operation.\n */\nexport type ListEntitiesResponse<T extends object> = Array<TableEntityResult<T>> & {\n /**\n * Contains the continuation token value for
|
|
1
|
+
{"version":3,"file":"internalModels.js","sourceRoot":"","sources":["../../../src/utils/internalModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TableServiceClientOptions,\n TableEntity,\n CreateTableEntityResponse,\n DeleteTableEntityOptions,\n GetTableEntityOptions,\n GetTableEntityResponse,\n ListTableEntitiesOptions,\n UpdateMode,\n UpdateTableEntityOptions,\n TableEntityResult,\n TableItem,\n TransactionAction,\n TableTransactionResponse\n} from \"../models\";\nimport { Pipeline, PipelineRequest } from \"@azure/core-rest-pipeline\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { DeleteTableEntityResponse, UpdateEntityResponse, UpsertEntityResponse } from \"..\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { OperationOptions } from \"@azure/core-client\";\n\nexport interface ConnectionString {\n kind: \"AccountConnString\" | \"SASConnString\";\n url: string;\n accountName: string;\n accountKey?: any;\n accountSas?: string;\n}\n\n/**\n * Contains response data for the listTable operation.\n */\nexport type ListTableItemsResponse = Array<TableItem> & {\n /**\n * This header contains the continuation token value.\n */\n nextTableName?: string;\n};\n\n/**\n * Contains response data for the getEntity operation.\n */\nexport type ListEntitiesResponse<T extends object> = Array<TableEntityResult<T>> & {\n /**\n * Contains the continuation token value for the next page.\n */\n continuationToken?: string;\n};\n\nexport interface ClientParamsFromConnectionString {\n url: string;\n options?: TableServiceClientOptions;\n credential?: NamedKeyCredential;\n}\n\n/**\n * Transaction request builder\n */\nexport interface InnerTransactionRequest {\n /**\n * Transaction request body\n */\n body: string[];\n /**\n * Creates a pipeline to intercept sub-requests and\n * build the request body\n */\n createPipeline(): Pipeline;\n /**\n * Adds an operation to add to the transaction body\n * @param request - The operation to add\n */\n appendSubRequestToBody(request: PipelineRequest): void;\n /**\n * Gets the transaction request body\n */\n getHttpRequestBody(): string;\n}\n\nexport interface InternalTransactionClientOptions extends TableServiceClientOptions {\n innerTransactionRequest: InnerTransactionRequest;\n}\n\n/**\n * Describes the shape of a TableClient\n */\nexport interface TableClientLike {\n /**\n * Represents a pipeline for making a HTTP request to a URL.\n */\n pipeline: Pipeline;\n /**\n * Name of the table to perform operations on.\n */\n readonly tableName: string;\n /**\n * Creates the current table.\n * @param options - The options parameters.\n */\n createTable(options?: OperationOptions): Promise<void>;\n /**\n * Submits a Transaction which is composed of a set of actions.\n * @param actions - tuple that contains the action to perform, and the entity to perform the action with\n */\n submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse>;\n /**\n * Insert entity in the table.\n * @param entity - The properties for the table entity.\n * @param options - The options parameters.\n */\n createEntity<T extends object>(\n entity: TableEntity<T>,\n options?: OperationOptions\n ): Promise<CreateTableEntityResponse>;\n /**\n * Permanently deletes the current table with all of its entities.\n * @param options - The options parameters.\n */\n deleteTable(options?: OperationOptions): Promise<void>;\n /**\n * Permanently deletes the current table if it exists in the account.\n * @param options - The options parameters.\n */\n deleteEntity(\n partitionKey: string,\n rowKey: string,\n options?: DeleteTableEntityOptions\n ): Promise<DeleteTableEntityResponse>;\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 getEntity<T extends object>(\n partitionKey: string,\n rowKey: string,\n options?: GetTableEntityOptions\n ): Promise<GetTableEntityResponse<T>>;\n /**\n * Queries entities in a table.\n * @param tableName - The name of the table.\n * @param options - The options parameters.\n */\n listEntities<T extends object>(\n options?: ListTableEntitiesOptions\n ): PagedAsyncIterableIterator<T, ListEntitiesResponse<T>>;\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 updateEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode,\n options?: UpdateTableEntityOptions\n ): Promise<UpdateEntityResponse>;\n /**\n * Upsert an entity in the table.\n * @param tableName - The name of 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 upsertEntity<T extends object>(\n entity: TableEntity<T>,\n mode: UpdateMode,\n options?: OperationOptions\n ): Promise<UpsertEntityResponse>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -595,7 +595,7 @@ export declare class TableClient {
|
|
|
595
595
|
* }
|
|
596
596
|
* ```
|
|
597
597
|
*/
|
|
598
|
-
listEntities<T extends object = Record<string, unknown>>(options?: ListTableEntitiesOptions): PagedAsyncIterableIterator<TableEntityResult<T>,
|
|
598
|
+
listEntities<T extends object = Record<string, unknown>>(options?: ListTableEntitiesOptions): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>>;
|
|
599
599
|
private listEntitiesAll;
|
|
600
600
|
private listEntitiesPage;
|
|
601
601
|
private _listEntities;
|
|
@@ -774,7 +774,6 @@ export declare class TableClient {
|
|
|
774
774
|
* @param actions - tuple that contains the action to perform, and the entity to perform the action with
|
|
775
775
|
*/
|
|
776
776
|
submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse>;
|
|
777
|
-
private convertQueryOptions;
|
|
778
777
|
/**
|
|
779
778
|
*
|
|
780
779
|
* Creates an instance of TableClient from connection string.
|
|
@@ -873,6 +872,15 @@ export declare type TableEntityResult<T> = T & {
|
|
|
873
872
|
*/
|
|
874
873
|
timestamp?: string;
|
|
875
874
|
};
|
|
875
|
+
/**
|
|
876
|
+
* Output page type for query operations
|
|
877
|
+
*/
|
|
878
|
+
export declare type TableEntityResultPage<T> = Array<TableEntityResult<T>> & {
|
|
879
|
+
/**
|
|
880
|
+
* Continuation token to get the next page
|
|
881
|
+
*/
|
|
882
|
+
continuationToken?: string;
|
|
883
|
+
};
|
|
876
884
|
/** Defines headers for Table_getAccessPolicy operation. */
|
|
877
885
|
export declare interface TableGetAccessPolicyHeaders {
|
|
878
886
|
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
|
|
@@ -635,7 +635,7 @@ export declare class TableClient {
|
|
|
635
635
|
* }
|
|
636
636
|
* ```
|
|
637
637
|
*/
|
|
638
|
-
listEntities<T extends object = Record<string, unknown>>(options?: ListTableEntitiesOptions): PagedAsyncIterableIterator<TableEntityResult<T>,
|
|
638
|
+
listEntities<T extends object = Record<string, unknown>>(options?: ListTableEntitiesOptions): PagedAsyncIterableIterator<TableEntityResult<T>, TableEntityResultPage<T>>;
|
|
639
639
|
private listEntitiesAll;
|
|
640
640
|
private listEntitiesPage;
|
|
641
641
|
private _listEntities;
|
|
@@ -814,7 +814,6 @@ export declare class TableClient {
|
|
|
814
814
|
* @param actions - tuple that contains the action to perform, and the entity to perform the action with
|
|
815
815
|
*/
|
|
816
816
|
submitTransaction(actions: TransactionAction[]): Promise<TableTransactionResponse>;
|
|
817
|
-
private convertQueryOptions;
|
|
818
817
|
/**
|
|
819
818
|
*
|
|
820
819
|
* Creates an instance of TableClient from connection string.
|
|
@@ -920,6 +919,16 @@ export declare type TableEntityResult<T> = T & {
|
|
|
920
919
|
timestamp?: string;
|
|
921
920
|
};
|
|
922
921
|
|
|
922
|
+
/**
|
|
923
|
+
* Output page type for query operations
|
|
924
|
+
*/
|
|
925
|
+
export declare type TableEntityResultPage<T> = Array<TableEntityResult<T>> & {
|
|
926
|
+
/**
|
|
927
|
+
* Continuation token to get the next page
|
|
928
|
+
*/
|
|
929
|
+
continuationToken?: string;
|
|
930
|
+
};
|
|
931
|
+
|
|
923
932
|
/** Defines headers for Table_getAccessPolicy operation. */
|
|
924
933
|
export declare interface TableGetAccessPolicyHeaders {
|
|
925
934
|
/** If a client request id header is sent in the request, this header will be present in the response with the same value. */
|