@effect-opcua/codegen 0.1.0-alpha.0
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/LICENSE +201 -0
- package/README.md +6 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +82 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/client/src/Opcua.d.mts +5 -0
- package/dist/client/src/OpcuaClient.d.mts +3 -0
- package/dist/client/src/OpcuaError.d.mts +139 -0
- package/dist/client/src/OpcuaError.d.mts.map +1 -0
- package/dist/client/src/OpcuaMethod.d.mts +78 -0
- package/dist/client/src/OpcuaMethod.d.mts.map +1 -0
- package/dist/client/src/OpcuaSession.d.mts +215 -0
- package/dist/client/src/OpcuaSession.d.mts.map +1 -0
- package/dist/client/src/OpcuaSubscription.d.mts +144 -0
- package/dist/client/src/OpcuaSubscription.d.mts.map +1 -0
- package/dist/client/src/OpcuaVariable.d.mts +140 -0
- package/dist/client/src/OpcuaVariable.d.mts.map +1 -0
- package/dist/client/src/index.d.mts +7 -0
- package/dist/client/src/internal/common/node-id.d.mts +1 -0
- package/dist/client/src/internal/events/model.d.mts +51 -0
- package/dist/client/src/internal/events/model.d.mts.map +1 -0
- package/dist/client/src/internal/monitoring/runtime.d.mts +7 -0
- package/dist/client/src/internal/structures/model.d.mts +18 -0
- package/dist/client/src/internal/structures/model.d.mts.map +1 -0
- package/dist/client/src/internal/structures/runtime.d.mts +5 -0
- package/dist/client/src/internal/values/codec.d.mts +21 -0
- package/dist/client/src/internal/values/codec.d.mts.map +1 -0
- package/dist/client/src/internal/values/normalize.d.mts +2 -0
- package/dist/client/src/node-opcua.d.mts +2 -0
- package/dist/compile/builtin-types.d.mts +10 -0
- package/dist/compile/builtin-types.d.mts.map +1 -0
- package/dist/compile/builtin-types.mjs +38 -0
- package/dist/compile/builtin-types.mjs.map +1 -0
- package/dist/compile/enums.d.mts +16 -0
- package/dist/compile/enums.d.mts.map +1 -0
- package/dist/compile/enums.mjs +81 -0
- package/dist/compile/enums.mjs.map +1 -0
- package/dist/compile/model.d.mts +10 -0
- package/dist/compile/model.d.mts.map +1 -0
- package/dist/compile/model.mjs +92 -0
- package/dist/compile/model.mjs.map +1 -0
- package/dist/compile/names.d.mts +17 -0
- package/dist/compile/names.d.mts.map +1 -0
- package/dist/compile/names.mjs +95 -0
- package/dist/compile/names.mjs.map +1 -0
- package/dist/compile/policy.d.mts +7 -0
- package/dist/compile/policy.d.mts.map +1 -0
- package/dist/compile/policy.mjs +6 -0
- package/dist/compile/policy.mjs.map +1 -0
- package/dist/compile/structures.d.mts +16 -0
- package/dist/compile/structures.d.mts.map +1 -0
- package/dist/compile/structures.mjs +220 -0
- package/dist/compile/structures.mjs.map +1 -0
- package/dist/compile/type-graph.d.mts +20 -0
- package/dist/compile/type-graph.d.mts.map +1 -0
- package/dist/compile/type-graph.mjs +78 -0
- package/dist/compile/type-graph.mjs.map +1 -0
- package/dist/compile/variables.d.mts +16 -0
- package/dist/compile/variables.d.mts.map +1 -0
- package/dist/compile/variables.mjs +110 -0
- package/dist/compile/variables.mjs.map +1 -0
- package/dist/compile.d.mts +9 -0
- package/dist/compile.d.mts.map +1 -0
- package/dist/compile.mjs +29 -0
- package/dist/compile.mjs.map +1 -0
- package/dist/config.d.mts +12 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +158 -0
- package/dist/config.mjs.map +1 -0
- package/dist/diagnostics.d.mts +16 -0
- package/dist/diagnostics.d.mts.map +1 -0
- package/dist/diagnostics.mjs +45 -0
- package/dist/diagnostics.mjs.map +1 -0
- package/dist/discover.d.mts +23 -0
- package/dist/discover.d.mts.map +1 -0
- package/dist/discover.mjs +356 -0
- package/dist/discover.mjs.map +1 -0
- package/dist/emit.d.mts +8 -0
- package/dist/emit.d.mts.map +1 -0
- package/dist/emit.mjs +233 -0
- package/dist/emit.mjs.map +1 -0
- package/dist/errors.d.mts +27 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +18 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/generate.d.mts +19 -0
- package/dist/generate.d.mts.map +1 -0
- package/dist/generate.mjs +172 -0
- package/dist/generate.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +5 -0
- package/dist/internal/types.d.mts +192 -0
- package/dist/internal/types.d.mts.map +1 -0
- package/dist/internal/types.mjs +1 -0
- package/dist/issue-codes.d.mts +119 -0
- package/dist/issue-codes.d.mts.map +1 -0
- package/dist/issue-codes.mjs +44 -0
- package/dist/issue-codes.mjs.map +1 -0
- package/dist/types.d.mts +57 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
https://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { displayPath } from "./diagnostics.mjs";
|
|
3
|
+
import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
import { CliError, Command, Flag } from "effect/unstable/cli";
|
|
6
|
+
|
|
7
|
+
//#region src/cli.ts
|
|
8
|
+
const configPath = Flag.string("config").pipe(Flag.withDescription("Path to the codegen config"), Flag.withDefault("effect-opcua.codegen.ts"));
|
|
9
|
+
const verbose = Flag.boolean("verbose").pipe(Flag.withDescription("Print informational diagnostics"));
|
|
10
|
+
const check = Flag.boolean("check").pipe(Flag.withDescription("Check generated output without writing files"));
|
|
11
|
+
const main = Command.make("effect-opcua-codegen", {
|
|
12
|
+
configPath,
|
|
13
|
+
verbose,
|
|
14
|
+
check
|
|
15
|
+
}, ({ configPath: configPath$1, verbose: verbose$1, check: check$1 }) => Effect.scoped(Effect.gen(function* () {
|
|
16
|
+
const { loadConfig } = yield* loadConfigModule;
|
|
17
|
+
const config = yield* loadConfig(configPath$1);
|
|
18
|
+
const generator = yield* loadGenerateModule;
|
|
19
|
+
const result = check$1 ? yield* generator.checkFromNormalizedConfig(config) : yield* generator.generateFromNormalizedConfig(config);
|
|
20
|
+
printIssues(result.issues, verbose$1);
|
|
21
|
+
if ("ok" in result) {
|
|
22
|
+
if (!result.ok) {
|
|
23
|
+
process.stderr.write(`Generated output is stale (${result.staleFiles.length} stale, ${result.missingFiles.length} missing).\n`);
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
process.stdout.write("Generated output is up to date.\n");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
process.stdout.write(`Generated ${result.writtenFiles.length} files.\n`);
|
|
31
|
+
}))).pipe(Command.withDescription("Generate an Effect OPC-UA client model")).pipe(Command.run({ version: "0.0.0" }), Effect.catch((error) => Effect.sync(() => {
|
|
32
|
+
if (CliError.isCliError(error) && error._tag === "ShowHelp") {
|
|
33
|
+
process.exitCode = 2;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const message = CliError.isCliError(error) ? error.message : formatError(error);
|
|
37
|
+
process.stderr.write(`${message}\n`);
|
|
38
|
+
process.exitCode = 2;
|
|
39
|
+
})), Effect.provide(NodeServices.layer));
|
|
40
|
+
const loadConfigModule = Effect.tryPromise({
|
|
41
|
+
try: () => import("./config.mjs"),
|
|
42
|
+
catch: (cause) => cause
|
|
43
|
+
});
|
|
44
|
+
const loadGenerateModule = Effect.tryPromise({
|
|
45
|
+
try: () => import("./generate.mjs"),
|
|
46
|
+
catch: (cause) => cause
|
|
47
|
+
});
|
|
48
|
+
const printIssues = (issues, verbose$1) => {
|
|
49
|
+
const visible = verbose$1 ? issues : issues.filter((item) => item.severity !== "info");
|
|
50
|
+
for (const item of visible) process.stderr.write(`${formatIssue(item)}\n`);
|
|
51
|
+
};
|
|
52
|
+
const formatIssue = (item) => {
|
|
53
|
+
const lines = [`${item.severity} ${item.code}`];
|
|
54
|
+
if (item.path) lines.push(`Path: ${displayPath(item.path)}`);
|
|
55
|
+
if (item.generatedPath) lines.push(`Generated key: ${item.generatedPath.join(".")}`);
|
|
56
|
+
lines.push(`Message: ${item.message}`);
|
|
57
|
+
const candidates = candidatesFromCause(item.cause);
|
|
58
|
+
if (candidates.length > 0) {
|
|
59
|
+
lines.push("Candidates:");
|
|
60
|
+
for (const candidate of candidates) lines.push(`- ${candidate}`);
|
|
61
|
+
}
|
|
62
|
+
return lines.join("\n");
|
|
63
|
+
};
|
|
64
|
+
const candidatesFromCause = (cause) => {
|
|
65
|
+
if (typeof cause === "object" && cause !== null && "candidates" in cause && Array.isArray(cause.candidates)) return cause.candidates.map(String);
|
|
66
|
+
return [];
|
|
67
|
+
};
|
|
68
|
+
const formatError = (error) => {
|
|
69
|
+
if (isTagged(error, "CodegenError")) {
|
|
70
|
+
const typed = error;
|
|
71
|
+
const issues = typed.issues ?? [];
|
|
72
|
+
return [`Codegen failed: ${typed.reason._tag}`, ...issues.map(formatIssue)].join("\n");
|
|
73
|
+
}
|
|
74
|
+
if (isTagged(error, "OpcuaError")) return `OPC-UA failed: ${error.reason._tag}`;
|
|
75
|
+
return error instanceof Error ? error.message : String(error);
|
|
76
|
+
};
|
|
77
|
+
const isTagged = (value, tag) => typeof value === "object" && value !== null && "_tag" in value && value._tag === tag;
|
|
78
|
+
NodeRuntime.runMain(main, { disableErrorReporting: true });
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { };
|
|
82
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["configPath","check","verbose"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { NodeRuntime, NodeServices } from \"@effect/platform-node\";\nimport { Effect } from \"effect\";\nimport { CliError, Command, Flag } from \"effect/unstable/cli\";\n\nimport { displayPath } from \"./diagnostics.js\";\nimport type { CodegenIssue } from \"./types.js\";\n\nconst configPath = Flag.string(\"config\").pipe(\n Flag.withDescription(\"Path to the codegen config\"),\n Flag.withDefault(\"effect-opcua.codegen.ts\"),\n);\n\nconst verbose = Flag.boolean(\"verbose\").pipe(\n Flag.withDescription(\"Print informational diagnostics\"),\n);\n\nconst check = Flag.boolean(\"check\").pipe(\n Flag.withDescription(\"Check generated output without writing files\"),\n);\n\nconst command = Command.make(\n \"effect-opcua-codegen\",\n { configPath, verbose, check },\n ({ configPath, verbose, check }) =>\n Effect.scoped(\n Effect.gen(function* () {\n const { loadConfig } = yield* loadConfigModule;\n const config = yield* loadConfig(configPath);\n const generator = yield* loadGenerateModule;\n const result = check\n ? yield* generator.checkFromNormalizedConfig(config)\n : yield* generator.generateFromNormalizedConfig(config);\n\n printIssues(result.issues, verbose);\n if (\"ok\" in result) {\n if (!result.ok) {\n process.stderr.write(\n `Generated output is stale (${result.staleFiles.length} stale, ${result.missingFiles.length} missing).\\n`,\n );\n process.exitCode = 1;\n return;\n }\n process.stdout.write(\"Generated output is up to date.\\n\");\n return;\n }\n process.stdout.write(\n `Generated ${result.writtenFiles.length} files.\\n`,\n );\n }),\n ),\n).pipe(Command.withDescription(\"Generate an Effect OPC-UA client model\"));\n\nconst main = command.pipe(\n Command.run({ version: \"0.0.0\" }),\n Effect.catch((error) =>\n Effect.sync(() => {\n if (CliError.isCliError(error) && error._tag === \"ShowHelp\") {\n process.exitCode = 2;\n return;\n }\n const message = CliError.isCliError(error)\n ? error.message\n : formatError(error);\n process.stderr.write(`${message}\\n`);\n process.exitCode = 2;\n }),\n ),\n Effect.provide(NodeServices.layer),\n);\n\nconst loadConfigModule = Effect.tryPromise({\n try: () => import(\"./config.js\"),\n catch: (cause) => cause,\n});\n\nconst loadGenerateModule = Effect.tryPromise({\n try: () => import(\"./generate.js\"),\n catch: (cause) => cause,\n});\n\nconst printIssues = (issues: readonly CodegenIssue[], verbose: boolean) => {\n const visible = verbose\n ? issues\n : issues.filter((item) => item.severity !== \"info\");\n for (const item of visible) {\n process.stderr.write(`${formatIssue(item)}\\n`);\n }\n};\n\nconst formatIssue = (item: CodegenIssue) => {\n const lines = [`${item.severity} ${item.code}`];\n if (item.path) lines.push(`Path: ${displayPath(item.path)}`);\n if (item.generatedPath) {\n lines.push(`Generated key: ${item.generatedPath.join(\".\")}`);\n }\n lines.push(`Message: ${item.message}`);\n const candidates = candidatesFromCause(item.cause);\n if (candidates.length > 0) {\n lines.push(\"Candidates:\");\n for (const candidate of candidates) {\n lines.push(`- ${candidate}`);\n }\n }\n return lines.join(\"\\n\");\n};\n\nconst candidatesFromCause = (cause: unknown): readonly string[] => {\n if (\n typeof cause === \"object\" &&\n cause !== null &&\n \"candidates\" in cause &&\n Array.isArray((cause as { readonly candidates?: unknown }).candidates)\n ) {\n return (\n cause as { readonly candidates: readonly unknown[] }\n ).candidates.map(String);\n }\n return [];\n};\n\nconst formatError = (error: unknown) => {\n if (isTagged(error, \"CodegenError\")) {\n const typed = error as {\n readonly reason: { readonly _tag: string };\n readonly issues?: readonly CodegenIssue[];\n };\n const issues = typed.issues ?? [];\n return [\n `Codegen failed: ${typed.reason._tag}`,\n ...issues.map(formatIssue),\n ].join(\"\\n\");\n }\n if (isTagged(error, \"OpcuaError\")) {\n const reason = (error as { readonly reason: { readonly _tag: string } })\n .reason;\n return `OPC-UA failed: ${reason._tag}`;\n }\n return error instanceof Error ? error.message : String(error);\n};\n\nconst isTagged = (value: unknown, tag: string) =>\n typeof value === \"object\" &&\n value !== null &&\n \"_tag\" in value &&\n (value as { readon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AI,YAAY,CAC3B,CAAC,KAAK,KAAK;;AAEd,KAAI,SAAS,OAAO,aAAa,CAG/B,QAAO,kBAFS,MACb,OAC6B;AAElC,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;AAG/D,MAAM,YAAY,OAAgB,QAChC,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACT,MAAsC,SAAS;AAElD,YAAY,QAAQ,MAAM,EAAE,uBAAuB,MAAM,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeIdOfVariableDef, ReadableVariableDef, ValueOfVariableDef, VariableAccess, VariableDef, WritableVariableDef } from "./OpcuaVariable.mjs";
|
|
2
|
+
import { StructureArrayDef, StructureDef } from "./internal/structures/model.mjs";
|
|
3
|
+
import { BufferPolicy, MonitorDeadband, MonitorFilter } from "./OpcuaSubscription.mjs";
|
|
4
|
+
import { AnySchema, OpcuaCodec } from "./internal/values/codec.mjs";
|
|
5
|
+
import { InputOfMethodDef, MethodArg, MethodArgSelector, MethodDef, OutputOfMethodDef } from "./OpcuaMethod.mjs";
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { NodeIdString, OpcuaStatusInfo, VariableCapability } from "./OpcuaVariable.mjs";
|
|
2
|
+
import { MonitorStartupReport } from "./OpcuaSubscription.mjs";
|
|
3
|
+
import * as effect_Types0 from "effect/Types";
|
|
4
|
+
import * as effect_Cause0 from "effect/Cause";
|
|
5
|
+
import { StatusCode } from "node-opcua";
|
|
6
|
+
|
|
7
|
+
//#region ../client/src/OpcuaError.d.ts
|
|
8
|
+
type OpcuaErrorReason = {
|
|
9
|
+
readonly _tag: "Configuration";
|
|
10
|
+
readonly operation: string;
|
|
11
|
+
readonly key?: string;
|
|
12
|
+
readonly nodeId?: NodeIdString;
|
|
13
|
+
readonly objectId?: NodeIdString;
|
|
14
|
+
readonly methodId?: NodeIdString;
|
|
15
|
+
readonly cause?: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
readonly _tag: "Service";
|
|
18
|
+
readonly operation: string;
|
|
19
|
+
readonly key?: string;
|
|
20
|
+
readonly nodeId?: NodeIdString;
|
|
21
|
+
readonly objectId?: NodeIdString;
|
|
22
|
+
readonly methodId?: NodeIdString;
|
|
23
|
+
readonly status?: OpcuaStatusInfo;
|
|
24
|
+
readonly statusCode?: StatusCode;
|
|
25
|
+
readonly cause?: unknown;
|
|
26
|
+
} | {
|
|
27
|
+
readonly _tag: "Connect";
|
|
28
|
+
readonly endpointUrl: string;
|
|
29
|
+
readonly cause?: unknown;
|
|
30
|
+
} | {
|
|
31
|
+
readonly _tag: "Disconnect";
|
|
32
|
+
readonly endpointUrl?: string;
|
|
33
|
+
readonly cause?: unknown;
|
|
34
|
+
} | {
|
|
35
|
+
readonly _tag: "SessionCreate";
|
|
36
|
+
readonly endpointUrl?: string;
|
|
37
|
+
readonly cause?: unknown;
|
|
38
|
+
} | {
|
|
39
|
+
readonly _tag: "SessionClose";
|
|
40
|
+
readonly cause?: unknown;
|
|
41
|
+
} | {
|
|
42
|
+
readonly _tag: "SubscriptionCreate";
|
|
43
|
+
readonly cause?: unknown;
|
|
44
|
+
} | {
|
|
45
|
+
readonly _tag: "AccessDenied";
|
|
46
|
+
readonly nodeId: NodeIdString;
|
|
47
|
+
readonly requestedCapability: VariableCapability;
|
|
48
|
+
readonly accessLevel?: number;
|
|
49
|
+
readonly userAccessLevel?: number;
|
|
50
|
+
readonly cause?: unknown;
|
|
51
|
+
} | {
|
|
52
|
+
readonly _tag: "Encode";
|
|
53
|
+
readonly nodeId: NodeIdString;
|
|
54
|
+
readonly value: unknown;
|
|
55
|
+
readonly error?: unknown;
|
|
56
|
+
readonly cause?: unknown;
|
|
57
|
+
} | {
|
|
58
|
+
readonly _tag: "Decode";
|
|
59
|
+
readonly nodeId: NodeIdString;
|
|
60
|
+
readonly cause?: unknown;
|
|
61
|
+
} | {
|
|
62
|
+
readonly _tag: "MethodInput";
|
|
63
|
+
readonly objectId: NodeIdString;
|
|
64
|
+
readonly methodId: NodeIdString;
|
|
65
|
+
readonly input: unknown;
|
|
66
|
+
readonly phase: "MissingInputKey" | "UnknownInputKey" | "ArgumentMapping" | "Encoding";
|
|
67
|
+
readonly argumentKey?: string;
|
|
68
|
+
readonly argumentIndex?: number;
|
|
69
|
+
readonly error?: unknown;
|
|
70
|
+
readonly cause?: unknown;
|
|
71
|
+
} | {
|
|
72
|
+
readonly _tag: "MethodNotExecutable";
|
|
73
|
+
readonly objectId: NodeIdString;
|
|
74
|
+
readonly methodId: NodeIdString;
|
|
75
|
+
readonly executable?: boolean;
|
|
76
|
+
readonly userExecutable?: boolean;
|
|
77
|
+
readonly cause?: unknown;
|
|
78
|
+
} | {
|
|
79
|
+
readonly _tag: "MonitorConfiguration";
|
|
80
|
+
readonly operation: string;
|
|
81
|
+
readonly key?: string;
|
|
82
|
+
readonly nodeId?: NodeIdString;
|
|
83
|
+
readonly cause?: unknown;
|
|
84
|
+
} | {
|
|
85
|
+
readonly _tag: "MonitorCreate";
|
|
86
|
+
readonly subscriptionId?: number;
|
|
87
|
+
readonly startup: unknown;
|
|
88
|
+
readonly cause?: unknown;
|
|
89
|
+
} | {
|
|
90
|
+
readonly _tag: "MonitorStartup";
|
|
91
|
+
readonly phase: "Validation" | "Create";
|
|
92
|
+
readonly key?: string;
|
|
93
|
+
readonly nodeId: NodeIdString;
|
|
94
|
+
readonly statusCode?: StatusCode;
|
|
95
|
+
readonly status?: OpcuaStatusInfo;
|
|
96
|
+
readonly cause?: unknown;
|
|
97
|
+
} | {
|
|
98
|
+
readonly _tag: "MonitorRuntime";
|
|
99
|
+
readonly subscriptionId?: number;
|
|
100
|
+
readonly nodeIds?: ReadonlyArray<NodeIdString>;
|
|
101
|
+
readonly cause?: unknown;
|
|
102
|
+
};
|
|
103
|
+
declare const OpcuaError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
|
|
104
|
+
readonly _tag: "OpcuaError";
|
|
105
|
+
} & Readonly<A>;
|
|
106
|
+
declare class OpcuaError extends OpcuaError_base<{
|
|
107
|
+
readonly reason: OpcuaErrorReason;
|
|
108
|
+
}> {}
|
|
109
|
+
type OpcuaDecodeError = OpcuaError & {
|
|
110
|
+
readonly reason: Extract<OpcuaErrorReason, {
|
|
111
|
+
readonly _tag: "Decode";
|
|
112
|
+
}>;
|
|
113
|
+
};
|
|
114
|
+
type OpcuaMonitorConfigurationError = OpcuaError & {
|
|
115
|
+
readonly reason: Extract<OpcuaErrorReason, {
|
|
116
|
+
readonly _tag: "MonitorConfiguration";
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
type OpcuaMonitorCreateError<Items = Record<string, unknown>> = OpcuaError & {
|
|
120
|
+
readonly reason: {
|
|
121
|
+
readonly _tag: "MonitorCreate";
|
|
122
|
+
readonly subscriptionId?: number;
|
|
123
|
+
readonly startup: MonitorStartupReport<Items>;
|
|
124
|
+
readonly cause?: unknown;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
type OpcuaMonitorStartupError = OpcuaError & {
|
|
128
|
+
readonly reason: Extract<OpcuaErrorReason, {
|
|
129
|
+
readonly _tag: "MonitorStartup";
|
|
130
|
+
}>;
|
|
131
|
+
};
|
|
132
|
+
type OpcuaMonitorRuntimeError = OpcuaError & {
|
|
133
|
+
readonly reason: Extract<OpcuaErrorReason, {
|
|
134
|
+
readonly _tag: "MonitorRuntime";
|
|
135
|
+
}>;
|
|
136
|
+
};
|
|
137
|
+
//#endregion
|
|
138
|
+
export { OpcuaDecodeError, OpcuaError, OpcuaMonitorConfigurationError, OpcuaMonitorCreateError, OpcuaMonitorRuntimeError, OpcuaMonitorStartupError };
|
|
139
|
+
//# sourceMappingURL=OpcuaError.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpcuaError.d.mts","names":[],"sources":["../../../../client/src/OpcuaError.ts"],"sourcesContent":[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A,aAAA;EAI4E,SAAA,QAAA,EAjHrD,YAiHqD;EAAK,SAAA,QAAA,EAhH1D,YAgH0D;EAAN,SAAA,KAAA,EAAA,OAAA;EAIjE,SAAA,KAAA,EAAA,iBAAwB,GAAA,iBAAA,GAAA,iBAAA,GAAA,UAAA;EAAG,SAAA,WAAA,CAAA,EAAA,MAAA;EAEnC,SAAA,aAAA,CAAA,EAAA,MAAA;EADe,SAAA,KAAA,CAAA,EAAA,OAAA;EAAO,SAAA,KAAA,CAAA,EAAA,OAAA;AAK1B,CAAA,GAAY;EAA2B,SAAA,IAAA,EAAA,qBAAA;EAEnC,SAAA,QAAA,EA9GqB,YA8GrB;EADe,SAAA,QAAA,EA5GM,YA4GN;EAAO,SAAA,UAAA,CAAA,EAAA,OAAA;;;;;;;oBAnGF;;;;;;;;;;;mBAaD;wBACK;oBACJ;;;;;qBAMC,cAAc;;;cAEjC;;;cAEO,UAAA,SAAmB;mBACb;;KAuCP,gBAAA,GAAmB;mBACZ,QAAQ;;;;KAWf,8BAAA,GAAiC;mBAC1B,QACf;;;;KAIQ,gCAAgC,2BAC1C;;;;sBAIiF,qBAAL;;;;KAIlE,wBAAA,GAA2B;mBACpB,QACf;;;;KAIQ,wBAAA,GAA2B;mBACpB,QACf"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { OpcuaStatusInfo } from "./OpcuaVariable.mjs";
|
|
2
|
+
import { OpcuaCodec } from "./internal/values/codec.mjs";
|
|
3
|
+
import { CallMethodRequestLike, CallMethodResult } from "node-opcua";
|
|
4
|
+
|
|
5
|
+
//#region ../client/src/OpcuaMethod.d.ts
|
|
6
|
+
type MethodCallOptions = {
|
|
7
|
+
readonly includeRaw?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type MethodArgSelector = {
|
|
10
|
+
readonly _tag: "Name";
|
|
11
|
+
readonly name: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly _tag: "Index";
|
|
14
|
+
readonly index: number;
|
|
15
|
+
};
|
|
16
|
+
type MethodArg<A> = {
|
|
17
|
+
readonly _tag: "MethodArg";
|
|
18
|
+
readonly codec: OpcuaCodec<unknown>;
|
|
19
|
+
readonly selector?: MethodArgSelector;
|
|
20
|
+
readonly _A?: A;
|
|
21
|
+
};
|
|
22
|
+
type MethodArgRecord = Readonly<Record<string, MethodArg<unknown>>>;
|
|
23
|
+
type MethodDef<ObjectId extends string = string, MethodId extends string = string, Input$1 extends MethodArgRecord | undefined = MethodArgRecord | undefined, Output$1 extends MethodArgRecord | undefined = MethodArgRecord | undefined> = {
|
|
24
|
+
readonly _tag: "MethodDef";
|
|
25
|
+
readonly objectId: ObjectId;
|
|
26
|
+
readonly methodId: MethodId;
|
|
27
|
+
readonly input?: Input$1;
|
|
28
|
+
readonly output?: Output$1;
|
|
29
|
+
readonly includeRaw?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type AnyMethodDef = MethodDef<string, string, MethodArgRecord | undefined, MethodArgRecord | undefined>;
|
|
32
|
+
type ArgType<Arg> = Arg extends MethodArg<infer A> ? A : never;
|
|
33
|
+
type InputOfMethodDef<Spec$1> = Spec$1 extends {
|
|
34
|
+
readonly input?: infer Input;
|
|
35
|
+
} ? Input extends MethodArgRecord ? { readonly [Key in keyof Input]: ArgType<Input[Key]> } : Record<never, never> : Record<never, never>;
|
|
36
|
+
type OutputOfMethodDef<Spec$1> = Spec$1 extends {
|
|
37
|
+
readonly output?: infer Output;
|
|
38
|
+
} ? Output extends MethodArgRecord ? { readonly [Key in keyof Output]: ArgType<Output[Key]> } : Record<never, never> : Record<never, never>;
|
|
39
|
+
type MethodCallRaw = {
|
|
40
|
+
readonly request: CallMethodRequestLike;
|
|
41
|
+
readonly result: CallMethodResult;
|
|
42
|
+
};
|
|
43
|
+
type MethodArgumentResult = {
|
|
44
|
+
readonly key: string;
|
|
45
|
+
readonly index: number;
|
|
46
|
+
readonly argumentName: string;
|
|
47
|
+
readonly status: OpcuaStatusInfo;
|
|
48
|
+
readonly diagnosticInfo?: unknown;
|
|
49
|
+
};
|
|
50
|
+
type MethodCallResult<Output$1, ObjectId extends string, MethodId extends string> = {
|
|
51
|
+
readonly _tag: "Called";
|
|
52
|
+
readonly objectId: ObjectId;
|
|
53
|
+
readonly methodId: MethodId;
|
|
54
|
+
readonly output: Output$1;
|
|
55
|
+
readonly status: OpcuaStatusInfo;
|
|
56
|
+
readonly inputArgumentResults?: ReadonlyArray<MethodArgumentResult>;
|
|
57
|
+
readonly unsafeRaw?: MethodCallRaw;
|
|
58
|
+
} | {
|
|
59
|
+
readonly _tag: "NonGoodStatus";
|
|
60
|
+
readonly objectId: ObjectId;
|
|
61
|
+
readonly methodId: MethodId;
|
|
62
|
+
readonly status: OpcuaStatusInfo;
|
|
63
|
+
readonly inputArgumentResults?: ReadonlyArray<MethodArgumentResult>;
|
|
64
|
+
readonly unsafeRaw?: MethodCallRaw;
|
|
65
|
+
} | {
|
|
66
|
+
readonly _tag: "DecodeError";
|
|
67
|
+
readonly objectId: ObjectId;
|
|
68
|
+
readonly methodId: MethodId;
|
|
69
|
+
readonly status: OpcuaStatusInfo;
|
|
70
|
+
readonly error: unknown;
|
|
71
|
+
readonly unsafeRaw?: MethodCallRaw;
|
|
72
|
+
};
|
|
73
|
+
type AnyCallManyRecord = Record<string, readonly [AnyMethodDef, unknown] | readonly [AnyMethodDef, unknown, MethodCallOptions]>;
|
|
74
|
+
type CallManyInput<Items extends AnyCallManyRecord> = { readonly [Key in keyof Items]: Items[Key] extends readonly [infer Def extends AnyMethodDef, unknown, MethodCallOptions] ? readonly [def: Def, input: InputOfMethodDef<Def>, options: MethodCallOptions] : Items[Key] extends readonly [infer Def extends AnyMethodDef, unknown] ? readonly [def: Def, input: InputOfMethodDef<Def>] : never };
|
|
75
|
+
type CallManyResult<Items> = { readonly [Key in keyof Items]: Items[Key] extends readonly [infer Def extends AnyMethodDef, unknown, ...ReadonlyArray<unknown>] ? MethodCallResult<OutputOfMethodDef<Def>, Def["objectId"], Def["methodId"]> : never };
|
|
76
|
+
//#endregion
|
|
77
|
+
export { AnyCallManyRecord, AnyMethodDef, CallManyInput, CallManyResult, InputOfMethodDef, MethodArg, MethodArgSelector, MethodCallOptions, MethodCallResult, MethodDef, OutputOfMethodDef };
|
|
78
|
+
//# sourceMappingURL=OpcuaMethod.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpcuaMethod.d.mts","names":[],"sources":["../../../../client/src/OpcuaMethod.ts"],"sourcesContent":[],"mappings":";;;;;KAqBY,iBAAA;;AAAZ,CAAA;AAIY,KAAA,iBAAA,GAAiB;EAIjB,SAAA,IAAS,EAAA,MAAA;EAEH,SAAA,IAAA,EAAA,MAAA;CACI,GAAA;EACN,SAAA,IAAA,EAAA,OAAA;EAAC,SAAA,KAAA,EAAA,MAAA;AAGjB,CAAA;AAAsD,KAP1C,SAO0C,CAAA,CAAA,CAAA,GAAA;EAAf,SAAA,IAAA,EAAA,WAAA;EAAT,SAAA,KAAA,EALZ,UAKY,CAAA,OAAA,CAAA;EAAQ,SAAA,QAAA,CAAA,EAJhB,iBAIgB;EAE1B,SAAA,EAAA,CAAS,EALL,CAKK;CAGL;AAA8B,KALlC,eAAA,GAAkB,QAKgB,CALP,MAKO,CAAA,MAAA,EALQ,SAKR,CAAA,OAAA,CAAA,CAAA,CAAA;AAC7B,KAJL,SAIK,CAAA,iBAAA,MAAA,GAAA,MAAA,EAAA,iBAAA,MAAA,GAAA,MAAA,EAAA,gBADD,eACC,GAAA,SAAA,GAD6B,eAC7B,GAAA,SAAA,EAAA,iBAAA,eAAA,GAAA,SAAA,GAA8B,eAA9B,GAAA,SAAA,CAAA,GAAA;EAA8B,SAAA,IAAA,EAAA,WAAA;EAG1B,SAAA,QAAA,EAAA,QAAA;EACA,SAAA,QAAA,EAAA,QAAA;EACF,SAAA,KAAA,CAAA,EAAA,OAAA;EACC,SAAA,MAAA,CAAA,EAAA,QAAA;EAAM,SAAA,UAAA,CAAA,EAAA,OAAA;AAI1B,CAAA;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