Add CI, add test coverage, upgrade ms-rest-js and fix encoding issue.

This commit is contained in:
FAREAST\jiacfan 2018-12-23 20:35:13 +08:00 коммит произвёл Vincent Jiang (LEI)
Родитель e6fe50e3a5
Коммит 0dcd4b3815
68 изменённых файлов: 3684 добавлений и 948 удалений

Просмотреть файл

@ -300,3 +300,163 @@ jobs:
testRunner: JUnit
testResultsFiles: "./file/test-results.browser.xml"
condition: succeededOrFailed()
- job: queuenodejslinux
displayName: Queue Linux
pool:
vmImage: "ubuntu-16.04"
strategy:
matrix:
node_6_x:
node_version: 6.x
node_8_x:
node_version: 8.x
node_10_x:
node_version: 10.x
steps:
- task: NodeTool@0
inputs:
versionSpec: "$(node_version)"
displayName: "Install Node.js"
- script: |
npm install
npm run build
workingDirectory: "./queue"
displayName: "npm install and build"
- script: |
npm run test:node
workingDirectory: "./queue"
displayName: "npm run test:node"
env: { ACCOUNT_NAME: "$(ACCOUNT-NAME)", ACCOUNT_KEY: "$(ACCOUNT-KEY)", SECONDARY_ACCOUNT_NAME": "$(ACCOUNT-NAME)", SECONDARY_ACCOUNT_KEY: "$(ACCOUNT-KEY)" }
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: "./queue/test-results.xml"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/*coverage.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/**/coverage"
- job: queuenodejswin
displayName: Queue Windows
pool:
vmImage: "vs2017-win2016"
strategy:
matrix:
node_6_x:
node_version: 6.x
node_8_x:
node_version: 8.x
node_10_x:
node_version: 10.x
steps:
- task: NodeTool@0
inputs:
versionSpec: "$(node_version)"
displayName: "Install Node.js"
- script: |
npm install
npm run build
workingDirectory: "./queue"
displayName: "npm install and build"
- script: |
npm run test:node
workingDirectory: "./queue"
displayName: "npm run test:node"
env: { ACCOUNT_NAME: "$(ACCOUNT-NAME)", ACCOUNT_KEY: "$(ACCOUNT-KEY)", SECONDARY_ACCOUNT_NAME": "$(ACCOUNT-NAME)", SECONDARY_ACCOUNT_KEY: "$(ACCOUNT-KEY)" }
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: "./queue/test-results.xml"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/*coverage.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/**/coverage"
- job: queuenodejsmac
displayName: Queue Mac
pool:
vmImage: "macOS-10.13"
strategy:
matrix:
node_6_x:
node_version: 6.x
node_8_x:
node_version: 8.x
node_10_x:
node_version: 10.x
steps:
- task: NodeTool@0
inputs:
versionSpec: "$(node_version)"
displayName: "Install Node.js"
- script: |
npm install
npm run build
workingDirectory: "./queue"
displayName: "npm install and build"
- script: |
npm run test:node
workingDirectory: "./queue"
displayName: "npm run test:node"
env: { ACCOUNT_NAME: "$(ACCOUNT-NAME)", ACCOUNT_KEY: "$(ACCOUNT-KEY)", SECONDARY_ACCOUNT_NAME": "$(ACCOUNT-NAME)", SECONDARY_ACCOUNT_KEY: "$(ACCOUNT-KEY)" }
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: "./queue/test-results.xml"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/*coverage.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/**/coverage"
- job: queuebrowser
displayName: Queue Browser
pool:
vmImage: "Ubuntu 16.04"
steps:
- task: NodeTool@0
inputs:
versionSpec: "10.x"
displayName: "Install Node.js"
- script: |
npm install
npm run build
workingDirectory: "./queue"
displayName: "npm install and build"
- script: |
npm run test:browser
workingDirectory: "./queue"
displayName: "npm run test:browser"
env: { ACCOUNT_NAME: "$(ACCOUNT-NAME)", ACCOUNT_SAS: "$(ACCOUNT-SAS)" }
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: "./queue/test-results.browser.xml"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/*coverage.xml"
reportDirectory: "$(System.DefaultWorkingDirectory)/**/coverage-browser"

Просмотреть файл

@ -1,9 +1,10 @@
# browser #
browser/azure-storage.queue.js
browser/azure-storage.queue.js.map
# dist-esm #
!dist-esm/lib/**/*.js
dist-esm/test
dist-esm/tests
dist-esm/samples
# dist-test #
@ -20,14 +21,14 @@ swagger/
# typings #
!typings/lib/**/*.d.ts
typings/test
typings/tests
typings/samples
# git #
.git*
# Test #
test/
tests/
# Others #
.vscode/
@ -39,7 +40,6 @@ gulpfile.js
.DS_Store
tsconfig.json
tslint.json
*.js.map
*.zip
package-lock.json
karma.conf.js
@ -47,4 +47,11 @@ temp
gulpfile.js
rollup.config.js
rollup.test.config.js
*.html
*.html
coverage/
.nyc_output/
test*.xml
*.tgz
coverage-browser
.nycrc
mocha.reporter.config.json

23
queue/.nycrc Normal file
Просмотреть файл

@ -0,0 +1,23 @@
{
"include": [
"lib/**/*.ts"
],
"exclude": [
"**/*.d.ts",
"lib/models.ts",
"lib/generated/lib/storageClient.ts"
],
"extension": [
".ts"
],
"require": [
"ts-node/register"
],
"reporter": [
"text-summary",
"html"
],
"sourceMap": true,
"instrument": true,
"all": true
}

Просмотреть файл

@ -4,13 +4,14 @@ const zip = require("gulp-zip");
const version = require("./package.json").version;
const zipFileName = `azurestoragejs.queue-${version}.zip`;
gulp.task("zip", async() => {
return gulp
gulp.task("zip", function(callback) {
gulp
.src([
"browser/azure-storage.queue.js",
"browser/azure-storage.queue.min.js",
"browser/*.txt"
])
.pipe(zip(zipFileName))
.pipe(gulp.dest("browser"));
.pipe(gulp.dest("browser"))
.on("end", callback);
});

Просмотреть файл

@ -1,82 +1,114 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["mocha"],
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["mocha"],
plugins: [
"karma-mocha",
"karma-mocha-reporter",
"karma-chrome-launcher",
"karma-edge-launcher",
"karma-firefox-launcher",
"karma-ie-launcher",
"karma-env-preprocessor"
],
plugins: [
"karma-mocha",
"karma-mocha-reporter",
"karma-chrome-launcher",
"karma-edge-launcher",
"karma-firefox-launcher",
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-coverage",
"karma-junit-reporter"
],
// list of files / patterns to load in the browser
files: [
// polyfill service supporting IE11 missing features
"https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes",
"dist-test/index.browser.js"
],
// list of files / patterns to load in the browser
files: [
// polyfill service supporting IE11 missing features
"https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes",
"dist-test/index.browser.js"
],
// list of files / patterns to exclude
exclude: [],
// list of files / patterns to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"]
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"],
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
"dist-test/index.browser.js": ["coverage"]
},
// inject following environment values into browser testing with window.__env__
// environment values MUST be exported or set with same console running "karma start"
// https://www.npmjs.com/package/karma-env-preprocessor
envPreprocessor: ["ACCOUNT_NAME", "ACCOUNT_SAS"],
// inject following environment values into browser testing with window.__env__
// environment values MUST be exported or set with same console running "karma start"
// https://www.npmjs.com/package/karma-env-preprocessor
envPreprocessor: ["ACCOUNT_NAME", "ACCOUNT_SAS"],
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha"],
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "remap-coverage", "junit"],
// web server port
port: 9876,
coverageReporter: { type: "in-memory" },
// enable / disable colors in the output (reporters and logs)
colors: true,
// Coverage report settings
remapCoverageReporter: {
"text-summary": null, // to show summary in console
html: "./coverage-browser"
},
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// Exclude coverage calculation for following files
remapOptions: {
exclude: /node_modules|tests/g
},
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
junitReporter: {
outputDir: "", // results will be saved as $outputDir/$browserName.xml
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: "", // suite will become the package name attribute in xml testsuite element
useBrowserName: false, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// 'Chrome', 'Firefox', 'Edge', 'IE'
browsers: ["Chrome"],
// web server port
port: 9328,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// enable / disable colors in the output (reporters and logs)
colors: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: 1,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
browserNoActivityTimeout: 600000,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: "600000"
}
}
});
};
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE'
browsers: ["Edge"],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: 1,
browserNoActivityTimeout: 600000,
client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: "600000"
}
}
});
};

Просмотреть файл

@ -1,4 +1,4 @@
import { AbortSignalLike, isNode } from "ms-rest-js";
import { AbortSignalLike, isNode } from "@azure/ms-rest-js";
/**
* An aborter instance implements AbortSignal interface, can abort HTTP requests.
@ -42,11 +42,11 @@ export class Aborter implements AbortSignalLike {
}
/**
* Creates a new Aborter instance with timeout in million-seconds.
* Creates a new Aborter instance with timeout in milliseconds.
* Set parameter timeout to 0 will not create a timer.
*
* @static
* @param {number} {timeout} in million-seconds
* @param {number} {timeout} in milliseconds
* @returns {Aborter}
* @memberof Aborter
*/
@ -67,7 +67,7 @@ export class Aborter implements AbortSignalLike {
private readonly parent?: Aborter;
private readonly children: Aborter[] = []; // When child object calls dispose(), remove child from here
private readonly abortEventListeners: Array<
(this: AbortSignalLike, ev: any) => any
(this: AbortSignalLike, ev?: any) => any
> = [];
// Pipeline proxies need to use "abortSignal as Aborter" in order to access non AbortSignalLike methods
// immutable primitive types

Просмотреть файл

@ -2,7 +2,7 @@ import {
RequestPolicy,
RequestPolicyFactory,
RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { BrowserPolicy } from "./policies/BrowserPolicy";

Просмотреть файл

@ -2,7 +2,7 @@ import {
RequestPolicy,
RequestPolicyFactory,
RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { LoggingPolicy } from "./policies/LoggingPolicy";

Просмотреть файл

@ -1,6 +1,6 @@
import * as Models from "./generated/models";
import * as Models from "./generated/lib/models";
import { Aborter } from "./Aborter";
import { MessageId } from "./generated/operations";
import { MessageId } from "./generated/lib/operations";
import { Pipeline } from "./Pipeline";
import { MessagesURL } from "./MessagesURL";
import { StorageURL } from "./StorageURL";

Просмотреть файл

@ -1,7 +1,7 @@
import { HttpResponse } from "ms-rest-js";
import * as Models from "../lib/generated/models";
import { HttpResponse } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/lib/models";
import { Aborter } from "./Aborter";
import { Messages } from "./generated/operations";
import { Messages } from "./generated/lib/operations";
import { Pipeline } from "./Pipeline";
import { QueueURL } from "./QueueURL";
import { StorageURL } from "./StorageURL";

Просмотреть файл

@ -10,7 +10,7 @@ import {
RequestPolicyOptions,
ServiceClientOptions,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
// Export following interfaces and types for customers who want to implement their
// own RequestPolicy or HTTPClient

Просмотреть файл

@ -1,7 +1,7 @@
import { HttpResponse } from "ms-rest-js";
import * as Models from "../lib/generated/models";
import { HttpResponse } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/lib/models";
import { Aborter } from "./Aborter";
import { Queue } from "./generated/operations";
import { Queue } from "./generated/lib/operations";
import { IMetadata } from "./models";
import { Pipeline } from "./Pipeline";
import { ServiceURL } from "./ServiceURL";

Просмотреть файл

@ -2,7 +2,7 @@ import {
RequestPolicy,
RequestPolicyFactory,
RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { RetryPolicy, RetryPolicyType } from "./policies/RetryPolicy";
@ -33,12 +33,9 @@ export interface IRetryOptions {
/**
* Optional. Indicates the maximum time in ms allowed for any single try of an HTTP request.
* A value of zero or undefined means that you accept our default timeout, 60s or 60 * 1000ms.
* A value of zero or undefined means that you accept our default timeout, 30s or 30 * 1000ms.
*
* NOTE: When transferring large amounts of data, the default TryTimeout will probably
* not be sufficient. You should override this value based on the bandwidth available to
* the host machine and proximity to the Storage service. A good starting point may be something
* like (60 seconds per MB of anticipated-payload-size)
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations
*
* @type {number}
* @memberof IRetryOptions

Просмотреть файл

@ -1,7 +1,7 @@
import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";
import { Aborter } from "./Aborter";
import { ListQueuesIncludeType } from "./generated/models/index";
import { Service } from "./generated/operations";
import { ListQueuesIncludeType } from "./generated/lib/models/index";
import { Service } from "./generated/lib/operations";
import { Pipeline } from "./Pipeline";
import { StorageURL } from "./StorageURL";
@ -50,7 +50,7 @@ export class ServiceURL extends StorageURL {
/**
* Creates an instance of ServiceURL.
* @param {string} url A URL string pointing to Azure Storage queue service, such as
* "https://myaccount.queue.core.windows.net". You can Append a SAS
* "https://myaccount.queue.core.windows.net". You can append a SAS
* if using AnonymousCredential, such as "https://myaccount.queue.core.windows.net?sasString".
* @param {Pipeline} pipeline Call StorageURL.newPipeline() to create a default
* pipeline, or provide a customized pipeline.

Просмотреть файл

@ -1,8 +1,8 @@
import { deserializationPolicy, RequestPolicyFactory } from "ms-rest-js";
import { deserializationPolicy, RequestPolicyFactory } from "@azure/ms-rest-js";
import { BrowserPolicyFactory } from "./BrowserPolicyFactory";
import { Credential } from "./credentials/Credential";
import { StorageClientContext } from "./generated/storageClientContext";
import { StorageClientContext } from "./generated/lib/storageClientContext";
import { LoggingPolicyFactory } from "./LoggingPolicyFactory";
import { IHttpClient, IHttpPipelineLogger, Pipeline } from "./Pipeline";
import { IRetryOptions, RetryPolicyFactory } from "./RetryPolicyFactory";
@ -113,5 +113,9 @@ export abstract class StorageURL {
url,
pipeline.toServiceClientOptions()
);
// Override protocol layer's default content-type
const storageClientContext = this.storageClientContext as any;
storageClientContext.requestContentType = undefined;
}
}

Просмотреть файл

@ -3,7 +3,7 @@ import {
RequestPolicy,
RequestPolicyFactory,
RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import * as os from "os";
import { TelemetryPolicy } from "./policies/TelemetryPolicy";

Просмотреть файл

@ -2,7 +2,7 @@ import {
RequestPolicy,
RequestPolicyFactory,
RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { UniqueRequestIDPolicy } from "./policies/UniqueRequestIDPolicy";

Просмотреть файл

@ -1,4 +1,4 @@
import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { AnonymousCredentialPolicy } from "../policies/AnonymousCredentialPolicy";
import { Credential } from "./Credential";

Просмотреть файл

@ -2,7 +2,7 @@ import {
RequestPolicy,
RequestPolicyFactory,
RequestPolicyOptions
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { CredentialPolicy } from "../policies/CredentialPolicy";

Просмотреть файл

@ -1,5 +1,5 @@
import * as Crypto from "crypto";
import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { SharedKeyCredentialPolicy } from "../policies/SharedKeyCredentialPolicy";
import { Credential } from "./Credential";

Просмотреть файл

@ -1,4 +1,4 @@
import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { Credential } from "../credentials/Credential";
import { TokenCredentialPolicy } from "../policies/TokenCredentialPolicy";

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
/**
@ -430,12 +430,12 @@ export interface StorageServiceStats {
*/
export interface ServiceSetPropertiesOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -453,12 +453,12 @@ export interface ServiceSetPropertiesOptionalParams extends msRest.RequestOption
*/
export interface ServiceGetPropertiesOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -476,12 +476,12 @@ export interface ServiceGetPropertiesOptionalParams extends msRest.RequestOption
*/
export interface ServiceGetStatisticsOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -530,12 +530,12 @@ export interface ServiceListQueuesSegmentOptionalParams extends msRest.RequestOp
*/
include?: ListQueuesIncludeType;
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -553,12 +553,12 @@ export interface ServiceListQueuesSegmentOptionalParams extends msRest.RequestOp
*/
export interface QueueCreateOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {{ [propertyName: string]: string }} [metadata] Optional. Include
* this parameter to specify that the queue's metadata be returned as part of
@ -585,12 +585,12 @@ export interface QueueCreateOptionalParams extends msRest.RequestOptionsBase {
*/
export interface QueueDeleteMethodOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -608,12 +608,12 @@ export interface QueueDeleteMethodOptionalParams extends msRest.RequestOptionsBa
*/
export interface QueueGetPropertiesOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -631,12 +631,12 @@ export interface QueueGetPropertiesOptionalParams extends msRest.RequestOptionsB
*/
export interface QueueSetMetadataOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {{ [propertyName: string]: string }} [metadata] Optional. Include
* this parameter to specify that the queue's metadata be returned as part of
@ -663,12 +663,12 @@ export interface QueueSetMetadataOptionalParams extends msRest.RequestOptionsBas
*/
export interface QueueGetAccessPolicyOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -690,12 +690,12 @@ export interface QueueSetAccessPolicyOptionalParams extends msRest.RequestOption
*/
queueAcl?: SignedIdentifier[];
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -729,12 +729,12 @@ export interface MessagesDequeueOptionalParams extends msRest.RequestOptionsBase
*/
visibilitytimeout?: number;
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -752,12 +752,12 @@ export interface MessagesDequeueOptionalParams extends msRest.RequestOptionsBase
*/
export interface MessagesClearOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -793,12 +793,12 @@ export interface MessagesEnqueueOptionalParams extends msRest.RequestOptionsBase
*/
messageTimeToLive?: number;
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -823,12 +823,12 @@ export interface MessagesPeekOptionalParams extends msRest.RequestOptionsBase {
*/
numberOfMessages?: number;
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -846,12 +846,12 @@ export interface MessagesPeekOptionalParams extends msRest.RequestOptionsBase {
*/
export interface MessageIdUpdateOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -869,12 +869,12 @@ export interface MessageIdUpdateOptionalParams extends msRest.RequestOptionsBase
*/
export interface MessageIdDeleteMethodOptionalParams extends msRest.RequestOptionsBase {
/**
* @member {number} [timeout] The The timeout parameter is expressed in
* seconds. For more information, see <a
* @member {number} [timeoutParameter] The The timeout parameter is expressed
* in seconds. For more information, see <a
* href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting
* Timeouts for Queue Service Operations.</a>
*/
timeout?: number;
timeoutParameter?: number;
/**
* @member {string} [requestId] Provides a client-generated, opaque value
* with a 1 KB character limit that is recorded in the analytics logs when
@ -1358,100 +1358,32 @@ export interface MessageIdDeleteHeaders {
/**
* Defines values for StorageErrorCode.
* Possible values include: 'AccountAlreadyExists', 'AccountBeingCreated',
* 'AccountIsDisabled', 'AuthenticationFailed', 'ConditionHeadersNotSupported',
* 'ConditionNotMet', 'EmptyMetadataKey', 'InsufficientAccountPermissions',
* 'InternalError', 'InvalidAuthenticationInfo', 'InvalidHeaderValue',
* 'InvalidHttpVerb', 'InvalidInput', 'InvalidMd5', 'InvalidMetadata',
* 'InvalidQueryParameterValue', 'InvalidRange', 'InvalidResourceName',
* 'InvalidUri', 'InvalidXmlDocument', 'InvalidXmlNodeValue', 'Md5Mismatch',
* 'MetadataTooLarge', 'MissingContentLengthHeader',
* 'MissingRequiredQueryParameter', 'MissingRequiredHeader',
* 'MissingRequiredXmlNode', 'MultipleConditionHeadersNotSupported',
* 'OperationTimedOut', 'OutOfRangeInput', 'OutOfRangeQueryParameterValue',
* 'RequestBodyTooLarge', 'ResourceTypeMismatch', 'RequestUrlFailedToParse',
* 'ResourceAlreadyExists', 'ResourceNotFound', 'ServerBusy',
* 'UnsupportedHeader', 'UnsupportedXmlNode', 'UnsupportedQueryParameter',
* 'UnsupportedHttpVerb', 'InvalidMarker', 'MessageNotFound',
* 'MessageTooLarge', 'PopReceiptMismatch', 'QueueAlreadyExists',
* 'QueueBeingDeleted', 'QueueDisabled', 'QueueNotEmpty', 'QueueNotFound'
* There could be more values for this enum apart from the ones defined here.If
* you want to set a value that is not from the known values then you can do
* the following:
* let param: StorageErrorCode =
* <StorageErrorCode>"someUnknownValueThatWillStillBeValid";
* Possible values include: 'AccountAlreadyExists', 'AccountBeingCreated', 'AccountIsDisabled',
* 'AuthenticationFailed', 'ConditionHeadersNotSupported', 'ConditionNotMet', 'EmptyMetadataKey',
* 'InsufficientAccountPermissions', 'InternalError', 'InvalidAuthenticationInfo',
* 'InvalidHeaderValue', 'InvalidHttpVerb', 'InvalidInput', 'InvalidMd5', 'InvalidMetadata',
* 'InvalidQueryParameterValue', 'InvalidRange', 'InvalidResourceName', 'InvalidUri',
* 'InvalidXmlDocument', 'InvalidXmlNodeValue', 'Md5Mismatch', 'MetadataTooLarge',
* 'MissingContentLengthHeader', 'MissingRequiredQueryParameter', 'MissingRequiredHeader',
* 'MissingRequiredXmlNode', 'MultipleConditionHeadersNotSupported', 'OperationTimedOut',
* 'OutOfRangeInput', 'OutOfRangeQueryParameterValue', 'RequestBodyTooLarge',
* 'ResourceTypeMismatch', 'RequestUrlFailedToParse', 'ResourceAlreadyExists', 'ResourceNotFound',
* 'ServerBusy', 'UnsupportedHeader', 'UnsupportedXmlNode', 'UnsupportedQueryParameter',
* 'UnsupportedHttpVerb', 'InvalidMarker', 'MessageNotFound', 'MessageTooLarge',
* 'PopReceiptMismatch', 'QueueAlreadyExists', 'QueueBeingDeleted', 'QueueDisabled',
* 'QueueNotEmpty', 'QueueNotFound'
* @readonly
* @enum {string}
*/
export enum StorageErrorCode {
AccountAlreadyExists = 'AccountAlreadyExists',
AccountBeingCreated = 'AccountBeingCreated',
AccountIsDisabled = 'AccountIsDisabled',
AuthenticationFailed = 'AuthenticationFailed',
ConditionHeadersNotSupported = 'ConditionHeadersNotSupported',
ConditionNotMet = 'ConditionNotMet',
EmptyMetadataKey = 'EmptyMetadataKey',
InsufficientAccountPermissions = 'InsufficientAccountPermissions',
InternalError = 'InternalError',
InvalidAuthenticationInfo = 'InvalidAuthenticationInfo',
InvalidHeaderValue = 'InvalidHeaderValue',
InvalidHttpVerb = 'InvalidHttpVerb',
InvalidInput = 'InvalidInput',
InvalidMd5 = 'InvalidMd5',
InvalidMetadata = 'InvalidMetadata',
InvalidQueryParameterValue = 'InvalidQueryParameterValue',
InvalidRange = 'InvalidRange',
InvalidResourceName = 'InvalidResourceName',
InvalidUri = 'InvalidUri',
InvalidXmlDocument = 'InvalidXmlDocument',
InvalidXmlNodeValue = 'InvalidXmlNodeValue',
Md5Mismatch = 'Md5Mismatch',
MetadataTooLarge = 'MetadataTooLarge',
MissingContentLengthHeader = 'MissingContentLengthHeader',
MissingRequiredQueryParameter = 'MissingRequiredQueryParameter',
MissingRequiredHeader = 'MissingRequiredHeader',
MissingRequiredXmlNode = 'MissingRequiredXmlNode',
MultipleConditionHeadersNotSupported = 'MultipleConditionHeadersNotSupported',
OperationTimedOut = 'OperationTimedOut',
OutOfRangeInput = 'OutOfRangeInput',
OutOfRangeQueryParameterValue = 'OutOfRangeQueryParameterValue',
RequestBodyTooLarge = 'RequestBodyTooLarge',
ResourceTypeMismatch = 'ResourceTypeMismatch',
RequestUrlFailedToParse = 'RequestUrlFailedToParse',
ResourceAlreadyExists = 'ResourceAlreadyExists',
ResourceNotFound = 'ResourceNotFound',
ServerBusy = 'ServerBusy',
UnsupportedHeader = 'UnsupportedHeader',
UnsupportedXmlNode = 'UnsupportedXmlNode',
UnsupportedQueryParameter = 'UnsupportedQueryParameter',
UnsupportedHttpVerb = 'UnsupportedHttpVerb',
InvalidMarker = 'InvalidMarker',
MessageNotFound = 'MessageNotFound',
MessageTooLarge = 'MessageTooLarge',
PopReceiptMismatch = 'PopReceiptMismatch',
QueueAlreadyExists = 'QueueAlreadyExists',
QueueBeingDeleted = 'QueueBeingDeleted',
QueueDisabled = 'QueueDisabled',
QueueNotEmpty = 'QueueNotEmpty',
QueueNotFound = 'QueueNotFound',
}
export type StorageErrorCode = 'AccountAlreadyExists' | 'AccountBeingCreated' | 'AccountIsDisabled' | 'AuthenticationFailed' | 'ConditionHeadersNotSupported' | 'ConditionNotMet' | 'EmptyMetadataKey' | 'InsufficientAccountPermissions' | 'InternalError' | 'InvalidAuthenticationInfo' | 'InvalidHeaderValue' | 'InvalidHttpVerb' | 'InvalidInput' | 'InvalidMd5' | 'InvalidMetadata' | 'InvalidQueryParameterValue' | 'InvalidRange' | 'InvalidResourceName' | 'InvalidUri' | 'InvalidXmlDocument' | 'InvalidXmlNodeValue' | 'Md5Mismatch' | 'MetadataTooLarge' | 'MissingContentLengthHeader' | 'MissingRequiredQueryParameter' | 'MissingRequiredHeader' | 'MissingRequiredXmlNode' | 'MultipleConditionHeadersNotSupported' | 'OperationTimedOut' | 'OutOfRangeInput' | 'OutOfRangeQueryParameterValue' | 'RequestBodyTooLarge' | 'ResourceTypeMismatch' | 'RequestUrlFailedToParse' | 'ResourceAlreadyExists' | 'ResourceNotFound' | 'ServerBusy' | 'UnsupportedHeader' | 'UnsupportedXmlNode' | 'UnsupportedQueryParameter' | 'UnsupportedHttpVerb' | 'InvalidMarker' | 'MessageNotFound' | 'MessageTooLarge' | 'PopReceiptMismatch' | 'QueueAlreadyExists' | 'QueueBeingDeleted' | 'QueueDisabled' | 'QueueNotEmpty' | 'QueueNotFound';
/**
* Defines values for GeoReplicationStatusType.
* Possible values include: 'live', 'bootstrap', 'unavailable'
* There could be more values for this enum apart from the ones defined here.If
* you want to set a value that is not from the known values then you can do
* the following:
* let param: GeoReplicationStatusType =
* <GeoReplicationStatusType>"someUnknownValueThatWillStillBeValid";
* @readonly
* @enum {string}
*/
export enum GeoReplicationStatusType {
Live = 'live',
Bootstrap = 'bootstrap',
Unavailable = 'unavailable',
}
export type GeoReplicationStatusType = 'live' | 'bootstrap' | 'unavailable';
/**
* Defines values for ListQueuesIncludeType.
@ -1459,9 +1391,7 @@ export enum GeoReplicationStatusType {
* @readonly
* @enum {string}
*/
export enum ListQueuesIncludeType {
Metadata = 'metadata',
}
export type ListQueuesIncludeType = 'metadata';
/**
* Contains response data for the setProperties operation.

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
export const AccessPolicy: msRest.CompositeMapper = {

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
export const comp0: msRest.OperationQueryParameter = {
parameterPath: "comp",

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/messageIdMappers";
import * as Parameters from "../models/parameters";
@ -31,31 +31,44 @@ export class MessageId {
* Message operation updates the visibility timeout of a message. You can also use this operation
* to update the contents of a message. A message must be in a format that can be included in an
* XML request with UTF-8 encoding, and the encoded message can be up to 64KB in size.
*
* @param {QueueMessage} queueMessage A Message object which can be stored in a Queue
*
* @param {string} popReceipt Required. Specifies the valid pop receipt value returned from an
* earlier call to the Get Messages or Update Message operation.
*
* @param {number} visibilitytimeout Optional. Specifies the new visibility timeout value, in
* seconds, relative to server time. The default value is 30 seconds. A specified value must be
* larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on
* REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be
* set to a value later than the expiry time.
*
* @param {MessageIdUpdateOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param queueMessage A Message object which can be stored in a Queue
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call
* to the Get Messages or Update Message operation.
* @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds,
* relative to server time. The default value is 30 seconds. A specified value must be larger than
* or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
* versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
* later than the expiry time.
* @param [options] The optional parameters
* @returns Promise<Models.MessageIdUpdateResponse>
*/
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number, options?: Models.MessageIdUpdateOptionalParams): Promise<Models.MessageIdUpdateResponse>;
/**
* @param queueMessage A Message object which can be stored in a Queue
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call
* to the Get Messages or Update Message operation.
* @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds,
* relative to server time. The default value is 30 seconds. A specified value must be larger than
* or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
* versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
* later than the expiry time.
* @param callback The callback
*/
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number): Promise<Models.MessageIdUpdateResponse>;
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number, options: Models.MessageIdUpdateOptionalParams): Promise<Models.MessageIdUpdateResponse>;
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number, callback: msRest.ServiceCallback<void>): void;
/**
* @param queueMessage A Message object which can be stored in a Queue
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call
* to the Get Messages or Update Message operation.
* @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds,
* relative to server time. The default value is 30 seconds. A specified value must be larger than
* or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol
* versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value
* later than the expiry time.
* @param options The optional parameters
* @param callback The callback
*/
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number, options: Models.MessageIdUpdateOptionalParams, callback: msRest.ServiceCallback<void>): void;
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number, options?: Models.MessageIdUpdateOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.MessageIdUpdateResponse> {
update(queueMessage: Models.QueueMessage, popReceipt: string, visibilitytimeout: number, options?: Models.MessageIdUpdateOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.MessageIdUpdateResponse> {
return this.client.sendOperationRequest(
{
queueMessage,
@ -69,23 +82,26 @@ export class MessageId {
/**
* The Delete operation deletes the specified message.
*
* @param {string} popReceipt Required. Specifies the valid pop receipt value returned from an
* earlier call to the Get Messages or Update Message operation.
*
* @param {MessageIdDeleteMethodOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call
* to the Get Messages or Update Message operation.
* @param [options] The optional parameters
* @returns Promise<Models.MessageIdDeleteResponse>
*/
deleteMethod(popReceipt: string, options?: Models.MessageIdDeleteMethodOptionalParams): Promise<Models.MessageIdDeleteResponse>;
/**
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call
* to the Get Messages or Update Message operation.
* @param callback The callback
*/
deleteMethod(popReceipt: string): Promise<Models.MessageIdDeleteResponse>;
deleteMethod(popReceipt: string, options: Models.MessageIdDeleteMethodOptionalParams): Promise<Models.MessageIdDeleteResponse>;
deleteMethod(popReceipt: string, callback: msRest.ServiceCallback<void>): void;
/**
* @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call
* to the Get Messages or Update Message operation.
* @param options The optional parameters
* @param callback The callback
*/
deleteMethod(popReceipt: string, options: Models.MessageIdDeleteMethodOptionalParams, callback: msRest.ServiceCallback<void>): void;
deleteMethod(popReceipt: string, options?: Models.MessageIdDeleteMethodOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.MessageIdDeleteResponse> {
deleteMethod(popReceipt: string, options?: Models.MessageIdDeleteMethodOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.MessageIdDeleteResponse> {
return this.client.sendOperationRequest(
{
popReceipt,
@ -94,7 +110,6 @@ export class MessageId {
deleteMethodOperationSpec,
callback) as Promise<Models.MessageIdDeleteResponse>;
}
}
// Operation Specifications

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/messagesMappers";
import * as Parameters from "../models/parameters";
@ -28,20 +28,20 @@ export class Messages {
/**
* The Dequeue operation retrieves one or more messages from the front of the queue.
*
* @param {MessagesDequeueOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.MessagesDequeueResponse>
*/
dequeue(options?: Models.MessagesDequeueOptionalParams): Promise<Models.MessagesDequeueResponse>;
/**
* @param callback The callback
*/
dequeue(): Promise<Models.MessagesDequeueResponse>;
dequeue(options: Models.MessagesDequeueOptionalParams): Promise<Models.MessagesDequeueResponse>;
dequeue(callback: msRest.ServiceCallback<Models.DequeuedMessageItem[]>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
dequeue(options: Models.MessagesDequeueOptionalParams, callback: msRest.ServiceCallback<Models.DequeuedMessageItem[]>): void;
dequeue(options?: Models.MessagesDequeueOptionalParams, callback?: msRest.ServiceCallback<Models.DequeuedMessageItem[]>): Promise<Models.MessagesDequeueResponse> {
dequeue(options?: Models.MessagesDequeueOptionalParams | msRest.ServiceCallback<Models.DequeuedMessageItem[]>, callback?: msRest.ServiceCallback<Models.DequeuedMessageItem[]>): Promise<Models.MessagesDequeueResponse> {
return this.client.sendOperationRequest(
{
options
@ -52,20 +52,20 @@ export class Messages {
/**
* The Clear operation deletes all messages from the specified queue.
*
* @param {MessagesClearOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.MessagesClearResponse>
*/
clear(options?: Models.MessagesClearOptionalParams): Promise<Models.MessagesClearResponse>;
/**
* @param callback The callback
*/
clear(): Promise<Models.MessagesClearResponse>;
clear(options: Models.MessagesClearOptionalParams): Promise<Models.MessagesClearResponse>;
clear(callback: msRest.ServiceCallback<void>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
clear(options: Models.MessagesClearOptionalParams, callback: msRest.ServiceCallback<void>): void;
clear(options?: Models.MessagesClearOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.MessagesClearResponse> {
clear(options?: Models.MessagesClearOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.MessagesClearResponse> {
return this.client.sendOperationRequest(
{
options
@ -80,22 +80,23 @@ export class Messages {
* message must be in a format that can be included in an XML request with UTF-8 encoding. The
* encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size
* for previous versions.
*
* @param {QueueMessage} queueMessage A Message object which can be stored in a Queue
*
* @param {MessagesEnqueueOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param queueMessage A Message object which can be stored in a Queue
* @param [options] The optional parameters
* @returns Promise<Models.MessagesEnqueueResponse>
*/
enqueue(queueMessage: Models.QueueMessage, options?: Models.MessagesEnqueueOptionalParams): Promise<Models.MessagesEnqueueResponse>;
/**
* @param queueMessage A Message object which can be stored in a Queue
* @param callback The callback
*/
enqueue(queueMessage: Models.QueueMessage): Promise<Models.MessagesEnqueueResponse>;
enqueue(queueMessage: Models.QueueMessage, options: Models.MessagesEnqueueOptionalParams): Promise<Models.MessagesEnqueueResponse>;
enqueue(queueMessage: Models.QueueMessage, callback: msRest.ServiceCallback<Models.EnqueuedMessage[]>): void;
/**
* @param queueMessage A Message object which can be stored in a Queue
* @param options The optional parameters
* @param callback The callback
*/
enqueue(queueMessage: Models.QueueMessage, options: Models.MessagesEnqueueOptionalParams, callback: msRest.ServiceCallback<Models.EnqueuedMessage[]>): void;
enqueue(queueMessage: Models.QueueMessage, options?: Models.MessagesEnqueueOptionalParams, callback?: msRest.ServiceCallback<Models.EnqueuedMessage[]>): Promise<Models.MessagesEnqueueResponse> {
enqueue(queueMessage: Models.QueueMessage, options?: Models.MessagesEnqueueOptionalParams | msRest.ServiceCallback<Models.EnqueuedMessage[]>, callback?: msRest.ServiceCallback<Models.EnqueuedMessage[]>): Promise<Models.MessagesEnqueueResponse> {
return this.client.sendOperationRequest(
{
queueMessage,
@ -108,20 +109,20 @@ export class Messages {
/**
* The Peek operation retrieves one or more messages from the front of the queue, but does not
* alter the visibility of the message.
*
* @param {MessagesPeekOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.MessagesPeekResponse>
*/
peek(options?: Models.MessagesPeekOptionalParams): Promise<Models.MessagesPeekResponse>;
/**
* @param callback The callback
*/
peek(): Promise<Models.MessagesPeekResponse>;
peek(options: Models.MessagesPeekOptionalParams): Promise<Models.MessagesPeekResponse>;
peek(callback: msRest.ServiceCallback<Models.PeekedMessageItem[]>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
peek(options: Models.MessagesPeekOptionalParams, callback: msRest.ServiceCallback<Models.PeekedMessageItem[]>): void;
peek(options?: Models.MessagesPeekOptionalParams, callback?: msRest.ServiceCallback<Models.PeekedMessageItem[]>): Promise<Models.MessagesPeekResponse> {
peek(options?: Models.MessagesPeekOptionalParams | msRest.ServiceCallback<Models.PeekedMessageItem[]>, callback?: msRest.ServiceCallback<Models.PeekedMessageItem[]>): Promise<Models.MessagesPeekResponse> {
return this.client.sendOperationRequest(
{
options
@ -129,7 +130,6 @@ export class Messages {
peekOperationSpec,
callback) as Promise<Models.MessagesPeekResponse>;
}
}
// Operation Specifications

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/queueMappers";
import * as Parameters from "../models/parameters";
@ -28,20 +28,20 @@ export class Queue {
/**
* creates a new queue under the given account.
*
* @param {QueueCreateOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.QueueCreateResponse>
*/
create(options?: Models.QueueCreateOptionalParams): Promise<Models.QueueCreateResponse>;
/**
* @param callback The callback
*/
create(): Promise<Models.QueueCreateResponse>;
create(options: Models.QueueCreateOptionalParams): Promise<Models.QueueCreateResponse>;
create(callback: msRest.ServiceCallback<void>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
create(options: Models.QueueCreateOptionalParams, callback: msRest.ServiceCallback<void>): void;
create(options?: Models.QueueCreateOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueCreateResponse> {
create(options?: Models.QueueCreateOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueCreateResponse> {
return this.client.sendOperationRequest(
{
options
@ -52,20 +52,20 @@ export class Queue {
/**
* operation permanently deletes the specified queue
*
* @param {QueueDeleteMethodOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.QueueDeleteResponse>
*/
deleteMethod(options?: Models.QueueDeleteMethodOptionalParams): Promise<Models.QueueDeleteResponse>;
/**
* @param callback The callback
*/
deleteMethod(): Promise<Models.QueueDeleteResponse>;
deleteMethod(options: Models.QueueDeleteMethodOptionalParams): Promise<Models.QueueDeleteResponse>;
deleteMethod(callback: msRest.ServiceCallback<void>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
deleteMethod(options: Models.QueueDeleteMethodOptionalParams, callback: msRest.ServiceCallback<void>): void;
deleteMethod(options?: Models.QueueDeleteMethodOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueDeleteResponse> {
deleteMethod(options?: Models.QueueDeleteMethodOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueDeleteResponse> {
return this.client.sendOperationRequest(
{
options
@ -77,20 +77,20 @@ export class Queue {
/**
* Retrieves user-defined metadata and queue properties on the specified queue. Metadata is
* associated with the queue as name-values pairs.
*
* @param {QueueGetPropertiesOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.QueueGetPropertiesResponse>
*/
getProperties(options?: Models.QueueGetPropertiesOptionalParams): Promise<Models.QueueGetPropertiesResponse>;
/**
* @param callback The callback
*/
getProperties(): Promise<Models.QueueGetPropertiesResponse>;
getProperties(options: Models.QueueGetPropertiesOptionalParams): Promise<Models.QueueGetPropertiesResponse>;
getProperties(callback: msRest.ServiceCallback<void>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
getProperties(options: Models.QueueGetPropertiesOptionalParams, callback: msRest.ServiceCallback<void>): void;
getProperties(options?: Models.QueueGetPropertiesOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueGetPropertiesResponse> {
getProperties(options?: Models.QueueGetPropertiesOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueGetPropertiesResponse> {
return this.client.sendOperationRequest(
{
options
@ -102,20 +102,20 @@ export class Queue {
/**
* sets user-defined metadata on the specified queue. Metadata is associated with the queue as
* name-value pairs.
*
* @param {QueueSetMetadataOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.QueueSetMetadataResponse>
*/
setMetadata(options?: Models.QueueSetMetadataOptionalParams): Promise<Models.QueueSetMetadataResponse>;
/**
* @param callback The callback
*/
setMetadata(): Promise<Models.QueueSetMetadataResponse>;
setMetadata(options: Models.QueueSetMetadataOptionalParams): Promise<Models.QueueSetMetadataResponse>;
setMetadata(callback: msRest.ServiceCallback<void>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
setMetadata(options: Models.QueueSetMetadataOptionalParams, callback: msRest.ServiceCallback<void>): void;
setMetadata(options?: Models.QueueSetMetadataOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueSetMetadataResponse> {
setMetadata(options?: Models.QueueSetMetadataOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueSetMetadataResponse> {
return this.client.sendOperationRequest(
{
options
@ -127,20 +127,20 @@ export class Queue {
/**
* returns details about any stored access policies specified on the queue that may be used with
* Shared Access Signatures.
*
* @param {QueueGetAccessPolicyOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.QueueGetAccessPolicyResponse>
*/
getAccessPolicy(options?: Models.QueueGetAccessPolicyOptionalParams): Promise<Models.QueueGetAccessPolicyResponse>;
/**
* @param callback The callback
*/
getAccessPolicy(): Promise<Models.QueueGetAccessPolicyResponse>;
getAccessPolicy(options: Models.QueueGetAccessPolicyOptionalParams): Promise<Models.QueueGetAccessPolicyResponse>;
getAccessPolicy(callback: msRest.ServiceCallback<Models.SignedIdentifier[]>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
getAccessPolicy(options: Models.QueueGetAccessPolicyOptionalParams, callback: msRest.ServiceCallback<Models.SignedIdentifier[]>): void;
getAccessPolicy(options?: Models.QueueGetAccessPolicyOptionalParams, callback?: msRest.ServiceCallback<Models.SignedIdentifier[]>): Promise<Models.QueueGetAccessPolicyResponse> {
getAccessPolicy(options?: Models.QueueGetAccessPolicyOptionalParams | msRest.ServiceCallback<Models.SignedIdentifier[]>, callback?: msRest.ServiceCallback<Models.SignedIdentifier[]>): Promise<Models.QueueGetAccessPolicyResponse> {
return this.client.sendOperationRequest(
{
options
@ -151,20 +151,20 @@ export class Queue {
/**
* sets stored access policies for the queue that may be used with Shared Access Signatures
*
* @param {QueueSetAccessPolicyOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.QueueSetAccessPolicyResponse>
*/
setAccessPolicy(options?: Models.QueueSetAccessPolicyOptionalParams): Promise<Models.QueueSetAccessPolicyResponse>;
/**
* @param callback The callback
*/
setAccessPolicy(): Promise<Models.QueueSetAccessPolicyResponse>;
setAccessPolicy(options: Models.QueueSetAccessPolicyOptionalParams): Promise<Models.QueueSetAccessPolicyResponse>;
setAccessPolicy(callback: msRest.ServiceCallback<void>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
setAccessPolicy(options: Models.QueueSetAccessPolicyOptionalParams, callback: msRest.ServiceCallback<void>): void;
setAccessPolicy(options?: Models.QueueSetAccessPolicyOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueSetAccessPolicyResponse> {
setAccessPolicy(options?: Models.QueueSetAccessPolicyOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.QueueSetAccessPolicyResponse> {
return this.client.sendOperationRequest(
{
options
@ -172,7 +172,6 @@ export class Queue {
setAccessPolicyOperationSpec,
callback) as Promise<Models.QueueSetAccessPolicyResponse>;
}
}
// Operation Specifications

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/serviceMappers";
import * as Parameters from "../models/parameters";
@ -29,22 +29,23 @@ export class Service {
/**
* Sets properties for a storage account's Queue service endpoint, including properties for Storage
* Analytics and CORS (Cross-Origin Resource Sharing) rules
*
* @param {StorageServiceProperties} storageServiceProperties The StorageService properties.
*
* @param {ServiceSetPropertiesOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param storageServiceProperties The StorageService properties.
* @param [options] The optional parameters
* @returns Promise<Models.ServiceSetPropertiesResponse>
*/
setProperties(storageServiceProperties: Models.StorageServiceProperties, options?: Models.ServiceSetPropertiesOptionalParams): Promise<Models.ServiceSetPropertiesResponse>;
/**
* @param storageServiceProperties The StorageService properties.
* @param callback The callback
*/
setProperties(storageServiceProperties: Models.StorageServiceProperties): Promise<Models.ServiceSetPropertiesResponse>;
setProperties(storageServiceProperties: Models.StorageServiceProperties, options: Models.ServiceSetPropertiesOptionalParams): Promise<Models.ServiceSetPropertiesResponse>;
setProperties(storageServiceProperties: Models.StorageServiceProperties, callback: msRest.ServiceCallback<void>): void;
/**
* @param storageServiceProperties The StorageService properties.
* @param options The optional parameters
* @param callback The callback
*/
setProperties(storageServiceProperties: Models.StorageServiceProperties, options: Models.ServiceSetPropertiesOptionalParams, callback: msRest.ServiceCallback<void>): void;
setProperties(storageServiceProperties: Models.StorageServiceProperties, options?: Models.ServiceSetPropertiesOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.ServiceSetPropertiesResponse> {
setProperties(storageServiceProperties: Models.StorageServiceProperties, options?: Models.ServiceSetPropertiesOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<Models.ServiceSetPropertiesResponse> {
return this.client.sendOperationRequest(
{
storageServiceProperties,
@ -57,20 +58,20 @@ export class Service {
/**
* gets the properties of a storage account's Queue service, including properties for Storage
* Analytics and CORS (Cross-Origin Resource Sharing) rules.
*
* @param {ServiceGetPropertiesOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.ServiceGetPropertiesResponse>
*/
getProperties(options?: Models.ServiceGetPropertiesOptionalParams): Promise<Models.ServiceGetPropertiesResponse>;
/**
* @param callback The callback
*/
getProperties(): Promise<Models.ServiceGetPropertiesResponse>;
getProperties(options: Models.ServiceGetPropertiesOptionalParams): Promise<Models.ServiceGetPropertiesResponse>;
getProperties(callback: msRest.ServiceCallback<Models.StorageServiceProperties>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
getProperties(options: Models.ServiceGetPropertiesOptionalParams, callback: msRest.ServiceCallback<Models.StorageServiceProperties>): void;
getProperties(options?: Models.ServiceGetPropertiesOptionalParams, callback?: msRest.ServiceCallback<Models.StorageServiceProperties>): Promise<Models.ServiceGetPropertiesResponse> {
getProperties(options?: Models.ServiceGetPropertiesOptionalParams | msRest.ServiceCallback<Models.StorageServiceProperties>, callback?: msRest.ServiceCallback<Models.StorageServiceProperties>): Promise<Models.ServiceGetPropertiesResponse> {
return this.client.sendOperationRequest(
{
options
@ -83,20 +84,20 @@ export class Service {
* Retrieves statistics related to replication for the Queue service. It is only available on the
* secondary location endpoint when read-access geo-redundant replication is enabled for the
* storage account.
*
* @param {ServiceGetStatisticsOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.ServiceGetStatisticsResponse>
*/
getStatistics(options?: Models.ServiceGetStatisticsOptionalParams): Promise<Models.ServiceGetStatisticsResponse>;
/**
* @param callback The callback
*/
getStatistics(): Promise<Models.ServiceGetStatisticsResponse>;
getStatistics(options: Models.ServiceGetStatisticsOptionalParams): Promise<Models.ServiceGetStatisticsResponse>;
getStatistics(callback: msRest.ServiceCallback<Models.StorageServiceStats>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
getStatistics(options: Models.ServiceGetStatisticsOptionalParams, callback: msRest.ServiceCallback<Models.StorageServiceStats>): void;
getStatistics(options?: Models.ServiceGetStatisticsOptionalParams, callback?: msRest.ServiceCallback<Models.StorageServiceStats>): Promise<Models.ServiceGetStatisticsResponse> {
getStatistics(options?: Models.ServiceGetStatisticsOptionalParams | msRest.ServiceCallback<Models.StorageServiceStats>, callback?: msRest.ServiceCallback<Models.StorageServiceStats>): Promise<Models.ServiceGetStatisticsResponse> {
return this.client.sendOperationRequest(
{
options
@ -107,20 +108,20 @@ export class Service {
/**
* The List Queues Segment operation returns a list of the queues under the specified account
*
* @param {ServiceListQueuesSegmentOptionalParams} [options] Optional Parameters.
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse} The deserialized result object.
*
* @reject {Error|ServiceError} The error object.
* @param [options] The optional parameters
* @returns Promise<Models.ServiceListQueuesSegmentResponse>
*/
listQueuesSegment(options?: Models.ServiceListQueuesSegmentOptionalParams): Promise<Models.ServiceListQueuesSegmentResponse>;
/**
* @param callback The callback
*/
listQueuesSegment(): Promise<Models.ServiceListQueuesSegmentResponse>;
listQueuesSegment(options: Models.ServiceListQueuesSegmentOptionalParams): Promise<Models.ServiceListQueuesSegmentResponse>;
listQueuesSegment(callback: msRest.ServiceCallback<Models.ListQueuesSegmentResponse>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
listQueuesSegment(options: Models.ServiceListQueuesSegmentOptionalParams, callback: msRest.ServiceCallback<Models.ListQueuesSegmentResponse>): void;
listQueuesSegment(options?: Models.ServiceListQueuesSegmentOptionalParams, callback?: msRest.ServiceCallback<Models.ListQueuesSegmentResponse>): Promise<Models.ServiceListQueuesSegmentResponse> {
listQueuesSegment(options?: Models.ServiceListQueuesSegmentOptionalParams | msRest.ServiceCallback<Models.ListQueuesSegmentResponse>, callback?: msRest.ServiceCallback<Models.ListQueuesSegmentResponse>): Promise<Models.ServiceListQueuesSegmentResponse> {
return this.client.sendOperationRequest(
{
options
@ -128,7 +129,6 @@ export class Service {
listQueuesSegmentOperationSpec,
callback) as Promise<Models.ServiceListQueuesSegmentResponse>;
}
}
// Operation Specifications

Просмотреть файл

@ -8,7 +8,7 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
@ -22,19 +22,10 @@ class StorageClient extends StorageClientContext {
messageId: operations.MessageId;
/**
* @class
* Initializes a new instance of the StorageClient class.
* @constructor
*
* @param {object} [options] - The parameter options
*
* @param {Array} [options.filters] - Filters to be added to the request pipeline
*
* @param {object} [options.requestOptions] - The request options. Detailed info can be found at
* {@link https://github.github.io/fetch/#Request Options doc}
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
* @param url The URL of the service account, queue or message that is the targe of the desired
* operation.
* @param [options] The parameter options
*/
constructor(url: string, options?: msRest.ServiceClientOptions) {
super(url, options);

Просмотреть файл

@ -8,31 +8,20 @@
* regenerated.
*/
import * as msRest from "ms-rest-js";
import * as msRest from "@azure/ms-rest-js";
const packageName = "";
const packageVersion = "";
const packageName = "azure-storage-queue";
const packageVersion = "1.0.0";
export class StorageClientContext extends msRest.ServiceClient {
url: string;
version: string;
/**
* @class
* Initializes a new instance of the StorageClientContext class.
* @constructor
*
* @param {string} url - The URL of the service account, queue or message that is the targe of the desired operation.
*
* @param {object} [options] - The parameter options
*
* @param {Array} [options.filters] - Filters to be added to the request pipeline
*
* @param {object} [options.requestOptions] - The request options. Detailed info can be found at
* {@link https://github.github.io/fetch/#Request Options doc}
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
* @param url The URL of the service account, queue or message that is the targe of the desired
* operation.
* @param [options] The parameter options
*/
constructor(url: string, options?: msRest.ServiceClientOptions) {
if (url === null || url === undefined) {
@ -42,6 +31,10 @@ export class StorageClientContext extends msRest.ServiceClient {
if (!options) {
options = {};
}
if(!options.userAgent) {
const defaultUserAgent = msRest.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}
super(undefined, options);
@ -50,6 +43,5 @@ export class StorageClientContext extends msRest.ServiceClient {
this.requestContentType = "application/json; charset=utf-8";
this.url = url;
this.addUserAgentInfo(`${packageName}/${packageVersion}`);
}
}

Просмотреть файл

@ -1,6 +1,6 @@
import { RestError } from "ms-rest-js";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";
export * from "./Aborter";
export * from "./credentials/AnonymousCredential";

Просмотреть файл

@ -1,6 +1,6 @@
import { RestError } from "ms-rest-js";
import { RestError } from "@azure/ms-rest-js";
import * as Models from "../lib/generated/models";
import * as Models from "../lib/generated/lib/models";
export * from "./Aborter";
export * from "./AccountSASPermissions";

Просмотреть файл

@ -1,4 +1,4 @@
import { RequestPolicy, RequestPolicyOptions } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions } from "@azure/ms-rest-js";
import { CredentialPolicy } from "./CredentialPolicy";

Просмотреть файл

@ -5,7 +5,7 @@ import {
RequestPolicy,
RequestPolicyOptions,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { HeaderConstants, URLConstants } from "../utils/constants";
import { setURLParameter } from "../utils/utils.common";

Просмотреть файл

@ -2,7 +2,7 @@ import {
BaseRequestPolicy,
HttpOperationResponse,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
/**
* Credential policy used to sign HTTP(S) requests before sending. This is an

Просмотреть файл

@ -5,7 +5,7 @@ import {
RequestPolicy,
RequestPolicyOptions,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { IRequestLogOptions } from "../LoggingPolicyFactory";
import { HTTPURLConnection, URLConstants } from "../utils/constants";

Просмотреть файл

@ -8,7 +8,7 @@ import {
RequestPolicyOptions,
RestError,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { IRetryOptions } from "../RetryPolicyFactory";
import { URLConstants } from "../utils/constants";
@ -58,7 +58,7 @@ const DEFAULT_RETRY_OPTIONS: IRetryOptions = {
retryDelayInMs: 4 * 1000,
retryPolicyType: RetryPolicyType.EXPONENTIAL,
secondaryHost: "",
tryTimeoutInMs: 60 * 1000
tryTimeoutInMs: 30 * 1000 //https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations
};
/**

Просмотреть файл

@ -1,4 +1,4 @@
import { RequestPolicy, RequestPolicyOptions, WebResource } from "ms-rest-js";
import { RequestPolicy, RequestPolicyOptions, WebResource } from "@azure/ms-rest-js";
import { SharedKeyCredential } from "../credentials/SharedKeyCredential";
import { HeaderConstants } from "../utils/constants";
import { getURLPath, getURLQueries } from "../utils/utils.common";
@ -52,7 +52,7 @@ export class SharedKeyCredentialPolicy extends CredentialPolicy {
typeof request.body === "string" &&
request.body.length > 0
) {
request.headers.set(HeaderConstants.CONTENT_LENGTH, request.body.length);
request.headers.set(HeaderConstants.CONTENT_LENGTH, request.body ? Buffer.byteLength(request.body,'utf8') : 0);
}
const stringToSign: string =

Просмотреть файл

@ -6,7 +6,7 @@ import {
RequestPolicy,
RequestPolicyOptions,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { HeaderConstants } from "../utils/constants";

Просмотреть файл

@ -3,7 +3,7 @@ import {
RequestPolicy,
RequestPolicyOptions,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { TokenCredential } from "../credentials/TokenCredential";
import { HeaderConstants } from "../utils/constants";

Просмотреть файл

@ -5,7 +5,7 @@ import {
RequestPolicy,
RequestPolicyOptions,
WebResource
} from "ms-rest-js";
} from "@azure/ms-rest-js";
import { HeaderConstants } from "../utils/constants";

Просмотреть файл

@ -1,4 +1,4 @@
export const SDK_VERSION: string = "10.0.0-preview";
export const SDK_VERSION: string = "10.1.0";
export const SERVICE_VERSION: string = "2018-03-28";
export const URLConstants = {

Просмотреть файл

@ -1,4 +1,4 @@
import { URLBuilder } from "ms-rest-js";
import { URLBuilder } from "@azure/ms-rest-js";
/**
* Append a string to URL path. Will remove duplicated "/" in front of the string

Просмотреть файл

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "test-results.xml"
}
}

2162
queue/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,13 +1,13 @@
{
"name": "@azure/storage-queue",
"version": "10.0.0-preview",
"version": "10.1.0",
"description": "Microsoft Azure Storage SDK for JavaScript - Queue",
"main": "./dist/index.js",
"module": "./dist-esm/lib/index.js",
"browser": {
"./dist/index.js": "./browser/azure-storage.queue.min.js",
"./dist-esm/lib/index.js": "./dist-esm/lib/index.browser.js",
"./dist-esm/test/utils/index.js": "./dist-esm/test/utils/index.browser.js",
"./dist-esm/tests/utils/index.js": "./dist-esm/tests/utils/index.browser.js",
"os": false,
"process": false
},
@ -16,25 +16,34 @@
"node": ">=6.5.0"
},
"dependencies": {
"ms-rest-js": "0.22.425",
"@azure/ms-rest-js": "^1.2.3",
"tslib": "^1.9.3"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.9",
"@types/node": "^10.12.3",
"assert": "^1.4.1",
"cross-env": "^5.2.0",
"es6-promise": "^4.2.5",
"gulp": "^4.0.0",
"gulp-zip": "^4.2.0",
"karma": "^3.1.1",
"istanbul": "^0.4.5",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-edge-launcher": "^0.4.2",
"karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^1.1.0",
"karma-ie-launcher": "^1.0.0",
"karma-junit-reporter": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-remap-coverage": "^0.1.5",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi-reporters": "^1.1.7",
"nyc": "^13.1.0",
"puppeteer": "^1.11.0",
"rimraf": "^2.6.2",
"rollup": "^0.65.2",
"rollup-plugin-commonjs": "^9.1.8",
@ -42,22 +51,24 @@
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-shim": "^1.0.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^5.0.2",
"rollup-plugin-visualizer": "^0.9.0",
"source-map-support": "^0.5.9",
"ts-node": "^7.0.1",
"typescript": "^3.2.1"
"typescript": "^3.2.2"
},
"scripts": {
"test": "npm run test:node && npm run test:browser",
"test:node": "mocha --no-timeouts dist-test/index.js",
"test:node": "cross-env TS_NODE_COMPILER_OPTIONS=\"{\\\"module\\\": \\\"commonjs\\\"}\" nyc mocha --compilers ts-node/register --require source-map-support/register --reporter mocha-multi-reporters --reporter-options configFile=mocha.reporter.config.json --full-trace --no-timeouts tests/*.test.ts tests/node/*.test.ts",
"test:browser": "karma start --single-run",
"build": "npm run build:es6 && npm run build:nodebrowser && npm run build:browserzip && npm run build:test",
"build:test": "rollup -c rollup.test.config.js",
"build:nodebrowser": "rollup -c",
"build:es6": "tsc -p tsconfig.json",
"build:autorest": "autorest ./swagger/README.md --typescript --use=@microsoft.azure/autorest.typescript@2.0.476",
"build:autorest": "autorest ./swagger/README.md --typescript --use=@microsoft.azure/autorest.typescript@2.1.3",
"build:browserzip": "gulp zip",
"clean": "rimraf dist dist-esm dist-test typings temp browser/*.js* browser/*.zip statistics.html"
"clean": "rimraf dist dist-esm dist-test typings temp browser/*.js* browser/*.zip statistics.html coverage coverage-browser .nyc_output *.tgz *.log test*.xml TEST*.xml"
},
"repository": {
"type": "git",

Просмотреть файл

@ -3,7 +3,7 @@ import { uglify } from "rollup-plugin-uglify";
import replace from "rollup-plugin-replace";
import commonjs from "rollup-plugin-commonjs";
import shim from "rollup-plugin-shim";
import visualizer from "rollup-plugin-visualizer";
//import visualizer from "rollup-plugin-visualizer";
const version = require("./package.json").version;
const banner = [
@ -15,7 +15,7 @@ const banner = [
const nodeRollupConfigFactory = () => {
return {
external: ["ms-rest-js", "crypto", "fs", "os"],
external: ["@azure/ms-rest-js", "crypto", "fs", "os"],
input: "dist-esm/lib/index.js",
output: {
file: "dist/index.js",
@ -73,11 +73,12 @@ const browserRollupConfigFactory = isProduction => {
output: {
preamble: banner
}
}),
visualizer({
filename: "./statistics.html",
sourcemap: true
})
// Comment visualizer because it only works on Node.js 8+; Uncomment it to get bundle analysis report
// visualizer({
// filename: "./statistics.html",
// sourcemap: true
// })
);
}
@ -85,7 +86,7 @@ const browserRollupConfigFactory = isProduction => {
};
export default [
nodeRollupConfigFactory(),
browserRollupConfigFactory(false),
browserRollupConfigFactory(true),
browserRollupConfigFactory(false)
nodeRollupConfigFactory()
];

Просмотреть файл

@ -1,16 +1,13 @@
import multi from "rollup-plugin-multi-entry";
import baseConfig from "./rollup.config";
const [node, browser] = baseConfig;
import sourcemaps from "rollup-plugin-sourcemaps";
const [browser] = baseConfig;
node.input = ["dist-esm/test/*.js", "dist-esm/test/node/*.js"];
node.output.file = "dist-test/index.js";
node.plugins.unshift(multi());
node.external.push("assert", "path");
node.context = "null";
browser.input = ["dist-esm/test/*.js", "dist-esm/test/browser/*.js"];
browser.input = ["dist-esm/tests/*.js", "dist-esm/tests/browser/*.js"];
browser.output.sourcemap = "inline";
browser.output.file = "dist-test/index.browser.js";
browser.plugins.unshift(multi());
browser.plugins.unshift(sourcemaps());
browser.context = "null";
export default [node, browser];
export default [browser];

Просмотреть файл

@ -1,69 +0,0 @@
import * as assert from "assert";
import { Aborter } from "../lib/Aborter";
import { QueueURL } from "../lib/QueueURL";
import { MessagesURL } from "../lib/MessagesURL";
import { MessageIdURL } from "../lib/MessageIdURL";
import { getQSU, getUniqueName } from "./utils";
describe("MessageIdURL", () => {
const serviceURL = getQSU();
let queueName = getUniqueName("queue");
let queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
const messageContent = "Hello World";
beforeEach(async () => {
queueName = getUniqueName("queue");
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
await queueURL.create(Aborter.none);
});
afterEach(async () => {
await queueURL.delete(Aborter.none);
});
it("update and delete message with default/all parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let newMessage = "New Message";
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let uResult = await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
0,
newMessage
);
assert.ok(uResult.version);
assert.ok(uResult.timeNextVisible);
assert.ok(uResult.date);
assert.ok(uResult.requestId);
assert.ok(uResult.popReceipt);
let pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
newMessage
);
let dResult = await messageIdURL.delete(Aborter.none, uResult.popReceipt!);
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 0);
});
});

Просмотреть файл

@ -1,249 +0,0 @@
import * as assert from "assert";
import { Aborter } from "../lib/Aborter";
import { QueueURL } from "../lib/QueueURL";
import { MessagesURL } from "../lib/MessagesURL";
import { getQSU, getUniqueName } from "./utils";
describe("MessagesURL", () => {
const serviceURL = getQSU();
let queueName = getUniqueName("queue");
let queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
const messageContent = "Hello World";
beforeEach(async () => {
queueName = getUniqueName("queue");
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
await queueURL.create(Aborter.none);
});
afterEach(async () => {
await queueURL.delete(Aborter.none);
});
it("enqueue, peek, dequeue and clear message with default parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
await messagesURL.enqueue(Aborter.none, messageContent);
let pResult = await messagesURL.peek(Aborter.none);
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
let dqResult = await messagesURL.dequeue(Aborter.none);
assert.ok(dqResult.date);
assert.ok(dqResult.requestId);
assert.ok(dqResult.version);
assert.deepStrictEqual(dqResult.dequeuedMessageItems.length, 1);
assert.ok(dqResult.dequeuedMessageItems[0].popReceipt);
assert.deepStrictEqual(
dqResult.dequeuedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(
dqResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
let cResult = await messagesURL.clear(Aborter.none);
assert.ok(cResult.date);
assert.ok(cResult.requestId);
assert.ok(cResult.version);
// check all messages are cleared
let pResult2 = await messagesURL.peek(Aborter.none);
assert.ok(pResult2.date);
assert.deepStrictEqual(pResult2.peekedMessageItems.length, 0);
});
it("enqueue, peek, dequeue and clear message with all parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let eResult2 = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 10,
visibilitytimeout: 5
});
await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 20,
visibilitytimeout: 19
});
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 2);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[1].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].messageId,
eResult2.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].insertionTime,
eResult2.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].expirationTime,
eResult2.expirationTime
);
let dResult = await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 10,
numberOfMessages: 2
});
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
assert.deepStrictEqual(dResult.dequeuedMessageItems.length, 2);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(dResult.dequeuedMessageItems[0].dequeueCount, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.ok(dResult.dequeuedMessageItems[0].popReceipt);
assert.ok(dResult.dequeuedMessageItems[0].timeNextVisible);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].messageText,
messageContent
);
// check no message is visible
let pResult2 = await messagesURL.peek(Aborter.none);
assert.ok(pResult2.date);
assert.deepStrictEqual(pResult2.peekedMessageItems.length, 0);
});
it("enqueue, dequeue and peek negative", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let error;
try {
await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 30,
visibilitytimeout: 30
});
} catch (err) {
error = err;
}
assert.ok(error);
let errorPeek;
try {
await messagesURL.peek(Aborter.none, { numberOfMessages: 100 });
} catch (err) {
errorPeek = err;
}
assert.ok(errorPeek);
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
// Note visibility time could be larger then message time to live for dequeue.
await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 40,
numberOfMessages: 2
});
});
});

Просмотреть файл

@ -15,13 +15,18 @@ describe("Aborter", () => {
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
});
it("Should not abort after calling abort()", async () => {
it("should set value and get value successfully", async () => {
const aborter = Aborter.none.withValue("mykey", "myvalue");
assert.deepStrictEqual(aborter.getValue("mykey"), "myvalue");
});
it("should not abort after calling abort()", async () => {
const cResp = await queueURL.create(Aborter.none);
assert.ok(cResp.date);
await queueURL.delete(Aborter.none);
});
it("Should abort when calling abort() before request finishes", async () => {
it("should abort when calling abort() before request finishes", async () => {
const aborter = Aborter.none;
const response = queueURL.create(aborter);
aborter.abort();
@ -31,21 +36,21 @@ describe("Aborter", () => {
} catch (err) {}
});
it("Should not abort when calling abort() after request finishes", async () => {
it("should not abort when calling abort() after request finishes", async () => {
const aborter = Aborter.none;
await queueURL.create(aborter);
aborter.abort();
await queueURL.delete(Aborter.none);
});
it("Should abort after aborter timeout", async () => {
it("should abort after aborter timeout", async () => {
try {
await queueURL.create(Aborter.timeout(1));
assert.fail();
} catch (err) {}
});
it("Should abort after parent aborter calls abort()", async () => {
it("should abort after parent aborter calls abort()", async () => {
try {
const aborter = Aborter.none;
const response = queueURL.create(aborter.withTimeout(10 * 60 * 1000));
@ -55,7 +60,7 @@ describe("Aborter", () => {
} catch (err) {}
});
it("Should abort after parent aborter timeout", async () => {
it("should abort after parent aborter timeout", async () => {
try {
const aborter = Aborter.timeout(1);
const response = queueURL.create(aborter.withTimeout(10 * 60 * 1000));

Просмотреть файл

@ -0,0 +1,201 @@
import * as assert from "assert";
import { Aborter } from "../lib/Aborter";
import { QueueURL } from "../lib/QueueURL";
import { MessagesURL } from "../lib/MessagesURL";
import { MessageIdURL } from "../lib/MessageIdURL";
import { getQSU, getUniqueName, sleep } from "./utils";
describe("MessageIdURL", () => {
const serviceURL = getQSU();
let queueName = getUniqueName("queue");
let queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
const messageContent = "Hello World";
beforeEach(async () => {
queueName = getUniqueName("queue");
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
await queueURL.create(Aborter.none);
});
afterEach(async () => {
await queueURL.delete(Aborter.none);
});
it("update and delete empty message with default parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let newMessage = "";
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let uResult = await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
0,
newMessage
);
assert.ok(uResult.version);
assert.ok(uResult.timeNextVisible);
assert.ok(uResult.date);
assert.ok(uResult.requestId);
assert.ok(uResult.popReceipt);
let pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
newMessage
);
let dResult = await messageIdURL.delete(Aborter.none, uResult.popReceipt!);
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 0);
});
it("update and delete message with all parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let newMessage = "New Message";
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let uResult = await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
10,
newMessage
);
assert.ok(uResult.version);
assert.ok(uResult.timeNextVisible);
assert.ok(uResult.date);
assert.ok(uResult.requestId);
assert.ok(uResult.popReceipt);
let pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 0);
await sleep(11 * 1000); // Sleep 11 seconds, and wait the message to be visible again
let pResult2 = await messagesURL.peek(Aborter.none);
assert.equal(pResult2.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult2.peekedMessageItems[0].messageText,
newMessage
);
});
it("update message with 64KB characters size which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let newMessage = new Array(64*1024 + 1).join('a');
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let uResult = await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
0,
newMessage
);
assert.ok(uResult.version);
assert.ok(uResult.timeNextVisible);
assert.ok(uResult.date);
assert.ok(uResult.requestId);
assert.ok(uResult.popReceipt);
let pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
newMessage
);
});
it("update message negative with 65537B (64KB+1B) characters size which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let newMessage = new Array(64*1024 + 2).join('a');
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let error;
try{
await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
0,
newMessage
);
} catch(err) {
error = err
}
assert.ok(error);
assert.ok(error.message.includes("The request body is too large and exceeds the maximum permissible limit."))
});
it("delete message negative", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let error
try{
await messageIdURL.delete(Aborter.none, "invalid");
} catch(err) {
error = err
}
assert.ok(error);
});
});

Просмотреть файл

@ -0,0 +1,470 @@
import * as assert from "assert";
import { Aborter } from "../lib/Aborter";
import { QueueURL } from "../lib/QueueURL";
import { MessagesURL } from "../lib/MessagesURL";
import { getQSU, getUniqueName } from "./utils";
describe("MessagesURL", () => {
const serviceURL = getQSU();
let queueName = getUniqueName("queue");
let queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
const messageContent = "Hello World";
beforeEach(async () => {
queueName = getUniqueName("queue");
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
await queueURL.create(Aborter.none);
});
afterEach(async () => {
await queueURL.delete(Aborter.none);
});
it("enqueue, peek, dequeue and clear message with default parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
await messagesURL.enqueue(Aborter.none, messageContent);
let pResult = await messagesURL.peek(Aborter.none);
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
let dqResult = await messagesURL.dequeue(Aborter.none);
assert.ok(dqResult.date);
assert.ok(dqResult.requestId);
assert.ok(dqResult.version);
assert.deepStrictEqual(dqResult.dequeuedMessageItems.length, 1);
assert.ok(dqResult.dequeuedMessageItems[0].popReceipt);
assert.deepStrictEqual(
dqResult.dequeuedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(
dqResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
let cResult = await messagesURL.clear(Aborter.none);
assert.ok(cResult.date);
assert.ok(cResult.requestId);
assert.ok(cResult.version);
// check all messages are cleared
let pResult2 = await messagesURL.peek(Aborter.none);
assert.ok(pResult2.date);
assert.deepStrictEqual(pResult2.peekedMessageItems.length, 0);
});
it("enqueue, peek, dequeue and clear message with all parameters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let eResult2 = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 10,
visibilitytimeout: 5
});
await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 20,
visibilitytimeout: 19
});
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 2);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[1].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].messageId,
eResult2.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].insertionTime,
eResult2.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].expirationTime,
eResult2.expirationTime
);
let dResult = await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 10,
numberOfMessages: 2
});
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
assert.deepStrictEqual(dResult.dequeuedMessageItems.length, 2);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(dResult.dequeuedMessageItems[0].dequeueCount, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.ok(dResult.dequeuedMessageItems[0].popReceipt);
assert.ok(dResult.dequeuedMessageItems[0].timeNextVisible);
assert.deepStrictEqual(
pResult.peekedMessageItems[1].messageText,
messageContent
);
// check no message is visible
let pResult2 = await messagesURL.peek(Aborter.none);
assert.ok(pResult2.date);
assert.deepStrictEqual(pResult2.peekedMessageItems.length, 0);
});
it("enqueue, peek, dequeue empty message, and peek, dequeue with numberOfMessages > count(messages)", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, "", {
messageTimeToLive: 40,
visibilitytimeout: 0
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
""
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
let dResult = await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 10,
numberOfMessages: 2
});
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
assert.deepStrictEqual(dResult.dequeuedMessageItems.length, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageText,
''
);
assert.deepStrictEqual(dResult.dequeuedMessageItems[0].dequeueCount, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.ok(dResult.dequeuedMessageItems[0].popReceipt);
assert.ok(dResult.dequeuedMessageItems[0].timeNextVisible);
});
it("enqueue, peek, dequeue special characters", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let specialMessage = '!@#$%^&*()_+`-=[]\|};\'":,./?><`~漢字㒈保ᨍ揫^p[뷁)׷񬓔7񈺝l鮍򧽶ͺ簣ڞ츊䈗㝯綞߫⯹?ÎᦡC왶żsmt㖩닡򈸱𕩣ОլFZ򃀮9tC榅ٻ컦驿Ϳ[𱿛봻烌󱰷򙥱Ռ򽒏򘤰δŊϜ췮㐦9ͽƙp퐂ʩ由巩•KFÓ֮򨾭⨿󊻅aBm󶴂旨Ϣ񓙠򻐪񇧱򆋸ջ֨ipn򒷐ꝷՆ򆊙斡賆𒚑m˞\𻆕󛿓򐞺Ӯ򡗺򴜍<񐸩԰Bu)򁉂񖨞á<џɏ嗂<C98F>⨣1PJ㬵┡ḸI򰱂ˮaࢸ۳i灛ȯɨb𹺪򕕱뿶uٔ䎴񷯆Φ륽󬃨س_NƵ¦\u00E9'
let eResult = await messagesURL.enqueue(Aborter.none, specialMessage, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
specialMessage
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
let dResult = await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 10,
numberOfMessages: 2
});
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
assert.deepStrictEqual(dResult.dequeuedMessageItems.length, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageText,
specialMessage
);
assert.deepStrictEqual(dResult.dequeuedMessageItems[0].dequeueCount, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.ok(dResult.dequeuedMessageItems[0].popReceipt);
assert.ok(dResult.dequeuedMessageItems[0].timeNextVisible);
});
it("enqueue, peek, dequeue with 64KB characters size which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let messageContent = new Array(64*1024 + 1).join('a');
let eResult = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
let dResult = await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 10,
numberOfMessages: 2
});
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
assert.deepStrictEqual(dResult.dequeuedMessageItems.length, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(dResult.dequeuedMessageItems[0].dequeueCount, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.ok(dResult.dequeuedMessageItems[0].popReceipt);
assert.ok(dResult.dequeuedMessageItems[0].timeNextVisible);
});
it("enqueue, peek and dequeue negative", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let error;
try {
await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 30,
visibilitytimeout: 30
});
} catch (err) {
error = err;
}
assert.ok(error);
let errorPeek;
try {
await messagesURL.peek(Aborter.none, { numberOfMessages: 100 });
} catch (err) {
errorPeek = err;
}
assert.ok(errorPeek);
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
// Note visibility time could be larger then message time to live for dequeue.
await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 40,
numberOfMessages: 2
});
});
it("enqueue negative with 65537B(64KB+1B) characters size which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let messageContent = new Array(64*1024 + 2).join('a');
let error
try {
await messagesURL.enqueue(Aborter.none, messageContent, {});
} catch(err) {
error = err
}
assert.ok(error)
assert.ok(error.message.includes("The request body is too large and exceeds the maximum permissible limit."))
});
});

Просмотреть файл

@ -0,0 +1,102 @@
import * as assert from "assert";
import { Aborter } from "../../lib/Aborter";
import { QueueURL } from "../../lib/QueueURL";
import { MessagesURL } from "../../lib/MessagesURL";
import { MessageIdURL } from "../../lib/MessageIdURL";
import { getQSU, getUniqueName } from "../utils";
describe("MessageIdURL Node", () => {
const serviceURL = getQSU();
let queueName = getUniqueName("queue");
let queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
const messageContent = "Hello World";
beforeEach(async () => {
queueName = getUniqueName("queue");
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
await queueURL.create(Aborter.none);
});
afterEach(async () => {
await queueURL.delete(Aborter.none);
});
it("update message with 64KB characters including special char which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let specialChars = '!@#$%^&*()_+`-=[]\|};\'":,./?><`~漢字㒈保ᨍ揫^p[뷁)׷񬓔7񈺝l鮍򧽶ͺ簣ڞ츊䈗㝯綞߫⯹?ÎᦡC왶żsmt㖩닡򈸱𕩣ОլFZ򃀮9tC榅ٻ컦驿Ϳ[𱿛봻烌󱰷򙥱Ռ򽒏򘤰δŊϜ췮㐦9ͽƙp퐂ʩ由巩•KFÓ֮򨾭⨿󊻅aBm󶴂旨Ϣ񓙠򻐪񇧱򆋸ջ֨ipn򒷐ꝷՆ򆊙斡賆𒚑m˞\𻆕󛿓򐞺Ӯ򡗺򴜍<񐸩԰Bu)򁉂񖨞á<џɏ嗂<C98F>⨣1PJ㬵┡ḸI򰱂ˮaࢸ۳i灛ȯɨb𹺪򕕱뿶uٔ䎴񷯆Φ륽󬃨س_NƵ¦'
let buffer = Buffer.alloc(64*1024); //64KB
buffer.fill('a');
buffer.write(specialChars, 0);
let newMessage = buffer.toString();
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let uResult = await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
0,
newMessage
);
assert.ok(uResult.version);
assert.ok(uResult.timeNextVisible);
assert.ok(uResult.date);
assert.ok(uResult.requestId);
assert.ok(uResult.popReceipt);
let pResult = await messagesURL.peek(Aborter.none);
assert.equal(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
newMessage
);
});
it("update message negative with 65537B (64KB+1B) characters including special char which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let eResult = await messagesURL.enqueue(Aborter.none, messageContent);
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let specialChars = '!@#$%^&*()_+`-=[]\|};\'":,./?><`~漢字㒈保ᨍ揫^p[뷁)׷񬓔7񈺝l鮍򧽶ͺ簣ڞ츊䈗㝯綞߫⯹?ÎᦡC왶żsmt㖩닡򈸱𕩣ОլFZ򃀮9tC榅ٻ컦驿Ϳ[𱿛봻烌󱰷򙥱Ռ򽒏򘤰δŊϜ췮㐦9ͽƙp퐂ʩ由巩•KFÓ֮򨾭⨿󊻅aBm󶴂旨Ϣ񓙠򻐪񇧱򆋸ջ֨ipn򒷐ꝷՆ򆊙斡賆𒚑m˞\𻆕󛿓򐞺Ӯ򡗺򴜍<񐸩԰Bu)򁉂񖨞á<џɏ嗂<C98F>⨣1PJ㬵┡ḸI򰱂ˮaࢸ۳i灛ȯɨb𹺪򕕱뿶uٔ䎴񷯆Φ륽󬃨س_NƵ¦'
let buffer = Buffer.alloc(64*1024 + 1);
buffer.fill('a');
buffer.write(specialChars, 0);
let newMessage = buffer.toString();
let messageIdURL = MessageIdURL.fromMessagesURL(
messagesURL,
eResult.messageId
);
let error;
try{
await messageIdURL.update(
Aborter.none,
eResult.popReceipt,
0,
newMessage
);
} catch(err) {
error = err
}
assert.ok(error);
assert.ok(error.message.includes("The request body is too large and exceeds the maximum permissible limit."))
});
});

Просмотреть файл

@ -0,0 +1,113 @@
import * as assert from "assert";
import { Aborter } from "../../lib/Aborter";
import { QueueURL } from "../../lib/QueueURL";
import { MessagesURL } from "../../lib/MessagesURL";
import { getQSU, getUniqueName } from "../utils";
describe("MessagesURL Node", () => {
const serviceURL = getQSU();
let queueName = getUniqueName("queue");
let queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
beforeEach(async () => {
queueName = getUniqueName("queue");
queueURL = QueueURL.fromServiceURL(serviceURL, queueName);
await queueURL.create(Aborter.none);
});
afterEach(async () => {
await queueURL.delete(Aborter.none);
});
it("enqueue, peek, dequeue with 64KB characters including special char which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let specialChars = '!@#$%^&*()_+`-=[]\|};\'":,./?><`~漢字㒈保ᨍ揫^p[뷁)׷񬓔7񈺝l鮍򧽶ͺ簣ڞ츊䈗㝯綞߫⯹?ÎᦡC왶żsmt㖩닡򈸱𕩣ОլFZ򃀮9tC榅ٻ컦驿Ϳ[𱿛봻烌󱰷򙥱Ռ򽒏򘤰δŊϜ췮㐦9ͽƙp퐂ʩ由巩•KFÓ֮򨾭⨿󊻅aBm󶴂旨Ϣ񓙠򻐪񇧱򆋸ջ֨ipn򒷐ꝷՆ򆊙斡賆𒚑m˞\𻆕󛿓򐞺Ӯ򡗺򴜍<񐸩԰Bu)򁉂񖨞á<џɏ嗂<C98F>⨣1PJ㬵┡ḸI򰱂ˮaࢸ۳i灛ȯɨb𹺪򕕱뿶uٔ䎴񷯆Φ륽󬃨س_NƵ¦'
let buffer = Buffer.alloc(64*1024); //64KB
buffer.fill('a');
buffer.write(specialChars, 0);
let messageContent = buffer.toString();
let eResult = await messagesURL.enqueue(Aborter.none, messageContent, {
messageTimeToLive: 40,
visibilitytimeout: 0
});
assert.ok(eResult.date);
assert.ok(eResult.expirationTime);
assert.ok(eResult.insertionTime);
assert.ok(eResult.messageId);
assert.ok(eResult.popReceipt);
assert.ok(eResult.requestId);
assert.ok(eResult.timeNextVisible);
assert.ok(eResult.version);
let pResult = await messagesURL.peek(Aborter.none, { numberOfMessages: 2 });
assert.ok(pResult.date);
assert.ok(pResult.requestId);
assert.ok(pResult.version);
assert.deepStrictEqual(pResult.peekedMessageItems.length, 1);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(pResult.peekedMessageItems[0].dequeueCount, 0);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
pResult.peekedMessageItems[0].expirationTime,
eResult.expirationTime
);
let dResult = await messagesURL.dequeue(Aborter.none, {
visibilitytimeout: 10,
numberOfMessages: 2
});
assert.ok(dResult.date);
assert.ok(dResult.requestId);
assert.ok(dResult.version);
assert.deepStrictEqual(dResult.dequeuedMessageItems.length, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageText,
messageContent
);
assert.deepStrictEqual(dResult.dequeuedMessageItems[0].dequeueCount, 1);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].messageId,
eResult.messageId
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].insertionTime,
eResult.insertionTime
);
assert.deepStrictEqual(
dResult.dequeuedMessageItems[0].expirationTime,
eResult.expirationTime
);
assert.ok(dResult.dequeuedMessageItems[0].popReceipt);
assert.ok(dResult.dequeuedMessageItems[0].timeNextVisible);
});
it("enqueue negative with 65537B(64KB+1B) characters including special char which is computed after encoding", async () => {
let messagesURL = MessagesURL.fromQueueURL(queueURL);
let specialChars = '!@#$%^&*()_+`-=[]\|};\'":,./?><`~漢字㒈保ᨍ揫^p[뷁)׷񬓔7񈺝l鮍򧽶ͺ簣ڞ츊䈗㝯綞߫⯹?ÎᦡC왶żsmt㖩닡򈸱𕩣ОլFZ򃀮9tC榅ٻ컦驿Ϳ[𱿛봻烌󱰷򙥱Ռ򽒏򘤰δŊϜ췮㐦9ͽƙp퐂ʩ由巩•KFÓ֮򨾭⨿󊻅aBm󶴂旨Ϣ񓙠򻐪񇧱򆋸ջ֨ipn򒷐ꝷՆ򆊙斡賆𒚑m˞\𻆕󛿓򐞺Ӯ򡗺򴜍<񐸩԰Bu)򁉂񖨞á<џɏ嗂<C98F>⨣1PJ㬵┡ḸI򰱂ˮaࢸ۳i灛ȯɨb𹺪򕕱뿶uٔ䎴񷯆Φ륽󬃨س_NƵ¦'
let buffer = Buffer.alloc(64*1024 + 1);
buffer.fill('a');
buffer.write(specialChars, 0);
let messageContent = buffer.toString();
let error
try {
await messagesURL.enqueue(Aborter.none, messageContent, {});
} catch(err) {
error = err
}
assert.ok(error)
assert.ok(error.message.includes("The request body is too large and exceeds the maximum permissible limit."))
});
});

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -39,6 +39,23 @@ describe("QueueURL", () => {
assert.ok(result.date);
});
it("getPropertis negative", async () => {
const queueName2 = getUniqueName("queue")
const queueURL2 = QueueURL.fromServiceURL(serviceURL, queueName2)
let error;
try {
await queueURL2.getProperties(Aborter.none);
} catch (err) {
error = err;
}
assert.ok(error);
assert.ok(error.statusCode);
assert.deepEqual(error.statusCode, 404)
assert.ok(error.response)
assert.ok(error.response.body)
assert.ok(error.response.body.includes("QueueNotFound"))
})
it("create with default parameters", done => {
// create() with default parameters has been tested in beforeEach
done();
@ -52,6 +69,23 @@ describe("QueueURL", () => {
assert.deepEqual(result.metadata, metadata);
});
// create with invalid queue name
it("create negative", async() => {
const qURL = QueueURL.fromServiceURL(serviceURL, "");
let error;
try {
await qURL.create(Aborter.none);
} catch(err) {
error = err;
}
assert.ok(error);
assert.ok(error.statusCode);
assert.deepEqual(error.statusCode, 400)
assert.ok(error.response)
assert.ok(error.response.body)
assert.ok(error.response.body.includes("InvalidResourceName"))
});
it("delete", done => {
// delete() with default parameters has been tested in afterEach
done();

Просмотреть файл

@ -2,7 +2,6 @@ import * as assert from "assert";
import { Aborter } from "../lib/Aborter";
import { QueueURL } from "../lib/QueueURL";
import { ListQueuesIncludeType } from "../lib/generated/models";
import { ServiceURL } from "../lib/ServiceURL";
import { getAlternateQSU, getQSU, getUniqueName, wait } from "./utils";
@ -39,7 +38,7 @@ describe("ServiceURL", () => {
Aborter.none,
undefined,
{
include: ListQueuesIncludeType.Metadata,
include: 'metadata',
maxresults: 1,
prefix: queueNamePrefix
}
@ -54,7 +53,7 @@ describe("ServiceURL", () => {
Aborter.none,
result1.nextMarker,
{
include: ListQueuesIncludeType.Metadata,
include: 'metadata',
maxresults: 1,
prefix: queueNamePrefix
}
@ -147,7 +146,7 @@ describe("ServiceURL", () => {
assert.deepEqual(result.hourMetrics, serviceProperties.hourMetrics);
});
it("getStatistics with default/all parameters", done => {
it("getStatistics with default/all parameters secondary", done => {
let serviceURL: ServiceURL | undefined;
try {
serviceURL = getAlternateQSU();

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -21,5 +21,5 @@
},
"compileOnSave": true,
"exclude": ["node_modules"],
"include": ["./lib/**/*.ts", "./test/**/*.ts"]
"include": ["./lib/**/*.ts", "./tests/**/*.ts"]
}