@azure-rest/agrifood-farming 1.0.0-alpha.20241218.1 → 1.0.0-alpha.20241220.1
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/dist/browser/farmBeats.d.ts +9 -4
- package/dist/browser/farmBeats.d.ts.map +1 -1
- package/dist/browser/farmBeats.js +28 -12
- package/dist/browser/farmBeats.js.map +1 -1
- package/dist/browser/isUnexpected.js +15 -15
- package/dist/browser/isUnexpected.js.map +1 -1
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/logger.js.map +1 -0
- package/dist/browser/paginateHelper.d.ts +27 -2
- package/dist/browser/paginateHelper.d.ts.map +1 -1
- package/dist/browser/paginateHelper.js +98 -1
- package/dist/browser/paginateHelper.js.map +1 -1
- package/dist/browser/parameters.d.ts +4 -4
- package/dist/browser/parameters.d.ts.map +1 -1
- package/dist/browser/parameters.js.map +1 -1
- package/dist/browser/pollingHelper.d.ts +66 -1
- package/dist/browser/pollingHelper.d.ts.map +1 -1
- package/dist/browser/pollingHelper.js +59 -5
- package/dist/browser/pollingHelper.js.map +1 -1
- package/dist/browser/responses.d.ts +0 -28
- package/dist/browser/responses.d.ts.map +1 -1
- package/dist/browser/responses.js.map +1 -1
- package/dist/browser/serializeHelper.d.ts +1 -1
- package/dist/browser/serializeHelper.d.ts.map +1 -1
- package/dist/browser/serializeHelper.js +2 -2
- package/dist/browser/serializeHelper.js.map +1 -1
- package/dist/commonjs/farmBeats.d.ts +9 -4
- package/dist/commonjs/farmBeats.d.ts.map +1 -1
- package/dist/commonjs/farmBeats.js +28 -12
- package/dist/commonjs/farmBeats.js.map +1 -1
- package/dist/commonjs/isUnexpected.js +15 -15
- package/dist/commonjs/isUnexpected.js.map +1 -1
- 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/paginateHelper.d.ts +27 -2
- package/dist/commonjs/paginateHelper.d.ts.map +1 -1
- package/dist/commonjs/paginateHelper.js +99 -2
- package/dist/commonjs/paginateHelper.js.map +1 -1
- package/dist/commonjs/parameters.d.ts +4 -4
- package/dist/commonjs/parameters.d.ts.map +1 -1
- package/dist/commonjs/parameters.js.map +1 -1
- package/dist/commonjs/pollingHelper.d.ts +66 -1
- package/dist/commonjs/pollingHelper.d.ts.map +1 -1
- package/dist/commonjs/pollingHelper.js +59 -5
- package/dist/commonjs/pollingHelper.js.map +1 -1
- package/dist/commonjs/responses.d.ts +0 -28
- package/dist/commonjs/responses.d.ts.map +1 -1
- package/dist/commonjs/responses.js.map +1 -1
- package/dist/commonjs/serializeHelper.d.ts +1 -1
- package/dist/commonjs/serializeHelper.d.ts.map +1 -1
- package/dist/commonjs/serializeHelper.js +2 -2
- package/dist/commonjs/serializeHelper.js.map +1 -1
- package/dist/esm/farmBeats.d.ts +9 -4
- package/dist/esm/farmBeats.d.ts.map +1 -1
- package/dist/esm/farmBeats.js +28 -12
- package/dist/esm/farmBeats.js.map +1 -1
- package/dist/esm/isUnexpected.js +15 -15
- package/dist/esm/isUnexpected.js.map +1 -1
- 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/paginateHelper.d.ts +27 -2
- package/dist/esm/paginateHelper.d.ts.map +1 -1
- package/dist/esm/paginateHelper.js +98 -1
- package/dist/esm/paginateHelper.js.map +1 -1
- package/dist/esm/parameters.d.ts +4 -4
- package/dist/esm/parameters.d.ts.map +1 -1
- package/dist/esm/parameters.js.map +1 -1
- package/dist/esm/pollingHelper.d.ts +66 -1
- package/dist/esm/pollingHelper.d.ts.map +1 -1
- package/dist/esm/pollingHelper.js +59 -5
- package/dist/esm/pollingHelper.js.map +1 -1
- package/dist/esm/responses.d.ts +0 -28
- package/dist/esm/responses.d.ts.map +1 -1
- package/dist/esm/responses.js.map +1 -1
- package/dist/esm/serializeHelper.d.ts +1 -1
- package/dist/esm/serializeHelper.d.ts.map +1 -1
- package/dist/esm/serializeHelper.js +2 -2
- package/dist/esm/serializeHelper.js.map +1 -1
- package/dist/react-native/farmBeats.d.ts +9 -4
- package/dist/react-native/farmBeats.d.ts.map +1 -1
- package/dist/react-native/farmBeats.js +28 -12
- package/dist/react-native/farmBeats.js.map +1 -1
- package/dist/react-native/isUnexpected.js +15 -15
- package/dist/react-native/isUnexpected.js.map +1 -1
- 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/paginateHelper.d.ts +27 -2
- package/dist/react-native/paginateHelper.d.ts.map +1 -1
- package/dist/react-native/paginateHelper.js +98 -1
- package/dist/react-native/paginateHelper.js.map +1 -1
- package/dist/react-native/parameters.d.ts +4 -4
- package/dist/react-native/parameters.d.ts.map +1 -1
- package/dist/react-native/parameters.js.map +1 -1
- package/dist/react-native/pollingHelper.d.ts +66 -1
- package/dist/react-native/pollingHelper.d.ts.map +1 -1
- package/dist/react-native/pollingHelper.js +59 -5
- package/dist/react-native/pollingHelper.js.map +1 -1
- package/dist/react-native/responses.d.ts +0 -28
- package/dist/react-native/responses.d.ts.map +1 -1
- package/dist/react-native/responses.js.map +1 -1
- package/dist/react-native/serializeHelper.d.ts +1 -1
- package/dist/react-native/serializeHelper.d.ts.map +1 -1
- package/dist/react-native/serializeHelper.js +2 -2
- package/dist/react-native/serializeHelper.js.map +1 -1
- package/package.json +7 -6
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
import type { Client, HttpResponse } from "@azure-rest/core-client";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AbortSignalLike } from "@azure/abort-controller";
|
|
3
|
+
import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro";
|
|
4
|
+
/**
|
|
5
|
+
* A simple poller that can be used to poll a long running operation.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the poller has finished polling.
|
|
10
|
+
*/
|
|
11
|
+
isDone(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the state of the operation.
|
|
14
|
+
*/
|
|
15
|
+
getOperationState(): TState;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the result value of the operation,
|
|
18
|
+
* regardless of the state of the poller.
|
|
19
|
+
* It can return undefined or an incomplete form of the final TResult value
|
|
20
|
+
* depending on the implementation.
|
|
21
|
+
*/
|
|
22
|
+
getResult(): TResult | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a promise that will resolve once a single polling request finishes.
|
|
25
|
+
* It does this by calling the update method of the Poller's operation.
|
|
26
|
+
*/
|
|
27
|
+
poll(options?: {
|
|
28
|
+
abortSignal?: AbortSignalLike;
|
|
29
|
+
}): Promise<TState>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a promise that will resolve once the underlying operation is completed.
|
|
32
|
+
*/
|
|
33
|
+
pollUntilDone(pollOptions?: {
|
|
34
|
+
abortSignal?: AbortSignalLike;
|
|
35
|
+
}): Promise<TResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Invokes the provided callback after each polling is completed,
|
|
38
|
+
* sending the current state of the poller's operation.
|
|
39
|
+
*
|
|
40
|
+
* It returns a method that can be used to stop receiving updates on the given callback function.
|
|
41
|
+
*/
|
|
42
|
+
onProgress(callback: (state: TState) => void): CancelOnProgress;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a promise that could be used for serialized version of the poller's operation
|
|
45
|
+
* by invoking the operation's serialize method.
|
|
46
|
+
*/
|
|
47
|
+
serialize(): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Wait the poller to be submitted.
|
|
50
|
+
*/
|
|
51
|
+
submitted(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a string representation of the poller's operation. Similar to serialize but returns a string.
|
|
54
|
+
* @deprecated Use serialize() instead.
|
|
55
|
+
*/
|
|
56
|
+
toString(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling
|
|
59
|
+
* @deprecated Use abortSignal to stop polling instead.
|
|
60
|
+
*/
|
|
61
|
+
stopPolling(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Returns true if the poller is stopped.
|
|
64
|
+
* @deprecated Use abortSignal status to track this instead.
|
|
65
|
+
*/
|
|
66
|
+
isStopped(): boolean;
|
|
67
|
+
}
|
|
3
68
|
/**
|
|
4
69
|
* Helper function that builds a Poller object to help polling a long running operation.
|
|
5
70
|
* @param client - Client to use for sending the request to get additional pages.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingHelper.d.ts","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,uBAAuB,EAGvB,cAAc,
|
|
1
|
+
{"version":3,"file":"pollingHelper.d.ts","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EAGvB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO;IAC/E;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC;IAClB;;OAEG;IACH,iBAAiB,IAAI,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE;;OAEG;IACH,aAAa,CAAC,WAAW,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAAC;IAEhE;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;OAGG;IACH,QAAQ,IAAI,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,SAAS,YAAY,EACrE,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,EACxB,OAAO,GAAE,uBAAuB,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAM,GACtE,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAgF7D"}
|
|
@@ -10,28 +10,82 @@ import { createHttpPoller } from "@azure/core-lro";
|
|
|
10
10
|
*/
|
|
11
11
|
export async function getLongRunningPoller(client, initialResponse, options = {}) {
|
|
12
12
|
var _a;
|
|
13
|
+
const abortController = new AbortController();
|
|
13
14
|
const poller = {
|
|
14
|
-
requestMethod: initialResponse.request.method,
|
|
15
|
-
requestPath: initialResponse.request.url,
|
|
16
15
|
sendInitialRequest: async () => {
|
|
17
16
|
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
|
18
17
|
// we are not triggering the initial request here, just extracting the information from the
|
|
19
18
|
// response we were provided.
|
|
20
19
|
return getLroResponse(initialResponse);
|
|
21
20
|
},
|
|
22
|
-
sendPollRequest: async (path) => {
|
|
21
|
+
sendPollRequest: async (path, pollOptions) => {
|
|
23
22
|
// This is the callback that is going to be called to poll the service
|
|
24
23
|
// to get the latest status. We use the client provided and the polling path
|
|
25
24
|
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
|
26
25
|
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
|
27
|
-
|
|
26
|
+
function abortListener() {
|
|
27
|
+
abortController.abort();
|
|
28
|
+
}
|
|
29
|
+
const inputAbortSignal = pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.abortSignal;
|
|
30
|
+
const abortSignal = abortController.signal;
|
|
31
|
+
if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) {
|
|
32
|
+
abortController.abort();
|
|
33
|
+
}
|
|
34
|
+
else if (!abortSignal.aborted) {
|
|
35
|
+
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, {
|
|
36
|
+
once: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let response;
|
|
40
|
+
try {
|
|
41
|
+
response = await client
|
|
42
|
+
.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url)
|
|
43
|
+
.get({ abortSignal });
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener);
|
|
47
|
+
}
|
|
28
48
|
const lroResponse = getLroResponse(response);
|
|
29
49
|
lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
|
|
30
50
|
return lroResponse;
|
|
31
51
|
},
|
|
32
52
|
};
|
|
33
53
|
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
|
|
34
|
-
|
|
54
|
+
const httpPoller = createHttpPoller(poller, options);
|
|
55
|
+
const simplePoller = {
|
|
56
|
+
isDone() {
|
|
57
|
+
return httpPoller.isDone;
|
|
58
|
+
},
|
|
59
|
+
isStopped() {
|
|
60
|
+
return abortController.signal.aborted;
|
|
61
|
+
},
|
|
62
|
+
getOperationState() {
|
|
63
|
+
if (!httpPoller.operationState) {
|
|
64
|
+
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
|
|
65
|
+
}
|
|
66
|
+
return httpPoller.operationState;
|
|
67
|
+
},
|
|
68
|
+
getResult() {
|
|
69
|
+
return httpPoller.result;
|
|
70
|
+
},
|
|
71
|
+
toString() {
|
|
72
|
+
if (!httpPoller.operationState) {
|
|
73
|
+
throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
|
|
74
|
+
}
|
|
75
|
+
return JSON.stringify({
|
|
76
|
+
state: httpPoller.operationState,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
stopPolling() {
|
|
80
|
+
abortController.abort();
|
|
81
|
+
},
|
|
82
|
+
onProgress: httpPoller.onProgress,
|
|
83
|
+
poll: httpPoller.poll,
|
|
84
|
+
pollUntilDone: httpPoller.pollUntilDone,
|
|
85
|
+
serialize: httpPoller.serialize,
|
|
86
|
+
submitted: httpPoller.submitted,
|
|
87
|
+
};
|
|
88
|
+
return simplePoller;
|
|
35
89
|
}
|
|
36
90
|
/**
|
|
37
91
|
* Converts a Rest Client response to a response that the LRO implementation understands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACv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rB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;KAChC,CAAC;IACF,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CACrB,QAAiB;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
|
|
@@ -93,7 +93,6 @@ export interface ApplicationDataCreateOrUpdateDefaultResponse extends HttpRespon
|
|
|
93
93
|
/** Deletes a specified application data resource under a particular party. */
|
|
94
94
|
export interface ApplicationDataDelete204Response extends HttpResponse {
|
|
95
95
|
status: "204";
|
|
96
|
-
body: Record<string, unknown>;
|
|
97
96
|
}
|
|
98
97
|
export interface ApplicationDataDeleteDefaultHeaders {
|
|
99
98
|
"x-ms-error-code"?: string;
|
|
@@ -154,7 +153,6 @@ export interface AttachmentsCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
154
153
|
/** Deletes a specified attachment resource under a particular party. */
|
|
155
154
|
export interface AttachmentsDelete204Response extends HttpResponse {
|
|
156
155
|
status: "204";
|
|
157
|
-
body: Record<string, unknown>;
|
|
158
156
|
}
|
|
159
157
|
export interface AttachmentsDeleteDefaultHeaders {
|
|
160
158
|
"x-ms-error-code"?: string;
|
|
@@ -300,7 +298,6 @@ export interface BoundariesGetDefaultResponse extends HttpResponse {
|
|
|
300
298
|
/** Deletes a specified boundary resource under a particular party. */
|
|
301
299
|
export interface BoundariesDelete204Response extends HttpResponse {
|
|
302
300
|
status: "204";
|
|
303
|
-
body: Record<string, unknown>;
|
|
304
301
|
}
|
|
305
302
|
export interface BoundariesDeleteDefaultHeaders {
|
|
306
303
|
"x-ms-error-code"?: string;
|
|
@@ -375,7 +372,6 @@ export interface CropProductsCreateOrUpdateDefaultResponse extends HttpResponse
|
|
|
375
372
|
/** Deletes a specified crop Product resource. */
|
|
376
373
|
export interface CropProductsDelete204Response extends HttpResponse {
|
|
377
374
|
status: "204";
|
|
378
|
-
body: Record<string, unknown>;
|
|
379
375
|
}
|
|
380
376
|
export interface CropProductsDeleteDefaultHeaders {
|
|
381
377
|
"x-ms-error-code"?: string;
|
|
@@ -436,7 +432,6 @@ export interface CropsCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
436
432
|
/** Deletes Crop for given crop id. */
|
|
437
433
|
export interface CropsDelete204Response extends HttpResponse {
|
|
438
434
|
status: "204";
|
|
439
|
-
body: Record<string, unknown>;
|
|
440
435
|
}
|
|
441
436
|
export interface CropsDeleteDefaultHeaders {
|
|
442
437
|
"x-ms-error-code"?: string;
|
|
@@ -497,7 +492,6 @@ export interface DeviceDataModelsGetDefaultResponse extends HttpResponse {
|
|
|
497
492
|
/** Deletes a device data model entity. */
|
|
498
493
|
export interface DeviceDataModelsDelete204Response extends HttpResponse {
|
|
499
494
|
status: "204";
|
|
500
|
-
body: Record<string, unknown>;
|
|
501
495
|
}
|
|
502
496
|
export interface DeviceDataModelsDeleteDefaultHeaders {
|
|
503
497
|
"x-ms-error-code"?: string;
|
|
@@ -558,7 +552,6 @@ export interface DevicesGetDefaultResponse extends HttpResponse {
|
|
|
558
552
|
/** Deletes a device entity. */
|
|
559
553
|
export interface DevicesDelete204Response extends HttpResponse {
|
|
560
554
|
status: "204";
|
|
561
|
-
body: Record<string, unknown>;
|
|
562
555
|
}
|
|
563
556
|
export interface DevicesDeleteDefaultHeaders {
|
|
564
557
|
"x-ms-error-code"?: string;
|
|
@@ -689,7 +682,6 @@ export interface FarmsCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
689
682
|
/** Deletes a specified farm resource under a particular party. */
|
|
690
683
|
export interface FarmsDelete204Response extends HttpResponse {
|
|
691
684
|
status: "204";
|
|
692
|
-
body: Record<string, unknown>;
|
|
693
685
|
}
|
|
694
686
|
export interface FarmsDeleteDefaultHeaders {
|
|
695
687
|
"x-ms-error-code"?: string;
|
|
@@ -792,7 +784,6 @@ export interface FieldsCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
792
784
|
/** Deletes a specified field resource under a particular party. */
|
|
793
785
|
export interface FieldsDelete204Response extends HttpResponse {
|
|
794
786
|
status: "204";
|
|
795
|
-
body: Record<string, unknown>;
|
|
796
787
|
}
|
|
797
788
|
export interface FieldsDeleteDefaultHeaders {
|
|
798
789
|
"x-ms-error-code"?: string;
|
|
@@ -895,7 +886,6 @@ export interface HarvestDataCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
895
886
|
/** Deletes a specified harvest data resource under a particular party. */
|
|
896
887
|
export interface HarvestDataDelete204Response extends HttpResponse {
|
|
897
888
|
status: "204";
|
|
898
|
-
body: Record<string, unknown>;
|
|
899
889
|
}
|
|
900
890
|
export interface HarvestDataDeleteDefaultHeaders {
|
|
901
891
|
"x-ms-error-code"?: string;
|
|
@@ -984,7 +974,6 @@ export interface InsightAttachmentsGetDefaultResponse extends HttpResponse {
|
|
|
984
974
|
/** Deletes a specified insight resource. */
|
|
985
975
|
export interface InsightAttachmentsDelete204Response extends HttpResponse {
|
|
986
976
|
status: "204";
|
|
987
|
-
body: Record<string, unknown>;
|
|
988
977
|
}
|
|
989
978
|
export interface InsightAttachmentsDeleteDefaultHeaders {
|
|
990
979
|
"x-ms-error-code"?: string;
|
|
@@ -1088,7 +1077,6 @@ export interface InsightsGetDefaultResponse extends HttpResponse {
|
|
|
1088
1077
|
/** Deletes a specified insight resource. */
|
|
1089
1078
|
export interface InsightsDelete204Response extends HttpResponse {
|
|
1090
1079
|
status: "204";
|
|
1091
|
-
body: Record<string, unknown>;
|
|
1092
1080
|
}
|
|
1093
1081
|
export interface InsightsDeleteDefaultHeaders {
|
|
1094
1082
|
"x-ms-error-code"?: string;
|
|
@@ -1191,7 +1179,6 @@ export interface ManagementZonesCreateOrUpdateDefaultResponse extends HttpRespon
|
|
|
1191
1179
|
/** Deletes a specified management zone resource under a particular party. */
|
|
1192
1180
|
export interface ManagementZonesDelete204Response extends HttpResponse {
|
|
1193
1181
|
status: "204";
|
|
1194
|
-
body: Record<string, unknown>;
|
|
1195
1182
|
}
|
|
1196
1183
|
export interface ManagementZonesDeleteDefaultHeaders {
|
|
1197
1184
|
"x-ms-error-code"?: string;
|
|
@@ -1350,7 +1337,6 @@ export interface NutrientAnalysesCreateOrUpdateDefaultResponse extends HttpRespo
|
|
|
1350
1337
|
/** Deletes a specified nutrient analysis resource under a particular party. */
|
|
1351
1338
|
export interface NutrientAnalysesDelete204Response extends HttpResponse {
|
|
1352
1339
|
status: "204";
|
|
1353
|
-
body: Record<string, unknown>;
|
|
1354
1340
|
}
|
|
1355
1341
|
export interface NutrientAnalysesDeleteDefaultHeaders {
|
|
1356
1342
|
"x-ms-error-code"?: string;
|
|
@@ -1411,7 +1397,6 @@ export interface OAuthProvidersCreateOrUpdateDefaultResponse extends HttpRespons
|
|
|
1411
1397
|
/** Deletes an specified oauthProvider resource. */
|
|
1412
1398
|
export interface OAuthProvidersDelete204Response extends HttpResponse {
|
|
1413
1399
|
status: "204";
|
|
1414
|
-
body: Record<string, unknown>;
|
|
1415
1400
|
}
|
|
1416
1401
|
export interface OAuthProvidersDeleteDefaultHeaders {
|
|
1417
1402
|
"x-ms-error-code"?: string;
|
|
@@ -1556,7 +1541,6 @@ export interface PartiesCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
1556
1541
|
/** Deletes a specified party resource. */
|
|
1557
1542
|
export interface PartiesDelete204Response extends HttpResponse {
|
|
1558
1543
|
status: "204";
|
|
1559
|
-
body: Record<string, unknown>;
|
|
1560
1544
|
}
|
|
1561
1545
|
export interface PartiesDeleteDefaultHeaders {
|
|
1562
1546
|
"x-ms-error-code"?: string;
|
|
@@ -1645,7 +1629,6 @@ export interface PlantingDataCreateOrUpdateDefaultResponse extends HttpResponse
|
|
|
1645
1629
|
/** Deletes a specified planting data resource under a particular party. */
|
|
1646
1630
|
export interface PlantingDataDelete204Response extends HttpResponse {
|
|
1647
1631
|
status: "204";
|
|
1648
|
-
body: Record<string, unknown>;
|
|
1649
1632
|
}
|
|
1650
1633
|
export interface PlantingDataDeleteDefaultHeaders {
|
|
1651
1634
|
"x-ms-error-code"?: string;
|
|
@@ -1748,7 +1731,6 @@ export interface PlantTissueAnalysesCreateOrUpdateDefaultResponse extends HttpRe
|
|
|
1748
1731
|
/** Deletes a specified plant tissue analysis resource under a particular party. */
|
|
1749
1732
|
export interface PlantTissueAnalysesDelete204Response extends HttpResponse {
|
|
1750
1733
|
status: "204";
|
|
1751
|
-
body: Record<string, unknown>;
|
|
1752
1734
|
}
|
|
1753
1735
|
export interface PlantTissueAnalysesDeleteDefaultHeaders {
|
|
1754
1736
|
"x-ms-error-code"?: string;
|
|
@@ -1851,7 +1833,6 @@ export interface PrescriptionMapsCreateOrUpdateDefaultResponse extends HttpRespo
|
|
|
1851
1833
|
/** Deletes a specified prescription map resource under a particular party. */
|
|
1852
1834
|
export interface PrescriptionMapsDelete204Response extends HttpResponse {
|
|
1853
1835
|
status: "204";
|
|
1854
|
-
body: Record<string, unknown>;
|
|
1855
1836
|
}
|
|
1856
1837
|
export interface PrescriptionMapsDeleteDefaultHeaders {
|
|
1857
1838
|
"x-ms-error-code"?: string;
|
|
@@ -1954,7 +1935,6 @@ export interface PrescriptionsCreateOrUpdateDefaultResponse extends HttpResponse
|
|
|
1954
1935
|
/** Deletes a specified prescription resource under a particular party. */
|
|
1955
1936
|
export interface PrescriptionsDelete204Response extends HttpResponse {
|
|
1956
1937
|
status: "204";
|
|
1957
|
-
body: Record<string, unknown>;
|
|
1958
1938
|
}
|
|
1959
1939
|
export interface PrescriptionsDeleteDefaultHeaders {
|
|
1960
1940
|
"x-ms-error-code"?: string;
|
|
@@ -2142,7 +2122,6 @@ export interface SeasonalFieldsCreateOrUpdateDefaultResponse extends HttpRespons
|
|
|
2142
2122
|
/** Deletes a specified seasonal-field resource under a particular party. */
|
|
2143
2123
|
export interface SeasonalFieldsDelete204Response extends HttpResponse {
|
|
2144
2124
|
status: "204";
|
|
2145
|
-
body: Record<string, unknown>;
|
|
2146
2125
|
}
|
|
2147
2126
|
export interface SeasonalFieldsDeleteDefaultHeaders {
|
|
2148
2127
|
"x-ms-error-code"?: string;
|
|
@@ -2245,7 +2224,6 @@ export interface SeasonsCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
2245
2224
|
/** Deletes a specified season resource. */
|
|
2246
2225
|
export interface SeasonsDelete204Response extends HttpResponse {
|
|
2247
2226
|
status: "204";
|
|
2248
|
-
body: Record<string, unknown>;
|
|
2249
2227
|
}
|
|
2250
2228
|
export interface SeasonsDeleteDefaultHeaders {
|
|
2251
2229
|
"x-ms-error-code"?: string;
|
|
@@ -2306,7 +2284,6 @@ export interface SensorDataModelsGetDefaultResponse extends HttpResponse {
|
|
|
2306
2284
|
/** Deletes a sensor data model entity. */
|
|
2307
2285
|
export interface SensorDataModelsDelete204Response extends HttpResponse {
|
|
2308
2286
|
status: "204";
|
|
2309
|
-
body: Record<string, unknown>;
|
|
2310
2287
|
}
|
|
2311
2288
|
export interface SensorDataModelsDeleteDefaultHeaders {
|
|
2312
2289
|
"x-ms-error-code"?: string;
|
|
@@ -2387,7 +2364,6 @@ export interface SensorMappingsGetDefaultResponse extends HttpResponse {
|
|
|
2387
2364
|
/** Deletes a sensor mapping entity. */
|
|
2388
2365
|
export interface SensorMappingsDelete204Response extends HttpResponse {
|
|
2389
2366
|
status: "204";
|
|
2390
|
-
body: Record<string, unknown>;
|
|
2391
2367
|
}
|
|
2392
2368
|
export interface SensorMappingsDeleteDefaultHeaders {
|
|
2393
2369
|
"x-ms-error-code"?: string;
|
|
@@ -2448,7 +2424,6 @@ export interface SensorPartnerIntegrationsGetDefaultResponse extends HttpRespons
|
|
|
2448
2424
|
/** Deletes a partner integration model entity. */
|
|
2449
2425
|
export interface SensorPartnerIntegrationsDelete204Response extends HttpResponse {
|
|
2450
2426
|
status: "204";
|
|
2451
|
-
body: Record<string, unknown>;
|
|
2452
2427
|
}
|
|
2453
2428
|
export interface SensorPartnerIntegrationsDeleteDefaultHeaders {
|
|
2454
2429
|
"x-ms-error-code"?: string;
|
|
@@ -2537,7 +2512,6 @@ export interface SensorsGetDefaultResponse extends HttpResponse {
|
|
|
2537
2512
|
/** Deletes a sensor entity. */
|
|
2538
2513
|
export interface SensorsDelete204Response extends HttpResponse {
|
|
2539
2514
|
status: "204";
|
|
2540
|
-
body: Record<string, unknown>;
|
|
2541
2515
|
}
|
|
2542
2516
|
export interface SensorsDeleteDefaultHeaders {
|
|
2543
2517
|
"x-ms-error-code"?: string;
|
|
@@ -2668,7 +2642,6 @@ export interface TillageDataCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
2668
2642
|
/** Deletes a specified tillage data resource under a particular party. */
|
|
2669
2643
|
export interface TillageDataDelete204Response extends HttpResponse {
|
|
2670
2644
|
status: "204";
|
|
2671
|
-
body: Record<string, unknown>;
|
|
2672
2645
|
}
|
|
2673
2646
|
export interface TillageDataDeleteDefaultHeaders {
|
|
2674
2647
|
"x-ms-error-code"?: string;
|
|
@@ -2862,7 +2835,6 @@ export interface ZonesCreateOrUpdateDefaultResponse extends HttpResponse {
|
|
|
2862
2835
|
/** Deletes a specified zone resource under a particular party. */
|
|
2863
2836
|
export interface ZonesDelete204Response extends HttpResponse {
|
|
2864
2837
|
status: "204";
|
|
2865
|
-
body: Record<string, unknown>;
|
|
2866
2838
|
}
|
|
2867
2839
|
export interface ZonesDeleteDefaultHeaders {
|
|
2868
2840
|
"x-ms-error-code"?: string;
|