@requence/service 1.0.0-alpha.2 → 1.0.0-alpha.21

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/build/{chunk-0x9092n4.js → chunk-6w7td62p.js} +5 -44
  3. package/build/chunk-6w7td62p.js.map +10 -0
  4. package/build/cli.js +22 -11
  5. package/build/cli.js.map +3 -3
  6. package/build/index.js +556 -775
  7. package/build/index.js.map +16 -16
  8. package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
  9. package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
  10. package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
  11. package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
  12. package/build/types/helpers/src/files/fileObject.d.ts +16 -0
  13. package/build/types/helpers/src/files/fileObject.d.ts.map +1 -0
  14. package/build/types/helpers/src/files/index.d.ts +7 -0
  15. package/build/types/helpers/src/files/index.d.ts.map +1 -0
  16. package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
  17. package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
  18. package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
  19. package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
  20. package/build/types/helpers/src/files/streamObject.d.ts +14 -0
  21. package/build/types/helpers/src/files/streamObject.d.ts.map +1 -0
  22. package/build/types/helpers/src/files/types.d.ts +4 -0
  23. package/build/types/helpers/src/files/types.d.ts.map +1 -0
  24. package/build/types/helpers/src/index.d.ts +9 -6
  25. package/build/types/helpers/src/index.d.ts.map +1 -1
  26. package/build/types/helpers/src/jsonschema/mapSchema.d.ts +20 -0
  27. package/build/types/helpers/src/jsonschema/mapSchema.d.ts.map +1 -0
  28. package/build/types/helpers/src/jsonschema/types.d.ts +11 -0
  29. package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
  30. package/build/types/helpers/src/jsonschema/validate.d.ts +29 -0
  31. package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
  32. package/build/types/helpers/src/jsonschema/zod.d.ts +12 -0
  33. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
  34. package/build/types/helpers/src/protocol/NodeTree.d.ts +504 -0
  35. package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
  36. package/build/types/helpers/src/protocol/command.d.ts +420 -0
  37. package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
  38. package/build/types/helpers/src/protocol/helpers.d.ts +5 -0
  39. package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -0
  40. package/build/types/helpers/src/protocol/index.d.ts +8 -0
  41. package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
  42. package/build/types/helpers/src/protocol/nodeType.d.ts +283 -0
  43. package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
  44. package/build/types/helpers/src/protocol/targetNodes.d.ts +253 -0
  45. package/build/types/helpers/src/protocol/targetNodes.d.ts.map +1 -0
  46. package/build/types/helpers/src/protocol/taskOptions.d.ts +17 -0
  47. package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
  48. package/build/types/helpers/src/protocol/treeNodes.d.ts +606 -0
  49. package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
  50. package/build/types/helpers/src/protocol/update.d.ts +264 -0
  51. package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
  52. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
  53. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
  54. package/build/types/helpers/src/utils/clone.d.ts +3 -0
  55. package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
  56. package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
  57. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
  58. package/build/types/helpers/src/{createRemotePromise.d.ts → utils/createRemotePromise.d.ts} +1 -1
  59. package/build/types/helpers/src/utils/createRemotePromise.d.ts.map +1 -0
  60. package/build/types/helpers/src/utils/isRecord.d.ts +2 -0
  61. package/build/types/helpers/src/utils/isRecord.d.ts.map +1 -0
  62. package/build/types/helpers/src/utils/mapData.d.ts +17 -0
  63. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
  64. package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +2 -2
  65. package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
  66. package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
  67. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +2 -0
  68. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
  69. package/build/types/helpers/src/utils/types.d.ts +4 -0
  70. package/build/types/helpers/src/utils/types.d.ts.map +1 -0
  71. package/build/types/service/src/createAmqpConnection.d.ts +17 -18
  72. package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
  73. package/build/types/service/src/helpers.d.ts +13 -88
  74. package/build/types/service/src/helpers.d.ts.map +1 -1
  75. package/build/types/service/src/index.d.ts +7 -5
  76. package/build/types/service/src/index.d.ts.map +1 -1
  77. package/build/types/service/src/mapInput.d.ts +2 -0
  78. package/build/types/service/src/mapInput.d.ts.map +1 -0
  79. package/package.json +7 -8
  80. package/build/chunk-0x9092n4.js.map +0 -12
  81. package/build/types/helpers/src/clone.d.ts +0 -3
  82. package/build/types/helpers/src/clone.d.ts.map +0 -1
  83. package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
  84. package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
  85. package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
  86. package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
  87. package/build/types/helpers/src/utils.d.ts.map +0 -1
  88. /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -0,0 +1,109 @@
1
+ # @requence/service
2
+
3
+ ## 1.0.0-alpha.21
4
+
5
+ ### Patch Changes
6
+
7
+ - a5c0c46: scaling
8
+
9
+ ## 1.0.0-alpha.20
10
+
11
+ ### Patch Changes
12
+
13
+ - a8b9588: rerelease
14
+
15
+ ## 1.0.0-alpha.19
16
+
17
+ ### Patch Changes
18
+
19
+ - 817e7ee: granular data / sub tasks / operator logic
20
+
21
+ ## 1.0.0-alpha.18
22
+
23
+ ### Patch Changes
24
+
25
+ - 515325e: use isRecord from helper package
26
+
27
+ ## 1.0.0-alpha.17
28
+
29
+ ### Patch Changes
30
+
31
+ - 41ef8e2: allow overwriting tls options
32
+
33
+ ## 1.0.0-alpha.16
34
+
35
+ ### Patch Changes
36
+
37
+ - 3a5e3e2: allow more access token options
38
+
39
+ ## 1.0.0-alpha.15
40
+
41
+ ### Patch Changes
42
+
43
+ - dc413ab: deps update
44
+
45
+ ## 1.0.0-alpha.14
46
+
47
+ ### Patch Changes
48
+
49
+ - 77bc2ed: improved task creation and event order
50
+
51
+ ## 1.0.0-alpha.13
52
+
53
+ ### Patch Changes
54
+
55
+ - 9dcaeae: fixed dependencies
56
+
57
+ ## 1.0.0-alpha.12
58
+
59
+ ### Patch Changes
60
+
61
+ - 1df3d43: improved typing
62
+
63
+ ## 1.0.0-alpha.11
64
+
65
+ ### Patch Changes
66
+
67
+ - 679cbaf: streams
68
+
69
+ ## 1.0.0-alpha.10
70
+
71
+ ### Patch Changes
72
+
73
+ - a464543: improved file matching algorithm
74
+
75
+ ## 1.0.0-alpha.9
76
+
77
+ ### Patch Changes
78
+
79
+ - 1d847ee: improved files handling
80
+
81
+ ## 1.0.0-alpha.8
82
+
83
+ ### Patch Changes
84
+
85
+ - f7ea7fa: added files support
86
+
87
+ ## 1.0.0-alpha.7
88
+
89
+ ### Patch Changes
90
+
91
+ - 04ce4a9: improved caching and live queries
92
+
93
+ ## 1.0.0-alpha.6
94
+
95
+ ### Patch Changes
96
+
97
+ - 1a0bca0: structure redesign
98
+
99
+ ## 1.0.0-alpha.5
100
+
101
+ ### Patch Changes
102
+
103
+ - add98b7: remove getData(alias) signature, add getNodes()
104
+
105
+ ## 1.0.0-alpha.4
106
+
107
+ ### Patch Changes
108
+
109
+ - 3c4feaa: migrated to new service options
@@ -1,4 +1,4 @@
1
- // ../helpers/src/obfuscate.ts
1
+ // ../helpers/src/utils/obfuscate.ts
2
2
  var separator = "";
3
3
  var base65Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
4
4
  var base65CharToIndex = {};
@@ -49,47 +49,8 @@ function deobfuscate(str) {
49
49
  }
50
50
  return decodedString.split(separator);
51
51
  }
52
- // ../helpers/src/clone.ts
53
- var CLONE_SYMBOL = Symbol("original");
54
- function clone(data) {
55
- if (typeof data !== "object" || data === null) {
56
- return data;
57
- }
58
- const target = data[CLONE_SYMBOL];
59
- if (target) {
60
- return clone(target);
61
- }
62
- if (Array.isArray(data)) {
63
- return data.map(clone);
64
- }
65
- return Object.fromEntries(Object.entries(data).map(([key, value]) => [key, clone(value)]));
66
- }
67
- // ../helpers/src/createObjectProxy.ts
68
- function createObjectProxy(obj, onChange) {
69
- return new Proxy(obj, {
70
- set(target, property, newValue) {
71
- const result = Reflect.set(target, property, newValue);
72
- onChange(target);
73
- return result;
74
- },
75
- deleteProperty(target, property) {
76
- const result = Reflect.deleteProperty(target, property);
77
- onChange(target);
78
- return result;
79
- },
80
- get(target, property, receiver) {
81
- if (property === CLONE_SYMBOL) {
82
- return target;
83
- }
84
- const result = Reflect.get(target, property, receiver);
85
- if (typeof result === "object" && result !== null) {
86
- return createObjectProxy(result, () => onChange(target));
87
- }
88
- return result;
89
- }
90
- });
91
- }
92
- export { obfuscate, deobfuscate, clone, createObjectProxy };
93
52
 
94
- //# debugId=A14CF1AD3BCA776264756E2164756E21
95
- //# sourceMappingURL=chunk-0x9092n4.js.map
53
+ export { obfuscate, deobfuscate };
54
+
55
+ //# debugId=E6AE9819DA2983FC64756E2164756E21
56
+ //# sourceMappingURL=chunk-6w7td62p.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../helpers/src/utils/obfuscate.ts"],
4
+ "sourcesContent": [
5
+ "const separator = '\\u{f6ee}'\n\nconst base65Chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$'\n\nconst base65CharToIndex: Record<string, number> = {}\nfor (let i = 0; i < base65Chars.length; i++) {\n base65CharToIndex[base65Chars[i]] = i\n}\n\nexport function obfuscate(...parts: Array<string>) {\n const str = parts.join(separator)\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const charCode = str.charCodeAt(i)\n binaryString += charCode.toString(2).padStart(16, '0')\n }\n\n let encodedString = ''\n const chunkSize = 6\n let paddingCount = 0\n\n for (let i = 0; i < binaryString.length; i += chunkSize) {\n let chunk = binaryString.substring(i, i + chunkSize)\n\n if (chunk.length < chunkSize) {\n paddingCount = chunkSize - chunk.length\n chunk = chunk.padEnd(chunkSize, '0')\n }\n\n const decimalValue = parseInt(chunk, 2)\n encodedString += base65Chars[decimalValue]\n }\n\n return encodedString + paddingCount.toString()\n}\n\nexport function randomString(length: number) {\n const randomValues = new Uint8Array(length)\n crypto.getRandomValues(randomValues)\n\n let randomString = ''\n for (let i = 0; i < length; i++) {\n randomString += base65Chars[randomValues[i] % base65Chars.length]\n }\n\n return randomString\n}\n\nexport function deobfuscate(str: string) {\n const paddingCount = parseInt(str.slice(-1), 10)\n str = str.slice(0, -1)\n\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const decimalValue = base65CharToIndex[str[i]]\n const binaryChunk = decimalValue.toString(2).padStart(6, '0')\n binaryString += binaryChunk\n }\n\n if (paddingCount > 0) {\n binaryString = binaryString.slice(0, -paddingCount)\n }\n\n let decodedString = ''\n const charSize = 16\n\n for (let i = 0; i < binaryString.length; i += charSize) {\n const byte = binaryString.substring(i, i + charSize)\n if (byte.length === 16) {\n const charCode = parseInt(byte, 2)\n decodedString += String.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AE,SAAS,GAAG,GAAG;AAAA,IAC5D,gBAAgB;AAAA,EAClB;AAAA,EAEA,IAAI,eAAe,GAAG;AAAA,IACpB,eAAe,aAAa,MAAM,IAAI,YAAY;AAAA,EACpD;AAAA,EAEA,IAAI,gBAAgB;AAAA,EACpB,MAAM,WAAW;AAAA,EAEjB,SAAS,IAAI,EAAG,IAAI,aAAa,QAAQ,KAAK,UAAU;AAAA,IACtD,MAAM,OAAO,aAAa,UAAU,GAAG,IAAI,QAAQ;AAAA,IACnD,IAAI,KAAK,WAAW,IAAI;AAAA,MACtB,MAAM,WAAW,SAAS,MAAM,CAAC;AAAA,MACjC,iBAAiB,OAAO,aAAa,QAAQ;AAAA,IAC/C;AAAA,EACF;AAAA,EAEA,OAAO,cAAc,MAAM,SAAS;AAAA;",
8
+ "debugId": "E6AE9819DA2983FC64756E2164756E21",
9
+ "names": []
10
+ }
package/build/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  deobfuscate
4
- } from "./chunk-0x9092n4.js";
4
+ } from "./chunk-6w7td62p.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import fs from "node:fs";
@@ -10,29 +10,40 @@ import chalk from "chalk";
10
10
  import yargs from "yargs";
11
11
  import { hideBin } from "yargs/helpers";
12
12
  var y = yargs(hideBin(process.argv));
13
- function errorExit(msg) {
14
- console.error(chalk.red.bold(msg + `
13
+ function errorExit(title, text) {
14
+ console.error(chalk.red.bold(title + `
15
15
  `));
16
+ if (text) {
17
+ console.error(chalk.red(text) + `
18
+ `);
19
+ }
16
20
  process.exit(1);
17
21
  }
18
- y.command("generate-types", "generates typescript types", (yargs2) => yargs2.option("service-key", {
19
- describe: "service key"
22
+ y.command("generate-types", "generates typescript types", (yargs2) => yargs2.option("access-token", {
23
+ describe: "service key",
24
+ type: "string"
20
25
  }).option("outfile", {
21
26
  default: "requence-env.d.ts"
22
27
  }).option("outdir", {
23
28
  default: ""
24
29
  }), async (argv) => {
25
- const key = argv.serviceKey ?? process.env.REQUENCE_SERVICE_KEY ?? JSON.parse(fs.readFileSync("package.json", "utf-8")).requence?.serviceKey;
30
+ let token = argv.accessToken ?? process.env.REQUENCE_SERVICE_ACCESS_TOKEN ?? process.env.REQUENCE_ACCESS_TOKEN;
31
+ if (!token) {
32
+ const pkgJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
33
+ token = pkgJson.requence?.service?.accessToken ?? pkgJson.requence?.accessToken;
34
+ }
26
35
  console.info();
27
- if (!key) {
28
- errorExit("No service key found");
36
+ if (!token) {
37
+ errorExit("No access token found", `You can provide the access token as argument to ${chalk.bold("createService")},
38
+ as environment variable ${chalk.bold("REQUENCE_ACCESS_TOKEN")} / ${chalk.bold("REQUENCE_SERVICE_ACCESS_TOKEN")} or
39
+ in your ${chalk.bold("package.json")} in ${chalk.bold("requence.accessToken")} / ${chalk.bold("requence.service.accessToken")}`);
29
40
  }
30
- const parts = deobfuscate(key);
41
+ const parts = deobfuscate(token);
31
42
  if (parts.length !== 3 || parts[0] !== "service") {
32
43
  errorExit("Invalid service key");
33
44
  }
34
45
  const [, connectionString, serverUrl] = parts;
35
- const response = await fetch(serverUrl + "/service/typescript", {
46
+ const response = await fetch(serverUrl + "/service/types/typescript", {
36
47
  method: "GET",
37
48
  headers: {
38
49
  Authorization: `Bearer ${connectionString}`
@@ -52,5 +63,5 @@ ${text}`;
52
63
  console.info(chalk.green("types saved to", chalk.bold(path.relative(process.cwd(), file))));
53
64
  }).scriptName("requence-service").help("h").demandCommand(1, 1).strict().parse();
54
65
 
55
- //# debugId=F0A3D1A618DB258D64756E2164756E21
66
+ //# debugId=BCA4F1671D286D7E64756E2164756E21
56
67
  //# sourceMappingURL=cli.js.map
package/build/cli.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/cli.ts"],
4
4
  "sourcesContent": [
5
- "#!/usr/bin/env node\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { deobfuscate } from '@requence/helpers'\nimport chalk from 'chalk'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nconst y = yargs(hideBin(process.argv))\n\nfunction errorExit(msg: string): never {\n console.error(chalk.red.bold(msg + '\\n'))\n process.exit(1)\n}\n\ny.command(\n 'generate-types',\n 'generates typescript types',\n (yargs) =>\n yargs\n .option('service-key', {\n describe: 'service key',\n })\n .option('outfile', {\n default: 'requence-env.d.ts',\n })\n .option('outdir', {\n default: '',\n }),\n async (argv) => {\n const key =\n argv.serviceKey ??\n process.env.REQUENCE_SERVICE_KEY ??\n JSON.parse(fs.readFileSync('package.json', 'utf-8')).requence?.serviceKey\n console.info() // newline\n if (!key) {\n errorExit('No service key found')\n }\n\n const parts = deobfuscate(key)\n if (parts.length !== 3 || parts[0] !== 'service') {\n errorExit('Invalid service key')\n }\n\n const [, connectionString, serverUrl] = parts\n\n const response = await fetch(serverUrl + '/service/typescript', {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${connectionString}`,\n },\n })\n\n if (!response.ok) {\n const error = await response.text()\n errorExit(error)\n }\n\n const text = await response.text()\n const data = `/* eslint-disable */\\n/* prettier-ignore */\\n\\n${text}`\n\n const file = path.join(argv.outdir || process.cwd(), argv.outfile)\n fs.writeFileSync(file, data)\n\n console.info(\n chalk.green(\n 'types saved to',\n chalk.bold(path.relative(process.cwd(), file)),\n ),\n )\n },\n)\n .scriptName('requence-service')\n .help('h')\n .demandCommand(1, 1)\n .strict()\n .parse()\n"
5
+ "#!/usr/bin/env node\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { deobfuscate } from '@requence/helpers'\nimport chalk from 'chalk'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nconst y = yargs(hideBin(process.argv))\n\nfunction errorExit(title: string, text?: string): never {\n console.error(chalk.red.bold(title + '\\n'))\n if (text) {\n console.error(chalk.red(text) + '\\n')\n }\n process.exit(1)\n}\n\ny.command(\n 'generate-types',\n 'generates typescript types',\n (yargs) =>\n yargs\n .option('access-token', {\n describe: 'service key',\n type: 'string',\n })\n .option('outfile', {\n default: 'requence-env.d.ts',\n })\n .option('outdir', {\n default: '',\n }),\n async (argv) => {\n let token =\n argv.accessToken ??\n process.env.REQUENCE_SERVICE_ACCESS_TOKEN ??\n process.env.REQUENCE_ACCESS_TOKEN\n\n if (!token) {\n const pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'))\n token =\n pkgJson.requence?.service?.accessToken ?? pkgJson.requence?.accessToken\n }\n\n console.info() // newline\n if (!token) {\n errorExit(\n 'No access token found',\n `You can provide the access token as argument to ${chalk.bold('createService')},\\nas environment variable ${chalk.bold('REQUENCE_ACCESS_TOKEN')} / ${chalk.bold('REQUENCE_SERVICE_ACCESS_TOKEN')} or\\nin your ${chalk.bold('package.json')} in ${chalk.bold('requence.accessToken')} / ${chalk.bold('requence.service.accessToken')}`,\n )\n }\n\n const parts = deobfuscate(token)\n if (parts.length !== 3 || parts[0] !== 'service') {\n errorExit('Invalid service key')\n }\n\n const [, connectionString, serverUrl] = parts\n\n const response = await fetch(serverUrl + '/service/types/typescript', {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${connectionString}`,\n },\n })\n\n if (!response.ok) {\n const error = await response.text()\n errorExit(error)\n }\n\n const text = await response.text()\n const data = `/* eslint-disable */\\n/* prettier-ignore */\\n\\n${text}`\n\n const file = path.join(argv.outdir || process.cwd(), argv.outfile)\n fs.writeFileSync(file, data)\n\n console.info(\n chalk.green(\n 'types saved to',\n chalk.bold(path.relative(process.cwd(), file)),\n ),\n )\n },\n)\n .scriptName('requence-service')\n .help('h')\n .demandCommand(1, 1)\n .strict()\n .parse()\n"
6
6
  ],
7
- "mappings": ";;;;;;AAEA;AACA;AAGA;AACA;AACA;AAEA,IAAM,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAErC,SAAS,SAAS,CAAC,KAAoB;AACrC,UAAQ,MAAM,MAAM,IAAI,KAAK,MAAM;AAAA,CAAI,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