@azure/storage-blob-changefeed 12.0.0-alpha.20220412.1 → 12.0.0-alpha.20220418.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/dist/index.js +82 -9
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/Chunk.js +2 -8
- package/dist-esm/storage-blob-changefeed/src/Chunk.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/models/BlobChangeFeedEvent.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js +81 -0
- package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js.map +1 -1
- package/package.json +1 -1
- package/types/3.1/storage-blob-changefeed/src/models/BlobChangeFeedEvent.d.ts +140 -1
- package/types/3.1/storage-blob-changefeed/src/utils/utils.common.d.ts +2 -0
- package/types/3.1/storage-blob-changefeed/test/utils/testutils.common.d.ts +9 -1
- package/types/3.1/storage-blob-changefeed.d.ts +140 -1
- package/types/latest/storage-blob-changefeed/src/Chunk.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed/src/models/BlobChangeFeedEvent.d.ts +140 -1
- package/types/latest/storage-blob-changefeed/src/models/BlobChangeFeedEvent.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed/src/utils/utils.common.d.ts +2 -0
- package/types/latest/storage-blob-changefeed/src/utils/utils.common.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed/test/utils/testutils.common.d.ts +9 -1
- package/types/latest/storage-blob-changefeed/test/utils/testutils.common.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed.d.ts +146 -1
- package/types/latest/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
+
import { rawEventToBlobChangeFeedEvent } from "./utils/utils.common";
|
|
3
4
|
export class Chunk {
|
|
4
5
|
constructor(avroReader, blockOffset, eventIndex, chunkPath, avroOptions = {}) {
|
|
5
6
|
this.chunkPath = chunkPath;
|
|
@@ -32,14 +33,7 @@ export class Chunk {
|
|
|
32
33
|
if (eventRaw === null) {
|
|
33
34
|
return undefined;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
eventRaw.eventTime = new Date(eventRaw.eventTime);
|
|
37
|
-
}
|
|
38
|
-
if (eventRaw.eTag) {
|
|
39
|
-
eventRaw.etag = eventRaw.eTag;
|
|
40
|
-
delete eventRaw.eTag;
|
|
41
|
-
}
|
|
42
|
-
return eventRaw;
|
|
36
|
+
return rawEventToBlobChangeFeedEvent(eventRaw);
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chunk.js","sourceRoot":"","sources":["../../../src/Chunk.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"Chunk.js","sourceRoot":"","sources":["../../../src/Chunk.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAarE,MAAM,OAAO,KAAK;IAchB,YACE,UAAsB,EACtB,WAAmB,EACnB,UAAkB,EACF,SAAiB,EACjC,cAAgC,EAAE;QADlB,cAAS,GAAT,SAAS,CAAQ;QAGjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IArBD,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAGD,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAgBM,OAAO;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE;YACnB,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAC/C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAChD,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO,SAAS,CAAC;SAClB;aAAM;YACL,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;YAC5B,IAAI,QAAQ,KAAK,IAAI,EAAE;gBACrB,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;SAChD;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AvroReader } from \"../../storage-internal-avro/src\";\nimport { BlobChangeFeedEvent } from \"./models/BlobChangeFeedEvent\";\nimport { CommonOptions } from \"@azure/storage-blob\";\nimport { AbortSignalLike } from \"@azure/core-http\";\nimport { AvroParseOptions } from \"../../storage-internal-avro/src/AvroReader\";\nimport { rawEventToBlobChangeFeedEvent } from \"./utils/utils.common\";\n\n/**\n * Options to configure {@link Chunk.getChange} operation.\n */\nexport interface ChunkGetChangeOptions extends CommonOptions {\n /**\n * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.\n * For example, use the @azure/abort-controller to create an `AbortSignal`.\n */\n abortSignal?: AbortSignalLike;\n}\n\nexport class Chunk {\n private readonly avroReader: AvroReader;\n private readonly iter: AsyncIterableIterator<Record<string, any> | null>;\n\n private _blockOffset: number;\n public get blockOffset(): number {\n return this._blockOffset;\n }\n\n private _eventIndex: number;\n public get eventIndex(): number {\n return this._eventIndex;\n }\n\n constructor(\n avroReader: AvroReader,\n blockOffset: number,\n eventIndex: number,\n public readonly chunkPath: string,\n avroOptions: AvroParseOptions = {}\n ) {\n this.avroReader = avroReader;\n this._blockOffset = blockOffset;\n this._eventIndex = eventIndex;\n\n this.iter = this.avroReader.parseObjects(avroOptions);\n }\n\n public hasNext(): boolean {\n return this.avroReader.hasNext();\n }\n\n public async getChange(): Promise<BlobChangeFeedEvent | undefined> {\n if (!this.hasNext()) {\n return undefined;\n }\n\n const next = await this.iter.next();\n this._eventIndex = this.avroReader.objectIndex;\n this._blockOffset = this.avroReader.blockOffset;\n if (next.done) {\n return undefined;\n } else {\n const eventRaw = next.value;\n if (eventRaw === null) {\n return undefined;\n }\n\n return rawEventToBlobChangeFeedEvent(eventRaw);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlobChangeFeedEvent.js","sourceRoot":"","sources":["../../../../src/models/BlobChangeFeedEvent.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// https://msazure.visualstudio.com/One/_git/Storage-XStore?path=%2Fsrc%2FXTable%2FNotifications%2Flib%2FBlobChangeEventv4.json&version=GBmaster\n\n/**\n * Change feed event record types.\n */\nexport type BlobChangeFeedEventType =\n | \"UnspecifiedEventType\"\n | \"BlobCreated\"\n | \"BlobDeleted\"\n | \"BlobPropertiesUpdated\"\n | \"BlobSnapshotCreated\"\n | \"Control\"\n | \"BlobTierChanged\"\n | \"BlobAsyncOperationInitiated\"\n | \"BlobMetadataUpdated\";\n\n/**\n * Change feed event record. Contains response data for the {@link BlobChangeFeedClient.listChanges} operation.\n * @see https://docs.microsoft.com/en-us/azure/event-grid/event-schema-blob-storage?toc=/azure/storage/blobs/toc.json#event-properties\n */\nexport interface BlobChangeFeedEvent {\n /**\n * Full resource path to the event source. This field is not writeable. Event Grid provides this value.\n */\n topic: string;\n\n /**\n * Publisher-defined path to the event subject.\n */\n subject: string;\n\n /**\n * One of the registered event types for this event source.\n */\n eventType: BlobChangeFeedEventType;\n\n /**\n * The time the event is generated based on the provider's UTC time.\n */\n eventTime: Date;\n\n /**\n * Unique identifier for the event.\n */\n id: string; // GUID\n\n /**\n * Blob storage event data.\n */\n data: BlobChangeFeedEventData;\n\n /**\n * The schema version of the data object. The publisher defines the schema version.\n */\n dataVersion?: string;\n\n /**\n * The schema version of the event metadata. Event Grid defines the schema of the top-level properties. Event Grid provides this value.\n */\n metadataVersion: string;\n}\n\n/**\n * The type of blob.\n */\nexport type BlobType = \"BlockBlob\" | \"AppendBlob\" | \"PageBlob\";\n\n/**\n * Change feed Blob storage event data.\n */\nexport interface BlobChangeFeedEventData {\n /**\n * The operation that triggered the event.\n */\n api: string;\n\n /**\n * A client-provided request id for the storage API operation. This id can be used to\n * correlate to Azure Storage diagnostic logs using the \"client-request-id\" field in the logs,\n * and can be provided in client requests using the \"x-ms-client-request-id\" header.\n */\n clientRequestId: string; // GUID\n\n /**\n * Service-generated request id for the storage API operation. Can be used to correlate to Azure Storage\n * diagnostic logs using the \"request-id-header\" field in the logs and is returned from initiating API call\n * in the 'x-ms-request-id' header.\n */\n requestId: string; // GUID\n\n /**\n * The value that you can use to perform operations conditionally.\n */\n etag: string;\n\n /**\n * The content type specified for the blob.\n */\n contentType: string;\n\n /**\n * The size of the blob in bytes.\n */\n contentLength: number;\n\n /**\n * The type of blob.\n */\n blobType: BlobType;\n\n /**\n * The path to the blob. If the client uses a Blob REST API, then the url has this structure:\n * <storage-account-name>.blob.core.windows.net/<container-name>/<file-name>.\n */\n url: string;\n\n /**\n * An opaque string value representing the logical sequence of events for any particular blob name.\n * Users can use standard string comparison to understand the relative sequence of two events on the same blob name.\n */\n sequencer: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BlobChangeFeedEvent.js","sourceRoot":"","sources":["../../../../src/models/BlobChangeFeedEvent.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// https://msazure.visualstudio.com/One/_git/Storage-XStore?path=%2Fsrc%2FXTable%2FNotifications%2Flib%2FBlobChangeEventv4.json&version=GBmaster\n\n/**\n * Change feed event record types.\n */\nexport type BlobChangeFeedEventType =\n | \"UnspecifiedEventType\"\n | \"BlobCreated\"\n | \"BlobDeleted\"\n | \"BlobPropertiesUpdated\"\n | \"BlobSnapshotCreated\"\n | \"Control\"\n | \"BlobTierChanged\"\n | \"BlobAsyncOperationInitiated\"\n | \"BlobMetadataUpdated\"\n | \"RestorePointMarkerCreated\";\n\n/**\n * Change feed event record. Contains response data for the {@link BlobChangeFeedClient.listChanges} operation.\n * @see https://docs.microsoft.com/en-us/azure/event-grid/event-schema-blob-storage?toc=/azure/storage/blobs/toc.json#event-properties\n */\nexport interface BlobChangeFeedEvent {\n /**\n * Full resource path to the event source. This field is not writeable. Event Grid provides this value.\n */\n topic: string;\n\n /**\n * Publisher-defined path to the event subject.\n */\n subject: string;\n\n /**\n * One of the registered event types for this event source.\n */\n eventType: BlobChangeFeedEventType;\n\n /**\n * The time the event is generated based on the provider's UTC time.\n */\n eventTime: Date;\n\n /**\n * Unique identifier for the event.\n */\n id: string; // GUID\n\n /**\n * Blob storage event data.\n */\n data: BlobChangeFeedEventData;\n\n /**\n * The schema version of the data object. The publisher defines the schema version.\n */\n dataVersion?: string;\n\n /**\n * The schema version of the data object. The publisher defines the schema version.\n */\n schemaVersion?: number;\n\n /**\n * The schema version of the event metadata. Event Grid defines the schema of the top-level properties. Event Grid provides this value.\n */\n metadataVersion: string;\n}\n\n/**\n * The type of blob.\n */\nexport type BlobType = \"BlockBlob\" | \"AppendBlob\" | \"PageBlob\";\n\n/**\n * The AccessTier.\n */\nexport type AccessTier =\n | \"P4\"\n | \"P6\"\n | \"P10\"\n | \"P15\"\n | \"P20\"\n | \"P30\"\n | \"P40\"\n | \"P50\"\n | \"P60\"\n | \"P70\"\n | \"P80\"\n | \"Hot\"\n | \"Cool\"\n | \"Archive\";\n\n/**\n * A blob property that was updated.\n */\nexport interface BlobPropertyChange {\n /**\n * The name of the property that was updated.\n */\n propertyName: string;\n /**\n * The previous value of the property.\n */\n oldValue: string;\n /**\n * The new value of the property.\n */\n newValue: string;\n}\n/**\n * Blob properties that were updated during an event.\n */\nexport type UpdatedBlobProperties = Record<string, BlobPropertyChange>;\n/**\n * Previous info for Change Feed Event.\n */\nexport interface ChangeFeedEventPreviousInfo {\n /**\n * Soft delete snapshot.\n */\n softDeleteSnapshot?: string;\n /**\n * If the blob was soft deleted.\n */\n isBlobSoftDeleted: boolean;\n /**\n * Blob version.\n */\n newBlobVersion?: string;\n /**\n * Last version.\n */\n oldBlobVersion?: string;\n /**\n * Previous Access Tier\n */\n previousTier?: AccessTier;\n}\n\n/**\n * ChangeFeedEvent AsyncOperationInfo\n */\nexport interface BlobOperationResult {\n /**\n * Destination access tier.\n */\n destinationAccessTier?: AccessTier;\n /**\n * If the operation was async.\n */\n isAsync: boolean;\n /**\n * Copy Id.\n */\n copyId?: string;\n}\n\n/**\n * Blob tags that were updated as part of the change feed event.\n */\nexport interface BlobTagsChange {\n /**\n * Previous Tags.\n */\n oldTags: Record<string, string>;\n /**\n * New Tags.\n */\n newTags: Record<string, string>;\n}\n\n/**\n * Change feed Blob storage event data.\n */\nexport interface BlobChangeFeedEventData {\n /**\n * The operation that triggered the event.\n */\n api: string;\n\n /**\n * A client-provided request id for the storage API operation. This id can be used to\n * correlate to Azure Storage diagnostic logs using the \"client-request-id\" field in the logs,\n * and can be provided in client requests using the \"x-ms-client-request-id\" header.\n */\n clientRequestId: string; // GUID\n\n /**\n * Service-generated request id for the storage API operation. Can be used to correlate to Azure Storage\n * diagnostic logs using the \"request-id-header\" field in the logs and is returned from initiating API call\n * in the 'x-ms-request-id' header.\n */\n requestId: string; // GUID\n\n /**\n * The value that you can use to perform operations conditionally.\n */\n etag: string;\n\n /**\n * The content type specified for the blob.\n */\n contentType: string;\n\n /**\n * The size of the blob in bytes.\n */\n contentLength: number;\n\n /**\n * The offset in bytes of a write operation taken at the point where the event-triggering application completed\n * writing to the file.\n * Appears only for events triggered on blob storage accounts that have a hierarchical namespace.\n */\n contentOffset?: number;\n\n /**\n * The type of blob.\n */\n blobType: BlobType;\n\n /**\n * The path to the blob. If the client uses a Blob REST API, then the url has this structure:\n * <storage-account-name>.blob.core.windows.net/<container-name>/<file-name>.\n */\n url: string;\n\n /**\n * The url of the file that will exist after the operation completes. For example, if a file is renamed,\n * the destinationUrl property contains the url of the new file name.\n * Appears only for events triggered on blob storage accounts that have a hierarchical namespace.\n */\n destinationUrl?: string;\n\n /**\n * The url of the file that exists prior to the operation. For example, if a file is renamed, the sourceUrl\n * contains the url of the original file name prior to the rename operation.\n * Appears only for events triggered on blob storage accounts that have a hierarchical namespace.\n */\n sourceUrl?: string;\n\n /**\n * True to perform the operation on all child directories; otherwise False.\n * Appears only for events triggered on blob storage accounts that have a hierarchical namespace.\n */\n isRecursive?: boolean;\n\n /**\n * An opaque string value representing the logical sequence of events for any particular blob name.\n * Users can use standard string comparison to understand the relative sequence of two events on the same blob name.\n */\n sequencer: string;\n\n /**\n * Previous info for the blob.\n */\n previousInfo?: ChangeFeedEventPreviousInfo;\n\n /**\n * Blob properties that were updated during this event.\n */\n updatedBlobProperties?: UpdatedBlobProperties;\n\n /**\n * Blob tags that were updated during this event.\n */\n updatedBlobTags?: BlobTagsChange;\n\n /**\n * The Snapshot associated with the event.\n */\n snapshot?: string;\n\n /**\n * Version of the blob.\n */\n blobVersion?: string;\n\n /**\n * Version of the container the blob is in.\n */\n containerVersion?: string;\n\n /**\n * Access Tier of the blob.\n */\n blobAccessTier?: AccessTier;\n /**\n * AsyncOperationInfo\n */\n longRunningOperationInfo?: BlobOperationResult;\n}\n"]}
|
|
@@ -151,4 +151,85 @@ export function minDate(dateA, dateB) {
|
|
|
151
151
|
}
|
|
152
152
|
return dateA;
|
|
153
153
|
}
|
|
154
|
+
export function rawEventToBlobChangeFeedEvent(rawEvent) {
|
|
155
|
+
if (rawEvent.eventTime) {
|
|
156
|
+
rawEvent.eventTime = new Date(rawEvent.eventTime);
|
|
157
|
+
}
|
|
158
|
+
if (rawEvent.eTag) {
|
|
159
|
+
rawEvent.etag = rawEvent.eTag;
|
|
160
|
+
delete rawEvent.eTag;
|
|
161
|
+
}
|
|
162
|
+
if (rawEvent.data) {
|
|
163
|
+
if (rawEvent.data.recursive !== undefined) {
|
|
164
|
+
rawEvent.data.isRecursive = rawEvent.data.recursive;
|
|
165
|
+
delete rawEvent.data.recursive;
|
|
166
|
+
}
|
|
167
|
+
if (rawEvent.data.previousInfo) {
|
|
168
|
+
const previousInfo = rawEvent.data.previousInfo;
|
|
169
|
+
if (previousInfo.SoftDeleteSnapshot) {
|
|
170
|
+
previousInfo.softDeleteSnapshot = previousInfo.SoftDeleteSnapshot;
|
|
171
|
+
delete previousInfo.SoftDeleteSnapshot;
|
|
172
|
+
}
|
|
173
|
+
if (previousInfo.WasBlobSoftDeleted) {
|
|
174
|
+
previousInfo.isBlobSoftDeleted = previousInfo.WasBlobSoftDeleted;
|
|
175
|
+
delete previousInfo.WasBlobSoftDeleted;
|
|
176
|
+
}
|
|
177
|
+
if (previousInfo.BlobVersion) {
|
|
178
|
+
previousInfo.newBlobVersion = previousInfo.BlobVersion;
|
|
179
|
+
delete previousInfo.BlobVersion;
|
|
180
|
+
}
|
|
181
|
+
if (previousInfo.LastVersion) {
|
|
182
|
+
previousInfo.oldBlobVersion = previousInfo.LastVersion;
|
|
183
|
+
delete previousInfo.LastVersion;
|
|
184
|
+
}
|
|
185
|
+
if (previousInfo.PreviousTier) {
|
|
186
|
+
previousInfo.previousTier = previousInfo.PreviousTier;
|
|
187
|
+
delete previousInfo.PreviousTier;
|
|
188
|
+
}
|
|
189
|
+
rawEvent.data.previousInfo = previousInfo;
|
|
190
|
+
}
|
|
191
|
+
if (rawEvent.data.blobPropertiesUpdated) {
|
|
192
|
+
const updatedBlobProperties = {};
|
|
193
|
+
Object.entries(rawEvent.data.blobPropertiesUpdated).map((item) => {
|
|
194
|
+
const blobPropertyChange = {
|
|
195
|
+
propertyName: item[0],
|
|
196
|
+
oldValue: item[1].previous,
|
|
197
|
+
newValue: item[1].current,
|
|
198
|
+
};
|
|
199
|
+
updatedBlobProperties[item[0]] = blobPropertyChange;
|
|
200
|
+
});
|
|
201
|
+
rawEvent.data.updatedBlobProperties = updatedBlobProperties;
|
|
202
|
+
delete rawEvent.data.blobPropertiesUpdated;
|
|
203
|
+
}
|
|
204
|
+
if (rawEvent.data.asyncOperationInfo) {
|
|
205
|
+
const longRunningOperationInfo = rawEvent.data.asyncOperationInfo;
|
|
206
|
+
if (longRunningOperationInfo.DestinationTier) {
|
|
207
|
+
longRunningOperationInfo.destinationAccessTier = longRunningOperationInfo.DestinationTier;
|
|
208
|
+
delete longRunningOperationInfo.DestinationTier;
|
|
209
|
+
}
|
|
210
|
+
if ("WasAsyncOperation" in longRunningOperationInfo) {
|
|
211
|
+
longRunningOperationInfo.isAsync = longRunningOperationInfo.WasAsyncOperation === "true";
|
|
212
|
+
delete longRunningOperationInfo.WasAsyncOperation;
|
|
213
|
+
}
|
|
214
|
+
if (longRunningOperationInfo.CopyId) {
|
|
215
|
+
longRunningOperationInfo.copyId = longRunningOperationInfo.CopyId;
|
|
216
|
+
delete longRunningOperationInfo.CopyId;
|
|
217
|
+
}
|
|
218
|
+
rawEvent.data.longRunningOperationInfo = longRunningOperationInfo;
|
|
219
|
+
delete rawEvent.data.asyncOperationInfo;
|
|
220
|
+
}
|
|
221
|
+
if (rawEvent.data.blobTagsUpdated) {
|
|
222
|
+
rawEvent.data.updatedBlobTags = {
|
|
223
|
+
newTags: rawEvent.data.blobTagsUpdated.current,
|
|
224
|
+
oldTags: rawEvent.data.blobTagsUpdated.previous,
|
|
225
|
+
};
|
|
226
|
+
delete rawEvent.data.blobTagsUpdated;
|
|
227
|
+
}
|
|
228
|
+
if (rawEvent.data.blobTier) {
|
|
229
|
+
rawEvent.data.blobAccessTier = rawEvent.data.blobTier;
|
|
230
|
+
delete rawEvent.data.blobTier;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return rawEvent;
|
|
234
|
+
}
|
|
154
235
|
//# sourceMappingURL=utils.common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.common.js","sourceRoot":"","sources":["../../../../src/utils/utils.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,0BAA0B,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5C,MAAM,UAAU,iBAAiB,CAAC,IAAsB;IACtD,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,oBAAoB,CAAC,GAAG,oBAAoB,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAsB;IACvD,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,oBAAoB,CAAC,GAAG,oBAAoB,CAAC,CAAC;AAC5F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,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EAAE;QACzB,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;KACvD;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAW,EAAE,KAAY;IAC/C,IAAI,KAAK,IAAI,KAAK,GAAG,KAAK,EAAE;QAC1B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { URLBuilder, AbortSignalLike } from \"@azure/core-http\";\nimport { ContainerClient, CommonOptions } from \"@azure/storage-blob\";\nimport { CHANGE_FEED_SEGMENT_PREFIX, CHANGE_FEED_INITIALIZATION_SEGMENT } from \"./constants\";\nimport { createSpan } from \"./tracing\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\n\nconst millisecondsInAnHour = 60 * 60 * 1000;\nexport function ceilToNearestHour(date: Date | undefined): Date | undefined {\n if (date === undefined) {\n return undefined;\n }\n return new Date(Math.ceil(date.getTime() / millisecondsInAnHour) * millisecondsInAnHour);\n}\n\nexport function floorToNearestHour(date: Date | undefined): Date | undefined {\n if (date === undefined) {\n return undefined;\n }\n return new Date(Math.floor(date.getTime() / millisecondsInAnHour) * millisecondsInAnHour);\n}\n\n/**\n * Get host from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getHost(url: string): string | undefined {\n const urlParsed = URLBuilder.parse(url);\n return urlParsed.getHost();\n}\n\n/**\n * Get URI from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURI(url: string): string {\n const urlParsed = URLBuilder.parse(url);\n return `${urlParsed.getHost()}${urlParsed.getPort()}${urlParsed.getPath()}`;\n}\n\n// s[0]*31^(n - 1) + s[1]*31^(n - 2) + ... + s[n - 1]\nexport function hashString(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i);\n hash |= 0; // Bit operation converts operands to 32-bit integers\n }\n return hash;\n}\n\n/**\n * Options to configure {@link getYearsPaths} operation.\n */\nexport interface GetYearsPathsOptions extends CommonOptions {\n /**\n * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.\n * For example, use the @azure/abort-controller to create an `AbortSignal`.\n */\n abortSignal?: AbortSignalLike;\n}\n\nexport async function getYearsPaths(\n containerClient: ContainerClient,\n options: GetYearsPathsOptions = {}\n): Promise<number[]> {\n const { span, updatedOptions } = createSpan(\"getYearsPaths\", options);\n try {\n const years: number[] = [];\n for await (const item of containerClient.listBlobsByHierarchy(\"/\", {\n abortSignal: options.abortSignal,\n tracingOptions: updatedOptions.tracingOptions,\n prefix: CHANGE_FEED_SEGMENT_PREFIX,\n })) {\n if (item.kind === \"prefix\" && !item.name.includes(CHANGE_FEED_INITIALIZATION_SEGMENT)) {\n const yearStr = item.name.slice(CHANGE_FEED_SEGMENT_PREFIX.length, -1);\n years.push(parseInt(yearStr));\n }\n }\n return years.sort((a, b) => a - b);\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/**\n * Options to configure {@link getSegmentsInYear} operation.\n */\nexport interface GetSegmentsInYearOptions extends CommonOptions {\n /**\n * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.\n * For example, use the @azure/abort-controller to create an `AbortSignal`.\n */\n abortSignal?: AbortSignalLike;\n}\n\nexport async function getSegmentsInYear(\n containerClient: ContainerClient,\n year: number,\n startTime?: Date,\n endTime?: Date,\n options: GetSegmentsInYearOptions = {}\n): Promise<string[]> {\n const { span, updatedOptions } = createSpan(\"getSegmentsInYear\", options);\n\n try {\n const segments: string[] = [];\n const yearBeginTime = new Date(Date.UTC(year, 0));\n if (endTime && yearBeginTime >= endTime) {\n return segments;\n }\n\n const prefix = `${CHANGE_FEED_SEGMENT_PREFIX}${year}/`;\n for await (const item of containerClient.listBlobsFlat({\n prefix,\n abortSignal: options.abortSignal,\n tracingOptions: updatedOptions.tracingOptions,\n })) {\n const segmentTime = parseDateFromSegmentPath(item.name);\n if ((startTime && segmentTime < startTime) || (endTime && segmentTime >= endTime)) {\n continue;\n }\n segments.push(item.name);\n }\n return segments;\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\nexport function parseDateFromSegmentPath(segmentPath: string): Date {\n const splitPath = segmentPath.split(\"/\");\n if (splitPath.length < 3) {\n throw new Error(`${segmentPath} is not a valid segment path.`);\n }\n\n const segmentTime = new Date(0);\n segmentTime.setUTCFullYear(parseInt(splitPath[2]));\n\n if (splitPath.length >= 4) {\n segmentTime.setUTCMonth(parseInt(splitPath[3]) - 1);\n }\n if (splitPath.length >= 5) {\n segmentTime.setUTCDate(parseInt(splitPath[4]));\n }\n if (splitPath.length >= 6) {\n segmentTime.setUTCHours(parseInt(splitPath[5]) / 100);\n }\n return segmentTime;\n}\n\nexport function minDate(dateA: Date, dateB?: Date): Date {\n if (dateB && dateB < dateA) {\n return dateB;\n }\n return dateA;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.common.js","sourceRoot":"","sources":["../../../../src/utils/utils.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,0BAA0B,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5C,MAAM,UAAU,iBAAiB,CAAC,IAAsB;IACtD,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,IAAI,CAAC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QAAQ;aAChD,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC;SACtC;QAED,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC1B,QAAQ,CAAC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;YACtD,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;SAC/B;KACF;IAED,OAAO,QAA+B,CAAC;AACzC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { URLBuilder, AbortSignalLike } from \"@azure/core-http\";\nimport { ContainerClient, CommonOptions } from \"@azure/storage-blob\";\nimport { CHANGE_FEED_SEGMENT_PREFIX, CHANGE_FEED_INITIALIZATION_SEGMENT } from \"./constants\";\nimport { createSpan } from \"./tracing\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { BlobChangeFeedEvent, UpdatedBlobProperties } from \"../models/BlobChangeFeedEvent\";\n\nconst millisecondsInAnHour = 60 * 60 * 1000;\nexport function ceilToNearestHour(date: Date | undefined): Date | undefined {\n if (date === undefined) {\n return undefined;\n }\n return new Date(Math.ceil(date.getTime() / millisecondsInAnHour) * millisecondsInAnHour);\n}\n\nexport function floorToNearestHour(date: Date | undefined): Date | undefined {\n if (date === undefined) {\n return undefined;\n }\n return new Date(Math.floor(date.getTime() / millisecondsInAnHour) * millisecondsInAnHour);\n}\n\n/**\n * Get host from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getHost(url: string): string | undefined {\n const urlParsed = URLBuilder.parse(url);\n return urlParsed.getHost();\n}\n\n/**\n * Get URI from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURI(url: string): string {\n const urlParsed = URLBuilder.parse(url);\n return `${urlParsed.getHost()}${urlParsed.getPort()}${urlParsed.getPath()}`;\n}\n\n// s[0]*31^(n - 1) + s[1]*31^(n - 2) + ... + s[n - 1]\nexport function hashString(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i);\n hash |= 0; // Bit operation converts operands to 32-bit integers\n }\n return hash;\n}\n\n/**\n * Options to configure {@link getYearsPaths} operation.\n */\nexport interface GetYearsPathsOptions extends CommonOptions {\n /**\n * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.\n * For example, use the @azure/abort-controller to create an `AbortSignal`.\n */\n abortSignal?: AbortSignalLike;\n}\n\nexport async function getYearsPaths(\n containerClient: ContainerClient,\n options: GetYearsPathsOptions = {}\n): Promise<number[]> {\n const { span, updatedOptions } = createSpan(\"getYearsPaths\", options);\n try {\n const years: number[] = [];\n for await (const item of containerClient.listBlobsByHierarchy(\"/\", {\n abortSignal: options.abortSignal,\n tracingOptions: updatedOptions.tracingOptions,\n prefix: CHANGE_FEED_SEGMENT_PREFIX,\n })) {\n if (item.kind === \"prefix\" && !item.name.includes(CHANGE_FEED_INITIALIZATION_SEGMENT)) {\n const yearStr = item.name.slice(CHANGE_FEED_SEGMENT_PREFIX.length, -1);\n years.push(parseInt(yearStr));\n }\n }\n return years.sort((a, b) => a - b);\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/**\n * Options to configure {@link getSegmentsInYear} operation.\n */\nexport interface GetSegmentsInYearOptions extends CommonOptions {\n /**\n * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation.\n * For example, use the @azure/abort-controller to create an `AbortSignal`.\n */\n abortSignal?: AbortSignalLike;\n}\n\nexport async function getSegmentsInYear(\n containerClient: ContainerClient,\n year: number,\n startTime?: Date,\n endTime?: Date,\n options: GetSegmentsInYearOptions = {}\n): Promise<string[]> {\n const { span, updatedOptions } = createSpan(\"getSegmentsInYear\", options);\n\n try {\n const segments: string[] = [];\n const yearBeginTime = new Date(Date.UTC(year, 0));\n if (endTime && yearBeginTime >= endTime) {\n return segments;\n }\n\n const prefix = `${CHANGE_FEED_SEGMENT_PREFIX}${year}/`;\n for await (const item of containerClient.listBlobsFlat({\n prefix,\n abortSignal: options.abortSignal,\n tracingOptions: updatedOptions.tracingOptions,\n })) {\n const segmentTime = parseDateFromSegmentPath(item.name);\n if ((startTime && segmentTime < startTime) || (endTime && segmentTime >= endTime)) {\n continue;\n }\n segments.push(item.name);\n }\n return segments;\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\nexport function parseDateFromSegmentPath(segmentPath: string): Date {\n const splitPath = segmentPath.split(\"/\");\n if (splitPath.length < 3) {\n throw new Error(`${segmentPath} is not a valid segment path.`);\n }\n\n const segmentTime = new Date(0);\n segmentTime.setUTCFullYear(parseInt(splitPath[2]));\n\n if (splitPath.length >= 4) {\n segmentTime.setUTCMonth(parseInt(splitPath[3]) - 1);\n }\n if (splitPath.length >= 5) {\n segmentTime.setUTCDate(parseInt(splitPath[4]));\n }\n if (splitPath.length >= 6) {\n segmentTime.setUTCHours(parseInt(splitPath[5]) / 100);\n }\n return segmentTime;\n}\n\nexport function minDate(dateA: Date, dateB?: Date): Date {\n if (dateB && dateB < dateA) {\n return dateB;\n }\n return dateA;\n}\n\nexport function rawEventToBlobChangeFeedEvent(rawEvent: Record<string, any>): BlobChangeFeedEvent {\n if (rawEvent.eventTime) {\n rawEvent.eventTime = new Date(rawEvent.eventTime);\n }\n if (rawEvent.eTag) {\n rawEvent.etag = rawEvent.eTag;\n delete rawEvent.eTag;\n }\n if (rawEvent.data) {\n if (rawEvent.data.recursive !== undefined) {\n rawEvent.data.isRecursive = rawEvent.data.recursive;\n delete rawEvent.data.recursive;\n }\n if (rawEvent.data.previousInfo) {\n const previousInfo = rawEvent.data.previousInfo;\n\n if (previousInfo.SoftDeleteSnapshot) {\n previousInfo.softDeleteSnapshot = previousInfo.SoftDeleteSnapshot;\n delete previousInfo.SoftDeleteSnapshot;\n }\n if (previousInfo.WasBlobSoftDeleted) {\n previousInfo.isBlobSoftDeleted = previousInfo.WasBlobSoftDeleted;\n delete previousInfo.WasBlobSoftDeleted;\n }\n if (previousInfo.BlobVersion) {\n previousInfo.newBlobVersion = previousInfo.BlobVersion;\n delete previousInfo.BlobVersion;\n }\n if (previousInfo.LastVersion) {\n previousInfo.oldBlobVersion = previousInfo.LastVersion;\n delete previousInfo.LastVersion;\n }\n if (previousInfo.PreviousTier) {\n previousInfo.previousTier = previousInfo.PreviousTier;\n delete previousInfo.PreviousTier;\n }\n\n rawEvent.data.previousInfo = previousInfo;\n }\n\n if (rawEvent.data.blobPropertiesUpdated) {\n const updatedBlobProperties: UpdatedBlobProperties = {};\n Object.entries(rawEvent.data.blobPropertiesUpdated).map((item) => {\n const blobPropertyChange = {\n propertyName: item[0],\n oldValue: (item[1] as any).previous as string,\n newValue: (item[1] as any).current as string,\n };\n updatedBlobProperties[item[0]] = blobPropertyChange;\n });\n rawEvent.data.updatedBlobProperties = updatedBlobProperties;\n delete rawEvent.data.blobPropertiesUpdated;\n }\n\n if (rawEvent.data.asyncOperationInfo) {\n const longRunningOperationInfo = rawEvent.data.asyncOperationInfo;\n if (longRunningOperationInfo.DestinationTier) {\n longRunningOperationInfo.destinationAccessTier = longRunningOperationInfo.DestinationTier;\n delete longRunningOperationInfo.DestinationTier;\n }\n if (\"WasAsyncOperation\" in longRunningOperationInfo) {\n longRunningOperationInfo.isAsync = longRunningOperationInfo.WasAsyncOperation === \"true\";\n delete longRunningOperationInfo.WasAsyncOperation;\n }\n if (longRunningOperationInfo.CopyId) {\n longRunningOperationInfo.copyId = longRunningOperationInfo.CopyId;\n delete longRunningOperationInfo.CopyId;\n }\n rawEvent.data.longRunningOperationInfo = longRunningOperationInfo;\n delete rawEvent.data.asyncOperationInfo;\n }\n\n if (rawEvent.data.blobTagsUpdated) {\n rawEvent.data.updatedBlobTags = {\n newTags: rawEvent.data.blobTagsUpdated.current,\n oldTags: rawEvent.data.blobTagsUpdated.previous,\n };\n\n delete rawEvent.data.blobTagsUpdated;\n }\n\n if (rawEvent.data.blobTier) {\n rawEvent.data.blobAccessTier = rawEvent.data.blobTier;\n delete rawEvent.data.blobTier;\n }\n }\n\n return rawEvent as BlobChangeFeedEvent;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/storage-blob-changefeed",
|
|
3
3
|
"sdk-type": "client",
|
|
4
|
-
"version": "12.0.0-alpha.
|
|
4
|
+
"version": "12.0.0-alpha.20220418.2",
|
|
5
5
|
"description": "Microsoft Azure Storage SDK for JavaScript - Blob Change Feed",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist-esm/storage-blob-changefeed/src/index.js",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Change feed event record types.
|
|
3
3
|
*/
|
|
4
|
-
export declare type BlobChangeFeedEventType = "UnspecifiedEventType" | "BlobCreated" | "BlobDeleted" | "BlobPropertiesUpdated" | "BlobSnapshotCreated" | "Control" | "BlobTierChanged" | "BlobAsyncOperationInitiated" | "BlobMetadataUpdated";
|
|
4
|
+
export declare type BlobChangeFeedEventType = "UnspecifiedEventType" | "BlobCreated" | "BlobDeleted" | "BlobPropertiesUpdated" | "BlobSnapshotCreated" | "Control" | "BlobTierChanged" | "BlobAsyncOperationInitiated" | "BlobMetadataUpdated" | "RestorePointMarkerCreated";
|
|
5
5
|
/**
|
|
6
6
|
* Change feed event record. Contains response data for the {@link BlobChangeFeedClient.listChanges} operation.
|
|
7
7
|
* @see https://docs.microsoft.com/en-us/azure/event-grid/event-schema-blob-storage?toc=/azure/storage/blobs/toc.json#event-properties
|
|
@@ -35,6 +35,10 @@ export interface BlobChangeFeedEvent {
|
|
|
35
35
|
* The schema version of the data object. The publisher defines the schema version.
|
|
36
36
|
*/
|
|
37
37
|
dataVersion?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The schema version of the data object. The publisher defines the schema version.
|
|
40
|
+
*/
|
|
41
|
+
schemaVersion?: number;
|
|
38
42
|
/**
|
|
39
43
|
* The schema version of the event metadata. Event Grid defines the schema of the top-level properties. Event Grid provides this value.
|
|
40
44
|
*/
|
|
@@ -44,6 +48,86 @@ export interface BlobChangeFeedEvent {
|
|
|
44
48
|
* The type of blob.
|
|
45
49
|
*/
|
|
46
50
|
export declare type BlobType = "BlockBlob" | "AppendBlob" | "PageBlob";
|
|
51
|
+
/**
|
|
52
|
+
* The AccessTier.
|
|
53
|
+
*/
|
|
54
|
+
export declare type AccessTier = "P4" | "P6" | "P10" | "P15" | "P20" | "P30" | "P40" | "P50" | "P60" | "P70" | "P80" | "Hot" | "Cool" | "Archive";
|
|
55
|
+
/**
|
|
56
|
+
* A blob property that was updated.
|
|
57
|
+
*/
|
|
58
|
+
export interface BlobPropertyChange {
|
|
59
|
+
/**
|
|
60
|
+
* The name of the property that was updated.
|
|
61
|
+
*/
|
|
62
|
+
propertyName: string;
|
|
63
|
+
/**
|
|
64
|
+
* The previous value of the property.
|
|
65
|
+
*/
|
|
66
|
+
oldValue: string;
|
|
67
|
+
/**
|
|
68
|
+
* The new value of the property.
|
|
69
|
+
*/
|
|
70
|
+
newValue: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Blob properties that were updated during an event.
|
|
74
|
+
*/
|
|
75
|
+
export declare type UpdatedBlobProperties = Record<string, BlobPropertyChange>;
|
|
76
|
+
/**
|
|
77
|
+
* Previous info for Change Feed Event.
|
|
78
|
+
*/
|
|
79
|
+
export interface ChangeFeedEventPreviousInfo {
|
|
80
|
+
/**
|
|
81
|
+
* Soft delete snapshot.
|
|
82
|
+
*/
|
|
83
|
+
softDeleteSnapshot?: string;
|
|
84
|
+
/**
|
|
85
|
+
* If the blob was soft deleted.
|
|
86
|
+
*/
|
|
87
|
+
isBlobSoftDeleted: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Blob version.
|
|
90
|
+
*/
|
|
91
|
+
newBlobVersion?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Last version.
|
|
94
|
+
*/
|
|
95
|
+
oldBlobVersion?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Previous Access Tier
|
|
98
|
+
*/
|
|
99
|
+
previousTier?: AccessTier;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* ChangeFeedEvent AsyncOperationInfo
|
|
103
|
+
*/
|
|
104
|
+
export interface BlobOperationResult {
|
|
105
|
+
/**
|
|
106
|
+
* Destination access tier.
|
|
107
|
+
*/
|
|
108
|
+
destinationAccessTier?: AccessTier;
|
|
109
|
+
/**
|
|
110
|
+
* If the operation was async.
|
|
111
|
+
*/
|
|
112
|
+
isAsync: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Copy Id.
|
|
115
|
+
*/
|
|
116
|
+
copyId?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Blob tags that were updated as part of the change feed event.
|
|
120
|
+
*/
|
|
121
|
+
export interface BlobTagsChange {
|
|
122
|
+
/**
|
|
123
|
+
* Previous Tags.
|
|
124
|
+
*/
|
|
125
|
+
oldTags: Record<string, string>;
|
|
126
|
+
/**
|
|
127
|
+
* New Tags.
|
|
128
|
+
*/
|
|
129
|
+
newTags: Record<string, string>;
|
|
130
|
+
}
|
|
47
131
|
/**
|
|
48
132
|
* Change feed Blob storage event data.
|
|
49
133
|
*/
|
|
@@ -76,6 +160,12 @@ export interface BlobChangeFeedEventData {
|
|
|
76
160
|
* The size of the blob in bytes.
|
|
77
161
|
*/
|
|
78
162
|
contentLength: number;
|
|
163
|
+
/**
|
|
164
|
+
* The offset in bytes of a write operation taken at the point where the event-triggering application completed
|
|
165
|
+
* writing to the file.
|
|
166
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
167
|
+
*/
|
|
168
|
+
contentOffset?: number;
|
|
79
169
|
/**
|
|
80
170
|
* The type of blob.
|
|
81
171
|
*/
|
|
@@ -85,10 +175,59 @@ export interface BlobChangeFeedEventData {
|
|
|
85
175
|
* <storage-account-name>.blob.core.windows.net/<container-name>/<file-name>.
|
|
86
176
|
*/
|
|
87
177
|
url: string;
|
|
178
|
+
/**
|
|
179
|
+
* The url of the file that will exist after the operation completes. For example, if a file is renamed,
|
|
180
|
+
* the destinationUrl property contains the url of the new file name.
|
|
181
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
182
|
+
*/
|
|
183
|
+
destinationUrl?: string;
|
|
184
|
+
/**
|
|
185
|
+
* The url of the file that exists prior to the operation. For example, if a file is renamed, the sourceUrl
|
|
186
|
+
* contains the url of the original file name prior to the rename operation.
|
|
187
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
188
|
+
*/
|
|
189
|
+
sourceUrl?: string;
|
|
190
|
+
/**
|
|
191
|
+
* True to perform the operation on all child directories; otherwise False.
|
|
192
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
193
|
+
*/
|
|
194
|
+
isRecursive?: boolean;
|
|
88
195
|
/**
|
|
89
196
|
* An opaque string value representing the logical sequence of events for any particular blob name.
|
|
90
197
|
* Users can use standard string comparison to understand the relative sequence of two events on the same blob name.
|
|
91
198
|
*/
|
|
92
199
|
sequencer: string;
|
|
200
|
+
/**
|
|
201
|
+
* Previous info for the blob.
|
|
202
|
+
*/
|
|
203
|
+
previousInfo?: ChangeFeedEventPreviousInfo;
|
|
204
|
+
/**
|
|
205
|
+
* Blob properties that were updated during this event.
|
|
206
|
+
*/
|
|
207
|
+
updatedBlobProperties?: UpdatedBlobProperties;
|
|
208
|
+
/**
|
|
209
|
+
* Blob tags that were updated during this event.
|
|
210
|
+
*/
|
|
211
|
+
updatedBlobTags?: BlobTagsChange;
|
|
212
|
+
/**
|
|
213
|
+
* The Snapshot associated with the event.
|
|
214
|
+
*/
|
|
215
|
+
snapshot?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Version of the blob.
|
|
218
|
+
*/
|
|
219
|
+
blobVersion?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Version of the container the blob is in.
|
|
222
|
+
*/
|
|
223
|
+
containerVersion?: string;
|
|
224
|
+
/**
|
|
225
|
+
* Access Tier of the blob.
|
|
226
|
+
*/
|
|
227
|
+
blobAccessTier?: AccessTier;
|
|
228
|
+
/**
|
|
229
|
+
* AsyncOperationInfo
|
|
230
|
+
*/
|
|
231
|
+
longRunningOperationInfo?: BlobOperationResult;
|
|
93
232
|
}
|
|
94
233
|
//# sourceMappingURL=BlobChangeFeedEvent.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbortSignalLike } from "@azure/core-http";
|
|
2
2
|
import { ContainerClient, CommonOptions } from "@azure/storage-blob";
|
|
3
|
+
import { BlobChangeFeedEvent } from "../models/BlobChangeFeedEvent";
|
|
3
4
|
export declare function ceilToNearestHour(date: Date | undefined): Date | undefined;
|
|
4
5
|
export declare function floorToNearestHour(date: Date | undefined): Date | undefined;
|
|
5
6
|
/**
|
|
@@ -39,4 +40,5 @@ export interface GetSegmentsInYearOptions extends CommonOptions {
|
|
|
39
40
|
export declare function getSegmentsInYear(containerClient: ContainerClient, year: number, startTime?: Date, endTime?: Date, options?: GetSegmentsInYearOptions): Promise<string[]>;
|
|
40
41
|
export declare function parseDateFromSegmentPath(segmentPath: string): Date;
|
|
41
42
|
export declare function minDate(dateA: Date, dateB?: Date): Date;
|
|
43
|
+
export declare function rawEventToBlobChangeFeedEvent(rawEvent: Record<string, any>): BlobChangeFeedEvent;
|
|
42
44
|
//# sourceMappingURL=utils.common.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { TokenCredential, GetTokenOptions, AccessToken } from "@azure/core-http";
|
|
2
3
|
import { RecorderEnvironmentSetup } from "@azure-tools/test-recorder";
|
|
4
|
+
import { Readable } from "stream";
|
|
3
5
|
export declare const testPollerProperties: {
|
|
4
6
|
intervalInMs: number | undefined;
|
|
5
7
|
};
|
|
@@ -49,8 +51,14 @@ export declare function isSuperSet(m1?: BlobMetadata, m2?: BlobMetadata): boolea
|
|
|
49
51
|
/**
|
|
50
52
|
* Sleep for seconds.
|
|
51
53
|
*
|
|
52
|
-
* @param seconds -
|
|
54
|
+
* @param seconds - duration to sleep in seconds
|
|
53
55
|
*/
|
|
54
56
|
export declare function sleep(seconds: number): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Read text content from a stream as string
|
|
59
|
+
* @param stream - stream to read from
|
|
60
|
+
* @returns a utf-8 string that is the whole content of the stream
|
|
61
|
+
*/
|
|
62
|
+
export declare function streamToString(stream: Readable): Promise<string>;
|
|
55
63
|
export {};
|
|
56
64
|
//# sourceMappingURL=testutils.common.d.ts.map
|
|
@@ -6,6 +6,10 @@ import { Pipeline } from '@azure/storage-blob';
|
|
|
6
6
|
import { StoragePipelineOptions } from '@azure/storage-blob';
|
|
7
7
|
import { StorageSharedKeyCredential } from '@azure/storage-blob';
|
|
8
8
|
import { TokenCredential } from '@azure/core-http';
|
|
9
|
+
/**
|
|
10
|
+
* The AccessTier.
|
|
11
|
+
*/
|
|
12
|
+
export declare type AccessTier = "P4" | "P6" | "P10" | "P15" | "P20" | "P30" | "P40" | "P50" | "P60" | "P70" | "P80" | "Hot" | "Cool" | "Archive";
|
|
9
13
|
/**
|
|
10
14
|
* BlobChangeFeedClient.
|
|
11
15
|
* @see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-change-feed?tabs=azure-portal
|
|
@@ -183,6 +187,10 @@ export declare interface BlobChangeFeedEvent {
|
|
|
183
187
|
* The schema version of the data object. The publisher defines the schema version.
|
|
184
188
|
*/
|
|
185
189
|
dataVersion?: string;
|
|
190
|
+
/**
|
|
191
|
+
* The schema version of the data object. The publisher defines the schema version.
|
|
192
|
+
*/
|
|
193
|
+
schemaVersion?: number;
|
|
186
194
|
/**
|
|
187
195
|
* The schema version of the event metadata. Event Grid defines the schema of the top-level properties. Event Grid provides this value.
|
|
188
196
|
*/
|
|
@@ -220,6 +228,12 @@ export declare interface BlobChangeFeedEventData {
|
|
|
220
228
|
* The size of the blob in bytes.
|
|
221
229
|
*/
|
|
222
230
|
contentLength: number;
|
|
231
|
+
/**
|
|
232
|
+
* The offset in bytes of a write operation taken at the point where the event-triggering application completed
|
|
233
|
+
* writing to the file.
|
|
234
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
235
|
+
*/
|
|
236
|
+
contentOffset?: number;
|
|
223
237
|
/**
|
|
224
238
|
* The type of blob.
|
|
225
239
|
*/
|
|
@@ -229,11 +243,60 @@ export declare interface BlobChangeFeedEventData {
|
|
|
229
243
|
* <storage-account-name>.blob.core.windows.net/<container-name>/<file-name>.
|
|
230
244
|
*/
|
|
231
245
|
url: string;
|
|
246
|
+
/**
|
|
247
|
+
* The url of the file that will exist after the operation completes. For example, if a file is renamed,
|
|
248
|
+
* the destinationUrl property contains the url of the new file name.
|
|
249
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
250
|
+
*/
|
|
251
|
+
destinationUrl?: string;
|
|
252
|
+
/**
|
|
253
|
+
* The url of the file that exists prior to the operation. For example, if a file is renamed, the sourceUrl
|
|
254
|
+
* contains the url of the original file name prior to the rename operation.
|
|
255
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
256
|
+
*/
|
|
257
|
+
sourceUrl?: string;
|
|
258
|
+
/**
|
|
259
|
+
* True to perform the operation on all child directories; otherwise False.
|
|
260
|
+
* Appears only for events triggered on blob storage accounts that have a hierarchical namespace.
|
|
261
|
+
*/
|
|
262
|
+
isRecursive?: boolean;
|
|
232
263
|
/**
|
|
233
264
|
* An opaque string value representing the logical sequence of events for any particular blob name.
|
|
234
265
|
* Users can use standard string comparison to understand the relative sequence of two events on the same blob name.
|
|
235
266
|
*/
|
|
236
267
|
sequencer: string;
|
|
268
|
+
/**
|
|
269
|
+
* Previous info for the blob.
|
|
270
|
+
*/
|
|
271
|
+
previousInfo?: ChangeFeedEventPreviousInfo;
|
|
272
|
+
/**
|
|
273
|
+
* Blob properties that were updated during this event.
|
|
274
|
+
*/
|
|
275
|
+
updatedBlobProperties?: UpdatedBlobProperties;
|
|
276
|
+
/**
|
|
277
|
+
* Blob tags that were updated during this event.
|
|
278
|
+
*/
|
|
279
|
+
updatedBlobTags?: BlobTagsChange;
|
|
280
|
+
/**
|
|
281
|
+
* The Snapshot associated with the event.
|
|
282
|
+
*/
|
|
283
|
+
snapshot?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Version of the blob.
|
|
286
|
+
*/
|
|
287
|
+
blobVersion?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Version of the container the blob is in.
|
|
290
|
+
*/
|
|
291
|
+
containerVersion?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Access Tier of the blob.
|
|
294
|
+
*/
|
|
295
|
+
blobAccessTier?: AccessTier;
|
|
296
|
+
/**
|
|
297
|
+
* AsyncOperationInfo
|
|
298
|
+
*/
|
|
299
|
+
longRunningOperationInfo?: BlobOperationResult;
|
|
237
300
|
}
|
|
238
301
|
/**
|
|
239
302
|
* Contains paged response data for the {@link BlobChangeFeedClient.listChanges} operation.
|
|
@@ -252,7 +315,7 @@ export declare class BlobChangeFeedEventPage {
|
|
|
252
315
|
/**
|
|
253
316
|
* Change feed event record types.
|
|
254
317
|
*/
|
|
255
|
-
export declare type BlobChangeFeedEventType = "UnspecifiedEventType" | "BlobCreated" | "BlobDeleted" | "BlobPropertiesUpdated" | "BlobSnapshotCreated" | "Control" | "BlobTierChanged" | "BlobAsyncOperationInitiated" | "BlobMetadataUpdated";
|
|
318
|
+
export declare type BlobChangeFeedEventType = "UnspecifiedEventType" | "BlobCreated" | "BlobDeleted" | "BlobPropertiesUpdated" | "BlobSnapshotCreated" | "Control" | "BlobTierChanged" | "BlobAsyncOperationInitiated" | "BlobMetadataUpdated" | "RestorePointMarkerCreated";
|
|
256
319
|
/**
|
|
257
320
|
* Options to configure {@link BlobChangeFeedClient.listChanges} operation.
|
|
258
321
|
*/
|
|
@@ -273,10 +336,82 @@ export declare interface BlobChangeFeedListChangesOptions extends CommonOptions
|
|
|
273
336
|
*/
|
|
274
337
|
end?: Date;
|
|
275
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* ChangeFeedEvent AsyncOperationInfo
|
|
341
|
+
*/
|
|
342
|
+
export declare interface BlobOperationResult {
|
|
343
|
+
/**
|
|
344
|
+
* Destination access tier.
|
|
345
|
+
*/
|
|
346
|
+
destinationAccessTier?: AccessTier;
|
|
347
|
+
/**
|
|
348
|
+
* If the operation was async.
|
|
349
|
+
*/
|
|
350
|
+
isAsync: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Copy Id.
|
|
353
|
+
*/
|
|
354
|
+
copyId?: string;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* A blob property that was updated.
|
|
358
|
+
*/
|
|
359
|
+
export declare interface BlobPropertyChange {
|
|
360
|
+
/**
|
|
361
|
+
* The name of the property that was updated.
|
|
362
|
+
*/
|
|
363
|
+
propertyName: string;
|
|
364
|
+
/**
|
|
365
|
+
* The previous value of the property.
|
|
366
|
+
*/
|
|
367
|
+
oldValue: string;
|
|
368
|
+
/**
|
|
369
|
+
* The new value of the property.
|
|
370
|
+
*/
|
|
371
|
+
newValue: string;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Blob tags that were updated as part of the change feed event.
|
|
375
|
+
*/
|
|
376
|
+
export declare interface BlobTagsChange {
|
|
377
|
+
/**
|
|
378
|
+
* Previous Tags.
|
|
379
|
+
*/
|
|
380
|
+
oldTags: Record<string, string>;
|
|
381
|
+
/**
|
|
382
|
+
* New Tags.
|
|
383
|
+
*/
|
|
384
|
+
newTags: Record<string, string>;
|
|
385
|
+
}
|
|
276
386
|
/**
|
|
277
387
|
* The type of blob.
|
|
278
388
|
*/
|
|
279
389
|
export declare type BlobType = "BlockBlob" | "AppendBlob" | "PageBlob";
|
|
390
|
+
/**
|
|
391
|
+
* Previous info for Change Feed Event.
|
|
392
|
+
*/
|
|
393
|
+
export declare interface ChangeFeedEventPreviousInfo {
|
|
394
|
+
/**
|
|
395
|
+
* Soft delete snapshot.
|
|
396
|
+
*/
|
|
397
|
+
softDeleteSnapshot?: string;
|
|
398
|
+
/**
|
|
399
|
+
* If the blob was soft deleted.
|
|
400
|
+
*/
|
|
401
|
+
isBlobSoftDeleted: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Blob version.
|
|
404
|
+
*/
|
|
405
|
+
newBlobVersion?: string;
|
|
406
|
+
/**
|
|
407
|
+
* Last version.
|
|
408
|
+
*/
|
|
409
|
+
oldBlobVersion?: string;
|
|
410
|
+
/**
|
|
411
|
+
* Previous Access Tier
|
|
412
|
+
*/
|
|
413
|
+
previousTier?: AccessTier;
|
|
414
|
+
}
|
|
280
415
|
/**
|
|
281
416
|
* Creates a new Pipeline object with Credential provided.
|
|
282
417
|
*
|
|
@@ -285,4 +420,8 @@ export declare type BlobType = "BlockBlob" | "AppendBlob" | "PageBlob";
|
|
|
285
420
|
* @returns A new Pipeline object.
|
|
286
421
|
*/
|
|
287
422
|
export declare function newPipeline(credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, pipelineOptions?: StoragePipelineOptions): Pipeline;
|
|
423
|
+
/**
|
|
424
|
+
* Blob properties that were updated during an event.
|
|
425
|
+
*/
|
|
426
|
+
export declare type UpdatedBlobProperties = Record<string, BlobPropertyChange>;
|
|
288
427
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chunk.d.ts","sourceRoot":"","sources":["../../../../src/Chunk.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,gB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