@azure/core-util 1.0.0-alpha.20210930.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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Release History
2
+
3
+ ## 1.0.0-beta.2 (Unreleased)
4
+
5
+ ### Other Changes
6
+
7
+ - Updates package to work with the react native bundler. [PR #17783](https://github.com/Azure/azure-sdk-for-js/pull/17783)
8
+
9
+ ## 1.0.0-beta.1 (2021-05-06)
10
+
11
+ ### Features Added
12
+
13
+ - First release of package. This package is intended to provide various shared utility functions for client SDK packages.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Azure Core Util client library for JavaScript (Experimental)
2
+
3
+ This library is intended to provide various shared utility functions for client SDK packages.
4
+
5
+ ## Getting started
6
+
7
+ ### Requirements
8
+
9
+ ### Currently supported environments
10
+
11
+ - [LTS versions of Node.js](https://nodejs.org/about/releases/)
12
+ - Latest versions of Safari, Chrome, Edge, and Firefox.
13
+
14
+ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
15
+
16
+ ### Installation
17
+
18
+ This package is primarily used in authoring client SDKs and not meant to be consumed directly by end users.
19
+
20
+ ## Key concepts
21
+
22
+ Utility methods provided by this library should be stateless.
23
+
24
+ ## Examples
25
+
26
+ Examples can be found in the `samples` folder.
27
+
28
+ ## Next steps
29
+
30
+ Look at usage in dependent client SDKs.
31
+
32
+ ## Troubleshooting
33
+
34
+ If you run into issues while using this library, please feel free to [file an issue](https://github.com/Azure/azure-sdk-for-js/issues/new).
35
+
36
+ ## Contributing
37
+
38
+ If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
39
+
40
+ ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcore%2Fcore-util%2FREADME.png)
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ // Copyright (c) Microsoft Corporation.
6
+ // Licensed under the MIT license.
7
+ var _a;
8
+ /**
9
+ * A constant that indicates whether the environment the code is running is Node.JS.
10
+ */
11
+ const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
12
+
13
+ // Copyright (c) Microsoft Corporation.
14
+ // Licensed under the MIT license.
15
+ /**
16
+ * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
17
+ * @param timeInMs - The number of milliseconds to be delayed.
18
+ * @returns Promise that is resolved after timeInMs
19
+ */
20
+ function delay(timeInMs) {
21
+ return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));
22
+ }
23
+
24
+ exports.delay = delay;
25
+ exports.isNode = isNode;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/isNode.ts","../src/delay.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNode =\n typeof process !== \"undefined\" && Boolean(process.version) && Boolean(process.versions?.node);\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Promise that is resolved after timeInMs\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;;AAEA;;;MAGa,MAAM,GACjB,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAA,OAAO,CAAC,QAAQ,0CAAE,IAAI;;ACP9F;AACA;AAEA;;;;;AAKA,SAAgB,KAAK,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,MAAM,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;;;;;"}
@@ -0,0 +1,11 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
5
+ * @param timeInMs - The number of milliseconds to be delayed.
6
+ * @returns Promise that is resolved after timeInMs
7
+ */
8
+ export function delay(timeInMs) {
9
+ return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));
10
+ }
11
+ //# sourceMappingURL=delay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Promise that is resolved after timeInMs\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n"]}
@@ -0,0 +1,5 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export { isNode } from "./isNode";
4
+ export { delay } from "./delay";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { isNode } from \"./isNode\";\nexport { delay } from \"./delay\";\n"]}
@@ -0,0 +1,7 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * A constant that indicates whether the environment the code is running is Node.JS.
5
+ */
6
+ export const isNode = false;
7
+ //# sourceMappingURL=isNode.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isNode.browser.js","sourceRoot":"","sources":["../../src/isNode.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNode = false;\n"]}
@@ -0,0 +1,8 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ var _a;
4
+ /**
5
+ * A constant that indicates whether the environment the code is running is Node.JS.
6
+ */
7
+ export const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
8
+ //# sourceMappingURL=isNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isNode.js","sourceRoot":"","sources":["../../src/isNode.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GACjB,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAA,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNode =\n typeof process !== \"undefined\" && Boolean(process.version) && Boolean(process.versions?.node);\n"]}
package/package.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "@azure/core-util",
3
+ "version": "1.0.0-alpha.20210930.2",
4
+ "description": "Core library for shared utility methods",
5
+ "sdk-type": "client",
6
+ "main": "dist/index.js",
7
+ "module": "dist-esm/src/index.js",
8
+ "browser": {
9
+ "./dist-esm/src/isNode.js": "./dist-esm/src/isNode.browser.js"
10
+ },
11
+ "react-native": {
12
+ "./dist/index.js": "./dist-esm/src/index.js"
13
+ },
14
+ "types": "types/latest/core-util.d.ts",
15
+ "typesVersions": {
16
+ "<3.6": {
17
+ "types/latest/*": [
18
+ "types/3.1/*"
19
+ ]
20
+ }
21
+ },
22
+ "scripts": {
23
+ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
24
+ "build:samples": "echo Obsolete",
25
+ "build:test": "tsc -p . && rollup -c 2>&1",
26
+ "build:types": "downlevel-dts types/latest/ types/3.1/",
27
+ "build": "npm run clean && tsc -p . && rollup -c 2>&1 && api-extractor run --local && npm run build:types",
28
+ "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
29
+ "clean": "rimraf dist dist-* temp types *.tgz *.log",
30
+ "docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --stripInternal --mode file --out ./dist/docs ./src",
31
+ "execute:samples": "echo skipped",
32
+ "extract-api": "tsc -p . && api-extractor run --local",
33
+ "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
34
+ "integration-test:browser": "echo skipped",
35
+ "integration-test:node": "echo skipped",
36
+ "integration-test": "npm run integration-test:node && npm run integration-test:browser",
37
+ "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
38
+ "lint": "eslint package.json api-extractor.json src test --ext .ts",
39
+ "pack": "npm pack 2>&1",
40
+ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
41
+ "test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node",
42
+ "test": "npm run clean && tsc -p . && npm run unit-test:node && rollup -c 2>&1 && npm run unit-test:browser && npm run integration-test",
43
+ "unit-test:browser": "karma start --single-run",
44
+ "unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"",
45
+ "unit-test": "npm run unit-test:node && npm run unit-test:browser"
46
+ },
47
+ "files": [
48
+ "dist/",
49
+ "dist-esm/src/",
50
+ "types/latest/core-util.d.ts",
51
+ "types/3.1/core-util.d.ts",
52
+ "README.md",
53
+ "LICENSE"
54
+ ],
55
+ "repository": "github:Azure/azure-sdk-for-js",
56
+ "keywords": [
57
+ "azure",
58
+ "cloud"
59
+ ],
60
+ "author": "Microsoft Corporation",
61
+ "license": "MIT",
62
+ "bugs": {
63
+ "url": "https://github.com/Azure/azure-sdk-for-js/issues"
64
+ },
65
+ "engines": {
66
+ "node": ">=12.0.0"
67
+ },
68
+ "homepage": "https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/",
69
+ "sideEffects": false,
70
+ "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
71
+ "dependencies": {
72
+ "tslib": "^2.2.0"
73
+ },
74
+ "devDependencies": {
75
+ "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
76
+ "@microsoft/api-extractor": "^7.18.11",
77
+ "@types/chai": "^4.1.6",
78
+ "@types/mocha": "^7.0.2",
79
+ "@types/node": "^12.0.0",
80
+ "@types/sinon": "^9.0.4",
81
+ "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
82
+ "chai": "^4.2.0",
83
+ "downlevel-dts": "~0.4.0",
84
+ "cross-env": "^7.0.2",
85
+ "eslint": "^7.15.0",
86
+ "inherits": "^2.0.3",
87
+ "karma": "^6.2.0",
88
+ "karma-chrome-launcher": "^3.0.0",
89
+ "karma-coverage": "^2.0.0",
90
+ "karma-edge-launcher": "^0.4.2",
91
+ "karma-env-preprocessor": "^0.1.1",
92
+ "karma-firefox-launcher": "^1.1.0",
93
+ "karma-ie-launcher": "^1.0.0",
94
+ "karma-junit-reporter": "^2.0.1",
95
+ "karma-mocha": "^2.0.1",
96
+ "karma-mocha-reporter": "^2.2.5",
97
+ "karma-sourcemap-loader": "^0.3.8",
98
+ "mocha": "^7.1.1",
99
+ "mocha-junit-reporter": "^1.18.0",
100
+ "prettier": "^1.16.4",
101
+ "rimraf": "^3.0.0",
102
+ "rollup": "^1.16.3",
103
+ "sinon": "^9.0.2",
104
+ "typescript": "~4.2.0",
105
+ "util": "^0.12.1",
106
+ "typedoc": "0.15.2"
107
+ }
108
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
3
+ * @param timeInMs - The number of milliseconds to be delayed.
4
+ * @returns Promise that is resolved after timeInMs
5
+ */
6
+ export declare function delay(timeInMs: number): Promise<void>;
7
+ /**
8
+ * A constant that indicates whether the environment the code is running is Node.JS.
9
+ */
10
+ export declare const isNode: boolean;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
3
+ * @param timeInMs - The number of milliseconds to be delayed.
4
+ * @returns Promise that is resolved after timeInMs
5
+ */
6
+ export declare function delay(timeInMs: number): Promise<void>;
7
+
8
+ /**
9
+ * A constant that indicates whether the environment the code is running is Node.JS.
10
+ */
11
+ export declare const isNode: boolean;
12
+
13
+ export { }