@azure/eventhubs-checkpointstore-blob 1.1.0-beta.1 → 2.0.0-alpha.20250128.2
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/README.md +10 -9
- package/{typings/eventhubs-checkpointstore-blob.d.ts → dist/browser/blobCheckpointStore.d.ts} +68 -124
- package/dist/browser/blobCheckpointStore.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/blobCheckpointStore.js +6 -6
- package/dist/browser/blobCheckpointStore.js.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +5 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/log.d.ts +12 -0
- package/dist/browser/log.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/log.js +1 -1
- package/{dist-esm/src → dist/browser}/log.js.map +1 -1
- package/dist/browser/package.json +3 -0
- package/dist/browser/storageBlobInterfaces.d.ts +39 -0
- package/dist/browser/storageBlobInterfaces.d.ts.map +1 -0
- package/dist/browser/storageBlobInterfaces.js +4 -0
- package/dist/browser/storageBlobInterfaces.js.map +1 -0
- package/dist/browser/util/error.d.ts +9 -0
- package/dist/browser/util/error.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/error.js +2 -2
- package/dist/browser/util/error.js.map +1 -0
- package/dist/commonjs/blobCheckpointStore.d.ts +68 -0
- package/dist/commonjs/blobCheckpointStore.d.ts.map +1 -0
- package/dist/commonjs/blobCheckpointStore.js +293 -0
- package/dist/commonjs/blobCheckpointStore.js.map +1 -0
- package/dist/commonjs/index.d.ts +4 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +10 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/log.d.ts +12 -0
- package/dist/commonjs/log.d.ts.map +1 -0
- package/dist/commonjs/log.js +23 -0
- package/dist/commonjs/log.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/storageBlobInterfaces.d.ts +39 -0
- package/dist/commonjs/storageBlobInterfaces.d.ts.map +1 -0
- package/dist/commonjs/storageBlobInterfaces.js +5 -0
- package/dist/commonjs/storageBlobInterfaces.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/commonjs/util/error.d.ts +9 -0
- package/dist/commonjs/util/error.d.ts.map +1 -0
- package/dist/commonjs/util/error.js +22 -0
- package/dist/commonjs/util/error.js.map +1 -0
- package/dist/esm/blobCheckpointStore.d.ts +68 -0
- package/dist/esm/blobCheckpointStore.d.ts.map +1 -0
- package/dist/{index.js → esm/blobCheckpointStore.js} +12 -55
- package/dist/esm/blobCheckpointStore.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/log.d.ts +12 -0
- package/dist/esm/log.d.ts.map +1 -0
- package/dist/esm/log.js +19 -0
- package/dist/esm/log.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/storageBlobInterfaces.d.ts +39 -0
- package/dist/esm/storageBlobInterfaces.d.ts.map +1 -0
- package/dist/esm/storageBlobInterfaces.js +4 -0
- package/dist/esm/storageBlobInterfaces.js.map +1 -0
- package/dist/esm/util/error.d.ts +9 -0
- package/dist/esm/util/error.d.ts.map +1 -0
- package/dist/esm/util/error.js +19 -0
- package/dist/esm/util/error.js.map +1 -0
- package/package.json +86 -64
- package/dist/index.js.map +0 -1
- package/dist-esm/src/blobCheckpointStore.js.map +0 -1
- package/dist-esm/src/index.js +0 -6
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/storageBlobInterfaces.js +0 -4
- package/dist-esm/src/storageBlobInterfaces.js.map +0 -1
- package/dist-esm/src/util/error.js.map +0 -1
|
@@ -1,52 +1,12 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var logger$1 = require('@azure/logger');
|
|
7
|
-
|
|
8
1
|
// Copyright (c) Microsoft Corporation.
|
|
9
|
-
// Licensed under the MIT
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
const logger = logger$1.createClientLogger("eventhubs-checkpointstore-blob");
|
|
15
|
-
/**
|
|
16
|
-
* Logs the error's stack trace to "verbose" if a stack trace is available.
|
|
17
|
-
* @param error - Error containing a stack trace.
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
function logErrorStackTrace(error) {
|
|
21
|
-
if (error && typeof error === "object" && "stack" in error) {
|
|
22
|
-
logger.verbose(error.stack);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Copyright (c) Microsoft Corporation.
|
|
27
|
-
// Licensed under the MIT license.
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
* Logs and Throws TypeError if given parameter is undefined or null
|
|
31
|
-
* @param methodName - Name of the method that was passed the parameter
|
|
32
|
-
* @param parameterName - Name of the parameter to check
|
|
33
|
-
* @param parameterValue - Value of the parameter to check
|
|
34
|
-
*/
|
|
35
|
-
function throwTypeErrorIfParameterMissing(methodName, parameterName, parameterValue) {
|
|
36
|
-
if (parameterValue === undefined || parameterValue === null) {
|
|
37
|
-
const error = new TypeError(`${methodName} called without required argument "${parameterName}"`);
|
|
38
|
-
logger.warning(error.message);
|
|
39
|
-
logErrorStackTrace(error);
|
|
40
|
-
throw error;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Copyright (c) Microsoft Corporation.
|
|
45
|
-
// Licensed under the MIT license.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { __asyncValues } from "tslib";
|
|
4
|
+
import { logger, logErrorStackTrace } from "./log.js";
|
|
5
|
+
import { throwTypeErrorIfParameterMissing } from "./util/error.js";
|
|
46
6
|
/**
|
|
47
7
|
* An implementation of CheckpointStore that uses Azure Blob Storage to persist checkpoint data.
|
|
48
8
|
*/
|
|
49
|
-
class BlobCheckpointStore {
|
|
9
|
+
export class BlobCheckpointStore {
|
|
50
10
|
/**
|
|
51
11
|
* Constructs a new instance of {@link BlobCheckpointStore}
|
|
52
12
|
* @param containerClient - An instance of a storage blob ContainerClient.
|
|
@@ -87,7 +47,7 @@ class BlobCheckpointStore {
|
|
|
87
47
|
tracingOptions,
|
|
88
48
|
});
|
|
89
49
|
try {
|
|
90
|
-
for (var _e = true, blobs_1 =
|
|
50
|
+
for (var _e = true, blobs_1 = __asyncValues(blobs), blobs_1_1; blobs_1_1 = await blobs_1.next(), _a = blobs_1_1.done, !_a; _e = true) {
|
|
91
51
|
_c = blobs_1_1.value;
|
|
92
52
|
_e = false;
|
|
93
53
|
const blob = _c;
|
|
@@ -196,7 +156,7 @@ class BlobCheckpointStore {
|
|
|
196
156
|
});
|
|
197
157
|
const checkpoints = [];
|
|
198
158
|
try {
|
|
199
|
-
for (var _e = true, blobs_2 =
|
|
159
|
+
for (var _e = true, blobs_2 = __asyncValues(blobs), blobs_2_1; blobs_2_1 = await blobs_2.next(), _a = blobs_2_1.done, !_a; _e = true) {
|
|
200
160
|
_c = blobs_2_1.value;
|
|
201
161
|
_e = false;
|
|
202
162
|
const blob = _c;
|
|
@@ -205,7 +165,7 @@ class BlobCheckpointStore {
|
|
|
205
165
|
const checkpointMetadata = (_d = blob.metadata) !== null && _d !== void 0 ? _d : {};
|
|
206
166
|
const offset = checkpointMetadata.offset;
|
|
207
167
|
if (offset == null) {
|
|
208
|
-
throw new Error(`Missing metadata property 'offset' on blob '${
|
|
168
|
+
throw new Error(`Missing metadata property 'offset' on blob '${blob.name}'`);
|
|
209
169
|
}
|
|
210
170
|
const sequenceNumber = parseIntOrThrow(blob.name, "sequencenumber", checkpointMetadata.sequencenumber);
|
|
211
171
|
checkpoints.push({
|
|
@@ -249,11 +209,11 @@ class BlobCheckpointStore {
|
|
|
249
209
|
return;
|
|
250
210
|
}
|
|
251
211
|
catch (err) {
|
|
252
|
-
logger.warning(`Error occurred while
|
|
212
|
+
logger.warning(`Error occurred while updating the checkpoint for partition: ${checkpoint.partitionId}.`, err.message);
|
|
253
213
|
logErrorStackTrace(err);
|
|
254
214
|
if ((err === null || err === void 0 ? void 0 : err.name) === "AbortError")
|
|
255
215
|
throw err;
|
|
256
|
-
throw
|
|
216
|
+
throw err;
|
|
257
217
|
}
|
|
258
218
|
}
|
|
259
219
|
static getBlobPrefix(params) {
|
|
@@ -315,7 +275,7 @@ class BlobCheckpointStore {
|
|
|
315
275
|
/**
|
|
316
276
|
* @internal
|
|
317
277
|
*/
|
|
318
|
-
function parseIntOrThrow(blobName, fieldName, numStr) {
|
|
278
|
+
export function parseIntOrThrow(blobName, fieldName, numStr) {
|
|
319
279
|
if (numStr == null) {
|
|
320
280
|
throw new Error(`Missing metadata property '${fieldName}' on blob '${blobName}'`);
|
|
321
281
|
}
|
|
@@ -325,7 +285,4 @@ function parseIntOrThrow(blobName, fieldName, numStr) {
|
|
|
325
285
|
}
|
|
326
286
|
return num;
|
|
327
287
|
}
|
|
328
|
-
|
|
329
|
-
exports.BlobCheckpointStore = BlobCheckpointStore;
|
|
330
|
-
exports.logger = logger;
|
|
331
|
-
//# sourceMappingURL=index.js.map
|
|
288
|
+
//# sourceMappingURL=blobCheckpointStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobCheckpointStore.js","sourceRoot":"","sources":["../../src/blobCheckpointStore.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAG9B;;;OAGG;IACH,YAAY,eAAoC;QAC9C,IAAI,CAAC,g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ACL,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAUD;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,SAAiB,EACjB,MAA0B;IAE1B,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,cAAc,QAAQ,GAAG,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEjC,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,sCAAsC,SAAS,cAAc,QAAQ,eAAe,CACrF,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n CheckpointStore,\n PartitionOwnership,\n Checkpoint,\n OperationOptions,\n} from \"@azure/event-hubs\";\nimport type { Metadata, RestError, BlobSetMetadataResponse } from \"@azure/storage-blob\";\nimport { logger, logErrorStackTrace } from \"./log.js\";\nimport type { ContainerClientLike } from \"./storageBlobInterfaces.js\";\nimport { throwTypeErrorIfParameterMissing } from \"./util/error.js\";\n\n/**\n * An implementation of CheckpointStore that uses Azure Blob Storage to persist checkpoint data.\n */\nexport class BlobCheckpointStore implements CheckpointStore {\n private _containerClient: ContainerClientLike;\n\n /**\n * Constructs a new instance of {@link BlobCheckpointStore}\n * @param containerClient - An instance of a storage blob ContainerClient.\n */\n constructor(containerClient: ContainerClientLike) {\n this._containerClient = containerClient;\n }\n /**\n * Get the list of all existing partition ownership from the underlying data store. May return empty\n * results if there are is no existing ownership information.\n * Partition Ownership contains the information on which `EventHubConsumerClient` subscribe call is currently processing the partition.\n *\n * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net.\n * @param eventHubName - The event hub name.\n * @param consumerGroup - The consumer group name.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n * @returns Partition ownership details of all the partitions that have had an owner.\n */\n async listOwnership(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n consumerGroup: string,\n options: OperationOptions = {},\n ): Promise<PartitionOwnership[]> {\n const partitionOwnershipArray: PartitionOwnership[] = [];\n const { abortSignal, tracingOptions } = options;\n\n const blobPrefix = BlobCheckpointStore.getBlobPrefix({\n type: \"ownership\",\n fullyQualifiedNamespace,\n eventHubName,\n consumerGroup: consumerGroup,\n });\n\n try {\n const blobs = this._containerClient.listBlobsFlat({\n abortSignal,\n includeMetadata: true,\n prefix: blobPrefix,\n tracingOptions,\n });\n\n for await (const blob of blobs) {\n const blobPath = blob.name.split(\"/\");\n const blobName = blobPath[blobPath.length - 1];\n\n const ownershipMetadata = (blob.metadata as OwnershipMetadata) ?? {};\n\n if (ownershipMetadata.ownerid == null) {\n throw new Error(`Missing ownerid in metadata for blob ${blob.name}`);\n }\n\n const partitionOwnership: PartitionOwnership = {\n fullyQualifiedNamespace,\n eventHubName,\n consumerGroup: consumerGroup,\n ownerId: ownershipMetadata.ownerid,\n partitionId: blobName,\n lastModifiedTimeInMs:\n blob.properties.lastModified && blob.properties.lastModified.getTime(),\n etag: blob.properties.etag,\n };\n partitionOwnershipArray.push(partitionOwnership);\n }\n return partitionOwnershipArray;\n } catch (err: any) {\n logger.warning(`Error occurred while fetching the list of blobs`, err.message);\n logErrorStackTrace(err);\n\n if (err?.name === \"AbortError\") throw err;\n\n throw new Error(`Error occurred while fetching the list of blobs. \\n${err}`);\n }\n }\n\n /**\n * Claim ownership of a list of partitions. This will return the list of partitions that were\n * successfully claimed.\n *\n * @param partitionOwnership - The list of partition ownership this instance is claiming to own.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n * @returns A list partitions this instance successfully claimed ownership.\n */\n async claimOwnership(\n partitionOwnership: PartitionOwnership[],\n options: OperationOptions = {},\n ): Promise<PartitionOwnership[]> {\n const partitionOwnershipArray: PartitionOwnership[] = [];\n for (const ownership of partitionOwnership) {\n const blobName = BlobCheckpointStore.getBlobPrefix({ type: \"ownership\", ...ownership });\n try {\n const updatedBlobResponse = await this._setBlobMetadata(\n blobName,\n {\n ownerid: ownership.ownerId,\n },\n ownership.etag,\n options,\n );\n\n if (updatedBlobResponse.lastModified) {\n ownership.lastModifiedTimeInMs = updatedBlobResponse.lastModified.getTime();\n }\n\n ownership.etag = updatedBlobResponse.etag;\n partitionOwnershipArray.push(ownership);\n logger.info(\n `[${ownership.ownerId}] Claimed ownership successfully for partition: ${ownership.partitionId}`,\n `LastModifiedTime: ${ownership.lastModifiedTimeInMs}, ETag: ${ownership.etag}`,\n );\n } catch (err: any) {\n const restError = err as RestError;\n\n if (restError.statusCode === 412) {\n // etag failures (precondition not met) aren't fatal errors. They happen\n // as multiple consumers attempt to claim the same partition (first one wins)\n // and losers get this error.\n logger.verbose(\n `[${ownership.ownerId}] Did not claim partition ${ownership.partitionId}. Another processor has already claimed it.`,\n );\n continue;\n }\n\n logger.warning(\n `Error occurred while claiming ownership for partition: ${ownership.partitionId}`,\n err.message,\n );\n logErrorStackTrace(err);\n\n throw err;\n }\n }\n return partitionOwnershipArray;\n }\n\n /**\n * Lists all the checkpoints in a data store for a given namespace, eventhub and consumer group.\n *\n * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net.\n * @param eventHubName - The event hub name.\n * @param consumerGroup - The consumer group name.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n */\n async listCheckpoints(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n consumerGroup: string,\n options: OperationOptions = {},\n ): Promise<Checkpoint[]> {\n const { abortSignal, tracingOptions } = options;\n const blobPrefix = BlobCheckpointStore.getBlobPrefix({\n type: \"checkpoint\",\n fullyQualifiedNamespace,\n eventHubName,\n consumerGroup,\n });\n\n const blobs = this._containerClient.listBlobsFlat({\n abortSignal,\n includeMetadata: true,\n prefix: blobPrefix,\n tracingOptions,\n });\n\n const checkpoints: Checkpoint[] = [];\n\n for await (const blob of blobs) {\n const blobPath = blob.name.split(\"/\");\n const blobName = blobPath[blobPath.length - 1];\n\n const checkpointMetadata = (blob.metadata as CheckpointMetadata) ?? {};\n\n const offset = checkpointMetadata.offset;\n if (offset == null) {\n throw new Error(`Missing metadata property 'offset' on blob '${blob.name}'`);\n }\n const sequenceNumber = parseIntOrThrow(\n blob.name,\n \"sequencenumber\",\n checkpointMetadata.sequencenumber,\n );\n\n checkpoints.push({\n consumerGroup,\n eventHubName,\n fullyQualifiedNamespace,\n partitionId: blobName,\n offset,\n sequenceNumber,\n });\n }\n\n return checkpoints;\n }\n\n /**\n * Updates the checkpoint in the data store for a partition.\n *\n * @param checkpoint - The checkpoint.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n * @returns The new etag on successful update.\n */\n async updateCheckpoint(checkpoint: Checkpoint, options: OperationOptions = {}): Promise<void> {\n throwTypeErrorIfParameterMissing(\n \"updateCheckpoint\",\n \"sequenceNumber\",\n checkpoint.sequenceNumber,\n );\n throwTypeErrorIfParameterMissing(\"updateCheckpoint\", \"offset\", checkpoint.offset);\n\n const blobName = BlobCheckpointStore.getBlobPrefix({ type: \"checkpoint\", ...checkpoint });\n try {\n const metadataResponse = await this._setBlobMetadata(\n blobName,\n {\n sequencenumber: checkpoint.sequenceNumber.toString(),\n offset: checkpoint.offset.toString(),\n },\n undefined,\n options,\n );\n\n logger.verbose(\n `Updated checkpoint successfully for partition: ${checkpoint.partitionId}`,\n `LastModifiedTime: ${metadataResponse.lastModified!.toISOString()}, ETag: ${\n metadataResponse.etag\n }`,\n );\n return;\n } catch (err: any) {\n logger.warning(\n `Error occurred while updating the checkpoint for partition: ${checkpoint.partitionId}.`,\n err.message,\n );\n logErrorStackTrace(err);\n\n if (err?.name === \"AbortError\") throw err;\n\n throw err;\n }\n }\n\n private static getBlobPrefix(params: {\n type: \"ownership\" | \"checkpoint\";\n fullyQualifiedNamespace: string;\n eventHubName: string;\n consumerGroup: string;\n partitionId?: string;\n }): string {\n // none of these are case-sensitive in eventhubs so we need to make sure we don't accidentally allow\n // the user to create a case-sensitive blob for their state!\n const consumerGroupName = params.consumerGroup.toLowerCase();\n const eventHubName = params.eventHubName.toLowerCase();\n const fullyQualifiedNamespace = params.fullyQualifiedNamespace.toLowerCase();\n\n if (params.partitionId) {\n return `${fullyQualifiedNamespace}/${eventHubName}/${consumerGroupName}/${params.type}/${params.partitionId}`;\n } else {\n return `${fullyQualifiedNamespace}/${eventHubName}/${consumerGroupName}/${params.type}/`;\n }\n }\n\n private async _setBlobMetadata(\n blobName: string,\n metadata: OwnershipMetadata | CheckpointMetadata,\n etag: string | undefined,\n options: OperationOptions = {},\n ): Promise<BlobSetMetadataResponse> {\n const { abortSignal, tracingOptions } = options;\n const blockBlobClient = this._containerClient.getBlobClient(blobName).getBlockBlobClient();\n\n // When we have an etag, we know the blob existed.\n // If we encounter an error we should fail.\n if (etag) {\n return blockBlobClient.setMetadata(metadata as Metadata, {\n abortSignal,\n conditions: {\n ifMatch: etag,\n },\n tracingOptions,\n });\n } else {\n try {\n // Attempt to set metadata, and fallback to upload if the blob doesn't already exist.\n // This avoids poor performance in storage accounts with soft-delete or blob versioning enabled.\n // https://github.com/Azure/azure-sdk-for-js/issues/10132\n return await blockBlobClient.setMetadata(metadata as Metadata, {\n abortSignal,\n tracingOptions,\n });\n } catch (err: any) {\n // Check if the error is `BlobNotFound` and fallback to `upload` if it is.\n if (err?.name !== \"RestError\") {\n throw err;\n }\n const errorDetails = (err as RestError).details as { [field: string]: string } | undefined;\n const errorCode = errorDetails?.errorCode;\n if (!errorCode || errorCode !== \"BlobNotFound\") {\n throw err;\n }\n\n return blockBlobClient.upload(\"\", 0, {\n abortSignal,\n metadata: metadata as Metadata,\n tracingOptions,\n });\n }\n }\n }\n}\n\ntype OwnershipMetadata = {\n [k in \"ownerid\"]: string | undefined;\n};\n\ntype CheckpointMetadata = {\n [k in \"sequencenumber\" | \"offset\"]: string | undefined;\n};\n\n/**\n * @internal\n */\nexport function parseIntOrThrow(\n blobName: string,\n fieldName: string,\n numStr: string | undefined,\n): number {\n if (numStr == null) {\n throw new Error(`Missing metadata property '${fieldName}' on blob '${blobName}'`);\n }\n\n const num = parseInt(numStr, 10);\n\n if (isNaN(num)) {\n throw new Error(\n `Failed to parse metadata property '${fieldName}' on blob '${blobName}' as a number`,\n );\n }\n\n return num;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM/D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { BlobCheckpointStore } from \"./blobCheckpointStore.js\";\nexport {\n ContainerClientLike,\n BlobClientLike,\n BlockBlobClientLike,\n} from \"./storageBlobInterfaces.js\";\nexport { logger } from \"./log.js\";\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@azure/logger` configuration for this package.
|
|
3
|
+
* This will output logs using the `azure:eventhubs-checkpointstore-blob` namespace prefix.
|
|
4
|
+
*/
|
|
5
|
+
export declare const logger: import("@azure/logger").AzureLogger;
|
|
6
|
+
/**
|
|
7
|
+
* Logs the error's stack trace to "verbose" if a stack trace is available.
|
|
8
|
+
* @param error - Error containing a stack trace.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function logErrorStackTrace(error: unknown): void;
|
|
12
|
+
//# sourceMappingURL=log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,MAAM,qCAAuD,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAIvD"}
|
package/dist/esm/log.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createClientLogger } from "@azure/logger";
|
|
4
|
+
/**
|
|
5
|
+
* The `@azure/logger` configuration for this package.
|
|
6
|
+
* This will output logs using the `azure:eventhubs-checkpointstore-blob` namespace prefix.
|
|
7
|
+
*/
|
|
8
|
+
export const logger = createClientLogger("eventhubs-checkpointstore-blob");
|
|
9
|
+
/**
|
|
10
|
+
* Logs the error's stack trace to "verbose" if a stack trace is available.
|
|
11
|
+
* @param error - Error containing a stack trace.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function logErrorStackTrace(error) {
|
|
15
|
+
if (error && typeof error === "object" && "stack" in error) {
|
|
16
|
+
logger.verbose(error.stack);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;QAC3D,MAAM,CAAC,OAAO,CAAE,KAAa,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The `@azure/logger` configuration for this package.\n * This will output logs using the `azure:eventhubs-checkpointstore-blob` namespace prefix.\n */\nexport const logger = createClientLogger(\"eventhubs-checkpointstore-blob\");\n\n/**\n * Logs the error's stack trace to \"verbose\" if a stack trace is available.\n * @param error - Error containing a stack trace.\n * @internal\n */\nexport function logErrorStackTrace(error: unknown): void {\n if (error && typeof error === \"object\" && \"stack\" in error) {\n logger.verbose((error as any).stack);\n }\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Metadata, BlobItem, ContainerListBlobFlatSegmentResponse, ContainerListBlobsOptions, BlockBlobUploadOptions, BlockBlobUploadResponse, HttpRequestBody, BlobSetMetadataOptions, ContainerSetMetadataResponse } from "@azure/storage-blob";
|
|
2
|
+
import type { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
3
|
+
/**
|
|
4
|
+
* An interface compatible with an instance of {@link BlobClient}.
|
|
5
|
+
*/
|
|
6
|
+
export interface BlobClientLike {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a BlockBlobClient object.
|
|
9
|
+
*/
|
|
10
|
+
getBlockBlobClient(): BlockBlobClientLike;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An interface compatible with Storage Blob's ContainerClient class.
|
|
14
|
+
*/
|
|
15
|
+
export interface ContainerClientLike {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a {@link BlobClient}
|
|
18
|
+
*/
|
|
19
|
+
getBlobClient(blobName: string): BlobClientLike;
|
|
20
|
+
/**
|
|
21
|
+
* Returns an async iterable iterator to list all the blobs
|
|
22
|
+
* under the specified account.
|
|
23
|
+
*/
|
|
24
|
+
listBlobsFlat(options?: ContainerListBlobsOptions): PagedAsyncIterableIterator<BlobItem, ContainerListBlobFlatSegmentResponse>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An interface compatible with Storage Blob's BlockBlobClient class.
|
|
28
|
+
*/
|
|
29
|
+
export interface BlockBlobClientLike {
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new block blob, or updated the content of an existing block blob.
|
|
32
|
+
*/
|
|
33
|
+
upload(body: HttpRequestBody, contentLength: number, options?: BlockBlobUploadOptions): Promise<BlockBlobUploadResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Sets user-defined metadata for the specified blob as one or more name-value pairs.
|
|
36
|
+
*/
|
|
37
|
+
setMetadata(metadata?: Metadata, options?: BlobSetMetadataOptions): Promise<ContainerSetMetadataResponse>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=storageBlobInterfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageBlobInterfaces.d.ts","sourceRoot":"","sources":["../../src/storageBlobInterfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,oCAAoC,EACpC,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,kBAAkB,IAAI,mBAAmB,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC;IAChD;;;OAGG;IACH,aAAa,CACX,OAAO,CAAC,EAAE,yBAAyB,GAClC,0BAA0B,CAAC,QAAQ,EAAE,oCAAoC,CAAC,CAAC;CAC/E;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACpC;;OAEG;IACH,WAAW,CACT,QAAQ,CAAC,EAAE,QAAQ,EACnB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageBlobInterfaces.js","sourceRoot":"","sources":["../../src/storageBlobInterfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n Metadata,\n BlobItem,\n ContainerListBlobFlatSegmentResponse,\n ContainerListBlobsOptions,\n BlockBlobUploadOptions,\n BlockBlobUploadResponse,\n HttpRequestBody,\n BlobSetMetadataOptions,\n ContainerSetMetadataResponse,\n} from \"@azure/storage-blob\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\n\n/**\n * An interface compatible with an instance of {@link BlobClient}.\n */\nexport interface BlobClientLike {\n /**\n * Creates a BlockBlobClient object.\n */\n getBlockBlobClient(): BlockBlobClientLike;\n}\n\n/**\n * An interface compatible with Storage Blob's ContainerClient class.\n */\nexport interface ContainerClientLike {\n /**\n * Creates a {@link BlobClient}\n */\n getBlobClient(blobName: string): BlobClientLike;\n /**\n * Returns an async iterable iterator to list all the blobs\n * under the specified account.\n */\n listBlobsFlat(\n options?: ContainerListBlobsOptions,\n ): PagedAsyncIterableIterator<BlobItem, ContainerListBlobFlatSegmentResponse>;\n}\n\n/**\n * An interface compatible with Storage Blob's BlockBlobClient class.\n */\nexport interface BlockBlobClientLike {\n /**\n * Creates a new block blob, or updated the content of an existing block blob.\n */\n upload(\n body: HttpRequestBody,\n contentLength: number,\n options?: BlockBlobUploadOptions,\n ): Promise<BlockBlobUploadResponse>;\n /**\n * Sets user-defined metadata for the specified blob as one or more name-value pairs.\n */\n setMetadata(\n metadata?: Metadata,\n options?: BlobSetMetadataOptions,\n ): Promise<ContainerSetMetadataResponse>;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* Logs and Throws TypeError if given parameter is undefined or null
|
|
4
|
+
* @param methodName - Name of the method that was passed the parameter
|
|
5
|
+
* @param parameterName - Name of the parameter to check
|
|
6
|
+
* @param parameterValue - Value of the parameter to check
|
|
7
|
+
*/
|
|
8
|
+
export declare function throwTypeErrorIfParameterMissing(methodName: string, parameterName: string, parameterValue: unknown): void;
|
|
9
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/util/error.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,OAAO,GACtB,IAAI,CASN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { logger, logErrorStackTrace } from "../log.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Logs and Throws TypeError if given parameter is undefined or null
|
|
7
|
+
* @param methodName - Name of the method that was passed the parameter
|
|
8
|
+
* @param parameterName - Name of the parameter to check
|
|
9
|
+
* @param parameterValue - Value of the parameter to check
|
|
10
|
+
*/
|
|
11
|
+
export function throwTypeErrorIfParameterMissing(methodName, parameterName, parameterValue) {
|
|
12
|
+
if (parameterValue === undefined || parameterValue === null) {
|
|
13
|
+
const error = new TypeError(`${methodName} called without required argument "${parameterName}"`);
|
|
14
|
+
logger.warning(error.message);
|
|
15
|
+
logErrorStackTrace(error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/util/error.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAC9C,UAAkB,EAClB,aAAqB,EACrB,cAAuB;IAEvB,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QAC5D,MAAM,KAAK,GAAG,IAAI,SAAS,CACzB,GAAG,UAAU,sCAAsC,aAAa,GAAG,CACpE,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger, logErrorStackTrace } from \"../log.js\";\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is undefined or null\n * @param methodName - Name of the method that was passed the parameter\n * @param parameterName - Name of the parameter to check\n * @param parameterValue - Value of the parameter to check\n */\nexport function throwTypeErrorIfParameterMissing(\n methodName: string,\n parameterName: string,\n parameterValue: unknown,\n): void {\n if (parameterValue === undefined || parameterValue === null) {\n const error = new TypeError(\n `${methodName} called without required argument \"${parameterName}\"`,\n );\n logger.warning(error.message);\n logErrorStackTrace(error);\n throw error;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/eventhubs-checkpointstore-blob",
|
|
3
3
|
"sdk-type": "client",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-alpha.20250128.2",
|
|
5
5
|
"description": "An Azure Storage Blob solution to store checkpoints when using Event Hubs.",
|
|
6
6
|
"author": "Microsoft Corporation",
|
|
7
7
|
"license": "MIT",
|
|
@@ -17,89 +17,93 @@
|
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
|
|
19
19
|
},
|
|
20
|
-
"main": "./dist/index.js",
|
|
21
|
-
"module": "dist
|
|
22
|
-
"types": "./
|
|
20
|
+
"main": "./dist/commonjs/index.js",
|
|
21
|
+
"module": "./dist/esm/index.js",
|
|
22
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=18.0.0"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"dist/",
|
|
28
|
-
"dist-esm/src/",
|
|
29
|
-
"typings/eventhubs-checkpointstore-blob.d.ts",
|
|
30
28
|
"README.md",
|
|
31
29
|
"LICENSE"
|
|
32
30
|
],
|
|
33
31
|
"scripts": {
|
|
34
|
-
"
|
|
35
|
-
"build:
|
|
36
|
-
"build:node": "tsc -p . && dev-tool run bundle",
|
|
37
|
-
"build:samples": "echo Obsolete",
|
|
38
|
-
"build:test:browser": "tsc -p . && dev-tool run bundle",
|
|
39
|
-
"build:test:node": "tsc -p . && dev-tool run bundle",
|
|
32
|
+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
33
|
+
"build:samples": "echo Obsolete.",
|
|
40
34
|
"build:test": "npm run build:test:node",
|
|
41
|
-
"build": "
|
|
42
|
-
"
|
|
43
|
-
"
|
|
35
|
+
"build:test:browser": "dev-tool run build-package && dev-tool run build-test",
|
|
36
|
+
"build:test:node": "dev-tool run build-package && dev-tool run build-test",
|
|
37
|
+
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
|
|
38
|
+
"clean": "dev-tool run vendored rimraf --glob dist dist-* temp *.tgz *.log .tshy *.xml",
|
|
44
39
|
"execute:samples": "dev-tool samples run samples-dev",
|
|
45
|
-
"extract-api": "
|
|
46
|
-
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
47
|
-
"integration-test:browser": "echo skipped",
|
|
48
|
-
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 1200000 \"dist-esm/test/*.spec.js\"",
|
|
40
|
+
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
|
|
41
|
+
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
|
|
49
42
|
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
43
|
+
"integration-test:browser": "dev-tool run build-package && dev-tool run build-test && dev-tool run vendored cross-env TEST_MODE=live dev-tool run test:vitest --browser --no-test-proxy",
|
|
44
|
+
"integration-test:node": "npm run vitest:node --esm",
|
|
45
|
+
"lint": "eslint README.md package.json api-extractor.json src test",
|
|
46
|
+
"lint:fix": "eslint README.md package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
|
|
52
47
|
"pack": "npm pack 2>&1",
|
|
48
|
+
"test": "npm run build:test && npm run unit-test && npm run integration-test",
|
|
53
49
|
"test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
|
|
54
50
|
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
|
|
55
|
-
"test": "npm run
|
|
51
|
+
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
56
52
|
"unit-test:browser": "echo skipped",
|
|
57
53
|
"unit-test:node": "echo skipped",
|
|
58
|
-
"
|
|
54
|
+
"update-snippets": "echo skipped",
|
|
55
|
+
"vitest:node": "dev-tool run test:vitest --no-test-proxy"
|
|
56
|
+
},
|
|
57
|
+
"tshy": {
|
|
58
|
+
"project": "tsconfig.src.json",
|
|
59
|
+
"exports": {
|
|
60
|
+
"./package.json": "./package.json",
|
|
61
|
+
".": "./src/index.ts"
|
|
62
|
+
},
|
|
63
|
+
"dialects": [
|
|
64
|
+
"esm",
|
|
65
|
+
"commonjs"
|
|
66
|
+
],
|
|
67
|
+
"esmDialects": [
|
|
68
|
+
"browser"
|
|
69
|
+
],
|
|
70
|
+
"selfLink": false
|
|
59
71
|
},
|
|
60
72
|
"dependencies": {
|
|
61
|
-
"@azure/abort-controller": "^1.
|
|
62
|
-
"@azure/core-paging": "^1.2
|
|
63
|
-
"@azure/event-hubs": "
|
|
64
|
-
"@azure/logger": "^1.
|
|
65
|
-
"@azure/storage-blob": "^12.
|
|
66
|
-
"
|
|
67
|
-
"tslib": "^2.2.0"
|
|
73
|
+
"@azure/abort-controller": "^2.1.2",
|
|
74
|
+
"@azure/core-paging": "^1.6.2",
|
|
75
|
+
"@azure/event-hubs": ">=6.0.0-alpha <6.0.0-alphb",
|
|
76
|
+
"@azure/logger": "^1.1.3",
|
|
77
|
+
"@azure/storage-blob": "^12.24.0",
|
|
78
|
+
"tslib": "^2.6.3"
|
|
68
79
|
},
|
|
69
80
|
"devDependencies": {
|
|
70
|
-
"@azure/
|
|
71
|
-
"@azure/
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
81
|
+
"@azure-tools/test-credential": "^2.0.0",
|
|
82
|
+
"@azure-tools/test-recorder": "^4.0.0",
|
|
83
|
+
"@azure-tools/vite-plugin-browser-test-map": ">=1.0.0-alpha <1.0.0-alphb",
|
|
84
|
+
"@azure/core-rest-pipeline": "^1.16.3",
|
|
85
|
+
"@azure/core-util": "^1.9.1",
|
|
86
|
+
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
87
|
+
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
88
|
+
"@azure/identity": "^4.4.1",
|
|
89
|
+
"@rollup/plugin-inject": "^5.0.5",
|
|
90
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
91
|
+
"@types/debug": "^4.1.12",
|
|
78
92
|
"@types/node": "^18.0.0",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"karma-junit-reporter": "^2.0.1",
|
|
94
|
-
"karma-mocha": "^2.0.1",
|
|
95
|
-
"karma-mocha-reporter": "^2.2.5",
|
|
96
|
-
"karma-sourcemap-loader": "^0.3.8",
|
|
97
|
-
"mocha": "^10.0.0",
|
|
98
|
-
"nyc": "^15.1.0",
|
|
99
|
-
"rimraf": "^5.0.5",
|
|
100
|
-
"ts-node": "^10.0.0",
|
|
101
|
-
"typescript": "~5.4.5",
|
|
102
|
-
"util": "^0.12.1"
|
|
93
|
+
"@vitest/browser": "^3.0.3",
|
|
94
|
+
"@vitest/coverage-istanbul": "^3.0.3",
|
|
95
|
+
"buffer": "^6.0.3",
|
|
96
|
+
"chai": "^5.1.1",
|
|
97
|
+
"chai-as-promised": "^8.0.0",
|
|
98
|
+
"debug": "^4.3.6",
|
|
99
|
+
"dotenv": "^16.4.5",
|
|
100
|
+
"eslint": "^9.9.0",
|
|
101
|
+
"playwright": "^1.45.3",
|
|
102
|
+
"process": "^0.11.10",
|
|
103
|
+
"stream": "^0.0.3",
|
|
104
|
+
"tsx": "^4.16.2",
|
|
105
|
+
"typescript": "~5.7.2",
|
|
106
|
+
"vitest": "^3.0.3"
|
|
103
107
|
},
|
|
104
108
|
"//sampleConfiguration": {
|
|
105
109
|
"skipFolder": true,
|
|
@@ -109,8 +113,26 @@
|
|
|
109
113
|
"azure-event-hubs"
|
|
110
114
|
],
|
|
111
115
|
"requiredResources": {
|
|
112
|
-
"Azure Event Hub": "https://
|
|
113
|
-
"Azure Storage Account": "https://
|
|
116
|
+
"Azure Event Hub": "https://learn.microsoft.com/azure/event-hubs/event-hubs-create",
|
|
117
|
+
"Azure Storage Account": "https://learn.microsoft.com/azure/storage/common/storage-account-overview"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"type": "module",
|
|
121
|
+
"exports": {
|
|
122
|
+
"./package.json": "./package.json",
|
|
123
|
+
".": {
|
|
124
|
+
"browser": {
|
|
125
|
+
"types": "./dist/browser/index.d.ts",
|
|
126
|
+
"default": "./dist/browser/index.js"
|
|
127
|
+
},
|
|
128
|
+
"import": {
|
|
129
|
+
"types": "./dist/esm/index.d.ts",
|
|
130
|
+
"default": "./dist/esm/index.js"
|
|
131
|
+
},
|
|
132
|
+
"require": {
|
|
133
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
134
|
+
"default": "./dist/commonjs/index.js"
|
|
135
|
+
}
|
|
114
136
|
}
|
|
115
137
|
}
|
|
116
138
|
}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/log.ts","../src/util/error.ts","../src/blobCheckpointStore.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The `@azure/logger` configuration for this package.\n * This will output logs using the `azure:eventhubs-checkpointstore-blob` namespace prefix.\n */\nexport const logger = createClientLogger(\"eventhubs-checkpointstore-blob\");\n\n/**\n * Logs the error's stack trace to \"verbose\" if a stack trace is available.\n * @param error - Error containing a stack trace.\n * @internal\n */\nexport function logErrorStackTrace(error: unknown): void {\n if (error && typeof error === \"object\" && \"stack\" in error) {\n logger.verbose((error as any).stack);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { logger, logErrorStackTrace } from \"../log\";\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is undefined or null\n * @param methodName - Name of the method that was passed the parameter\n * @param parameterName - Name of the parameter to check\n * @param parameterValue - Value of the parameter to check\n */\nexport function throwTypeErrorIfParameterMissing(\n methodName: string,\n parameterName: string,\n parameterValue: unknown,\n): void {\n if (parameterValue === undefined || parameterValue === null) {\n const error = new TypeError(\n `${methodName} called without required argument \"${parameterName}\"`,\n );\n logger.warning(error.message);\n logErrorStackTrace(error);\n throw error;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CheckpointStore,\n PartitionOwnership,\n Checkpoint,\n OperationOptions,\n} from \"@azure/event-hubs\";\nimport { Metadata, RestError, BlobSetMetadataResponse } from \"@azure/storage-blob\";\nimport { logger, logErrorStackTrace } from \"./log\";\nimport { ContainerClientLike } from \"./storageBlobInterfaces\";\nimport { throwTypeErrorIfParameterMissing } from \"./util/error\";\n\n/**\n * An implementation of CheckpointStore that uses Azure Blob Storage to persist checkpoint data.\n */\nexport class BlobCheckpointStore implements CheckpointStore {\n private _containerClient: ContainerClientLike;\n\n /**\n * Constructs a new instance of {@link BlobCheckpointStore}\n * @param containerClient - An instance of a storage blob ContainerClient.\n */\n constructor(containerClient: ContainerClientLike) {\n this._containerClient = containerClient;\n }\n /**\n * Get the list of all existing partition ownership from the underlying data store. May return empty\n * results if there are is no existing ownership information.\n * Partition Ownership contains the information on which `EventHubConsumerClient` subscribe call is currently processing the partition.\n *\n * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net.\n * @param eventHubName - The event hub name.\n * @param consumerGroup - The consumer group name.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n * @returns Partition ownership details of all the partitions that have had an owner.\n */\n async listOwnership(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n consumerGroup: string,\n options: OperationOptions = {},\n ): Promise<PartitionOwnership[]> {\n const partitionOwnershipArray: PartitionOwnership[] = [];\n const { abortSignal, tracingOptions } = options;\n\n const blobPrefix = BlobCheckpointStore.getBlobPrefix({\n type: \"ownership\",\n fullyQualifiedNamespace,\n eventHubName,\n consumerGroup: consumerGroup,\n });\n\n try {\n const blobs = this._containerClient.listBlobsFlat({\n abortSignal,\n includeMetadata: true,\n prefix: blobPrefix,\n tracingOptions,\n });\n\n for await (const blob of blobs) {\n const blobPath = blob.name.split(\"/\");\n const blobName = blobPath[blobPath.length - 1];\n\n const ownershipMetadata = (blob.metadata as OwnershipMetadata) ?? {};\n\n if (ownershipMetadata.ownerid == null) {\n throw new Error(`Missing ownerid in metadata for blob ${blob.name}`);\n }\n\n const partitionOwnership: PartitionOwnership = {\n fullyQualifiedNamespace,\n eventHubName,\n consumerGroup: consumerGroup,\n ownerId: ownershipMetadata.ownerid,\n partitionId: blobName,\n lastModifiedTimeInMs:\n blob.properties.lastModified && blob.properties.lastModified.getTime(),\n etag: blob.properties.etag,\n };\n partitionOwnershipArray.push(partitionOwnership);\n }\n return partitionOwnershipArray;\n } catch (err: any) {\n logger.warning(`Error occurred while fetching the list of blobs`, err.message);\n logErrorStackTrace(err);\n\n if (err?.name === \"AbortError\") throw err;\n\n throw new Error(`Error occurred while fetching the list of blobs. \\n${err}`);\n }\n }\n\n /**\n * Claim ownership of a list of partitions. This will return the list of partitions that were\n * successfully claimed.\n *\n * @param partitionOwnership - The list of partition ownership this instance is claiming to own.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n * @returns A list partitions this instance successfully claimed ownership.\n */\n async claimOwnership(\n partitionOwnership: PartitionOwnership[],\n options: OperationOptions = {},\n ): Promise<PartitionOwnership[]> {\n const partitionOwnershipArray: PartitionOwnership[] = [];\n for (const ownership of partitionOwnership) {\n const blobName = BlobCheckpointStore.getBlobPrefix({ type: \"ownership\", ...ownership });\n try {\n const updatedBlobResponse = await this._setBlobMetadata(\n blobName,\n {\n ownerid: ownership.ownerId,\n },\n ownership.etag,\n options,\n );\n\n if (updatedBlobResponse.lastModified) {\n ownership.lastModifiedTimeInMs = updatedBlobResponse.lastModified.getTime();\n }\n\n ownership.etag = updatedBlobResponse.etag;\n partitionOwnershipArray.push(ownership);\n logger.info(\n `[${ownership.ownerId}] Claimed ownership successfully for partition: ${ownership.partitionId}`,\n `LastModifiedTime: ${ownership.lastModifiedTimeInMs}, ETag: ${ownership.etag}`,\n );\n } catch (err: any) {\n const restError = err as RestError;\n\n if (restError.statusCode === 412) {\n // etag failures (precondition not met) aren't fatal errors. They happen\n // as multiple consumers attempt to claim the same partition (first one wins)\n // and losers get this error.\n logger.verbose(\n `[${ownership.ownerId}] Did not claim partition ${ownership.partitionId}. Another processor has already claimed it.`,\n );\n continue;\n }\n\n logger.warning(\n `Error occurred while claiming ownership for partition: ${ownership.partitionId}`,\n err.message,\n );\n logErrorStackTrace(err);\n\n throw err;\n }\n }\n return partitionOwnershipArray;\n }\n\n /**\n * Lists all the checkpoints in a data store for a given namespace, eventhub and consumer group.\n *\n * @param fullyQualifiedNamespace - The fully qualified Event Hubs namespace. This is likely to be similar to\n * <yournamespace>.servicebus.windows.net.\n * @param eventHubName - The event hub name.\n * @param consumerGroup - The consumer group name.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n */\n async listCheckpoints(\n fullyQualifiedNamespace: string,\n eventHubName: string,\n consumerGroup: string,\n options: OperationOptions = {},\n ): Promise<Checkpoint[]> {\n const { abortSignal, tracingOptions } = options;\n const blobPrefix = BlobCheckpointStore.getBlobPrefix({\n type: \"checkpoint\",\n fullyQualifiedNamespace,\n eventHubName,\n consumerGroup,\n });\n\n const blobs = this._containerClient.listBlobsFlat({\n abortSignal,\n includeMetadata: true,\n prefix: blobPrefix,\n tracingOptions,\n });\n\n const checkpoints: Checkpoint[] = [];\n\n for await (const blob of blobs) {\n const blobPath = blob.name.split(\"/\");\n const blobName = blobPath[blobPath.length - 1];\n\n const checkpointMetadata = (blob.metadata as CheckpointMetadata) ?? {};\n\n const offset = checkpointMetadata.offset;\n if (offset == null) {\n throw new Error(`Missing metadata property 'offset' on blob '${blobName}'`);\n }\n const sequenceNumber = parseIntOrThrow(\n blob.name,\n \"sequencenumber\",\n checkpointMetadata.sequencenumber,\n );\n\n checkpoints.push({\n consumerGroup,\n eventHubName,\n fullyQualifiedNamespace,\n partitionId: blobName,\n offset,\n sequenceNumber,\n });\n }\n\n return checkpoints;\n }\n\n /**\n * Updates the checkpoint in the data store for a partition.\n *\n * @param checkpoint - The checkpoint.\n * @param options - A set of options that can be specified to influence the behavior of this method.\n * - `abortSignal`: A signal used to request operation cancellation.\n * - `tracingOptions`: Options for configuring tracing.\n * @returns The new etag on successful update.\n */\n async updateCheckpoint(checkpoint: Checkpoint, options: OperationOptions = {}): Promise<void> {\n throwTypeErrorIfParameterMissing(\n \"updateCheckpoint\",\n \"sequenceNumber\",\n checkpoint.sequenceNumber,\n );\n throwTypeErrorIfParameterMissing(\"updateCheckpoint\", \"offset\", checkpoint.offset);\n\n const blobName = BlobCheckpointStore.getBlobPrefix({ type: \"checkpoint\", ...checkpoint });\n try {\n const metadataResponse = await this._setBlobMetadata(\n blobName,\n {\n sequencenumber: checkpoint.sequenceNumber.toString(),\n offset: checkpoint.offset.toString(),\n },\n undefined,\n options,\n );\n\n logger.verbose(\n `Updated checkpoint successfully for partition: ${checkpoint.partitionId}`,\n `LastModifiedTime: ${metadataResponse.lastModified!.toISOString()}, ETag: ${\n metadataResponse.etag\n }`,\n );\n return;\n } catch (err: any) {\n logger.warning(\n `Error occurred while upating the checkpoint for partition: ${checkpoint.partitionId}.`,\n err.message,\n );\n logErrorStackTrace(err);\n\n if (err?.name === \"AbortError\") throw err;\n\n throw new Error(\n `Error occurred while upating the checkpoint for partition: ${checkpoint.partitionId}, ${err}`,\n );\n }\n }\n\n private static getBlobPrefix(params: {\n type: \"ownership\" | \"checkpoint\";\n fullyQualifiedNamespace: string;\n eventHubName: string;\n consumerGroup: string;\n partitionId?: string;\n }): string {\n // none of these are case-sensitive in eventhubs so we need to make sure we don't accidentally allow\n // the user to create a case-sensitive blob for their state!\n const consumerGroupName = params.consumerGroup.toLowerCase();\n const eventHubName = params.eventHubName.toLowerCase();\n const fullyQualifiedNamespace = params.fullyQualifiedNamespace.toLowerCase();\n\n if (params.partitionId) {\n return `${fullyQualifiedNamespace}/${eventHubName}/${consumerGroupName}/${params.type}/${params.partitionId}`;\n } else {\n return `${fullyQualifiedNamespace}/${eventHubName}/${consumerGroupName}/${params.type}/`;\n }\n }\n\n private async _setBlobMetadata(\n blobName: string,\n metadata: OwnershipMetadata | CheckpointMetadata,\n etag: string | undefined,\n options: OperationOptions = {},\n ): Promise<BlobSetMetadataResponse> {\n const { abortSignal, tracingOptions } = options;\n const blockBlobClient = this._containerClient.getBlobClient(blobName).getBlockBlobClient();\n\n // When we have an etag, we know the blob existed.\n // If we encounter an error we should fail.\n if (etag) {\n return blockBlobClient.setMetadata(metadata as Metadata, {\n abortSignal,\n conditions: {\n ifMatch: etag,\n },\n tracingOptions,\n });\n } else {\n try {\n // Attempt to set metadata, and fallback to upload if the blob doesn't already exist.\n // This avoids poor performance in storage accounts with soft-delete or blob versioning enabled.\n // https://github.com/Azure/azure-sdk-for-js/issues/10132\n return await blockBlobClient.setMetadata(metadata as Metadata, {\n abortSignal,\n tracingOptions,\n });\n } catch (err: any) {\n // Check if the error is `BlobNotFound` and fallback to `upload` if it is.\n if (err?.name !== \"RestError\") {\n throw err;\n }\n const errorDetails = (err as RestError).details as { [field: string]: string } | undefined;\n const errorCode = errorDetails?.errorCode;\n if (!errorCode || errorCode !== \"BlobNotFound\") {\n throw err;\n }\n\n return blockBlobClient.upload(\"\", 0, {\n abortSignal,\n metadata: metadata as Metadata,\n tracingOptions,\n });\n }\n }\n }\n}\n\ntype OwnershipMetadata = {\n [k in \"ownerid\"]: string | undefined;\n};\n\ntype CheckpointMetadata = {\n [k in \"sequencenumber\" | \"offset\"]: string | undefined;\n};\n\n/**\n * @internal\n */\nexport function parseIntOrThrow(\n blobName: string,\n fieldName: string,\n numStr: string | undefined,\n): number {\n if (numStr == null) {\n throw new Error(`Missing metadata property '${fieldName}' on blob '${blobName}'`);\n }\n\n const num = parseInt(numStr, 10);\n\n if (isNaN(num)) {\n throw new Error(\n `Failed to parse metadata property '${fieldName}' on blob '${blobName}' as a number`,\n );\n }\n\n return num;\n}\n"],"names":["createClientLogger","__asyncValues"],"mappings":";;;;;;;AAAA;AACA;AAIA;;;AAGG;MACU,MAAM,GAAGA,2BAAkB,CAAC,gCAAgC,EAAE;AAE3E;;;;AAIG;AACG,SAAU,kBAAkB,CAAC,KAAc,EAAA;IAC/C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,EAAE;AAC1D,QAAA,MAAM,CAAC,OAAO,CAAE,KAAa,CAAC,KAAK,CAAC,CAAC;KACtC;AACH;;ACpBA;AACA;AAIA;;;;;;AAMG;SACa,gCAAgC,CAC9C,UAAkB,EAClB,aAAqB,EACrB,cAAuB,EAAA;IAEvB,IAAI,cAAc,KAAK,SAAS,IAA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