diff --git a/packages/@azure/arm-billing/.npmignore b/packages/@azure/arm-billing/.npmignore index 3b46bc6202d8..a07a455ac10c 100644 --- a/packages/@azure/arm-billing/.npmignore +++ b/packages/@azure/arm-billing/.npmignore @@ -1,35 +1,35 @@ -#git -.git -.gitignore -#gulp -gulpfile.js -#documentation -doc/ -docs/ -#dependencies -node_modules/ -#samples -sample/ -samples/ -#tests -test/ -tests/ -coverage/ -#tools and scripts -tools/ -scripts/ -#IDE settings -*.sln -.vscode/ -.idea -.editorconfig -.ntvs_analysis.* -#build tools -.travis.yml -.jenkins.yml -.codeclimate.yml -appveyor.yml -# Nuget packages # -.nuget/ -packages/ -packages.config +#git +.git +.gitignore +#gulp +gulpfile.js +#documentation +doc/ +docs/ +#dependencies +node_modules/ +#samples +sample/ +samples/ +#tests +test/ +tests/ +coverage/ +#tools and scripts +tools/ +scripts/ +#IDE settings +*.sln +.vscode/ +.idea +.editorconfig +.ntvs_analysis.* +#build tools +.travis.yml +.jenkins.yml +.codeclimate.yml +appveyor.yml +# Nuget packages # +.nuget/ +packages/ +packages.config diff --git a/packages/@azure/arm-billing/LICENSE.txt b/packages/@azure/arm-billing/LICENSE.txt index a70e8cf66038..5431ba98b936 100644 --- a/packages/@azure/arm-billing/LICENSE.txt +++ b/packages/@azure/arm-billing/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/arm-billing/README.md b/packages/@azure/arm-billing/README.md index 685f2dcccc02..da6a8514c5f9 100644 --- a/packages/@azure/arm-billing/README.md +++ b/packages/@azure/arm-billing/README.md @@ -1,77 +1,67 @@ -# Azure BillingManagementClient SDK for JavaScript -This package contains an isomorphic SDK for BillingManagementClient. - -## Currently supported environments -- Node.js version 6.x.x or higher -- Browser JavaScript - -## How to Install -``` -npm install @azure/arm-billing -``` - - -## How to use - -### nodejs - Authentication, client creation and list enrollmentAccounts as an example written in TypeScript. - -```ts -import * as msRest from "ms-rest-js"; -import * as msRestAzure from "ms-rest-azure-js"; -import * as msRestNodeAuth from "ms-rest-nodeauth"; -import { BillingManagementClient, BillingManagementModels, BillingManagementMappers } from "@azure/arm-billing"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new BillingManagementClient(creds, subscriptionId); - client.enrollmentAccounts.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -### browser - Authentication, client creation and list enrollmentAccounts as an example written in JavaScript. -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-billing sample - - - - - - - - - -``` - -# Related projects - - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +# Azure BillingManagementClient SDK for JavaScript +This package contains an isomorphic SDK for BillingManagementClient. + +## Currently supported environments +- Node.js version 6.x.x or higher +- Browser JavaScript + +## How to Install +``` +npm install @azure/arm-billing +``` + + +## How to use + +### nodejs - Authentication, client creation and list enrollmentAccounts as an example written in TypeScript. + +```ts +import * as msRest from "ms-rest-js"; +import * as msRestAzure from "ms-rest-azure-js"; +import * as msRestNodeAuth from "ms-rest-nodeauth"; +import { BillingManagementClient, BillingManagementModels, BillingManagementMappers } from "@azure/arm-billing"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new BillingManagementClient(creds, subscriptionId); + client.enrollmentAccounts.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +### browser - Authentication, client creation and list enrollmentAccounts as an example written in JavaScript. + +- index.html +```html + + + + @azure/arm-billing sample + + + + + + + + +``` + +# Related projects + - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-billing/lib/models/index.ts b/packages/@azure/arm-billing/lib/models/index.ts index 377f4bb14e37..59f6023515e8 100644 --- a/packages/@azure/arm-billing/lib/models/index.ts +++ b/packages/@azure/arm-billing/lib/models/index.ts @@ -14,21 +14,6 @@ import * as msRest from "ms-rest-js"; export { BaseResource, CloudError }; -/** - * @interface - * An interface representing EnrollmentAccountProperties. - * The properties of the enrollment account. - * - */ -export interface EnrollmentAccountProperties { - /** - * @member {string} [principalName] The account owner's principal name. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly principalName?: string; -} - /** * @interface * An interface representing Resource. @@ -73,35 +58,6 @@ export interface EnrollmentAccount extends Resource { readonly principalName?: string; } -/** - * @interface - * An interface representing BillingPeriodProperties. - * The properties of the billing period. - * - */ -export interface BillingPeriodProperties { - /** - * @member {Date} [billingPeriodStartDate] The start of the date range - * covered by the billing period. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly billingPeriodStartDate?: Date; - /** - * @member {Date} [billingPeriodEndDate] The end of the date range covered by - * the billing period. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly billingPeriodEndDate?: Date; - /** - * @member {string[]} [invoiceIds] Array of invoice ids that associated with. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly invoiceIds?: string[]; -} - /** * @interface * An interface representing BillingPeriod. @@ -197,42 +153,6 @@ export interface ErrorResponse { error?: ErrorDetails; } -/** - * @interface - * An interface representing InvoiceProperties. - * The properties of the invoice. - * - */ -export interface InvoiceProperties { - /** - * @member {DownloadUrl} [downloadUrl] A secure link to download the PDF - * version of an invoice. The link will cease to work after its expiry time - * is reached. - */ - downloadUrl?: DownloadUrl; - /** - * @member {Date} [invoicePeriodStartDate] The start of the date range - * covered by the invoice. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly invoicePeriodStartDate?: Date; - /** - * @member {Date} [invoicePeriodEndDate] The end of the date range covered by - * the invoice. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly invoicePeriodEndDate?: Date; - /** - * @member {string[]} [billingPeriodIds] Array of billing perdiod ids that - * the invoice is attributed to. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly billingPeriodIds?: string[]; -} - /** * @interface * An interface representing Invoice. @@ -262,8 +182,8 @@ export interface Invoice extends Resource { */ readonly invoicePeriodEndDate?: Date; /** - * @member {string[]} [billingPeriodIds] Array of billing perdiod ids that - * the invoice is attributed to. + * @member {string[]} [billingPeriodIds] Array of billing period ids that the + * invoice is attributed to. * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ diff --git a/packages/@azure/arm-billing/lib/models/mappers.ts b/packages/@azure/arm-billing/lib/models/mappers.ts index b2dd643d5e6c..9ae65c44eb82 100644 --- a/packages/@azure/arm-billing/lib/models/mappers.ts +++ b/packages/@azure/arm-billing/lib/models/mappers.ts @@ -14,23 +14,6 @@ import * as msRest from "ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; -export const EnrollmentAccountProperties: msRest.CompositeMapper = { - serializedName: "EnrollmentAccountProperties", - type: { - name: "Composite", - className: "EnrollmentAccountProperties", - modelProperties: { - principalName: { - readOnly: true, - serializedName: "principalName", - type: { - name: "String" - } - } - } - } -}; - export const Resource: msRest.CompositeMapper = { serializedName: "Resource", type: { @@ -80,42 +63,6 @@ export const EnrollmentAccount: msRest.CompositeMapper = { } }; -export const BillingPeriodProperties: msRest.CompositeMapper = { - serializedName: "BillingPeriodProperties", - type: { - name: "Composite", - className: "BillingPeriodProperties", - modelProperties: { - billingPeriodStartDate: { - readOnly: true, - serializedName: "billingPeriodStartDate", - type: { - name: "Date" - } - }, - billingPeriodEndDate: { - readOnly: true, - serializedName: "billingPeriodEndDate", - type: { - name: "Date" - } - }, - invoiceIds: { - readOnly: true, - serializedName: "invoiceIds", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - export const BillingPeriod: msRest.CompositeMapper = { serializedName: "BillingPeriod", type: { @@ -225,49 +172,6 @@ export const ErrorResponse: msRest.CompositeMapper = { } }; -export const InvoiceProperties: msRest.CompositeMapper = { - serializedName: "InvoiceProperties", - type: { - name: "Composite", - className: "InvoiceProperties", - modelProperties: { - downloadUrl: { - serializedName: "downloadUrl", - type: { - name: "Composite", - className: "DownloadUrl" - } - }, - invoicePeriodStartDate: { - readOnly: true, - serializedName: "invoicePeriodStartDate", - type: { - name: "Date" - } - }, - invoicePeriodEndDate: { - readOnly: true, - serializedName: "invoicePeriodEndDate", - type: { - name: "Date" - } - }, - billingPeriodIds: { - readOnly: true, - serializedName: "billingPeriodIds", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - export const Invoice: msRest.CompositeMapper = { serializedName: "Invoice", type: { diff --git a/packages/@azure/arm-billing/package.json b/packages/@azure/arm-billing/package.json index 6b300f239c2a..d2b220d7dce2 100644 --- a/packages/@azure/arm-billing/package.json +++ b/packages/@azure/arm-billing/package.json @@ -4,9 +4,8 @@ "description": "BillingManagementClient Library with typescript type definitions for node.js and browser.", "version": "1.0.0-preview", "dependencies": { - "ms-rest-azure-js": "^1.0.166", - "ms-rest-js": "^1.0.439", - "tslib": "^1.9.3" + "ms-rest-azure-js": "~0.17.165", + "ms-rest-js": "~0.22.434" }, "keywords": [ "node", @@ -16,16 +15,16 @@ "isomorphic" ], "license": "MIT", - "main": "./dist/arm-billing.js", + "main": "./cjs/billingManagementClient.js", "module": "./esm/billingManagementClient.js", - "types": "./esm/billingManagementClient.d.ts", + "types": "./cjs/billingManagementClient.d.ts", "devDependencies": { - "typescript": "^3.1.1", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", - "uglify-js": "^3.4.9" + "tslib": "^1.9.3", + "typescript": "^3.0.3", + "webpack": "^4.17.2", + "webpack-cli": "^3.1.0" }, - "homepage": "https://github.com/azure/azure-sdk-for-js", + "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/packages/@azure/arm-billing", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-js.git" @@ -34,9 +33,7 @@ "url": "https://github.com/azure/azure-sdk-for-js/issues" }, "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-billing.js.map'\" -o ./dist/arm-billing.min.js ./dist/arm-billing.js", + "build": "tsc && tsc -p tsconfig.esm.json && webpack", "prepare": "npm run build" - }, - "sideEffects": false + } } diff --git a/packages/@azure/arm-billing/tsconfig.esm.json b/packages/@azure/arm-billing/tsconfig.esm.json new file mode 100644 index 000000000000..0b3aed07505c --- /dev/null +++ b/packages/@azure/arm-billing/tsconfig.esm.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "outDir": "./esm", + "module": "es6", + "target": "es5" + } +} diff --git a/packages/@azure/arm-billing/tsconfig.json b/packages/@azure/arm-billing/tsconfig.json index f32d1664f320..d5b25971c029 100644 --- a/packages/@azure/arm-billing/tsconfig.json +++ b/packages/@azure/arm-billing/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "module": "es6", + "module": "commonjs", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,8 +11,7 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./cjs" }, "include": ["./lib/**/*"], "exclude": ["node_modules"] diff --git a/packages/@azure/arm-billing/webpack.config.js b/packages/@azure/arm-billing/webpack.config.js new file mode 100644 index 000000000000..20f55120e5a0 --- /dev/null +++ b/packages/@azure/arm-billing/webpack.config.js @@ -0,0 +1,30 @@ +// This is a template webpack config file with minimal configuration. +// Users are free to create their own webpack configuration files in their application. +const path = require('path'); + +/** + * @type {import('webpack').Configuration} + */ +const config = { + mode: 'production', + entry: './esm/billingManagementClient.js', + devtool: 'source-map', + output: { + filename: 'billingManagementClientBundle.js', + path: __dirname, + libraryTarget: 'var', + library: 'billingManagementClient' + }, + // "ms-rest-js" and "ms-rest-azure-js" are dependencies of this library. + // Customer is expected to import/include this library in browser javascript + // (probably using the script tag in their html file). + externals: { + "ms-rest-js": "msRest", + "ms-rest-azure-js": "msRestAzure" + }, + resolve: { + extensions: [".tsx", ".ts", ".js"] + } +}; + +module.exports = config;