@azure-rest/communication-job-router 1.1.0-beta.1 → 1.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +168 -115
- package/dist/browser/azureCommunicationRoutingServiceClient.d.ts +14 -0
- package/dist/browser/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
- package/dist/browser/azureCommunicationRoutingServiceClient.js +41 -0
- package/dist/browser/azureCommunicationRoutingServiceClient.js.map +1 -0
- package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
- package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
- package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.js +29 -0
- package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
- package/dist/browser/clientDefinitions.d.ts +159 -0
- package/dist/browser/clientDefinitions.d.ts.map +1 -0
- package/dist/browser/clientDefinitions.js +4 -0
- package/dist/browser/clientDefinitions.js.map +1 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +13 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/isUnexpected.d.ts +35 -0
- package/dist/browser/isUnexpected.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/isUnexpected.js +5 -6
- package/dist/browser/isUnexpected.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/logger.js +1 -1
- package/{dist-esm/src → dist/browser}/logger.js.map +1 -1
- package/dist/browser/models.d.ts +562 -0
- package/dist/browser/models.d.ts.map +1 -0
- package/dist/browser/models.js +4 -0
- package/dist/browser/models.js.map +1 -0
- package/dist/browser/outputModels.d.ts +683 -0
- package/dist/browser/outputModels.d.ts.map +1 -0
- package/dist/browser/outputModels.js +4 -0
- package/dist/browser/outputModels.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/paginateHelper.d.ts +68 -0
- package/dist/browser/paginateHelper.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/paginateHelper.js +70 -3
- package/dist/browser/paginateHelper.js.map +1 -0
- package/dist/browser/parameters.d.ts +245 -0
- package/dist/browser/parameters.d.ts.map +1 -0
- package/dist/browser/parameters.js +4 -0
- package/dist/browser/parameters.js.map +1 -0
- package/dist/browser/responses.d.ts +616 -0
- package/dist/browser/responses.d.ts.map +1 -0
- package/dist/browser/responses.js +4 -0
- package/dist/browser/responses.js.map +1 -0
- package/dist/commonjs/azureCommunicationRoutingServiceClient.d.ts +14 -0
- package/dist/commonjs/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
- package/dist/commonjs/azureCommunicationRoutingServiceClient.js +44 -0
- package/dist/commonjs/azureCommunicationRoutingServiceClient.js.map +1 -0
- package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
- package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
- package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.js +33 -0
- package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
- package/dist/commonjs/clientDefinitions.d.ts +159 -0
- package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
- package/dist/commonjs/clientDefinitions.js +5 -0
- package/dist/commonjs/clientDefinitions.js.map +1 -0
- package/dist/commonjs/index.d.ts +11 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +16 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/isUnexpected.d.ts +35 -0
- package/dist/commonjs/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/isUnexpected.js +104 -0
- package/dist/commonjs/isUnexpected.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/models.d.ts +562 -0
- package/dist/commonjs/models.d.ts.map +1 -0
- package/dist/commonjs/models.js +5 -0
- package/dist/commonjs/models.js.map +1 -0
- package/dist/commonjs/outputModels.d.ts +683 -0
- package/dist/commonjs/outputModels.d.ts.map +1 -0
- package/dist/commonjs/outputModels.js +5 -0
- package/dist/commonjs/outputModels.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/paginateHelper.d.ts +68 -0
- package/dist/commonjs/paginateHelper.d.ts.map +1 -0
- package/dist/commonjs/paginateHelper.js +140 -0
- package/dist/commonjs/paginateHelper.js.map +1 -0
- package/dist/commonjs/parameters.d.ts +245 -0
- package/dist/commonjs/parameters.d.ts.map +1 -0
- package/dist/commonjs/parameters.js +5 -0
- package/dist/commonjs/parameters.js.map +1 -0
- package/dist/commonjs/responses.d.ts +616 -0
- package/dist/commonjs/responses.d.ts.map +1 -0
- package/dist/commonjs/responses.js +5 -0
- package/dist/commonjs/responses.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/azureCommunicationRoutingServiceClient.d.ts +14 -0
- package/dist/esm/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
- package/dist/esm/azureCommunicationRoutingServiceClient.js +41 -0
- package/dist/esm/azureCommunicationRoutingServiceClient.js.map +1 -0
- package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
- package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
- package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.js +29 -0
- package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
- package/dist/esm/clientDefinitions.d.ts +159 -0
- package/dist/esm/clientDefinitions.d.ts.map +1 -0
- package/dist/esm/clientDefinitions.js +4 -0
- package/dist/esm/clientDefinitions.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/isUnexpected.d.ts +35 -0
- package/dist/esm/isUnexpected.d.ts.map +1 -0
- package/dist/esm/isUnexpected.js +101 -0
- package/dist/esm/isUnexpected.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/models.d.ts +562 -0
- package/dist/esm/models.d.ts.map +1 -0
- package/dist/esm/models.js +4 -0
- package/dist/esm/models.js.map +1 -0
- package/dist/esm/outputModels.d.ts +683 -0
- package/dist/esm/outputModels.d.ts.map +1 -0
- package/dist/esm/outputModels.js +4 -0
- package/dist/esm/outputModels.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/paginateHelper.d.ts +68 -0
- package/dist/esm/paginateHelper.d.ts.map +1 -0
- package/dist/esm/paginateHelper.js +137 -0
- package/dist/esm/paginateHelper.js.map +1 -0
- package/dist/esm/parameters.d.ts +245 -0
- package/dist/esm/parameters.d.ts.map +1 -0
- package/dist/esm/parameters.js +4 -0
- package/dist/esm/parameters.js.map +1 -0
- package/dist/esm/responses.d.ts +616 -0
- package/dist/esm/responses.d.ts.map +1 -0
- package/dist/esm/responses.js +4 -0
- package/dist/esm/responses.js.map +1 -0
- package/dist/react-native/azureCommunicationRoutingServiceClient.d.ts +14 -0
- package/dist/react-native/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
- package/dist/react-native/azureCommunicationRoutingServiceClient.js +41 -0
- package/dist/react-native/azureCommunicationRoutingServiceClient.js.map +1 -0
- package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
- package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
- package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.js +29 -0
- package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
- package/dist/react-native/clientDefinitions.d.ts +159 -0
- package/dist/react-native/clientDefinitions.d.ts.map +1 -0
- package/dist/react-native/clientDefinitions.js +4 -0
- package/dist/react-native/clientDefinitions.js.map +1 -0
- package/dist/react-native/index.d.ts +11 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +13 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/isUnexpected.d.ts +35 -0
- package/dist/react-native/isUnexpected.d.ts.map +1 -0
- package/dist/react-native/isUnexpected.js +101 -0
- package/dist/react-native/isUnexpected.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/models.d.ts +562 -0
- package/dist/react-native/models.d.ts.map +1 -0
- package/dist/react-native/models.js +4 -0
- package/dist/react-native/models.js.map +1 -0
- package/dist/react-native/outputModels.d.ts +683 -0
- package/dist/react-native/outputModels.d.ts.map +1 -0
- package/dist/react-native/outputModels.js +4 -0
- package/dist/react-native/outputModels.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/paginateHelper.d.ts +68 -0
- package/dist/react-native/paginateHelper.d.ts.map +1 -0
- package/dist/react-native/paginateHelper.js +137 -0
- package/dist/react-native/paginateHelper.js.map +1 -0
- package/dist/react-native/parameters.d.ts +245 -0
- package/dist/react-native/parameters.d.ts.map +1 -0
- package/dist/react-native/parameters.js +4 -0
- package/dist/react-native/parameters.js.map +1 -0
- package/dist/react-native/responses.d.ts +616 -0
- package/dist/react-native/responses.d.ts.map +1 -0
- package/dist/react-native/responses.js +4 -0
- package/dist/react-native/responses.js.map +1 -0
- package/package.json +84 -75
- package/review/{communication-job-router.api.md → communication-job-router-node.api.md} +168 -55
- package/dist/index.js +0 -229
- package/dist/index.js.map +0 -1
- package/dist-esm/src/azureCommunicationRoutingServiceClient.js +0 -42
- package/dist-esm/src/azureCommunicationRoutingServiceClient.js.map +0 -1
- package/dist-esm/src/clientDefinitions.js +0 -4
- package/dist-esm/src/clientDefinitions.js.map +0 -1
- package/dist-esm/src/index.js +0 -13
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/isUnexpected.js.map +0 -1
- package/dist-esm/src/models.js +0 -4
- package/dist-esm/src/models.js.map +0 -1
- package/dist-esm/src/outputModels.js +0 -4
- package/dist-esm/src/outputModels.js.map +0 -1
- package/dist-esm/src/paginateHelper.js.map +0 -1
- package/dist-esm/src/parameters.js +0 -4
- package/dist-esm/src/parameters.js.map +0 -1
- package/dist-esm/src/responses.js +0 -4
- package/dist-esm/src/responses.js.map +0 -1
- package/types/communication-job-router.d.ts +0 -2677
package/dist/index.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var coreClient = require('@azure-rest/core-client');
|
|
6
|
-
var coreAuth = require('@azure/core-auth');
|
|
7
|
-
var logger$1 = require('@azure/logger');
|
|
8
|
-
var communicationCommon = require('@azure/communication-common');
|
|
9
|
-
var corePaging = require('@azure/core-paging');
|
|
10
|
-
|
|
11
|
-
// Copyright (c) Microsoft Corporation.
|
|
12
|
-
// Licensed under the MIT license.
|
|
13
|
-
const logger = logger$1.createClientLogger("communication-job-router");
|
|
14
|
-
|
|
15
|
-
// Copyright (c) Microsoft Corporation.
|
|
16
|
-
// Licensed under the MIT license.
|
|
17
|
-
// Implementation
|
|
18
|
-
function createClient(arg1, arg2, arg3) {
|
|
19
|
-
var _a, _b, _c, _d;
|
|
20
|
-
let credentialOrOptions;
|
|
21
|
-
let options;
|
|
22
|
-
const connectionStringOrUrl = arg1;
|
|
23
|
-
// Determine which constructor is being called based on the types of the arguments
|
|
24
|
-
if (coreAuth.isTokenCredential(arg2) || communicationCommon.isKeyCredential(arg2)) {
|
|
25
|
-
credentialOrOptions = arg2;
|
|
26
|
-
options = arg3;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
options = arg2;
|
|
30
|
-
}
|
|
31
|
-
if (options === undefined) {
|
|
32
|
-
options = {};
|
|
33
|
-
}
|
|
34
|
-
// Rest of the function remains the same, using connectionStringOrUrl or endpoint as needed
|
|
35
|
-
const { url, credential } = communicationCommon.parseClientArguments(connectionStringOrUrl, credentialOrOptions);
|
|
36
|
-
const baseUrl = (_a = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _a !== void 0 ? _a : `${url}`;
|
|
37
|
-
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2024-01-18-preview";
|
|
38
|
-
const userAgentInfo = `azsdk-js-communication-job-router-rest/1.1.0-beta.1`;
|
|
39
|
-
const userAgentPrefix = (options === null || options === void 0 ? void 0 : options.userAgentOptions) && (options === null || options === void 0 ? void 0 : options.userAgentOptions.userAgentPrefix)
|
|
40
|
-
? `${options === null || options === void 0 ? void 0 : options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
41
|
-
: `${userAgentInfo}`;
|
|
42
|
-
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
43
|
-
userAgentPrefix,
|
|
44
|
-
}, loggingOptions: {
|
|
45
|
-
logger: (_d = (_c = options === null || options === void 0 ? void 0 : options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info,
|
|
46
|
-
} });
|
|
47
|
-
const client = coreClient.getClient(baseUrl, options);
|
|
48
|
-
const authPolicy = communicationCommon.createCommunicationAuthPolicy(credential);
|
|
49
|
-
client.pipeline.addPolicy(authPolicy);
|
|
50
|
-
return client;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Copyright (c) Microsoft Corporation.
|
|
54
|
-
// Licensed under the MIT license.
|
|
55
|
-
const responseMap = {
|
|
56
|
-
"PATCH /routing/classificationPolicies/{classificationPolicyId}": ["200", "201"],
|
|
57
|
-
"GET /routing/classificationPolicies/{classificationPolicyId}": ["200"],
|
|
58
|
-
"DELETE /routing/classificationPolicies/{classificationPolicyId}": ["204"],
|
|
59
|
-
"GET /routing/classificationPolicies": ["200"],
|
|
60
|
-
"PATCH /routing/distributionPolicies/{distributionPolicyId}": ["200", "201"],
|
|
61
|
-
"GET /routing/distributionPolicies/{distributionPolicyId}": ["200"],
|
|
62
|
-
"DELETE /routing/distributionPolicies/{distributionPolicyId}": ["204"],
|
|
63
|
-
"GET /routing/distributionPolicies": ["200"],
|
|
64
|
-
"PATCH /routing/exceptionPolicies/{exceptionPolicyId}": ["200", "201"],
|
|
65
|
-
"GET /routing/exceptionPolicies/{exceptionPolicyId}": ["200"],
|
|
66
|
-
"DELETE /routing/exceptionPolicies/{exceptionPolicyId}": ["204"],
|
|
67
|
-
"GET /routing/exceptionPolicies": ["200"],
|
|
68
|
-
"PATCH /routing/queues/{queueId}": ["200", "201"],
|
|
69
|
-
"GET /routing/queues/{queueId}": ["200"],
|
|
70
|
-
"DELETE /routing/queues/{queueId}": ["204"],
|
|
71
|
-
"GET /routing/queues": ["200"],
|
|
72
|
-
"PATCH /routing/jobs/{jobId}": ["200", "201"],
|
|
73
|
-
"GET /routing/jobs/{jobId}": ["200"],
|
|
74
|
-
"DELETE /routing/jobs/{jobId}": ["204"],
|
|
75
|
-
"POST /routing/jobs/{jobId}:reclassify": ["200"],
|
|
76
|
-
"POST /routing/jobs/{jobId}:cancel": ["200"],
|
|
77
|
-
"POST /routing/jobs/{jobId}/assignments/{assignmentId}:complete": ["200"],
|
|
78
|
-
"POST /routing/jobs/{jobId}/assignments/{assignmentId}:close": ["200"],
|
|
79
|
-
"GET /routing/jobs": ["200"],
|
|
80
|
-
"GET /routing/jobs/{jobId}/position": ["200"],
|
|
81
|
-
"POST /routing/jobs/{jobId}/assignments/{assignmentId}:unassign": ["200"],
|
|
82
|
-
"POST /routing/workers/{workerId}/offers/{offerId}:accept": ["200"],
|
|
83
|
-
"POST /routing/workers/{workerId}/offers/{offerId}:decline": ["200"],
|
|
84
|
-
"GET /routing/queues/{queueId}/statistics": ["200"],
|
|
85
|
-
"PATCH /routing/workers/{workerId}": ["200", "201"],
|
|
86
|
-
"GET /routing/workers/{workerId}": ["200"],
|
|
87
|
-
"DELETE /routing/workers/{workerId}": ["204"],
|
|
88
|
-
"GET /routing/workers": ["200"],
|
|
89
|
-
};
|
|
90
|
-
function isUnexpected(response) {
|
|
91
|
-
const lroOriginal = response.headers["x-ms-original-url"];
|
|
92
|
-
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
|
|
93
|
-
const method = response.request.method;
|
|
94
|
-
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
95
|
-
if (!pathDetails) {
|
|
96
|
-
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
97
|
-
}
|
|
98
|
-
return !pathDetails.includes(response.status);
|
|
99
|
-
}
|
|
100
|
-
function getParametrizedPathSuccess(method, path) {
|
|
101
|
-
var _a, _b, _c, _d;
|
|
102
|
-
const pathParts = path.split("/");
|
|
103
|
-
// Traverse list to match the longest candidate
|
|
104
|
-
// matchedLen: the length of candidate path
|
|
105
|
-
// matchedValue: the matched status code array
|
|
106
|
-
let matchedLen = -1, matchedValue = [];
|
|
107
|
-
// Iterate the responseMap to find a match
|
|
108
|
-
for (const [key, value] of Object.entries(responseMap)) {
|
|
109
|
-
// Extracting the path from the map key which is in format
|
|
110
|
-
// GET /path/foo
|
|
111
|
-
if (!key.startsWith(method)) {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
const candidatePath = getPathFromMapKey(key);
|
|
115
|
-
// Get each part of the url path
|
|
116
|
-
const candidateParts = candidatePath.split("/");
|
|
117
|
-
// track if we have found a match to return the values found.
|
|
118
|
-
let found = true;
|
|
119
|
-
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
120
|
-
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
121
|
-
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
122
|
-
// If the current part of the candidate is a "template" part
|
|
123
|
-
// Try to use the suffix of pattern to match the path
|
|
124
|
-
// {guid} ==> $
|
|
125
|
-
// {guid}:export ==> :export$
|
|
126
|
-
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
127
|
-
if (!isMatched) {
|
|
128
|
-
found = false;
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
// If the candidate part is not a template and
|
|
134
|
-
// the parts don't match mark the candidate as not found
|
|
135
|
-
// to move on with the next candidate path.
|
|
136
|
-
if (candidateParts[i] !== pathParts[j]) {
|
|
137
|
-
found = false;
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// We finished evaluating the current candidate parts
|
|
142
|
-
// Update the matched value if and only if we found the longer pattern
|
|
143
|
-
if (found && candidatePath.length > matchedLen) {
|
|
144
|
-
matchedLen = candidatePath.length;
|
|
145
|
-
matchedValue = value;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return matchedValue;
|
|
149
|
-
}
|
|
150
|
-
function getPathFromMapKey(mapKey) {
|
|
151
|
-
const pathStart = mapKey.indexOf("/");
|
|
152
|
-
return mapKey.slice(pathStart);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Copyright (c) Microsoft Corporation.
|
|
156
|
-
// Licensed under the MIT license.
|
|
157
|
-
/**
|
|
158
|
-
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
159
|
-
* @param client - Client to use for sending the next page requests
|
|
160
|
-
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
161
|
-
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
162
|
-
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
163
|
-
*/
|
|
164
|
-
function paginate(client, initialResponse, options = {}) {
|
|
165
|
-
let firstRun = true;
|
|
166
|
-
const itemName = "value";
|
|
167
|
-
const nextLinkName = "nextLink";
|
|
168
|
-
const { customGetPage } = options;
|
|
169
|
-
const pagedResult = {
|
|
170
|
-
firstPageLink: "",
|
|
171
|
-
getPage: typeof customGetPage === "function"
|
|
172
|
-
? customGetPage
|
|
173
|
-
: async (pageLink) => {
|
|
174
|
-
const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
|
|
175
|
-
firstRun = false;
|
|
176
|
-
checkPagingRequest(result);
|
|
177
|
-
const nextLink = getNextLink(result.body, nextLinkName);
|
|
178
|
-
const values = getElements(result.body, itemName);
|
|
179
|
-
return {
|
|
180
|
-
page: values,
|
|
181
|
-
nextPageLink: nextLink,
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
return corePaging.getPagedAsyncIterator(pagedResult);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Gets for the value of nextLink in the body
|
|
189
|
-
*/
|
|
190
|
-
function getNextLink(body, nextLinkName) {
|
|
191
|
-
if (!nextLinkName) {
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
const nextLink = body[nextLinkName];
|
|
195
|
-
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
196
|
-
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
197
|
-
}
|
|
198
|
-
return nextLink;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Gets the elements of the current request in the body.
|
|
202
|
-
*/
|
|
203
|
-
function getElements(body, itemName) {
|
|
204
|
-
const value = body[itemName];
|
|
205
|
-
// value has to be an array according to the x-ms-pageable extension.
|
|
206
|
-
// The fact that this must be an array is used above to calculate the
|
|
207
|
-
// type of elements in the page in PaginateReturn
|
|
208
|
-
if (!Array.isArray(value)) {
|
|
209
|
-
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
210
|
-
}
|
|
211
|
-
return value !== null && value !== void 0 ? value : [];
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Checks if a request failed
|
|
215
|
-
*/
|
|
216
|
-
function checkPagingRequest(response) {
|
|
217
|
-
const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
|
|
218
|
-
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
219
|
-
throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Copyright (c) Microsoft Corporation.
|
|
224
|
-
// Licensed under the MIT license.
|
|
225
|
-
|
|
226
|
-
exports.default = createClient;
|
|
227
|
-
exports.isUnexpected = isUnexpected;
|
|
228
|
-
exports.paginate = paginate;
|
|
229
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/logger.ts","../src/azureCommunicationRoutingServiceClient.ts","../src/isUnexpected.ts","../src/paginateHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"communication-job-router\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { isTokenCredential, KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { logger } from \"./logger\";\nimport { AzureCommunicationRoutingServiceClient } from \"./clientDefinitions\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param connectionString - The connectionString or url of your Communication Services resource.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n connectionString: string,\n options: ClientOptions,\n): AzureCommunicationRoutingServiceClient;\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param endpoint - Uri of your Communication resource\n * @param credentialOrOptions The key or token credential.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentialOrOptions?: KeyCredential | TokenCredential,\n options?: ClientOptions,\n): AzureCommunicationRoutingServiceClient;\n\n// Implementation\nexport default function createClient(\n arg1: string,\n arg2?: ClientOptions | (KeyCredential | TokenCredential),\n arg3?: ClientOptions,\n): AzureCommunicationRoutingServiceClient {\n let credentialOrOptions: KeyCredential | TokenCredential | undefined;\n let options: ClientOptions | undefined;\n const connectionStringOrUrl = arg1;\n\n // Determine which constructor is being called based on the types of the arguments\n if (isTokenCredential(arg2) || isKeyCredential(arg2)) {\n credentialOrOptions = arg2 as KeyCredential | TokenCredential;\n options = arg3 as ClientOptions;\n } else {\n options = arg2 as ClientOptions;\n }\n if (options === undefined) {\n options = {};\n }\n\n // Rest of the function remains the same, using connectionStringOrUrl or endpoint as needed\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const baseUrl = options?.baseUrl ?? `${url}`;\n options.apiVersion = options.apiVersion ?? \"2024-01-18-preview\";\n const userAgentInfo = `azsdk-js-communication-job-router-rest/1.1.0-beta.1`;\n const userAgentPrefix =\n options?.userAgentOptions && options?.userAgentOptions.userAgentPrefix\n ? `${options?.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options?.loggingOptions?.logger ?? logger.info,\n },\n };\n\n const client = getClient(baseUrl, options) as AzureCommunicationRoutingServiceClient;\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n UpsertClassificationPolicy200Response,\n UpsertClassificationPolicy201Response,\n UpsertClassificationPolicyDefaultResponse,\n GetClassificationPolicy200Response,\n GetClassificationPolicyDefaultResponse,\n DeleteClassificationPolicy204Response,\n DeleteClassificationPolicyDefaultResponse,\n ListClassificationPolicies200Response,\n ListClassificationPoliciesDefaultResponse,\n UpsertDistributionPolicy200Response,\n UpsertDistributionPolicy201Response,\n UpsertDistributionPolicyDefaultResponse,\n GetDistributionPolicy200Response,\n GetDistributionPolicyDefaultResponse,\n DeleteDistributionPolicy204Response,\n DeleteDistributionPolicyDefaultResponse,\n ListDistributionPolicies200Response,\n ListDistributionPoliciesDefaultResponse,\n UpsertExceptionPolicy200Response,\n UpsertExceptionPolicy201Response,\n UpsertExceptionPolicyDefaultResponse,\n GetExceptionPolicy200Response,\n GetExceptionPolicyDefaultResponse,\n DeleteExceptionPolicy204Response,\n DeleteExceptionPolicyDefaultResponse,\n ListExceptionPolicies200Response,\n ListExceptionPoliciesDefaultResponse,\n UpsertQueue200Response,\n UpsertQueue201Response,\n UpsertQueueDefaultResponse,\n GetQueue200Response,\n GetQueueDefaultResponse,\n DeleteQueue204Response,\n DeleteQueueDefaultResponse,\n ListQueues200Response,\n ListQueuesDefaultResponse,\n UpsertJob200Response,\n UpsertJob201Response,\n UpsertJobDefaultResponse,\n GetJob200Response,\n GetJobDefaultResponse,\n DeleteJob204Response,\n DeleteJobDefaultResponse,\n Reclassify200Response,\n ReclassifyDefaultResponse,\n Cancel200Response,\n CancelDefaultResponse,\n Complete200Response,\n CompleteDefaultResponse,\n Close200Response,\n CloseDefaultResponse,\n ListJobs200Response,\n ListJobsDefaultResponse,\n GetInQueuePosition200Response,\n GetInQueuePositionDefaultResponse,\n Unassign200Response,\n UnassignDefaultResponse,\n Accept200Response,\n AcceptDefaultResponse,\n Decline200Response,\n DeclineDefaultResponse,\n GetQueueStatistics200Response,\n GetQueueStatisticsDefaultResponse,\n UpsertWorker200Response,\n UpsertWorker201Response,\n UpsertWorkerDefaultResponse,\n GetWorker200Response,\n GetWorkerDefaultResponse,\n DeleteWorker204Response,\n DeleteWorkerDefaultResponse,\n ListWorkers200Response,\n ListWorkersDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"PATCH /routing/classificationPolicies/{classificationPolicyId}\": [\"200\", \"201\"],\n \"GET /routing/classificationPolicies/{classificationPolicyId}\": [\"200\"],\n \"DELETE /routing/classificationPolicies/{classificationPolicyId}\": [\"204\"],\n \"GET /routing/classificationPolicies\": [\"200\"],\n \"PATCH /routing/distributionPolicies/{distributionPolicyId}\": [\"200\", \"201\"],\n \"GET /routing/distributionPolicies/{distributionPolicyId}\": [\"200\"],\n \"DELETE /routing/distributionPolicies/{distributionPolicyId}\": [\"204\"],\n \"GET /routing/distributionPolicies\": [\"200\"],\n \"PATCH /routing/exceptionPolicies/{exceptionPolicyId}\": [\"200\", \"201\"],\n \"GET /routing/exceptionPolicies/{exceptionPolicyId}\": [\"200\"],\n \"DELETE /routing/exceptionPolicies/{exceptionPolicyId}\": [\"204\"],\n \"GET /routing/exceptionPolicies\": [\"200\"],\n \"PATCH /routing/queues/{queueId}\": [\"200\", \"201\"],\n \"GET /routing/queues/{queueId}\": [\"200\"],\n \"DELETE /routing/queues/{queueId}\": [\"204\"],\n \"GET /routing/queues\": [\"200\"],\n \"PATCH /routing/jobs/{jobId}\": [\"200\", \"201\"],\n \"GET /routing/jobs/{jobId}\": [\"200\"],\n \"DELETE /routing/jobs/{jobId}\": [\"204\"],\n \"POST /routing/jobs/{jobId}:reclassify\": [\"200\"],\n \"POST /routing/jobs/{jobId}:cancel\": [\"200\"],\n \"POST /routing/jobs/{jobId}/assignments/{assignmentId}:complete\": [\"200\"],\n \"POST /routing/jobs/{jobId}/assignments/{assignmentId}:close\": [\"200\"],\n \"GET /routing/jobs\": [\"200\"],\n \"GET /routing/jobs/{jobId}/position\": [\"200\"],\n \"POST /routing/jobs/{jobId}/assignments/{assignmentId}:unassign\": [\"200\"],\n \"POST /routing/workers/{workerId}/offers/{offerId}:accept\": [\"200\"],\n \"POST /routing/workers/{workerId}/offers/{offerId}:decline\": [\"200\"],\n \"GET /routing/queues/{queueId}/statistics\": [\"200\"],\n \"PATCH /routing/workers/{workerId}\": [\"200\", \"201\"],\n \"GET /routing/workers/{workerId}\": [\"200\"],\n \"DELETE /routing/workers/{workerId}\": [\"204\"],\n \"GET /routing/workers\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | UpsertClassificationPolicy200Response\n | UpsertClassificationPolicy201Response\n | UpsertClassificationPolicyDefaultResponse,\n): response is UpsertClassificationPolicyDefaultResponse;\nexport function isUnexpected(\n response: GetClassificationPolicy200Response | GetClassificationPolicyDefaultResponse,\n): response is GetClassificationPolicyDefaultResponse;\nexport function isUnexpected(\n response: DeleteClassificationPolicy204Response | DeleteClassificationPolicyDefaultResponse,\n): response is DeleteClassificationPolicyDefaultResponse;\nexport function isUnexpected(\n response: ListClassificationPolicies200Response | ListClassificationPoliciesDefaultResponse,\n): response is ListClassificationPoliciesDefaultResponse;\nexport function isUnexpected(\n response:\n | UpsertDistributionPolicy200Response\n | UpsertDistributionPolicy201Response\n | UpsertDistributionPolicyDefaultResponse,\n): response is UpsertDistributionPolicyDefaultResponse;\nexport function isUnexpected(\n response: GetDistributionPolicy200Response | GetDistributionPolicyDefaultResponse,\n): response is GetDistributionPolicyDefaultResponse;\nexport function isUnexpected(\n response: DeleteDistributionPolicy204Response | DeleteDistributionPolicyDefaultResponse,\n): response is DeleteDistributionPolicyDefaultResponse;\nexport function isUnexpected(\n response: ListDistributionPolicies200Response | ListDistributionPoliciesDefaultResponse,\n): response is ListDistributionPoliciesDefaultResponse;\nexport function isUnexpected(\n response:\n | UpsertExceptionPolicy200Response\n | UpsertExceptionPolicy201Response\n | UpsertExceptionPolicyDefaultResponse,\n): response is UpsertExceptionPolicyDefaultResponse;\nexport function isUnexpected(\n response: GetExceptionPolicy200Response | GetExceptionPolicyDefaultResponse,\n): response is GetExceptionPolicyDefaultResponse;\nexport function isUnexpected(\n response: DeleteExceptionPolicy204Response | DeleteExceptionPolicyDefaultResponse,\n): response is DeleteExceptionPolicyDefaultResponse;\nexport function isUnexpected(\n response: ListExceptionPolicies200Response | ListExceptionPoliciesDefaultResponse,\n): response is ListExceptionPoliciesDefaultResponse;\nexport function isUnexpected(\n response: UpsertQueue200Response | UpsertQueue201Response | UpsertQueueDefaultResponse,\n): response is UpsertQueueDefaultResponse;\nexport function isUnexpected(\n response: GetQueue200Response | GetQueueDefaultResponse,\n): response is GetQueueDefaultResponse;\nexport function isUnexpected(\n response: DeleteQueue204Response | DeleteQueueDefaultResponse,\n): response is DeleteQueueDefaultResponse;\nexport function isUnexpected(\n response: ListQueues200Response | ListQueuesDefaultResponse,\n): response is ListQueuesDefaultResponse;\nexport function isUnexpected(\n response: UpsertJob200Response | UpsertJob201Response | UpsertJobDefaultResponse,\n): response is UpsertJobDefaultResponse;\nexport function isUnexpected(\n response: GetJob200Response | GetJobDefaultResponse,\n): response is GetJobDefaultResponse;\nexport function isUnexpected(\n response: DeleteJob204Response | DeleteJobDefaultResponse,\n): response is DeleteJobDefaultResponse;\nexport function isUnexpected(\n response: Reclassify200Response | ReclassifyDefaultResponse,\n): response is ReclassifyDefaultResponse;\nexport function isUnexpected(\n response: Cancel200Response | CancelDefaultResponse,\n): response is CancelDefaultResponse;\nexport function isUnexpected(\n response: Complete200Response | CompleteDefaultResponse,\n): response is CompleteDefaultResponse;\nexport function isUnexpected(\n response: Close200Response | CloseDefaultResponse,\n): response is CloseDefaultResponse;\nexport function isUnexpected(\n response: ListJobs200Response | ListJobsDefaultResponse,\n): response is ListJobsDefaultResponse;\nexport function isUnexpected(\n response: GetInQueuePosition200Response | GetInQueuePositionDefaultResponse,\n): response is GetInQueuePositionDefaultResponse;\nexport function isUnexpected(\n response: Unassign200Response | UnassignDefaultResponse,\n): response is UnassignDefaultResponse;\nexport function isUnexpected(\n response: Accept200Response | AcceptDefaultResponse,\n): response is AcceptDefaultResponse;\nexport function isUnexpected(\n response: Decline200Response | DeclineDefaultResponse,\n): response is DeclineDefaultResponse;\nexport function isUnexpected(\n response: GetQueueStatistics200Response | GetQueueStatisticsDefaultResponse,\n): response is GetQueueStatisticsDefaultResponse;\nexport function isUnexpected(\n response: UpsertWorker200Response | UpsertWorker201Response | UpsertWorkerDefaultResponse,\n): response is UpsertWorkerDefaultResponse;\nexport function isUnexpected(\n response: GetWorker200Response | GetWorkerDefaultResponse,\n): response is GetWorkerDefaultResponse;\nexport function isUnexpected(\n response: DeleteWorker204Response | DeleteWorkerDefaultResponse,\n): response is DeleteWorkerDefaultResponse;\nexport function isUnexpected(\n response: ListWorkers200Response | ListWorkersDefaultResponse,\n): response is ListWorkersDefaultResponse;\nexport function isUnexpected(\n response:\n | UpsertClassificationPolicy200Response\n | UpsertClassificationPolicy201Response\n | UpsertClassificationPolicyDefaultResponse\n | GetClassificationPolicy200Response\n | GetClassificationPolicyDefaultResponse\n | DeleteClassificationPolicy204Response\n | DeleteClassificationPolicyDefaultResponse\n | ListClassificationPolicies200Response\n | ListClassificationPoliciesDefaultResponse\n | UpsertDistributionPolicy200Response\n | UpsertDistributionPolicy201Response\n | UpsertDistributionPolicyDefaultResponse\n | GetDistributionPolicy200Response\n | GetDistributionPolicyDefaultResponse\n | DeleteDistributionPolicy204Response\n | DeleteDistributionPolicyDefaultResponse\n | ListDistributionPolicies200Response\n | ListDistributionPoliciesDefaultResponse\n | UpsertExceptionPolicy200Response\n | UpsertExceptionPolicy201Response\n | UpsertExceptionPolicyDefaultResponse\n | GetExceptionPolicy200Response\n | GetExceptionPolicyDefaultResponse\n | DeleteExceptionPolicy204Response\n | DeleteExceptionPolicyDefaultResponse\n | ListExceptionPolicies200Response\n | ListExceptionPoliciesDefaultResponse\n | UpsertQueue200Response\n | UpsertQueue201Response\n | UpsertQueueDefaultResponse\n | GetQueue200Response\n | GetQueueDefaultResponse\n | DeleteQueue204Response\n | DeleteQueueDefaultResponse\n | ListQueues200Response\n | ListQueuesDefaultResponse\n | UpsertJob200Response\n | UpsertJob201Response\n | UpsertJobDefaultResponse\n | GetJob200Response\n | GetJobDefaultResponse\n | DeleteJob204Response\n | DeleteJobDefaultResponse\n | Reclassify200Response\n | ReclassifyDefaultResponse\n | Cancel200Response\n | CancelDefaultResponse\n | Complete200Response\n | CompleteDefaultResponse\n | Close200Response\n | CloseDefaultResponse\n | ListJobs200Response\n | ListJobsDefaultResponse\n | GetInQueuePosition200Response\n | GetInQueuePositionDefaultResponse\n | Unassign200Response\n | UnassignDefaultResponse\n | Accept200Response\n | AcceptDefaultResponse\n | Decline200Response\n | DeclineDefaultResponse\n | GetQueueStatistics200Response\n | GetQueueStatisticsDefaultResponse\n | UpsertWorker200Response\n | UpsertWorker201Response\n | UpsertWorkerDefaultResponse\n | GetWorker200Response\n | GetWorkerDefaultResponse\n | DeleteWorker204Response\n | DeleteWorkerDefaultResponse\n | ListWorkers200Response\n | ListWorkersDefaultResponse,\n): response is\n | UpsertClassificationPolicyDefaultResponse\n | GetClassificationPolicyDefaultResponse\n | DeleteClassificationPolicyDefaultResponse\n | ListClassificationPoliciesDefaultResponse\n | UpsertDistributionPolicyDefaultResponse\n | GetDistributionPolicyDefaultResponse\n | DeleteDistributionPolicyDefaultResponse\n | ListDistributionPoliciesDefaultResponse\n | UpsertExceptionPolicyDefaultResponse\n | GetExceptionPolicyDefaultResponse\n | DeleteExceptionPolicyDefaultResponse\n | ListExceptionPoliciesDefaultResponse\n | UpsertQueueDefaultResponse\n | GetQueueDefaultResponse\n | DeleteQueueDefaultResponse\n | ListQueuesDefaultResponse\n | UpsertJobDefaultResponse\n | GetJobDefaultResponse\n | DeleteJobDefaultResponse\n | ReclassifyDefaultResponse\n | CancelDefaultResponse\n | CompleteDefaultResponse\n | CloseDefaultResponse\n | ListJobsDefaultResponse\n | GetInQueuePositionDefaultResponse\n | UnassignDefaultResponse\n | AcceptDefaultResponse\n | DeclineDefaultResponse\n | GetQueueStatisticsDefaultResponse\n | UpsertWorkerDefaultResponse\n | GetWorkerDefaultResponse\n | DeleteWorkerDefaultResponse\n | ListWorkersDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { Client, createRestError, PathUncheckedResponse } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number,\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {},\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`,\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response,\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport AzureCommunicationRoutingServiceClient from \"./azureCommunicationRoutingServiceClient\";\n\nexport * from \"./azureCommunicationRoutingServiceClient\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default AzureCommunicationRoutingServiceClient;\n"],"names":["createClientLogger","isTokenCredential","isKeyCredential","parseClientArguments","getClient","createCommunicationAuthPolicy","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;;;;AAAA;AACA;AAGO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,0BAA0B,CAAC;;ACJpE;AACA;AAkCA;AACwB,SAAA,YAAY,CAClC,IAAY,EACZ,IAAwD,EACxD,IAAoB,EAAA;;AAEpB,IAAA,IAAI,mBAAgE,CAAC;AACrE,IAAA,IAAI,OAAkC,CAAC;IACvC,MAAM,qBAAqB,GAAG,IAAI,CAAC;;IAGnC,IAAIC,0BAAiB,CAAC,IAAI,CAAC,IAAIC,mCAAe,CAAC,IAAI,CAAC,EAAE;QACpD,mBAAmB,GAAG,IAAuC,CAAC;QAC9D,OAAO,GAAG,IAAqB,CAAC;KACjC;SAAM;QACL,OAAO,GAAG,IAAqB,CAAC;KACjC;AACD,IAAA,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,GAAG,EAAE,CAAC;KACd;;AAGD,IAAA,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAGC,wCAAoB,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;AAC7F,IAAA,MAAM,OAAO,GAAG,CAAA,EAAA,GAAA,OAAO,aAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAG,EAAA,GAAG,EAAE,CAAC;IAC7C,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,oBAAoB,CAAC;IAChE,MAAM,aAAa,GAAG,CAAA,mDAAA,CAAqD,CAAC;IAC5E,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AE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjD,MAAMC,0BAAe,CACnB,CAAA,6CAAA,EAAgD,QAAQ,CAAC,MAAM,CAAE,CAAA,EACjE,QAAQ,CACT,CAAC;KACH;AACH;;AClIA;AACA;;;;;;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { getClient } from "@azure-rest/core-client";
|
|
4
|
-
import { isTokenCredential } from "@azure/core-auth";
|
|
5
|
-
import { logger } from "./logger";
|
|
6
|
-
import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
|
|
7
|
-
// Implementation
|
|
8
|
-
export default function createClient(arg1, arg2, arg3) {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
10
|
-
let credentialOrOptions;
|
|
11
|
-
let options;
|
|
12
|
-
const connectionStringOrUrl = arg1;
|
|
13
|
-
// Determine which constructor is being called based on the types of the arguments
|
|
14
|
-
if (isTokenCredential(arg2) || isKeyCredential(arg2)) {
|
|
15
|
-
credentialOrOptions = arg2;
|
|
16
|
-
options = arg3;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
options = arg2;
|
|
20
|
-
}
|
|
21
|
-
if (options === undefined) {
|
|
22
|
-
options = {};
|
|
23
|
-
}
|
|
24
|
-
// Rest of the function remains the same, using connectionStringOrUrl or endpoint as needed
|
|
25
|
-
const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);
|
|
26
|
-
const baseUrl = (_a = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _a !== void 0 ? _a : `${url}`;
|
|
27
|
-
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2024-01-18-preview";
|
|
28
|
-
const userAgentInfo = `azsdk-js-communication-job-router-rest/1.1.0-beta.1`;
|
|
29
|
-
const userAgentPrefix = (options === null || options === void 0 ? void 0 : options.userAgentOptions) && (options === null || options === void 0 ? void 0 : options.userAgentOptions.userAgentPrefix)
|
|
30
|
-
? `${options === null || options === void 0 ? void 0 : options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
31
|
-
: `${userAgentInfo}`;
|
|
32
|
-
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
33
|
-
userAgentPrefix,
|
|
34
|
-
}, loggingOptions: {
|
|
35
|
-
logger: (_d = (_c = options === null || options === void 0 ? void 0 : options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info,
|
|
36
|
-
} });
|
|
37
|
-
const client = getClient(baseUrl, options);
|
|
38
|
-
const authPolicy = createCommunicationAuthPolicy(credential);
|
|
39
|
-
client.pipeline.addPolicy(authPolicy);
|
|
40
|
-
return client;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=azureCommunicationRoutingServiceClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"azureCommunicationRoutingServiceClient.js","sourceRoot":"","sources":["../../src/azureCommunicationRoutingServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAkC,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAwBrC,iBAAiB;AACjB,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAY,EACZ,IAAwD,EACxD,IAAoB;;IAEpB,IAAI,mBAAgE,CAAC;IACrE,IAAI,OAAkC,CAAC;IACvC,MAAM,qBAAqB,GAAG,IAAI,CAAC;IAEnC,kFAAkF;IAClF,IAAI,iBAAiB,CAA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AAM,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { isTokenCredential, KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { logger } from \"./logger\";\nimport { AzureCommunicationRoutingServiceClient } from \"./clientDefinitions\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param connectionString - The connectionString or url of your Communication Services resource.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n connectionString: string,\n options: ClientOptions,\n): AzureCommunicationRoutingServiceClient;\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param endpoint - Uri of your Communication resource\n * @param credentialOrOptions The key or token credential.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentialOrOptions?: KeyCredential | TokenCredential,\n options?: ClientOptions,\n): AzureCommunicationRoutingServiceClient;\n\n// Implementation\nexport default function createClient(\n arg1: string,\n arg2?: ClientOptions | (KeyCredential | TokenCredential),\n arg3?: ClientOptions,\n): AzureCommunicationRoutingServiceClient {\n let credentialOrOptions: KeyCredential | TokenCredential | undefined;\n let options: ClientOptions | undefined;\n const connectionStringOrUrl = arg1;\n\n // Determine which constructor is being called based on the types of the arguments\n if (isTokenCredential(arg2) || isKeyCredential(arg2)) {\n credentialOrOptions = arg2 as KeyCredential | TokenCredential;\n options = arg3 as ClientOptions;\n } else {\n options = arg2 as ClientOptions;\n }\n if (options === undefined) {\n options = {};\n }\n\n // Rest of the function remains the same, using connectionStringOrUrl or endpoint as needed\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const baseUrl = options?.baseUrl ?? `${url}`;\n options.apiVersion = options.apiVersion ?? \"2024-01-18-preview\";\n const userAgentInfo = `azsdk-js-communication-job-router-rest/1.1.0-beta.1`;\n const userAgentPrefix =\n options?.userAgentOptions && options?.userAgentOptions.userAgentPrefix\n ? `${options?.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options?.loggingOptions?.logger ?? logger.info,\n },\n };\n\n const client = getClient(baseUrl, options) as AzureCommunicationRoutingServiceClient;\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n UpsertClassificationPolicyParameters,\n GetClassificationPolicyParameters,\n DeleteClassificationPolicyParameters,\n ListClassificationPoliciesParameters,\n UpsertDistributionPolicyParameters,\n GetDistributionPolicyParameters,\n DeleteDistributionPolicyParameters,\n ListDistributionPoliciesParameters,\n UpsertExceptionPolicyParameters,\n GetExceptionPolicyParameters,\n DeleteExceptionPolicyParameters,\n ListExceptionPoliciesParameters,\n UpsertQueueParameters,\n GetQueueParameters,\n DeleteQueueParameters,\n ListQueuesParameters,\n UpsertJobParameters,\n GetJobParameters,\n DeleteJobParameters,\n ReclassifyParameters,\n CancelParameters,\n CompleteParameters,\n CloseParameters,\n ListJobsParameters,\n GetInQueuePositionParameters,\n UnassignParameters,\n AcceptParameters,\n DeclineParameters,\n GetQueueStatisticsParameters,\n UpsertWorkerParameters,\n GetWorkerParameters,\n DeleteWorkerParameters,\n ListWorkersParameters,\n} from \"./parameters\";\nimport {\n UpsertClassificationPolicy200Response,\n UpsertClassificationPolicy201Response,\n UpsertClassificationPolicyDefaultResponse,\n GetClassificationPolicy200Response,\n GetClassificationPolicyDefaultResponse,\n DeleteClassificationPolicy204Response,\n DeleteClassificationPolicyDefaultResponse,\n ListClassificationPolicies200Response,\n ListClassificationPoliciesDefaultResponse,\n UpsertDistributionPolicy200Response,\n UpsertDistributionPolicy201Response,\n UpsertDistributionPolicyDefaultResponse,\n GetDistributionPolicy200Response,\n GetDistributionPolicyDefaultResponse,\n DeleteDistributionPolicy204Response,\n DeleteDistributionPolicyDefaultResponse,\n ListDistributionPolicies200Response,\n ListDistributionPoliciesDefaultResponse,\n UpsertExceptionPolicy200Response,\n UpsertExceptionPolicy201Response,\n UpsertExceptionPolicyDefaultResponse,\n GetExceptionPolicy200Response,\n GetExceptionPolicyDefaultResponse,\n DeleteExceptionPolicy204Response,\n DeleteExceptionPolicyDefaultResponse,\n ListExceptionPolicies200Response,\n ListExceptionPoliciesDefaultResponse,\n UpsertQueue200Response,\n UpsertQueue201Response,\n UpsertQueueDefaultResponse,\n GetQueue200Response,\n GetQueueDefaultResponse,\n DeleteQueue204Response,\n DeleteQueueDefaultResponse,\n ListQueues200Response,\n ListQueuesDefaultResponse,\n UpsertJob200Response,\n UpsertJob201Response,\n UpsertJobDefaultResponse,\n GetJob200Response,\n GetJobDefaultResponse,\n DeleteJob204Response,\n DeleteJobDefaultResponse,\n Reclassify200Response,\n ReclassifyDefaultResponse,\n Cancel200Response,\n CancelDefaultResponse,\n Complete200Response,\n CompleteDefaultResponse,\n Close200Response,\n CloseDefaultResponse,\n ListJobs200Response,\n ListJobsDefaultResponse,\n GetInQueuePosition200Response,\n GetInQueuePositionDefaultResponse,\n Unassign200Response,\n UnassignDefaultResponse,\n Accept200Response,\n AcceptDefaultResponse,\n Decline200Response,\n DeclineDefaultResponse,\n GetQueueStatistics200Response,\n GetQueueStatisticsDefaultResponse,\n UpsertWorker200Response,\n UpsertWorker201Response,\n UpsertWorkerDefaultResponse,\n GetWorker200Response,\n GetWorkerDefaultResponse,\n DeleteWorker204Response,\n DeleteWorkerDefaultResponse,\n ListWorkers200Response,\n ListWorkersDefaultResponse,\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface UpsertClassificationPolicy {\n /** Creates or updates a classification policy. */\n patch(\n options: UpsertClassificationPolicyParameters,\n ): StreamableMethod<\n | UpsertClassificationPolicy200Response\n | UpsertClassificationPolicy201Response\n | UpsertClassificationPolicyDefaultResponse\n >;\n /** Retrieves an existing classification policy by Id. */\n get(\n options?: GetClassificationPolicyParameters,\n ): StreamableMethod<GetClassificationPolicy200Response | GetClassificationPolicyDefaultResponse>;\n /** Delete a classification policy by Id. */\n delete(\n options?: DeleteClassificationPolicyParameters,\n ): StreamableMethod<\n DeleteClassificationPolicy204Response | DeleteClassificationPolicyDefaultResponse\n >;\n}\n\nexport interface ListClassificationPolicies {\n /** Retrieves existing classification policies. */\n get(\n options?: ListClassificationPoliciesParameters,\n ): StreamableMethod<\n ListClassificationPolicies200Response | ListClassificationPoliciesDefaultResponse\n >;\n}\n\nexport interface UpsertDistributionPolicy {\n /** Creates or updates a distribution policy. */\n patch(\n options: UpsertDistributionPolicyParameters,\n ): StreamableMethod<\n | UpsertDistributionPolicy200Response\n | UpsertDistributionPolicy201Response\n | UpsertDistributionPolicyDefaultResponse\n >;\n /** Retrieves an existing distribution policy by Id. */\n get(\n options?: GetDistributionPolicyParameters,\n ): StreamableMethod<GetDistributionPolicy200Response | GetDistributionPolicyDefaultResponse>;\n /** Delete a distribution policy by Id. */\n delete(\n options?: DeleteDistributionPolicyParameters,\n ): StreamableMethod<\n DeleteDistributionPolicy204Response | DeleteDistributionPolicyDefaultResponse\n >;\n}\n\nexport interface ListDistributionPolicies {\n /** Retrieves existing distribution policies. */\n get(\n options?: ListDistributionPoliciesParameters,\n ): StreamableMethod<\n ListDistributionPolicies200Response | ListDistributionPoliciesDefaultResponse\n >;\n}\n\nexport interface UpsertExceptionPolicy {\n /** Creates or updates a exception policy. */\n patch(\n options: UpsertExceptionPolicyParameters,\n ): StreamableMethod<\n | UpsertExceptionPolicy200Response\n | UpsertExceptionPolicy201Response\n | UpsertExceptionPolicyDefaultResponse\n >;\n /** Retrieves an existing exception policy by Id. */\n get(\n options?: GetExceptionPolicyParameters,\n ): StreamableMethod<GetExceptionPolicy200Response | GetExceptionPolicyDefaultResponse>;\n /** Deletes a exception policy by Id. */\n delete(\n options?: DeleteExceptionPolicyParameters,\n ): StreamableMethod<DeleteExceptionPolicy204Response | DeleteExceptionPolicyDefaultResponse>;\n}\n\nexport interface ListExceptionPolicies {\n /** Retrieves existing exception policies. */\n get(\n options?: ListExceptionPoliciesParameters,\n ): StreamableMethod<ListExceptionPolicies200Response | ListExceptionPoliciesDefaultResponse>;\n}\n\nexport interface UpsertQueue {\n /** Creates or updates a queue. */\n patch(\n options: UpsertQueueParameters,\n ): StreamableMethod<UpsertQueue200Response | UpsertQueue201Response | UpsertQueueDefaultResponse>;\n /** Retrieves an existing queue by Id. */\n get(\n options?: GetQueueParameters,\n ): StreamableMethod<GetQueue200Response | GetQueueDefaultResponse>;\n /** Deletes a queue by Id. */\n delete(\n options?: DeleteQueueParameters,\n ): StreamableMethod<DeleteQueue204Response | DeleteQueueDefaultResponse>;\n}\n\nexport interface ListQueues {\n /** Retrieves existing queues. */\n get(\n options?: ListQueuesParameters,\n ): StreamableMethod<ListQueues200Response | ListQueuesDefaultResponse>;\n}\n\nexport interface UpsertJob {\n /** Creates or updates a router job. */\n patch(\n options: UpsertJobParameters,\n ): StreamableMethod<UpsertJob200Response | UpsertJob201Response | UpsertJobDefaultResponse>;\n /** Retrieves an existing job by Id. */\n get(options?: GetJobParameters): StreamableMethod<GetJob200Response | GetJobDefaultResponse>;\n /** Deletes a job and all of its traces. */\n delete(\n options?: DeleteJobParameters,\n ): StreamableMethod<DeleteJob204Response | DeleteJobDefaultResponse>;\n}\n\nexport interface Reclassify {\n /** Reclassify a job. */\n post(\n options?: ReclassifyParameters,\n ): StreamableMethod<Reclassify200Response | ReclassifyDefaultResponse>;\n}\n\nexport interface Cancel {\n /** Submits request to cancel an existing job by Id while supplying free-form cancellation reason. */\n post(options?: CancelParameters): StreamableMethod<Cancel200Response | CancelDefaultResponse>;\n}\n\nexport interface Complete {\n /** Completes an assigned job. */\n post(\n options?: CompleteParameters,\n ): StreamableMethod<Complete200Response | CompleteDefaultResponse>;\n}\n\nexport interface Close {\n /** Closes a completed job. */\n post(options?: CloseParameters): StreamableMethod<Close200Response | CloseDefaultResponse>;\n}\n\nexport interface ListJobs {\n /** Retrieves list of jobs based on filter parameters. */\n get(\n options?: ListJobsParameters,\n ): StreamableMethod<ListJobs200Response | ListJobsDefaultResponse>;\n}\n\nexport interface GetInQueuePosition {\n /** Gets a job's position details. */\n get(\n options?: GetInQueuePositionParameters,\n ): StreamableMethod<GetInQueuePosition200Response | GetInQueuePositionDefaultResponse>;\n}\n\nexport interface Unassign {\n /** Unassign a job. */\n post(\n options?: UnassignParameters,\n ): StreamableMethod<Unassign200Response | UnassignDefaultResponse>;\n}\n\nexport interface Accept {\n /** Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. */\n post(options?: AcceptParameters): StreamableMethod<Accept200Response | AcceptDefaultResponse>;\n}\n\nexport interface Decline {\n /** Declines an offer to work on a job. */\n post(options?: DeclineParameters): StreamableMethod<Decline200Response | DeclineDefaultResponse>;\n}\n\nexport interface GetQueueStatistics {\n /** Retrieves a queue's statistics. */\n get(\n options?: GetQueueStatisticsParameters,\n ): StreamableMethod<GetQueueStatistics200Response | GetQueueStatisticsDefaultResponse>;\n}\n\nexport interface UpsertWorker {\n /** Creates or updates a worker. */\n patch(\n options: UpsertWorkerParameters,\n ): StreamableMethod<\n UpsertWorker200Response | UpsertWorker201Response | UpsertWorkerDefaultResponse\n >;\n /** Retrieves an existing worker by Id. */\n get(\n options?: GetWorkerParameters,\n ): StreamableMethod<GetWorker200Response | GetWorkerDefaultResponse>;\n /** Deletes a worker and all of its traces. */\n delete(\n options?: DeleteWorkerParameters,\n ): StreamableMethod<DeleteWorker204Response | DeleteWorkerDefaultResponse>;\n}\n\nexport interface ListWorkers {\n /** Retrieves existing workers. */\n get(\n options?: ListWorkersParameters,\n ): StreamableMethod<ListWorkers200Response | ListWorkersDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/routing/classificationPolicies/\\{classificationPolicyId\\}' has methods for the following verbs: patch, get, delete */\n (\n path: \"/routing/classificationPolicies/{classificationPolicyId}\",\n classificationPolicyId: string,\n ): UpsertClassificationPolicy;\n /** Resource for '/routing/classificationPolicies' has methods for the following verbs: get */\n (path: \"/routing/classificationPolicies\"): ListClassificationPolicies;\n /** Resource for '/routing/distributionPolicies/\\{distributionPolicyId\\}' has methods for the following verbs: patch, get, delete */\n (\n path: \"/routing/distributionPolicies/{distributionPolicyId}\",\n distributionPolicyId: string,\n ): UpsertDistributionPolicy;\n /** Resource for '/routing/distributionPolicies' has methods for the following verbs: get */\n (path: \"/routing/distributionPolicies\"): ListDistributionPolicies;\n /** Resource for '/routing/exceptionPolicies/\\{exceptionPolicyId\\}' has methods for the following verbs: patch, get, delete */\n (\n path: \"/routing/exceptionPolicies/{exceptionPolicyId}\",\n exceptionPolicyId: string,\n ): UpsertExceptionPolicy;\n /** Resource for '/routing/exceptionPolicies' has methods for the following verbs: get */\n (path: \"/routing/exceptionPolicies\"): ListExceptionPolicies;\n /** Resource for '/routing/queues/\\{queueId\\}' has methods for the following verbs: patch, get, delete */\n (path: \"/routing/queues/{queueId}\", queueId: string): UpsertQueue;\n /** Resource for '/routing/queues' has methods for the following verbs: get */\n (path: \"/routing/queues\"): ListQueues;\n /** Resource for '/routing/jobs/\\{jobId\\}' has methods for the following verbs: patch, get, delete */\n (path: \"/routing/jobs/{jobId}\", jobId: string): UpsertJob;\n /** Resource for '/routing/jobs/\\{jobId\\}:reclassify' has methods for the following verbs: post */\n (path: \"/routing/jobs/{jobId}:reclassify\", jobId: string): Reclassify;\n /** Resource for '/routing/jobs/\\{jobId\\}:cancel' has methods for the following verbs: post */\n (path: \"/routing/jobs/{jobId}:cancel\", jobId: string): Cancel;\n /** Resource for '/routing/jobs/\\{jobId\\}/assignments/\\{assignmentId\\}:complete' has methods for the following verbs: post */\n (\n path: \"/routing/jobs/{jobId}/assignments/{assignmentId}:complete\",\n jobId: string,\n assignmentId: string,\n ): Complete;\n /** Resource for '/routing/jobs/\\{jobId\\}/assignments/\\{assignmentId\\}:close' has methods for the following verbs: post */\n (\n path: \"/routing/jobs/{jobId}/assignments/{assignmentId}:close\",\n jobId: string,\n assignmentId: string,\n ): Close;\n /** Resource for '/routing/jobs' has methods for the following verbs: get */\n (path: \"/routing/jobs\"): ListJobs;\n /** Resource for '/routing/jobs/\\{jobId\\}/position' has methods for the following verbs: get */\n (path: \"/routing/jobs/{jobId}/position\", jobId: string): GetInQueuePosition;\n /** Resource for '/routing/jobs/\\{jobId\\}/assignments/\\{assignmentId\\}:unassign' has methods for the following verbs: post */\n (\n path: \"/routing/jobs/{jobId}/assignments/{assignmentId}:unassign\",\n jobId: string,\n assignmentId: string,\n ): Unassign;\n /** Resource for '/routing/workers/\\{workerId\\}/offers/\\{offerId\\}:accept' has methods for the following verbs: post */\n (\n path: \"/routing/workers/{workerId}/offers/{offerId}:accept\",\n workerId: string,\n offerId: string,\n ): Accept;\n /** Resource for '/routing/workers/\\{workerId\\}/offers/\\{offerId\\}:decline' has methods for the following verbs: post */\n (\n path: \"/routing/workers/{workerId}/offers/{offerId}:decline\",\n workerId: string,\n offerId: string,\n ): Decline;\n /** Resource for '/routing/queues/\\{queueId\\}/statistics' has methods for the following verbs: get */\n (path: \"/routing/queues/{queueId}/statistics\", queueId: string): GetQueueStatistics;\n /** Resource for '/routing/workers/\\{workerId\\}' has methods for the following verbs: patch, get, delete */\n (path: \"/routing/workers/{workerId}\", workerId: string): UpsertWorker;\n /** Resource for '/routing/workers' has methods for the following verbs: get */\n (path: \"/routing/workers\"): ListWorkers;\n}\n\nexport type AzureCommunicationRoutingServiceClient = Client & {\n path: Routes;\n};\n"]}
|
package/dist-esm/src/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import AzureCommunicationRoutingServiceClient from "./azureCommunicationRoutingServiceClient";
|
|
4
|
-
export * from "./azureCommunicationRoutingServiceClient";
|
|
5
|
-
export * from "./parameters";
|
|
6
|
-
export * from "./responses";
|
|
7
|
-
export * from "./clientDefinitions";
|
|
8
|
-
export * from "./isUnexpected";
|
|
9
|
-
export * from "./models";
|
|
10
|
-
export * from "./outputModels";
|
|
11
|
-
export * from "./paginateHelper";
|
|
12
|
-
export default AzureCommunicationRoutingServiceClient;
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,sCAAsC,MAAM,0CAA0C,CAAC;AAE9F,cAAc,0CAA0C,CAAC;AACzD,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,eAAe,sCAAsC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport AzureCommunicationRoutingServiceClient from \"./azureCommunicationRoutingServiceClient\";\n\nexport * from \"./azureCommunicationRoutingServiceClient\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default AzureCommunicationRoutingServiceClient;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","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AAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n UpsertClassificationPolicy200Response,\n UpsertClassificationPolicy201Response,\n UpsertClassificationPolicyDefaultResponse,\n GetClassificationPolicy200Response,\n GetClassificationPolicyDefaultResponse,\n DeleteClassificationPolicy204Response,\n DeleteClassificationPolicyDefaultResponse,\n ListClassificationPolicies200Response,\n ListClassificationPoliciesDefaultResponse,\n UpsertDistributionPolicy200Response,\n UpsertDistributionPolicy201Response,\n UpsertDistributionPolicyDefaultResponse,\n GetDistributionPolicy200Response,\n GetDistributionPolicyDefaultResponse,\n DeleteDistributionPolicy204Response,\n DeleteDistributionPolicyDefaultResponse,\n ListDistributionPolicies200Response,\n ListDistributionPoliciesDefaultResponse,\n UpsertExceptionPolicy200Response,\n UpsertExceptionPolicy201Response,\n UpsertExceptionPolicyDefaultResponse,\n GetExceptionPolicy200Response,\n GetExceptionPolicyDefaultResponse,\n DeleteExceptionPolicy204Response,\n DeleteExceptionPolicyDefaultResponse,\n ListExceptionPolicies200Response,\n ListExceptionPoliciesDefaultResponse,\n UpsertQueue200Response,\n UpsertQueue201Response,\n UpsertQueueDefaultResponse,\n GetQueue200Response,\n GetQueueDefaultResponse,\n DeleteQueue204Response,\n DeleteQueueDefaultResponse,\n ListQueues200Response,\n ListQueuesDefaultResponse,\n UpsertJob200Response,\n UpsertJob201Response,\n UpsertJobDefaultResponse,\n GetJob200Response,\n GetJobDefaultResponse,\n DeleteJob204Response,\n DeleteJobDefaultResponse,\n Reclassify200Response,\n ReclassifyDefaultResponse,\n Cancel200Response,\n CancelDefaultResponse,\n Complete200Response,\n CompleteDefaultResponse,\n Close200Response,\n CloseDefaultResponse,\n ListJobs200Response,\n ListJobsDefaultResponse,\n GetInQueuePosition200Response,\n GetInQueuePositionDefaultResponse,\n Unassign200Response,\n UnassignDefaultResponse,\n Accept200Response,\n AcceptDefaultResponse,\n Decline200Response,\n DeclineDefaultResponse,\n GetQueueStatistics200Response,\n GetQueueStatisticsDefaultResponse,\n UpsertWorker200Response,\n UpsertWorker201Response,\n UpsertWorkerDefaultResponse,\n GetWorker200Response,\n GetWorkerDefaultResponse,\n DeleteWorker204Response,\n DeleteWorkerDefaultResponse,\n ListWorkers200Response,\n ListWorkersDefaultResponse,\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"PATCH /routing/classificationPolicies/{classificationPolicyId}\": [\"200\", \"201\"],\n \"GET /routing/classificationPolicies/{classificationPolicyId}\": [\"200\"],\n \"DELETE /routing/classificationPolicies/{classificationPolicyId}\": [\"204\"],\n \"GET /routing/classificationPolicies\": [\"200\"],\n \"PATCH /routing/distributionPolicies/{distributionPolicyId}\": [\"200\", \"201\"],\n \"GET /routing/distributionPolicies/{distributionPolicyId}\": [\"200\"],\n \"DELETE /routing/distributionPolicies/{distributionPolicyId}\": [\"204\"],\n \"GET /routing/distributionPolicies\": [\"200\"],\n \"PATCH /routing/exceptionPolicies/{exceptionPolicyId}\": [\"200\", \"201\"],\n \"GET /routing/exceptionPolicies/{exceptionPolicyId}\": [\"200\"],\n \"DELETE /routing/exceptionPolicies/{exceptionPolicyId}\": [\"204\"],\n \"GET /routing/exceptionPolicies\": [\"200\"],\n \"PATCH /routing/queues/{queueId}\": [\"200\", \"201\"],\n \"GET /routing/queues/{queueId}\": [\"200\"],\n \"DELETE /routing/queues/{queueId}\": [\"204\"],\n \"GET /routing/queues\": [\"200\"],\n \"PATCH /routing/jobs/{jobId}\": [\"200\", \"201\"],\n \"GET /routing/jobs/{jobId}\": [\"200\"],\n \"DELETE /routing/jobs/{jobId}\": [\"204\"],\n \"POST /routing/jobs/{jobId}:reclassify\": [\"200\"],\n \"POST /routing/jobs/{jobId}:cancel\": [\"200\"],\n \"POST /routing/jobs/{jobId}/assignments/{assignmentId}:complete\": [\"200\"],\n \"POST /routing/jobs/{jobId}/assignments/{assignmentId}:close\": [\"200\"],\n \"GET /routing/jobs\": [\"200\"],\n \"GET /routing/jobs/{jobId}/position\": [\"200\"],\n \"POST /routing/jobs/{jobId}/assignments/{assignmentId}:unassign\": [\"200\"],\n \"POST /routing/workers/{workerId}/offers/{offerId}:accept\": [\"200\"],\n \"POST /routing/workers/{workerId}/offers/{offerId}:decline\": [\"200\"],\n \"GET /routing/queues/{queueId}/statistics\": [\"200\"],\n \"PATCH /routing/workers/{workerId}\": [\"200\", \"201\"],\n \"GET /routing/workers/{workerId}\": [\"200\"],\n \"DELETE /routing/workers/{workerId}\": [\"204\"],\n \"GET /routing/workers\": [\"200\"],\n};\n\nexport function isUnexpected(\n response:\n | UpsertClassificationPolicy200Response\n | UpsertClassificationPolicy201Response\n | UpsertClassificationPolicyDefaultResponse,\n): response is UpsertClassificationPolicyDefaultResponse;\nexport function isUnexpected(\n response: GetClassificationPolicy200Response | GetClassificationPolicyDefaultResponse,\n): response is GetClassificationPolicyDefaultResponse;\nexport function isUnexpected(\n response: DeleteClassificationPolicy204Response | DeleteClassificationPolicyDefaultResponse,\n): response is DeleteClassificationPolicyDefaultResponse;\nexport function isUnexpected(\n response: ListClassificationPolicies200Response | ListClassificationPoliciesDefaultResponse,\n): response is ListClassificationPoliciesDefaultResponse;\nexport function isUnexpected(\n response:\n | UpsertDistributionPolicy200Response\n | UpsertDistributionPolicy201Response\n | UpsertDistributionPolicyDefaultResponse,\n): response is UpsertDistributionPolicyDefaultResponse;\nexport function isUnexpected(\n response: GetDistributionPolicy200Response | GetDistributionPolicyDefaultResponse,\n): response is GetDistributionPolicyDefaultResponse;\nexport function isUnexpected(\n response: DeleteDistributionPolicy204Response | DeleteDistributionPolicyDefaultResponse,\n): response is DeleteDistributionPolicyDefaultResponse;\nexport function isUnexpected(\n response: ListDistributionPolicies200Response | ListDistributionPoliciesDefaultResponse,\n): response is ListDistributionPoliciesDefaultResponse;\nexport function isUnexpected(\n response:\n | UpsertExceptionPolicy200Response\n | UpsertExceptionPolicy201Response\n | UpsertExceptionPolicyDefaultResponse,\n): response is UpsertExceptionPolicyDefaultResponse;\nexport function isUnexpected(\n response: GetExceptionPolicy200Response | GetExceptionPolicyDefaultResponse,\n): response is GetExceptionPolicyDefaultResponse;\nexport function isUnexpected(\n response: DeleteExceptionPolicy204Response | DeleteExceptionPolicyDefaultResponse,\n): response is DeleteExceptionPolicyDefaultResponse;\nexport function isUnexpected(\n response: ListExceptionPolicies200Response | ListExceptionPoliciesDefaultResponse,\n): response is ListExceptionPoliciesDefaultResponse;\nexport function isUnexpected(\n response: UpsertQueue200Response | UpsertQueue201Response | UpsertQueueDefaultResponse,\n): response is UpsertQueueDefaultResponse;\nexport function isUnexpected(\n response: GetQueue200Response | GetQueueDefaultResponse,\n): response is GetQueueDefaultResponse;\nexport function isUnexpected(\n response: DeleteQueue204Response | DeleteQueueDefaultResponse,\n): response is DeleteQueueDefaultResponse;\nexport function isUnexpected(\n response: ListQueues200Response | ListQueuesDefaultResponse,\n): response is ListQueuesDefaultResponse;\nexport function isUnexpected(\n response: UpsertJob200Response | UpsertJob201Response | UpsertJobDefaultResponse,\n): response is UpsertJobDefaultResponse;\nexport function isUnexpected(\n response: GetJob200Response | GetJobDefaultResponse,\n): response is GetJobDefaultResponse;\nexport function isUnexpected(\n response: DeleteJob204Response | DeleteJobDefaultResponse,\n): response is DeleteJobDefaultResponse;\nexport function isUnexpected(\n response: Reclassify200Response | ReclassifyDefaultResponse,\n): response is ReclassifyDefaultResponse;\nexport function isUnexpected(\n response: Cancel200Response | CancelDefaultResponse,\n): response is CancelDefaultResponse;\nexport function isUnexpected(\n response: Complete200Response | CompleteDefaultResponse,\n): response is CompleteDefaultResponse;\nexport function isUnexpected(\n response: Close200Response | CloseDefaultResponse,\n): response is CloseDefaultResponse;\nexport function isUnexpected(\n response: ListJobs200Response | ListJobsDefaultResponse,\n): response is ListJobsDefaultResponse;\nexport function isUnexpected(\n response: GetInQueuePosition200Response | GetInQueuePositionDefaultResponse,\n): response is GetInQueuePositionDefaultResponse;\nexport function isUnexpected(\n response: Unassign200Response | UnassignDefaultResponse,\n): response is UnassignDefaultResponse;\nexport function isUnexpected(\n response: Accept200Response | AcceptDefaultResponse,\n): response is AcceptDefaultResponse;\nexport function isUnexpected(\n response: Decline200Response | DeclineDefaultResponse,\n): response is DeclineDefaultResponse;\nexport function isUnexpected(\n response: GetQueueStatistics200Response | GetQueueStatisticsDefaultResponse,\n): response is GetQueueStatisticsDefaultResponse;\nexport function isUnexpected(\n response: UpsertWorker200Response | UpsertWorker201Response | UpsertWorkerDefaultResponse,\n): response is UpsertWorkerDefaultResponse;\nexport function isUnexpected(\n response: GetWorker200Response | GetWorkerDefaultResponse,\n): response is GetWorkerDefaultResponse;\nexport function isUnexpected(\n response: DeleteWorker204Response | DeleteWorkerDefaultResponse,\n): response is DeleteWorkerDefaultResponse;\nexport function isUnexpected(\n response: ListWorkers200Response | ListWorkersDefaultResponse,\n): response is ListWorkersDefaultResponse;\nexport function isUnexpected(\n response:\n | UpsertClassificationPolicy200Response\n | UpsertClassificationPolicy201Response\n | UpsertClassificationPolicyDefaultResponse\n | GetClassificationPolicy200Response\n | GetClassificationPolicyDefaultResponse\n | DeleteClassificationPolicy204Response\n | DeleteClassificationPolicyDefaultResponse\n | ListClassificationPolicies200Response\n | ListClassificationPoliciesDefaultResponse\n | UpsertDistributionPolicy200Response\n | UpsertDistributionPolicy201Response\n | UpsertDistributionPolicyDefaultResponse\n | GetDistributionPolicy200Response\n | GetDistributionPolicyDefaultResponse\n | DeleteDistributionPolicy204Response\n | DeleteDistributionPolicyDefaultResponse\n | ListDistributionPolicies200Response\n | ListDistributionPoliciesDefaultResponse\n | UpsertExceptionPolicy200Response\n | UpsertExceptionPolicy201Response\n | UpsertExceptionPolicyDefaultResponse\n | GetExceptionPolicy200Response\n | GetExceptionPolicyDefaultResponse\n | DeleteExceptionPolicy204Response\n | DeleteExceptionPolicyDefaultResponse\n | ListExceptionPolicies200Response\n | ListExceptionPoliciesDefaultResponse\n | UpsertQueue200Response\n | UpsertQueue201Response\n | UpsertQueueDefaultResponse\n | GetQueue200Response\n | GetQueueDefaultResponse\n | DeleteQueue204Response\n | DeleteQueueDefaultResponse\n | ListQueues200Response\n | ListQueuesDefaultResponse\n | UpsertJob200Response\n | UpsertJob201Response\n | UpsertJobDefaultResponse\n | GetJob200Response\n | GetJobDefaultResponse\n | DeleteJob204Response\n | DeleteJobDefaultResponse\n | Reclassify200Response\n | ReclassifyDefaultResponse\n | Cancel200Response\n | CancelDefaultResponse\n | Complete200Response\n | CompleteDefaultResponse\n | Close200Response\n | CloseDefaultResponse\n | ListJobs200Response\n | ListJobsDefaultResponse\n | GetInQueuePosition200Response\n | GetInQueuePositionDefaultResponse\n | Unassign200Response\n | UnassignDefaultResponse\n | Accept200Response\n | AcceptDefaultResponse\n | Decline200Response\n | DeclineDefaultResponse\n | GetQueueStatistics200Response\n | GetQueueStatisticsDefaultResponse\n | UpsertWorker200Response\n | UpsertWorker201Response\n | UpsertWorkerDefaultResponse\n | GetWorker200Response\n | GetWorkerDefaultResponse\n | DeleteWorker204Response\n | DeleteWorkerDefaultResponse\n | ListWorkers200Response\n | ListWorkersDefaultResponse,\n): response is\n | UpsertClassificationPolicyDefaultResponse\n | GetClassificationPolicyDefaultResponse\n | DeleteClassificationPolicyDefaultResponse\n | ListClassificationPoliciesDefaultResponse\n | UpsertDistributionPolicyDefaultResponse\n | GetDistributionPolicyDefaultResponse\n | DeleteDistributionPolicyDefaultResponse\n | ListDistributionPoliciesDefaultResponse\n | UpsertExceptionPolicyDefaultResponse\n | GetExceptionPolicyDefaultResponse\n | DeleteExceptionPolicyDefaultResponse\n | ListExceptionPoliciesDefaultResponse\n | UpsertQueueDefaultResponse\n | GetQueueDefaultResponse\n | DeleteQueueDefaultResponse\n | ListQueuesDefaultResponse\n | UpsertJobDefaultResponse\n | GetJobDefaultResponse\n | DeleteJobDefaultResponse\n | ReclassifyDefaultResponse\n | CancelDefaultResponse\n | CompleteDefaultResponse\n | CloseDefaultResponse\n | ListJobsDefaultResponse\n | GetInQueuePositionDefaultResponse\n | UnassignDefaultResponse\n | AcceptDefaultResponse\n | DeclineDefaultResponse\n | GetQueueStatisticsDefaultResponse\n | UpsertWorkerDefaultResponse\n | GetWorkerDefaultResponse\n | DeleteWorkerDefaultResponse\n | ListWorkersDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
package/dist-esm/src/models.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** A container for the rules that govern how jobs are classified. */\nexport interface ClassificationPolicy {\n /** Friendly name of this policy. */\n name?: string;\n /** Id of a fallback queue to select if queue selector attachments doesn't find a match. */\n fallbackQueueId?: string;\n /** Queue selector attachments used to resolve a queue for a job. */\n queueSelectorAttachments?: Array<QueueSelectorAttachment>;\n /** A rule to determine a priority score for a job. */\n prioritizationRule?: RouterRule;\n /** Worker selector attachments used to attach worker selectors to a job. */\n workerSelectorAttachments?: Array<WorkerSelectorAttachment>;\n}\n\n/** An attachment of queue selectors to resolve a queue to a job from a classification policy. */\nexport interface QueueSelectorAttachmentParent {\n kind: string;\n}\n\n/** Describes a set of queue selectors that will be attached if the given condition resolves to true. */\nexport interface ConditionalQueueSelectorAttachment extends QueueSelectorAttachmentParent {\n /** The condition that must be true for the queue selectors to be attached. */\n condition: RouterRule;\n /** The queue selectors to attach. */\n queueSelectors: Array<RouterQueueSelector>;\n /** The type discriminator describing the type of queue selector attachment. */\n kind: \"conditional\";\n}\n\n/**\n * A rule of one of the following types:\n * StaticRule: A rule providing static rules that always return the same result, regardless of input.\n * DirectMapRule: A rule that return the same labels as the input labels.\n * ExpressionRule: A rule providing inline expression rules.\n * FunctionRule: A rule providing a binding to an HTTP Triggered Azure Function.\n * WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol.\n */\nexport interface RouterRuleParent {\n kind: string;\n}\n\n/** A rule that return the same labels as the input labels. */\nexport interface DirectMapRouterRule extends RouterRuleParent {\n /** The type discriminator describing a sub-type of Rule. */\n kind: \"directMap\";\n}\n\n/** A rule providing inline expression rules. */\nexport interface ExpressionRouterRule extends RouterRuleParent {\n /**\n * The expression language to compile to and execute.\n *\n * Possible values: \"powerFx\"\n */\n language?: string;\n /** An expression to evaluate. Should contain return statement with calculated values. */\n expression: string;\n /** The type discriminator describing a sub-type of Rule. */\n kind: \"expression\";\n}\n\n/** A rule providing a binding to an HTTP Triggered Azure Function. */\nexport interface FunctionRouterRule extends RouterRuleParent {\n /** URL for Azure Function. */\n functionUri: string;\n /** Credentials used to access Azure function rule. */\n credential?: FunctionRouterRuleCredential;\n /** The type discriminator describing a sub-type of Rule. */\n kind: \"function\";\n}\n\n/** Credentials used to access Azure function rule. */\nexport interface FunctionRouterRuleCredential {\n /** Access key scoped to a particular function. */\n functionKey?: string;\n /** Access key scoped to a Azure Function app. This key grants access to all functions under the app. */\n appKey?: string;\n /** Client id, when AppKey is provided In context of Azure function, this is usually the name of the key. */\n clientId?: string;\n}\n\n/** A rule providing static rules that always return the same result, regardless of input. */\nexport interface StaticRouterRule extends RouterRuleParent {\n /** The static value this rule always returns. Values must be primitive values - number, string, boolean. */\n value?: unknown;\n /** The type discriminator describing a sub-type of Rule. */\n kind: \"static\";\n}\n\n/** A rule providing a binding to an external web server. */\nexport interface WebhookRouterRule extends RouterRuleParent {\n /** Uri for Authorization Server. */\n authorizationServerUri?: string;\n /** OAuth2.0 Credentials used to Contoso's Authorization server. Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ */\n clientCredential?: OAuth2WebhookClientCredential;\n /** Uri for Contoso's Web Server. */\n webhookUri?: string;\n /** The type discriminator describing a sub-type of Rule. */\n kind: \"webhook\";\n}\n\n/** OAuth2.0 Credentials used to Contoso's Authorization server. Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ */\nexport interface OAuth2WebhookClientCredential {\n /** ClientId for Contoso Authorization server. */\n clientId?: string;\n /** Client secret for Contoso Authorization server. */\n clientSecret?: string;\n}\n\n/** Describes a condition that must be met against a set of labels for queue selection. */\nexport interface RouterQueueSelector {\n /** The label key to query against. */\n key: string;\n /**\n * Describes how the value of the label is compared to the value defined on the label selector.\n *\n * Possible values: \"equal\", \"notEqual\", \"lessThan\", \"lessThanOrEqual\", \"greaterThan\", \"greaterThanOrEqual\"\n */\n labelOperator: string;\n /** The value to compare against the actual label value with the given operator. Values must be primitive values - number, string, boolean. */\n value?: unknown;\n}\n\n/** Attaches a queue selector where the value is passed through from a job's label with the same key. */\nexport interface PassThroughQueueSelectorAttachment extends QueueSelectorAttachmentParent {\n /** The label key to query against. */\n key: string;\n /**\n * Describes how the value of the label is compared to the value pass through.\n *\n * Possible values: \"equal\", \"notEqual\", \"lessThan\", \"lessThanOrEqual\", \"greaterThan\", \"greaterThanOrEqual\"\n */\n labelOperator: string;\n /** The type discriminator describing the type of queue selector attachment. */\n kind: \"passThrough\";\n}\n\n/** Attaches queue selectors to a job when the RouterRule is resolved. */\nexport interface RuleEngineQueueSelectorAttachment extends QueueSelectorAttachmentParent {\n /** A RouterRule that resolves a collection of queue selectors to attach. */\n rule: RouterRule;\n /** The type discriminator describing the type of queue selector attachment. */\n kind: \"ruleEngine\";\n}\n\n/** Describes a queue selector that will be attached to a job. */\nexport interface StaticQueueSelectorAttachment extends QueueSelectorAttachmentParent {\n /** The queue selector to attach. */\n queueSelector: RouterQueueSelector;\n /** The type discriminator describing the type of queue selector attachment. */\n kind: \"static\";\n}\n\n/** Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting. */\nexport interface WeightedAllocationQueueSelectorAttachment extends QueueSelectorAttachmentParent {\n /** A collection of percentage based weighted allocations. */\n allocations: Array<QueueWeightedAllocation>;\n /** The type discriminator describing the type of queue selector attachment. */\n kind: \"weightedAllocation\";\n}\n\n/** Contains the weight percentage and queue selectors to be applied if selected for weighted distributions. */\nexport interface QueueWeightedAllocation {\n /** The percentage of this weight, expressed as a fraction of 1. */\n weight: number;\n /** A collection of queue selectors that will be applied if this allocation is selected. */\n queueSelectors: Array<RouterQueueSelector>;\n}\n\n/** An attachment which attaches worker selectors to a job. */\nexport interface WorkerSelectorAttachmentParent {\n kind: string;\n}\n\n/** Describes a set of worker selectors that will be attached if the given condition resolves to true. */\nexport interface ConditionalWorkerSelectorAttachment extends WorkerSelectorAttachmentParent {\n /** The condition that must be true for the worker selectors to be attached. */\n condition: RouterRule;\n /** The worker selectors to attach. */\n workerSelectors: Array<RouterWorkerSelector>;\n /** The type discriminator describing the type of worker selector attachment. */\n kind: \"conditional\";\n}\n\n/** Describes a condition that must be met against a set of labels for worker selection. */\nexport interface RouterWorkerSelector {\n /** The label key to query against. */\n key: string;\n /**\n * Describes how the value of the label is compared to the value defined on the worker selector.\n *\n * Possible values: \"equal\", \"notEqual\", \"lessThan\", \"lessThanOrEqual\", \"greaterThan\", \"greaterThanOrEqual\"\n */\n labelOperator: string;\n /** The value to compare against the actual label value with the given operator. Values must be primitive values - number, string, boolean. */\n value?: unknown;\n /** Describes how long this label selector is valid in seconds. */\n expiresAfterSeconds?: number;\n /** Pushes a job to the front of the queue as long as this selector is active. */\n expedite?: boolean;\n}\n\n/** Attaches a worker selector where the value is passed through from a job's label with the same key. */\nexport interface PassThroughWorkerSelectorAttachment extends WorkerSelectorAttachmentParent {\n /** The label key to query against. */\n key: string;\n /**\n * Describes how the value of the label is compared to the value pass through.\n *\n * Possible values: \"equal\", \"notEqual\", \"lessThan\", \"lessThanOrEqual\", \"greaterThan\", \"greaterThanOrEqual\"\n */\n labelOperator: string;\n /** Describes how long the attached label selector is valid in seconds. */\n expiresAfterSeconds?: number;\n /** The type discriminator describing the type of worker selector attachment. */\n kind: \"passThrough\";\n}\n\n/** Attaches worker selectors to a job when a RouterRule is resolved. */\nexport interface RuleEngineWorkerSelectorAttachment extends WorkerSelectorAttachmentParent {\n /** A RouterRule that resolves a collection of worker selectors to attach. */\n rule: RouterRule;\n /** The type discriminator describing the type of worker selector attachment. */\n kind: \"ruleEngine\";\n}\n\n/** Describes a worker selector that will be attached to a job. */\nexport interface StaticWorkerSelectorAttachment extends WorkerSelectorAttachmentParent {\n /** The worker selector to attach. */\n workerSelector: RouterWorkerSelector;\n /** The type discriminator describing the type of worker selector attachment. */\n kind: \"static\";\n}\n\n/** Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting. */\nexport interface WeightedAllocationWorkerSelectorAttachment extends WorkerSelectorAttachmentParent {\n /** A collection of percentage based weighted allocations. */\n allocations: Array<WorkerWeightedAllocation>;\n /** The type discriminator describing the type of worker selector attachment. */\n kind: \"weightedAllocation\";\n}\n\n/** Contains the weight percentage and worker selectors to be applied if selected for weighted distributions. */\nexport interface WorkerWeightedAllocation {\n /** The percentage of this weight, expressed as a fraction of 1. */\n weight: number;\n /** A collection of worker selectors that will be applied if this allocation is selected. */\n workerSelectors: Array<RouterWorkerSelector>;\n}\n\n/** Policy governing how jobs are distributed to workers */\nexport interface DistributionPolicy {\n /** Friendly name of this policy. */\n name?: string;\n /** Number of seconds after which any offers created under this policy will be expired. */\n offerExpiresAfterSeconds?: number;\n /** Mode governing the specific distribution method. */\n mode?: DistributionMode;\n}\n\n/** Abstract base class for defining a distribution mode. */\nexport interface DistributionModeParent {\n /** Governs the minimum desired number of active concurrent offers a job can have. */\n minConcurrentOffers?: number;\n /** Governs the maximum number of active concurrent offers a job can have. */\n maxConcurrentOffers?: number;\n /** If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. */\n bypassSelectors?: boolean;\n kind: string;\n}\n\n/** Jobs are distributed to the worker with the strongest abilities available. */\nexport interface BestWorkerMode extends DistributionModeParent {\n /** Define a scoring rule to use, when calculating a score to determine the best worker. If not set, will use a default scoring formula that uses the number of job labels that the worker labels match, as well as the number of label selectors the worker labels match and/or exceed using a logistic function (https://en.wikipedia.org/wiki/Logistic_function). */\n scoringRule?: RouterRule;\n /** Options to configure 'scoringRule'. If not set, default values are used. */\n scoringRuleOptions?: ScoringRuleOptions;\n /** The type discriminator describing a sub-type of Mode */\n kind: \"bestWorker\";\n}\n\n/** Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. */\nexport interface ScoringRuleOptions {\n /** Set batch size when 'isBatchScoringEnabled' is set to true. Defaults to 20 if not configured. */\n batchSize?: number;\n /** List of extra parameters from a job that will be sent as part of the payload to scoring rule. If not set, a job's labels (sent in the payload as `job`) and a job's worker selectors (sent in the payload as `selectors`) are added to the payload of the scoring rule by default. Note: Worker labels are always sent with scoring payload. */\n scoringParameters?: string[];\n /** If set to true, will score workers in batches, and the parameter name of the worker labels will be sent as `workers`. By default, set to false and the parameter name for the worker labels will be sent as `worker`. Note: If enabled, use 'batchSize' to set batch size. */\n isBatchScoringEnabled?: boolean;\n /** If false, will sort scores by ascending order. By default, set to true. */\n descendingOrder?: boolean;\n}\n\n/** Jobs are directed to the worker who has been idle longest. */\nexport interface LongestIdleMode extends DistributionModeParent {\n /** The type discriminator describing a sub-type of Mode. */\n kind: \"longestIdle\";\n}\n\n/** Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job. */\nexport interface RoundRobinMode extends DistributionModeParent {\n /** The type discriminator describing a sub-type of Mode. */\n kind: \"roundRobin\";\n}\n\n/** A policy that defines actions to execute when exception are triggered. */\nexport interface ExceptionPolicy {\n /** Friendly name of this policy. */\n name?: string;\n /** A collection of exception rules on the exception policy. */\n exceptionRules?: Array<ExceptionRule>;\n}\n\n/** A rule that defines actions to execute upon a specific trigger. */\nexport interface ExceptionRule {\n /** Id of an exception rule. */\n id: string;\n /** The trigger for this exception rule. */\n trigger: ExceptionTrigger;\n /** A collection of actions to perform once the exception is triggered. */\n actions: Array<ExceptionAction>;\n}\n\n/** Abstract base class for defining a trigger for exception rules. */\nexport interface ExceptionTriggerParent {\n kind: string;\n}\n\n/** Trigger for an exception action on exceeding queue length. */\nexport interface QueueLengthExceptionTrigger extends ExceptionTriggerParent {\n /** Threshold of number of jobs ahead in the queue to for this trigger to fire. */\n threshold: number;\n /** The type discriminator describing a sub-type of ExceptionTrigger. */\n kind: \"queueLength\";\n}\n\n/** Trigger for an exception action on exceeding wait time. */\nexport interface WaitTimeExceptionTrigger extends ExceptionTriggerParent {\n /** Threshold for wait time for this trigger. */\n thresholdSeconds: number;\n /** The type discriminator describing a sub-type of ExceptionTrigger. */\n kind: \"waitTime\";\n}\n\n/** The action to take when the exception is triggered. */\nexport interface ExceptionActionParent {\n /** Unique Id of the exception action. */\n id?: string;\n kind: string;\n}\n\n/** An action that marks a job as cancelled. */\nexport interface CancelExceptionAction extends ExceptionActionParent {\n /** A note that will be appended to a job's notes collection with the current timestamp. */\n note?: string;\n /** Indicates the outcome of a job, populate this field with your own custom values. */\n dispositionCode?: string;\n /** The type discriminator describing a sub-type of ExceptionAction. */\n kind: \"cancel\";\n}\n\n/** An action that manually reclassifies a job by providing the queue, priority and worker selectors. */\nexport interface ManualReclassifyExceptionAction extends ExceptionActionParent {\n /** Updated QueueId. */\n queueId?: string;\n /** Updated Priority. */\n priority?: number;\n /** Updated WorkerSelectors. */\n workerSelectors?: Array<RouterWorkerSelector>;\n /** The type discriminator describing a sub-type of ExceptionAction. */\n kind: \"manualReclassify\";\n}\n\n/** An action that modifies labels on a job and then reclassifies it. */\nexport interface ReclassifyExceptionAction extends ExceptionActionParent {\n /** The new classification policy that will determine queue, priority and worker selectors. */\n classificationPolicyId?: string;\n /** Dictionary containing the labels to update (or add if not existing) in key-value pairs. Values must be primitive values - number, string, boolean. */\n labelsToUpsert?: Record<string, unknown>;\n /** The type discriminator describing a sub-type of ExceptionAction. */\n kind: \"reclassify\";\n}\n\n/** A queue that can contain jobs to be routed. */\nexport interface RouterQueue {\n /** Friendly name of this queue. */\n name?: string;\n /** Id of a distribution policy that will determine how a job is distributed to workers. */\n distributionPolicyId?: string;\n /** A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. Values must be primitive values - number, string, boolean. */\n labels?: Record<string, unknown>;\n /** Id of an exception policy that determines various job escalation rules. */\n exceptionPolicyId?: string;\n}\n\n/** A unit of work to be routed */\nexport interface RouterJob {\n /** Reference to an external parent context, eg. call ID. */\n channelReference?: string;\n /** The channel identifier. eg. voice, chat, etc. */\n channelId?: string;\n /** Id of a classification policy used for classifying this job. */\n classificationPolicyId?: string;\n /** Id of a queue that this job is queued to. */\n queueId?: string;\n /** Priority of this job. */\n priority?: number;\n /** Reason code for cancelled or closed jobs. */\n dispositionCode?: string;\n /** A collection of manually specified worker selectors, which a worker must satisfy in order to process this job. */\n requestedWorkerSelectors?: Array<RouterWorkerSelector>;\n /** A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. Values must be primitive values - number, string, boolean. */\n labels?: Record<string, unknown>;\n /** A set of non-identifying attributes attached to this job. Values must be primitive values - number, string, boolean. */\n tags?: Record<string, unknown>;\n /** Notes attached to a job, sorted by timestamp. */\n notes?: Array<RouterJobNote>;\n /** If provided, will determine how job matching will be carried out. Default mode: QueueAndMatchMode. */\n matchingMode?: JobMatchingMode;\n}\n\n/** Assignment details of a job to a worker. */\nexport interface RouterJobAssignment {\n /** Id of the Worker assigned to the job. */\n workerId?: string;\n /** Timestamp when the job was assigned to a worker in UTC. */\n assignedAt: Date | string;\n /** Timestamp when the job was marked as completed after being assigned in UTC. */\n completedAt?: Date | string;\n /** Timestamp when the job was marked as closed after being completed in UTC. */\n closedAt?: Date | string;\n}\n\n/** A note attached to a job. */\nexport interface RouterJobNote {\n /** The message contained in the note. */\n message: string;\n /** The time at which the note was added in UTC. If not provided, will default to the current time. */\n addedAt?: Date | string;\n}\n\n/**\n * A matching mode of one of the following types:\n * QueueAndMatchMode: Used when matching worker to a job is required to be done right after job is queued.\n * ScheduleAndSuspendMode: Used for scheduling jobs to be queued at a future time. At specified time, matching of a worker to the job will not start automatically.\n * SuspendMode: Used when matching workers to a job needs to be suspended.\n */\nexport interface JobMatchingModeParent {\n kind: string;\n}\n\n/** Describes a matching mode used for scheduling jobs to be queued at a future time. At the specified time, matching worker to a job will not start automatically. */\nexport interface ScheduleAndSuspendMode extends JobMatchingModeParent {\n /** Requested schedule time. */\n scheduleAt: Date | string;\n /** The type discriminator describing ScheduleAndSuspendMode */\n kind: \"scheduleAndSuspend\";\n}\n\n/** Describes a matching mode where matching worker to a job is automatically started after job is queued successfully. */\nexport interface QueueAndMatchMode extends JobMatchingModeParent {\n /** The type discriminator describing QueueAndMatchMode */\n kind: \"queueAndMatch\";\n}\n\n/** Describes a matching mode where matching worker to a job is suspended. */\nexport interface SuspendMode extends JobMatchingModeParent {\n /** The type discriminator describing SuspendMode */\n kind: \"suspend\";\n}\n\n/** Request payload for reclassifying jobs. */\nexport interface ReclassifyJobOptions {}\n\n/** Request payload for cancelling a job. */\nexport interface CancelJobOptions {\n /** A note that will be appended to a job's Notes collection with the current timestamp. */\n note?: string;\n /** Indicates the outcome of a job, populate this field with your own custom values. If not provided, default value of \"Cancelled\" is set. */\n dispositionCode?: string;\n}\n\n/** Request payload for completing jobs. */\nexport interface CompleteJobOptions {\n /** A note that will be appended to a job's Notes collection with the current timestamp. */\n note?: string;\n}\n\n/** Request payload for closing jobs */\nexport interface CloseJobOptions {\n /** Indicates the outcome of a job, populate this field with your own custom values. */\n dispositionCode?: string;\n /** If not provided, worker capacity is released immediately along with a JobClosedEvent notification. If provided, worker capacity is released along with a JobClosedEvent notification at a future time in UTC. */\n closeAt?: Date | string;\n /** A note that will be appended to a job's Notes collection with the current timestamp. */\n note?: string;\n}\n\n/** Request payload for unassigning a job. */\nexport interface UnassignJobOptions {\n /** If SuspendMatching is true, then a job is not queued for re-matching with a worker. */\n suspendMatching?: boolean;\n}\n\n/** Request payload for declining offers. */\nexport interface DeclineJobOfferOptions {\n /** If the RetryOfferAt is not provided, then this job will not be offered again to the worker who declined this job unless the worker is de-registered and re-registered. If a RetryOfferAt time is provided, then the job will be re-matched to eligible workers at the retry time in UTC. The worker that declined the job will also be eligible for the job at that time. */\n retryOfferAt?: Date | string;\n}\n\n/** An entity for jobs to be routed to. */\nexport interface RouterWorker {\n /** Collection of queue(s) that this worker can receive work from. */\n queues?: string[];\n /** The total capacity score this worker has to manage multiple concurrent jobs. */\n capacity?: number;\n /** A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. Values must be primitive values - number, string, boolean. */\n labels?: Record<string, unknown>;\n /** A set of non-identifying attributes attached to this worker. Values must be primitive values - number, string, boolean. */\n tags?: Record<string, unknown>;\n /** Collection of channel(s) this worker can handle and their impact on the workers capacity. */\n channels?: Array<RouterChannel>;\n /** A flag indicating this worker is open to receive offers or not. */\n availableForOffers?: boolean;\n /** If this is set, the worker will only receive up to this many new offers at a time. */\n maxConcurrentOffers?: number;\n}\n\n/** Represents the capacity a job in this channel will consume from a worker. */\nexport interface RouterChannel {\n /** Id of a channel. */\n channelId: string;\n /** The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. */\n capacityCostPerJob: number;\n /** The maximum number of jobs that can be supported concurrently for this channel. */\n maxNumberOfJobs?: number;\n}\n\n/** An offer of a job to a worker. */\nexport interface RouterJobOffer {\n /** Id of the job. */\n jobId: string;\n /** The capacity cost consumed by the job offer. */\n capacityCost: number;\n /** Timestamp when the offer was created in UTC. */\n offeredAt?: Date | string;\n /** Timestamp when the offer will expire in UTC. */\n expiresAt?: Date | string;\n}\n\n/** The assignment for a worker to a job. */\nexport interface RouterWorkerAssignment {\n /** Id of the assignment. */\n assignmentId: string;\n /** Id of the job assigned. */\n jobId: string;\n /** The amount of capacity this assignment has consumed on the worker. */\n capacityCost: number;\n /** The assignment time of the job in UTC. */\n assignedAt: Date | string;\n}\n\n/** An attachment of queue selectors to resolve a queue to a job from a classification policy. */\nexport type QueueSelectorAttachment =\n | QueueSelectorAttachmentParent\n | ConditionalQueueSelectorAttachment\n | PassThroughQueueSelectorAttachment\n | RuleEngineQueueSelectorAttachment\n | StaticQueueSelectorAttachment\n | WeightedAllocationQueueSelectorAttachment;\n/**\n * A rule of one of the following types:\n * StaticRule: A rule providing static rules that always return the same result, regardless of input.\n * DirectMapRule: A rule that return the same labels as the input labels.\n * ExpressionRule: A rule providing inline expression rules.\n * FunctionRule: A rule providing a binding to an HTTP Triggered Azure Function.\n * WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol.\n */\nexport type RouterRule =\n | RouterRuleParent\n | DirectMapRouterRule\n | ExpressionRouterRule\n | FunctionRouterRule\n | StaticRouterRule\n | WebhookRouterRule;\n/** An attachment which attaches worker selectors to a job. */\nexport type WorkerSelectorAttachment =\n | WorkerSelectorAttachmentParent\n | ConditionalWorkerSelectorAttachment\n | PassThroughWorkerSelectorAttachment\n | RuleEngineWorkerSelectorAttachment\n | StaticWorkerSelectorAttachment\n | WeightedAllocationWorkerSelectorAttachment;\n/** Abstract base class for defining a distribution mode. */\nexport type DistributionMode =\n | DistributionModeParent\n | BestWorkerMode\n | LongestIdleMode\n | RoundRobinMode;\n/** Abstract base class for defining a trigger for exception rules. */\nexport type ExceptionTrigger =\n | ExceptionTriggerParent\n | QueueLengthExceptionTrigger\n | WaitTimeExceptionTrigger;\n/** The action to take when the exception is triggered. */\nexport type ExceptionAction =\n | ExceptionActionParent\n | CancelExceptionAction\n | ManualReclassifyExceptionAction\n | ReclassifyExceptionAction;\n/**\n * A matching mode of one of the following types:\n * QueueAndMatchMode: Used when matching worker to a job is required to be done right after job is queued.\n * ScheduleAndSuspendMode: Used for scheduling jobs to be queued at a future time. At specified time, matching of a worker to the job will not start automatically.\n * SuspendMode: Used when matching workers to a job needs to be suspended.\n */\nexport type JobMatchingMode =\n | JobMatchingModeParent\n | ScheduleAndSuspendMode\n | QueueAndMatchMode\n | SuspendMode;\n"]}
|