Skip to content

Commit 47b72eb

Browse files
[storage] Rework samples and migrate to Samples V2 (Azure#19608)
* [storage-blob] Update samples to v2 * Use types instead of typings * Some more fixes, regenerated samples * Fixed broken paths to samples * [storage-queue] Rework samples for v2 * [storage-queue] Fixup samples and regenerate * [storage-blob] Fixup samples and regenerate * [storage-blob-changefeed] Rework samples for v2 * [storage-queue] Fix some scripts in package.json * [storage-file-share] Reworked samples for v2 * [storage-file-share] Regenerate samples * [storage-file-datalake] Rework samples for v2 * Regenerate samples * Fixed a small bug in storage-queue samples * Fixed a lot of links * typings -> types * Accidentally a comma * Fixed links * Really fixed links * Format code with new prettier * Capitalize Corporation * filesystem -> file system
1 parent a499341 commit 47b72eb

File tree

229 files changed

+6418
-4946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+6418
-4946
lines changed

sdk/storage/perf-tests/storage-blob-track-1/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../../../tsconfig.package",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"declarationDir": "./typings/latest",
5+
"declarationDir": "./types/latest",
66
"outDir": "./dist-esm",
77
"lib": ["dom", "es5", "es6", "es7", "esnext"]
88
},

sdk/storage/perf-tests/storage-blob/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../../../tsconfig.package",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"declarationDir": "./typings/latest",
5+
"declarationDir": "./types/latest",
66
"outDir": "./dist-esm",
77
"lib": ["dom", "es5", "es6", "es7", "esnext"]
88
},

sdk/storage/perf-tests/storage-file-datalake/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../../../tsconfig.package",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"declarationDir": "./typings/latest",
5+
"declarationDir": "./types/latest",
66
"outDir": "./dist-esm",
77
"lib": ["dom", "es5", "es6", "es7", "esnext"]
88
},

sdk/storage/perf-tests/storage-file-share-track-1/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../../../tsconfig.package",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"declarationDir": "./typings/latest",
5+
"declarationDir": "./types/latest",
66
"outDir": "./dist-esm",
77
"lib": ["dom", "es5", "es6", "es7", "esnext"]
88
},

sdk/storage/perf-tests/storage-file-share/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../../../tsconfig.package",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"declarationDir": "./typings/latest",
5+
"declarationDir": "./types/latest",
66
"outDir": "./dist-esm",
77
"lib": ["dom", "es5", "es6", "es7", "esnext"]
88
},

sdk/storage/storage-blob-changefeed/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Use the client libraries in this package to:
1212
- Resuming reading events from a saved position
1313

1414
Key links:
15+
1516
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed)
1617
- [Package (npm)](https://www.npmjs.com/package/@azure/storage-blob-changefeed/)
1718
- [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/storage-blob-changefeed)
@@ -29,7 +30,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP
2930

3031
### Prerequisites
3132

32-
- An [Azure subscription](https://azure.microsoft.com/free/)
33+
- An [Azure subscription](https://azure.microsoft.com/free/)
3334
- A [Storage Account](https://docs.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-portal)
3435

3536
### Install the package
@@ -166,8 +167,8 @@ setLogLevel("info");
166167

167168
More code samples:
168169

169-
- [Blob Storage Change Feed Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/samples/javascript)
170-
- [Blob Storage Change Feed Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/samples/typescript)
170+
- [Blob Storage Change Feed Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/samples/v12-beta/javascript)
171+
- [Blob Storage Change Feed Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/samples/v12-beta/typescript)
171172
- [Blob Storage Change Feed Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/test/)
172173

173174
## Contributing

sdk/storage/storage-blob-changefeed/api-extractor.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3-
"mainEntryPointFilePath": "typings/latest/storage-blob-changefeed/src/index.d.ts",
3+
"mainEntryPointFilePath": "types/latest/storage-blob-changefeed/src/index.d.ts",
44
"docModel": {
55
"enabled": true
66
},
@@ -11,7 +11,7 @@
1111
"dtsRollup": {
1212
"enabled": true,
1313
"untrimmedFilePath": "",
14-
"publicTrimmedFilePath": "./typings/latest/storage-blob-changefeed.d.ts"
14+
"publicTrimmedFilePath": "./types/latest/storage-blob-changefeed.d.ts"
1515
},
1616
"messages": {
1717
"tsdocMessageReporting": {

sdk/storage/storage-blob-changefeed/package.json

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"os": false,
1313
"process": false
1414
},
15-
"types": "./typings/latest/storage-blob-changefeed.d.ts",
15+
"types": "./types/latest/storage-blob-changefeed.d.ts",
1616
"typesVersions": {
1717
"<3.6": {
1818
"*": [
19-
"./typings/3.1/storage-blob-changefeed.d.ts"
19+
"./types/3.1/storage-blob-changefeed.d.ts"
2020
]
2121
}
2222
},
@@ -26,17 +26,17 @@
2626
"scripts": {
2727
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
2828
"build:es6": "tsc -p tsconfig.json",
29-
"build:samples": "cross-env ONLY_NODE=true npm run build && npm run build:prep-samples",
29+
"build:samples": "echo Obsolete.",
3030
"build:prep-samples": "dev-tool samples prep && cd dist-samples && tsc",
3131
"build:test": "npm run build:es6 && rollup -c 2>&1",
32-
"build:types": "downlevel-dts typings/latest typings/3.1",
32+
"build:types": "downlevel-dts types/latest types/3.1",
3333
"build": "npm run clean && npm run build:es6 && rollup -c 2>&1 && api-extractor run --local && npm run build:types",
34-
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
35-
"clean": "rimraf dist dist-* typings temp statistics.html coverage coverage-browser .nyc_output *.tgz *.log test*.xml TEST*.xml",
36-
"clean:samples": "rimraf samples/javascript/node_modules samples/typescript/node_modules samples/typescript/dist samples/typescript/package-lock.json samples/javascript/package-lock.json",
34+
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
35+
"clean": "rimraf dist dist-* types temp statistics.html coverage coverage-browser .nyc_output *.tgz *.log test*.xml TEST*.xml",
36+
"clean:samples": "rimraf samples/v12-beta/javascript/node_modules samples/v12-beta/typescript/node_modules samples/v12-beta/typescript/dist samples/v12-beta/typescript/package-lock.json samples/v12-beta/javascript/package-lock.json",
3737
"extract-api": "tsc -p . && api-extractor run --local",
38-
"execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/storage-blob-changefeed/dist-samples/typescript/src/",
39-
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
38+
"execute:samples": "dev-tool samples run samples-dev",
39+
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
4040
"integration-test:browser": "karma start --single-run",
4141
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace -t 300000 \"dist-esm/storage-blob-changefeed/test/*.spec.js\" \"dist-esm/storage-blob-changefeed/test/node/*.spec.js\"",
4242
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
@@ -58,8 +58,8 @@
5858
"dist-browser/",
5959
"dist-esm/storage-blob-changefeed/src/",
6060
"dist-esm/storage-internal-avro/src/",
61-
"typings/latest/storage-blob-changefeed.d.ts",
62-
"typings/3.1/storage-blob-changefeed.d.ts",
61+
"types/latest/storage-blob-changefeed.d.ts",
62+
"types/3.1/storage-blob-changefeed.d.ts",
6363
"README.md",
6464
"LICENSE"
6565
],
@@ -154,6 +154,14 @@
154154
"sinon": "^9.0.2"
155155
},
156156
"//sampleConfiguration": {
157-
"skipFolder": true
157+
"skipFolder": true,
158+
"productName": "Azure Storage Blob Change Feed",
159+
"productSlugs": [
160+
"azure",
161+
"azure-storage"
162+
],
163+
"requiredResources": {
164+
"Azure Storage Account": "https://docs.microsoft.com/azure/storage/common/storage-account-overview"
165+
}
158166
}
159167
}

sdk/storage/storage-blob-changefeed/samples/javascript/sample.env renamed to sdk/storage/storage-blob-changefeed/sample.env

File renamed without changes.

sdk/storage/storage-blob-changefeed/samples/typescript/src/basic.ts renamed to sdk/storage/storage-blob-changefeed/samples-dev/blobChangeFeedClient.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4+
/**
5+
* @summary use `BlobChangeFeedClient` to list changes to a blob
6+
*/
7+
48
import { StorageSharedKeyCredential } from "@azure/storage-blob";
59
import { BlobChangeFeedClient, BlobChangeFeedEvent } from "@azure/storage-blob-changefeed";
610

@@ -24,13 +28,15 @@ export async function main() {
2428

2529
const start = new Date(Date.UTC(2020, 1, 21, 22, 30, 0)); // will be rounded down to 22:00
2630
const end = new Date(Date.UTC(2020, 4, 8, 21, 10, 0)); // will be rounded up to 22:00
27-
let changeFeedEvents: BlobChangeFeedEvent[] = [];
31+
32+
const changeFeedEvents: BlobChangeFeedEvent[] = [];
2833
// You can also provide just a start or end time.
2934
for await (const event of changeFeedClient.listChanges({ start, end })) {
3035
changeFeedEvents.push(event);
3136
}
3237
}
3338

34-
main().catch((err) => {
35-
console.error("Error running sample:", err.message);
39+
main().catch((error) => {
40+
console.error(error);
41+
process.exit(1);
3642
});

0 commit comments

Comments
 (0)