@azure/core-rest-pipeline 1.17.1-alpha.20240920.2 → 1.17.1-alpha.20240925.5
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/README.md +9 -9
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ A `PipelineResponse` describes the HTTP response (body, headers, and status code
|
|
|
31
31
|
|
|
32
32
|
A `SendRequest` method is a method that given a `PipelineRequest` can asynchronously return a `PipelineResponse`.
|
|
33
33
|
|
|
34
|
-
```ts
|
|
34
|
+
```ts snippet:send_request
|
|
35
35
|
export type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse>;
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -39,7 +39,7 @@ export type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse
|
|
|
39
39
|
|
|
40
40
|
An `HttpClient` is any object that satisfies the following interface to implement a `SendRequest` method:
|
|
41
41
|
|
|
42
|
-
```ts
|
|
42
|
+
```ts snippet:http_request
|
|
43
43
|
export interface HttpClient {
|
|
44
44
|
/**
|
|
45
45
|
* The method that makes the request and returns a response.
|
|
@@ -54,7 +54,7 @@ export interface HttpClient {
|
|
|
54
54
|
|
|
55
55
|
A `PipelinePolicy` is a simple object that implements the following interface:
|
|
56
56
|
|
|
57
|
-
```ts
|
|
57
|
+
```ts snippet:pipeline_policy
|
|
58
58
|
export interface PipelinePolicy {
|
|
59
59
|
/**
|
|
60
60
|
* The policy name. Must be a unique string in the pipeline.
|
|
@@ -62,8 +62,8 @@ export interface PipelinePolicy {
|
|
|
62
62
|
name: string;
|
|
63
63
|
/**
|
|
64
64
|
* The main method to implement that manipulates a request/response.
|
|
65
|
-
* @param request The request being performed.
|
|
66
|
-
* @param next The next policy in the pipeline. Must be called to continue the pipeline.
|
|
65
|
+
* @param request - The request being performed.
|
|
66
|
+
* @param next - The next policy in the pipeline. Must be called to continue the pipeline.
|
|
67
67
|
*/
|
|
68
68
|
sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse>;
|
|
69
69
|
}
|
|
@@ -75,7 +75,7 @@ One can view the role of policies as that of `middleware`, a concept that is fam
|
|
|
75
75
|
|
|
76
76
|
The `sendRequest` implementation can both transform the outgoing request as well as the incoming response:
|
|
77
77
|
|
|
78
|
-
```ts
|
|
78
|
+
```ts snippet:custom_policy
|
|
79
79
|
const customPolicy = {
|
|
80
80
|
name: "My wonderful policy",
|
|
81
81
|
async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {
|
|
@@ -86,7 +86,7 @@ const customPolicy = {
|
|
|
86
86
|
// Do something special if this policy sees Forbidden
|
|
87
87
|
}
|
|
88
88
|
return result;
|
|
89
|
-
}
|
|
89
|
+
},
|
|
90
90
|
};
|
|
91
91
|
```
|
|
92
92
|
|
|
@@ -100,7 +100,7 @@ You can think of policies being applied like a stack (first-in/last-out.) The fi
|
|
|
100
100
|
|
|
101
101
|
A `Pipeline` satisfies the following interface:
|
|
102
102
|
|
|
103
|
-
```ts
|
|
103
|
+
```ts snippet:pipeline
|
|
104
104
|
export interface Pipeline {
|
|
105
105
|
addPolicy(policy: PipelinePolicy, options?: AddPolicyOptions): void;
|
|
106
106
|
removePolicy(options: { name?: string; phase?: PipelinePhase }): PipelinePolicy[];
|
|
@@ -123,7 +123,7 @@ Phases occur in the above order, with serialization policies being applied first
|
|
|
123
123
|
|
|
124
124
|
When adding a policy to the pipeline you can specify not only what phase a policy is in, but also if it has any dependencies:
|
|
125
125
|
|
|
126
|
-
```ts
|
|
126
|
+
```ts snippet:add_policy_options
|
|
127
127
|
export interface AddPolicyOptions {
|
|
128
128
|
beforePolicies?: string[];
|
|
129
129
|
afterPolicies?: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/core-rest-pipeline",
|
|
3
|
-
"version": "1.17.1-alpha.
|
|
3
|
+
"version": "1.17.1-alpha.20240925.5",
|
|
4
4
|
"description": "Isomorphic client library for making HTTP requests in node.js and browser.",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"type": "module",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build:samples": "echo Obsolete",
|
|
55
55
|
"build:test": "echo skipped. actual commands inlined in browser test scripts",
|
|
56
|
-
"build": "npm run clean &&
|
|
56
|
+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
57
57
|
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
|
|
58
58
|
"clean": "rimraf --glob dist dist-* temp types *.tgz *.log",
|
|
59
59
|
"execute:samples": "echo skipped",
|
|
60
|
-
"extract-api": "
|
|
60
|
+
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
|
|
61
61
|
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
|
|
62
62
|
"integration-test:browser": "echo skipped",
|
|
63
63
|
"integration-test:node": "echo skipped",
|
|
@@ -66,11 +66,12 @@
|
|
|
66
66
|
"lint": "eslint package.json api-extractor.json src",
|
|
67
67
|
"pack": "npm pack 2>&1",
|
|
68
68
|
"test:browser": "npm run clean && npm run unit-test:browser && npm run integration-test:browser",
|
|
69
|
-
"test:node": "npm run clean &&
|
|
70
|
-
"test": "npm run clean &&
|
|
71
|
-
"unit-test:browser": "npm run clean &&
|
|
69
|
+
"test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node",
|
|
70
|
+
"test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run build-test && npm run unit-test:browser && npm run integration-test",
|
|
71
|
+
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --no-test-proxy --browser",
|
|
72
72
|
"unit-test:node": "dev-tool run test:vitest --no-test-proxy",
|
|
73
|
-
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
|
|
73
|
+
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
|
|
74
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
74
75
|
},
|
|
75
76
|
"//metadata": {
|
|
76
77
|
"constantPaths": [
|
|
@@ -110,7 +111,6 @@
|
|
|
110
111
|
"eslint": "^9.9.0",
|
|
111
112
|
"playwright": "^1.41.2",
|
|
112
113
|
"rimraf": "^5.0.5",
|
|
113
|
-
"tshy": "^2.0.0",
|
|
114
114
|
"typescript": "~5.6.2",
|
|
115
115
|
"vitest": "^2.0.5"
|
|
116
116
|
},
|