@pact-foundation/pact 9.17.2 → 9.17.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 +11 -0
- package/README.md +14 -36
- package/package.json +2 -2
- package/src/dsl/verifier.js +2 -2
- package/src/httpPact.js +3 -0
- package/src/httpPact.js.map +1 -1
- package/src/pact-web.js +3 -0
- package/src/pact-web.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [9.17.3](https://github.com/pact-foundation/pact-js/compare/v9.17.2...v9.17.3) (2022-03-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Fixes and Improvements
|
|
9
|
+
|
|
10
|
+
* remove rust from v3 release build ([2a5f65b](https://github.com/pact-foundation/pact-js/commit/2a5f65bc7e8a48c7ee786905f78207cba7837110))
|
|
11
|
+
* The table on README.md is corrupted and unreadable ([#832](https://github.com/pact-foundation/pact-js/issues/832)) ([b73fa05](https://github.com/pact-foundation/pact-js/commit/b73fa05a7f92ed81d225f6c68349d322d388656d))
|
|
12
|
+
* throw an error when pact spec version is not set to 2 ([4186c22](https://github.com/pact-foundation/pact-js/commit/4186c22030cc3a7f2abb99c096d480c66f17f2a4))
|
|
13
|
+
* upgrade to latest pact-node ([0d9b127](https://github.com/pact-foundation/pact-js/commit/0d9b1270d4dc03e761941ae060b2a75db0bab24d))
|
|
14
|
+
* verifier req/res logging on debug ([#835](https://github.com/pact-foundation/pact-js/issues/835)) ([3edc5a0](https://github.com/pact-foundation/pact-js/commit/3edc5a035170fb28f74be6b908091e37093cad98))
|
|
15
|
+
|
|
5
16
|
### [9.17.2](https://github.com/pact-foundation/pact-js/compare/v9.17.1...v9.17.2) (2022-01-12)
|
|
6
17
|
|
|
7
18
|
|
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ Read [Getting started with Pact] for more information for beginners.
|
|
|
42
42
|
- [HTTP API Testing](#http-api-testing)
|
|
43
43
|
- [Consumer Side Testing](#consumer-side-testing)
|
|
44
44
|
- [API](#api)
|
|
45
|
+
- [Constructor](#constructor)
|
|
45
46
|
- [Example](#example)
|
|
46
47
|
- [Provider API Testing](#provider-api-testing)
|
|
47
48
|
- [Verification Options](#verification-options)
|
|
@@ -156,8 +157,6 @@ The `Pact` class provides the following high-level APIs, they are listed in the
|
|
|
156
157
|
|
|
157
158
|
#### API
|
|
158
159
|
|
|
159
|
-
<details><summary>Consumer API</summary>
|
|
160
|
-
|
|
161
160
|
| API | Options | Returns | Description |
|
|
162
161
|
| ------------------- | ----------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
163
162
|
| `new Pact(options)` | See constructor options below | `Object` | Creates a Mock Server test double of your Provider API. If you need multiple Providers for a scenario, you can create as many as these as you need. |
|
|
@@ -166,9 +165,7 @@ The `Pact` class provides the following high-level APIs, they are listed in the
|
|
|
166
165
|
| `verify()` | n/a | `Promise` | Verifies that all interactions specified. This should be called once per test, to ensure your expectations were correct |
|
|
167
166
|
| `finalize()` | n/a | `Promise` | Records the interactions registered to the Mock Server into the pact file and shuts it down. You would normally call this only once in an `afterAll(...)` type clause. |
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<details><summary>Constructor</summary>
|
|
168
|
+
#### Constructor
|
|
172
169
|
|
|
173
170
|
| Parameter | Required? | Type | Description |
|
|
174
171
|
| ------------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------- |
|
|
@@ -185,9 +182,7 @@ The `Pact` class provides the following high-level APIs, they are listed in the
|
|
|
185
182
|
| `spec` | no | number | Pact specification version (defaults to 2) |
|
|
186
183
|
| `cors` | no | boolean | Allow CORS OPTION requests to be accepted, defaults to false |
|
|
187
184
|
| `pactfileWriteMode` | no | string | Control how the Pact files are written. Choices: 'overwrite' 'update' or 'none'. Defaults to 'overwrite' |
|
|
188
|
-
| `timeout` | no | number | The time to wait for the mock server to start up in milliseconds. Defaults to 30 seconds (30000)
|
|
189
|
-
|
|
190
|
-
</details>
|
|
185
|
+
| `timeout` | no | number | The time to wait for the mock server to start up in milliseconds. Defaults to 30 seconds (30000) |
|
|
191
186
|
|
|
192
187
|
#### Example
|
|
193
188
|
|
|
@@ -289,16 +284,12 @@ describe("Pact", () => {
|
|
|
289
284
|
|
|
290
285
|
### Provider API Testing
|
|
291
286
|
|
|
292
|
-
<details><summary>Provider API</summary>
|
|
293
|
-
|
|
294
287
|
Once you have created Pacts for your Consumer, you need to validate those Pacts against your Provider. The Verifier object provides the following API for you to do so:
|
|
295
288
|
|
|
296
289
|
| API | Options | Returns | Description |
|
|
297
290
|
| ------------------ | :-------: | --------- | --------------------- |
|
|
298
291
|
| `verifyProvider()` | See below | `Promise` | Start the Mock Server |
|
|
299
292
|
|
|
300
|
-
</details>
|
|
301
|
-
|
|
302
293
|
1. Start your local Provider service.
|
|
303
294
|
1. Optionally, instrument your API with ability to configure [provider states](https://github.com/pact-foundation/pact-provider-verifier/)
|
|
304
295
|
1. Then run the Provider side verification step
|
|
@@ -316,10 +307,8 @@ new Verifier(opts).verifyProvider().then(function () {
|
|
|
316
307
|
|
|
317
308
|
#### Verification Options
|
|
318
309
|
|
|
319
|
-
<details><summary>Verification Options</summary>
|
|
320
|
-
|
|
321
310
|
| Parameter | Required? | Type | Description |
|
|
322
|
-
| --------------------------- | --------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
311
|
+
| --------------------------- | --------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
323
312
|
| `providerBaseUrl` | true | string | Running API provider host endpoint. |
|
|
324
313
|
| `pactBrokerUrl` | false | string | Base URL of the Pact Broker from which to retrieve the pacts. Required if `pactUrls` not given. |
|
|
325
314
|
| `provider` | false | string | Name of the provider if fetching from a Broker |
|
|
@@ -337,15 +326,13 @@ new Verifier(opts).verifyProvider().then(function () {
|
|
|
337
326
|
| `pactBrokerPassword` | false | string | Password for Pact Broker basic authentication |
|
|
338
327
|
| `pactBrokerToken` | false | string | Bearer token for Pact Broker authentication |
|
|
339
328
|
| `publishVerificationResult` | false | boolean | Publish verification result to Broker (_NOTE_: you should only enable this during CI builds) |
|
|
340
|
-
| `customProviderHeaders` | false | array | Header(s) to add to provider state set up and pact verification |
|
|
329
|
+
| `customProviderHeaders` | false | array | Header(s) to add to provider state set up and pact verification | | `requests`. eg 'Authorization: Basic cGFjdDpwYWN0'. |
|
|
341
330
|
| `providerVersion` | false | string | Provider version, required to publish verification result to Broker. Optional otherwise. |
|
|
342
331
|
| `enablePending` | false | boolean | Enable the [pending pacts](https://docs.pact.io/pending) feature. |
|
|
343
332
|
| `timeout` | false | number | The duration in ms we should wait to confirm verification process was successful. Defaults to 30000. |
|
|
344
333
|
| `format` | false | string | What format the verification results are printed in. Options are `json`, `xml`, `progress` and `RspecJunitFormatter` (which is a synonym for `xml`) |
|
|
345
334
|
| `verbose` | false | boolean | Enables verbose output for underlying pact binary. |
|
|
346
335
|
|
|
347
|
-
</details>
|
|
348
|
-
|
|
349
336
|
To dynamically retrieve pacts from a Pact Broker for a provider, provide the broker URL, the name of the provider, and the consumer version tags that you want to verify:
|
|
350
337
|
|
|
351
338
|
```js
|
|
@@ -550,7 +537,7 @@ The easiest way to publish pacts to the broker is via an npm script in your pack
|
|
|
550
537
|
|
|
551
538
|
```
|
|
552
539
|
|
|
553
|
-
"pact:publish": "pact-broker publish <YOUR_PACT_FILES_OR_DIR> --consumer-app-version=\"$(npx @pact-foundation/absolute-version)\" --
|
|
540
|
+
"pact:publish": "pact-broker publish <YOUR_PACT_FILES_OR_DIR> --consumer-app-version=\"$(npx @pact-foundation/absolute-version)\" --auto-detect-version-properties --broker-base-url=https://your-broker-url.example.com"
|
|
554
541
|
```
|
|
555
542
|
|
|
556
543
|
For a full list of the options, see the [CLI usage instructions](https://github.com/pact-foundation/pact-ruby-standalone/releases).
|
|
@@ -581,8 +568,6 @@ new Publisher(opts)
|
|
|
581
568
|
|
|
582
569
|
#### Pact publishing options
|
|
583
570
|
|
|
584
|
-
<details><summary>Publishing Options</summary>
|
|
585
|
-
|
|
586
571
|
| Parameter | Required | Type | Description |
|
|
587
572
|
| -------------------- | :------: | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
588
573
|
| `providerBaseUrl` | `false` | string | Running API provider host endpoint. |
|
|
@@ -594,8 +579,6 @@ new Publisher(opts)
|
|
|
594
579
|
| `consumerVersion` | `true` | string | The consumer application version; e.g. '1.0.0-cac389f'. ([See more info on versioning](https://docs.pact.io/getting_started/versioning_in_the_pact_broker)) |
|
|
595
580
|
| `tags` | `false` | array of strings | Tag your pacts, often used with your branching, release or environment strategy e.g. ['prod', 'test'] |
|
|
596
581
|
|
|
597
|
-
</details>
|
|
598
|
-
|
|
599
582
|
If your broker has a self signed certificate, set the environment variable `SSL_CERT_FILE` (or `SSL_CERT_DIR`) pointing to a copy of your certificate.
|
|
600
583
|
|
|
601
584
|
#### Publishing Verification Results to a Pact Broker
|
|
@@ -648,7 +631,7 @@ const {
|
|
|
648
631
|
} = require("@pact-foundation/pact")
|
|
649
632
|
|
|
650
633
|
// 1 Dog API Handler
|
|
651
|
-
const dogApiHandler = function(dog) {
|
|
634
|
+
const dogApiHandler = function (dog) {
|
|
652
635
|
if (!dog.id && !dog.name && !dog.type) {
|
|
653
636
|
throw new Error("missing fields")
|
|
654
637
|
}
|
|
@@ -775,8 +758,6 @@ _NOTE: Make sure to start the mock service via the `Pact` declaration with the o
|
|
|
775
758
|
|
|
776
759
|
Often times, you find yourself having to re-write regular expressions for common formats. We've created a number of them for you to save you the time:
|
|
777
760
|
|
|
778
|
-
<details><summary>Matchers API</summary>
|
|
779
|
-
|
|
780
761
|
| method | description |
|
|
781
762
|
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
782
763
|
| `boolean` | Match a boolean value (using equality) |
|
|
@@ -794,8 +775,6 @@ Often times, you find yourself having to re-write regular expressions for common
|
|
|
794
775
|
| `uuid` | Will match strings containing UUIDs |
|
|
795
776
|
| `email` | Will match strings containing Email address |
|
|
796
777
|
|
|
797
|
-
</details>
|
|
798
|
-
|
|
799
778
|
### Match based on type
|
|
800
779
|
|
|
801
780
|
```javascript
|
|
@@ -1120,7 +1099,7 @@ There is an `XmlBuilder` class that provides a DSL to help construct XML bodies
|
|
|
1120
1099
|
for example:
|
|
1121
1100
|
|
|
1122
1101
|
```javascript
|
|
1123
|
-
body: new XmlBuilder("1.0", "UTF-8", "ns1:projects").build(el => {
|
|
1102
|
+
body: new XmlBuilder("1.0", "UTF-8", "ns1:projects").build((el) => {
|
|
1124
1103
|
el.setAttributes({
|
|
1125
1104
|
id: "1234",
|
|
1126
1105
|
"xmlns:ns1": "http://some.namespace/and/more/stuff",
|
|
@@ -1133,8 +1112,8 @@ body: new XmlBuilder("1.0", "UTF-8", "ns1:projects").build(el => {
|
|
|
1133
1112
|
name: string("Project 1"),
|
|
1134
1113
|
due: timestamp("yyyy-MM-dd'T'HH:mm:ss.SZ", "2016-02-11T09:46:56.023Z"),
|
|
1135
1114
|
},
|
|
1136
|
-
project => {
|
|
1137
|
-
project.appendElement("ns1:tasks", {}, task => {
|
|
1115
|
+
(project) => {
|
|
1116
|
+
project.appendElement("ns1:tasks", {}, (task) => {
|
|
1138
1117
|
task.eachLike(
|
|
1139
1118
|
"ns1:task",
|
|
1140
1119
|
{
|
|
@@ -1240,9 +1219,10 @@ The symptom presents as follows:
|
|
|
1240
1219
|
|
|
1241
1220
|
1. The mock server starts up correctly, as shown by a debug level log message such as this:
|
|
1242
1221
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1222
|
+
```
|
|
1223
|
+
[2021-11-22 11:16:01.214 +0000] DEBUG (3863 on Matts-iMac): pact-core@11.0.1: INFO WEBrick::HTTPServer#start: pid=3864 port=50337
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1246
1226
|
2. You receive a conflicting message such as "The pact mock service doesn't appear to be running" and the tests never run or any before all blocks fail to complete.
|
|
1247
1227
|
|
|
1248
1228
|
The problem is that the Pact framework attempts to ensure the mock service can be communicated with before the tests run. It does so via an HTTP call, which will be sent via any intermediate proxies if configured. The proxy is unlikely to know how send the request back to your machine, which results in a timeout or error.
|
|
@@ -1415,8 +1395,6 @@ You'll need to add the additional header `Access-Control-Expose-Headers`, this w
|
|
|
1415
1395
|
|
|
1416
1396
|
See [this issue](https://github.com/angular/angular/issues/13554) for background.
|
|
1417
1397
|
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
1398
|
## Contributing
|
|
1421
1399
|
|
|
1422
1400
|
1. Fork it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pact-foundation/pact",
|
|
3
|
-
"version": "9.17.
|
|
3
|
+
"version": "9.17.3",
|
|
4
4
|
"description": "Pact for all things Javascript",
|
|
5
5
|
"main": "./src/pact.js",
|
|
6
6
|
"types": "./src/pact.d.ts",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@pact-foundation/pact-node": "^10.
|
|
97
|
+
"@pact-foundation/pact-node": "^10.17.2",
|
|
98
98
|
"@types/bluebird": "^3.5.20",
|
|
99
99
|
"@types/express": "^4.17.11",
|
|
100
100
|
"bluebird": "~3.5.1",
|
package/src/dsl/verifier.js
CHANGED
|
@@ -231,7 +231,7 @@ var Verifier = /** @class */ (function () {
|
|
|
231
231
|
};
|
|
232
232
|
Verifier.prototype.createRequestTracer = function () {
|
|
233
233
|
return function (req, _, next) {
|
|
234
|
-
logger_1.default.
|
|
234
|
+
logger_1.default.debug("incoming request", removeEmptyRequestProperties(req));
|
|
235
235
|
next();
|
|
236
236
|
};
|
|
237
237
|
};
|
|
@@ -248,7 +248,7 @@ var Verifier = /** @class */ (function () {
|
|
|
248
248
|
chunks.push(Buffer.from(chunk));
|
|
249
249
|
}
|
|
250
250
|
var body = Buffer.concat(chunks).toString("utf8");
|
|
251
|
-
logger_1.default.
|
|
251
|
+
logger_1.default.debug("outgoing response", removeEmptyResponseProperties(body, res));
|
|
252
252
|
oldEnd.apply(res, [chunk]);
|
|
253
253
|
};
|
|
254
254
|
if (typeof next === "function") {
|
package/src/httpPact.js
CHANGED
|
@@ -46,6 +46,9 @@ var Pact = /** @class */ (function () {
|
|
|
46
46
|
if (lodash_1.isEmpty(this.opts.provider)) {
|
|
47
47
|
throw new configurationError_1.default("You must specify a Provider for this pact.");
|
|
48
48
|
}
|
|
49
|
+
if (this.opts.spec !== 2) {
|
|
50
|
+
throw new configurationError_1.default("Pact-js currently only supports pact spec version 2. If you need a higher version of the pact specification, you can try the beta. See instructions here: https://github.com/pact-foundation/pact-js#pact-js-v3");
|
|
51
|
+
}
|
|
49
52
|
logger_1.setLogLevel(this.opts.logLevel);
|
|
50
53
|
pact_node_1.default.logLevel(this.opts.logLevel);
|
|
51
54
|
if (this.opts.logLevel === "trace") {
|
package/src/httpPact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpPact.js","sourceRoot":"","sources":["../../src/httpPact.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wDAAuD;AACvD,2BAA4B;AAC5B,+BAAgC;AAChC,iCAAkC;AAClC,iDAAkE;AAClE,iCAAgC;AAChC,oCAA8C;AAC9C,0CAA4E;AAC5E,iDAA+C;AAG/C,gEAA0D;AAC1D,kEAA4D;AAE5D,IAAM,oBAAoB,GAAG;IAC3B,gBAAM,CAAC,KAAK,CACV,sDAAsD;QACpD,6FAA6F;QAC7F,gIAAgI;QAChI,uIAAuI;QACvI,+FAA+F,CAClG,CAAA;AACH,CAAC,CAAA;AAED;;;;;;GAMG;AACH;IAyBE,cAAY,MAAmB;QAC7B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,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CACtB;gBACE,KAAI,CAAC,IAAI,CAAC,IAAI,GAAG,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,KAAI,CAAC,IAAI,CAAC,IAAI,CAAA;gBAC3D,OAAO,CAAC,KAAI,CAAC,IAAI,CAAC,CAAA;YACpB,CAAC,EACD,UAAC,CAAM,IAAK,OAAA,MAAM,CAAC,CAAC,CAAC,EAAT,CAAS,CACtB;QAND,CAMC,CACF,CAAA;IACH,CAAC;IAEO,2BAAY,GAApB,UAAqB,MAAmB;QACtC,IAAI,CAAC,MAAM,GAAG,mBAAc,CAAC,YAAY,CAAC,oBACxC,OAAO,EAAE,KAAK,IACX,IAAI,CAAC,IAAI,KACZ,IAAI,EAAE,MAAM,CAAC,IAAI,GACD,CAAC,CAAA;IACrB,CAAC;IAlQa,aAAQ,GAAG;QACvB,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC;QACzC,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC;QACpD,QAAQ,EAAE,MAAM;QAChB,iBAAiB,EAAE,WAAW;QAC9B,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,KAAK;KACI,CAAA;IAwPlB,WAAC;CAAA,AApQD,IAoQC;AApQY,oBAAI"}
|
package/src/pact-web.js
CHANGED
|
@@ -51,6 +51,9 @@ var PactWeb = /** @class */ (function () {
|
|
|
51
51
|
ssl: false,
|
|
52
52
|
};
|
|
53
53
|
this.opts = __assign(__assign({}, defaults), config);
|
|
54
|
+
if (this.opts.spec !== 2) {
|
|
55
|
+
throw new Error("Pact-web only supports pact spec version 2");
|
|
56
|
+
}
|
|
54
57
|
console.info("Setting up Pact using mock service on port: \"" + this.opts.port + "\"");
|
|
55
58
|
this.mockService = new mockService_1.MockService(this.opts.consumer, this.opts.provider, this.opts.port, this.opts.host, this.opts.ssl, this.opts.pactfileWriteMode);
|
|
56
59
|
}
|
package/src/pact-web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pact-web.js","sourceRoot":"","sources":["../../src/pact-web.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B;;;GAGG;AACH,2CAAsC;AAEtC,iDAAkE;AAClE,iDAAkE;AAElE,gEAA0D;AAC1D,sBAAQ,EAAE,CAAA;AAwCV;;;;;;;GAOG;AACH;IAKE,iBAAY,MAAuB;QACjC,IAAM,QAAQ,GAAG;YACf,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,WAAW;YACjB,iBAAiB,EAAE,WAAW;YAC9B,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,KAAK;SACI,CAAA;QAEhB,IAAI,CAAC,IAAI,GAAG,sBAAK,QAAQ,GAAK,MAAM,CAA4B,CAAA;QAEhE,OAAO,CAAC,IAAI,CACV,mDAAgD,IAAI,CAAC,IAAI,CAAC,IAAI,OAAG,CAClE,CAAA;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAChC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAClB,IAAI,CAAC,IAAI,CAAC,IAAI,EACd,IAAI,CAAC,IAAI,CAAC,IAAI,EACd,IAAI,CAAC,IAAI,CAAC,GAAG,EACb,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAC5B,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACI,gCAAc,GAArB,UACE,cAA+C;QAE/C,IAAI,cAAc,YAAY,yBAAW,EAAE;YACzC,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,cAAc,CA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