Skip to content

Commit

Permalink
Use descriptorCodes from amqp-common (Azure#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a authored Dec 17, 2018
1 parent 34802c0 commit f2bdfe9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
14 changes: 7 additions & 7 deletions lib/core/managementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import * as log from "../log";
import { ReceiveMode } from "./messageReceiver";
import { reorderLockTokens, toBuffer } from "../util/utils";
import { Typed } from "rhea/typings/types";
import { max32BitNumber, descriptorCodes } from "../util/constants";
import { max32BitNumber } from "../util/constants";

/**
* @ignore
Expand Down Expand Up @@ -1085,7 +1085,7 @@ export class ManagementClient extends LinkEntity {
if (
!ruleDescriptor ||
!ruleDescriptor.descriptor ||
ruleDescriptor.descriptor.value !== descriptorCodes.ruleDescriptionList ||
ruleDescriptor.descriptor.value !== Constants.descriptorCodes.ruleDescriptionList ||
!Array.isArray(ruleDescriptor.value) ||
ruleDescriptor.value.length < 3
) {
Expand All @@ -1099,22 +1099,22 @@ export class ManagementClient extends LinkEntity {
};

switch (filtersRawData.descriptor.value) {
case descriptorCodes.trueFilterList:
case Constants.descriptorCodes.trueFilterList:
rule.filter = {
expression: "1=1"
};
break;
case descriptorCodes.falseFilterList:
case Constants.descriptorCodes.falseFilterList:
rule.filter = {
expression: "1=0"
};
break;
case descriptorCodes.sqlFilterList:
case Constants.descriptorCodes.sqlFilterList:
rule.filter = {
expression: this._safelyGetTypedValueFromArray(filtersRawData.value, 0)
};
break;
case descriptorCodes.correlationFilterList:
case Constants.descriptorCodes.correlationFilterList:
rule.filter = {
correlationId: this._safelyGetTypedValueFromArray(filtersRawData.value, 0),
messageId: this._safelyGetTypedValueFromArray(filtersRawData.value, 1),
Expand All @@ -1135,7 +1135,7 @@ export class ManagementClient extends LinkEntity {
}

if (
actionsRawData.descriptor.value === descriptorCodes.sqlRuleActionList &&
actionsRawData.descriptor.value === Constants.descriptorCodes.sqlRuleActionList &&
Array.isArray(actionsRawData.value) &&
actionsRawData.value.length
) {
Expand Down
9 changes: 0 additions & 9 deletions lib/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,3 @@ export const packageJsonInfo = {
export const messageDispositionTimeout = 20000;

export const max32BitNumber = Math.pow(2, 31) - 1;

export const descriptorCodes = {
ruleDescriptionList: 1335734829060,
sqlFilterList: 83483426822,
correlationFilterList: 83483426825,
sqlRuleActionList: 1335734829062,
trueFilterList: 83483426823,
falseFilterList: 83483426824
};
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "./dist/lib/index.js",
"types": "./typings/lib/index.d.ts",
"dependencies": {
"@azure/amqp-common": "^0.1.8",
"@azure/amqp-common": "^0.1.9",
"debug": "^3.1.0",
"is-buffer": "^2.0.3",
"long": "^4.0.0",
Expand Down

0 comments on commit f2bdfe9

Please sign in to comment.