@open-pioneer/core 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @open-pioneer/core
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 77f7d5c: Initial test release
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/Logger.js ADDED
@@ -0,0 +1,110 @@
1
+ const LOG_LEVEL = validateLogLevel(__LOG_LEVEL__);
2
+ function createLogger(prefix) {
3
+ return new LoggerImpl(prefix, LOG_LEVEL);
4
+ }
5
+ const logLevelNumbers = {
6
+ DEBUG: 0,
7
+ INFO: 1,
8
+ WARN: 2,
9
+ ERROR: 3
10
+ };
11
+ class LoggerImpl {
12
+ prefix;
13
+ enabledLogLevelNumber;
14
+ constructor(prefix, logLevel) {
15
+ this.prefix = prefix;
16
+ this.enabledLogLevelNumber = logLevelToLogLevelNumber(logLevel);
17
+ }
18
+ isDebug() {
19
+ return this._isLogLevelEnabled("DEBUG");
20
+ }
21
+ /**
22
+ * Performs a debug log with the given message and values if DEBUG level is enabled.
23
+ * @param message
24
+ * @param values
25
+ */
26
+ debug(message, ...values) {
27
+ this._doLog("DEBUG", message, values);
28
+ }
29
+ /**
30
+ * Performs an info log with the given message and values if INFO level is enabled.
31
+ * @param message
32
+ * @param values
33
+ */
34
+ info(message, ...values) {
35
+ this._doLog("INFO", message, values);
36
+ }
37
+ /**
38
+ * Performs a warning log with the given message and values if WARN level is enabled.
39
+ * @param message
40
+ * @param values
41
+ */
42
+ warn(message, ...values) {
43
+ this._doLog("WARN", message, values);
44
+ }
45
+ /**
46
+ * Performs an error log with the given message and values if ERROR level is enabled.
47
+ * @param message
48
+ * @param values
49
+ */
50
+ error(message, ...values) {
51
+ this._doLog("ERROR", message, values);
52
+ }
53
+ /**
54
+ * Internal method for performing the log if the specified level is enabled.
55
+ * @param level
56
+ * @param messageOrError
57
+ * @param values
58
+ * @private
59
+ */
60
+ _doLog(level, messageOrError, values) {
61
+ if (this._isLogLevelEnabled(level)) {
62
+ let message = `[${level}] ${this.prefix}:`;
63
+ if (typeof messageOrError === "string") {
64
+ message += " " + messageOrError;
65
+ } else {
66
+ values.unshift(messageOrError);
67
+ }
68
+ const consoleMethodName = logLevelToConsoleMethodName(level);
69
+ console[consoleMethodName](message, ...values);
70
+ }
71
+ }
72
+ _isLogLevelEnabled(logLevel) {
73
+ const logLevelNumber = logLevelToLogLevelNumber(logLevel);
74
+ return logLevelNumber >= this.enabledLogLevelNumber;
75
+ }
76
+ }
77
+ function logLevelToConsoleMethodName(logLevel) {
78
+ switch (logLevel) {
79
+ case "DEBUG":
80
+ return "debug";
81
+ case "INFO":
82
+ return "info";
83
+ case "WARN":
84
+ return "warn";
85
+ case "ERROR":
86
+ return "error";
87
+ }
88
+ }
89
+ function logLevelToLogLevelNumber(logLevel) {
90
+ return logLevelNumbers[logLevel];
91
+ }
92
+ function validateLogLevel(logLevelString) {
93
+ if (!logLevelString) {
94
+ return "INFO";
95
+ }
96
+ switch (logLevelString) {
97
+ case "DEBUG":
98
+ case "INFO":
99
+ case "WARN":
100
+ case "ERROR":
101
+ return logLevelString;
102
+ default:
103
+ throw new Error(
104
+ `invalid log level '${logLevelString}'; allowed levels are: DEBUG, INFO, WARN, ERROR`
105
+ );
106
+ }
107
+ }
108
+
109
+ export { LoggerImpl, createLogger };
110
+ //# sourceMappingURL=Logger.js.map
package/Logger.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/core/Logger.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nconst LOG_LEVEL = validateLogLevel(__LOG_LEVEL__);\n\n/**\n * Creates and returns a new logger instance for an application wide standardized logging.\n * For available log methods see {@link Logger} interface.\n * The log level is globally configured (see vite.config.ts).\n *\n * @param prefix Prefix used to prefix all log messages invoked by the created logger instance.\n */\nexport function createLogger(prefix: string): Logger {\n return new LoggerImpl(prefix, LOG_LEVEL);\n}\n\n/**\n * Allowed log levels.\n * Order: DEBUG < INFO < WARN < ERROR\n */\nexport type LogLevel = \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\";\n\n// internal representation of log levels as numbers for log level comparison.\nconst logLevelNumbers: Record<LogLevel, number> = {\n DEBUG: 0,\n INFO: 1,\n WARN: 2,\n ERROR: 3\n};\n\nexport interface LogMethod {\n /**\n * Logger's log method signature\n *\n * @param message Log message to be logged (attached to the prefix). Can be a string or an Error.\n * @param values Arbitrary amount of additional values to be logged (attached to message).\n */\n (message: string | Error, ...values: unknown[]): void;\n}\n\n/**\n * Provides a logger for a standardized application wide logging.\n *\n * The logger's log level is configured globally.\n *\n * Use the `createLogger` function to receive a new logger instance for logging.\n */\nexport interface Logger {\n /**\n * Prefix prepended to all logging messages\n */\n readonly prefix: string;\n\n /**\n * Returns true if debug log level is enabled.\n */\n isDebug(): boolean;\n\n /**\n * Logging method for debug log level.\n * Follows normal LogMethod structure but logs in debug level.\n */\n debug: LogMethod;\n\n /**\n * Logging method for info log level.\n * Follows normal log method structure but logs in info level.\n */\n info: LogMethod;\n\n /**\n * Logging method for warn log level.\n * Follows normal log method structure but logs in warn level.\n */\n warn: LogMethod;\n\n /**\n * Logging method for debug error level.\n * Follows normal log method structure but logs in error level.\n */\n error: LogMethod;\n}\n\n/**\n * A class implementing a logger with a global log level.\n */\nexport class LoggerImpl implements Logger {\n prefix: string;\n private readonly enabledLogLevelNumber: number;\n\n constructor(prefix: string, logLevel: LogLevel) {\n this.prefix = prefix;\n this.enabledLogLevelNumber = logLevelToLogLevelNumber(logLevel);\n }\n\n isDebug() {\n return this._isLogLevelEnabled(\"DEBUG\");\n }\n\n /**\n * Performs a debug log with the given message and values if DEBUG level is enabled.\n * @param message\n * @param values\n */\n debug(message: string | Error, ...values: unknown[]) {\n this._doLog(\"DEBUG\", message, values);\n }\n\n /**\n * Performs an info log with the given message and values if INFO level is enabled.\n * @param message\n * @param values\n */\n info(message: string | Error, ...values: unknown[]) {\n this._doLog(\"INFO\", message, values);\n }\n\n /**\n * Performs a warning log with the given message and values if WARN level is enabled.\n * @param message\n * @param values\n */\n warn(message: string | Error, ...values: unknown[]) {\n this._doLog(\"WARN\", message, values);\n }\n\n /**\n * Performs an error log with the given message and values if ERROR level is enabled.\n * @param message\n * @param values\n */\n error(message: string | Error, ...values: unknown[]) {\n this._doLog(\"ERROR\", message, values);\n }\n\n /**\n * Internal method for performing the log if the specified level is enabled.\n * @param level\n * @param messageOrError\n * @param values\n * @private\n */\n private _doLog(level: LogLevel, messageOrError: string | Error, values: unknown[]) {\n if (this._isLogLevelEnabled(level)) {\n let message = `[${level}] ${this.prefix}:`;\n if (typeof messageOrError === \"string\") {\n message += \" \" + messageOrError;\n } else {\n values.unshift(messageOrError);\n }\n const consoleMethodName = logLevelToConsoleMethodName(level);\n console[consoleMethodName](message, ...values);\n }\n }\n\n private _isLogLevelEnabled(logLevel: LogLevel) {\n const logLevelNumber = logLevelToLogLevelNumber(logLevel);\n return logLevelNumber >= this.enabledLogLevelNumber;\n }\n}\n\n/**\n * Converts a LogLevel to a browser's debugging console method name.\n * @param logLevel\n */\nfunction logLevelToConsoleMethodName(logLevel: LogLevel): \"debug\" | \"info\" | \"warn\" | \"error\" {\n switch (logLevel) {\n case \"DEBUG\":\n return \"debug\";\n case \"INFO\":\n return \"info\";\n case \"WARN\":\n return \"warn\";\n case \"ERROR\":\n return \"error\";\n }\n}\n\nfunction logLevelToLogLevelNumber(logLevel: LogLevel) {\n return logLevelNumbers[logLevel];\n}\n\nfunction validateLogLevel(logLevelString: string): LogLevel {\n if (!logLevelString) {\n return \"INFO\";\n }\n\n switch (logLevelString) {\n case \"DEBUG\":\n case \"INFO\":\n case \"WARN\":\n case \"ERROR\":\n return logLevelString;\n default:\n throw new Error(\n `invalid log level '${logLevelString}'; allowed levels are: DEBUG, INFO, WARN, ERROR`\n );\n }\n}\n"],"names":[],"mappings":"AAEA,MAAM,SAAA,GAAY,iBAAiB,aAAa,CAAA,CAAA;AASzC,SAAS,aAAa,MAAwB,EAAA;AACjD,EAAO,OAAA,IAAI,UAAW,CAAA,MAAA,EAAQ,SAAS,CAAA,CAAA;AAC3C,CAAA;AASA,MAAM,eAA4C,GAAA;AAAA,EAC9C,KAAO,EAAA,CAAA;AAAA,EACP,IAAM,EAAA,CAAA;AAAA,EACN,IAAM,EAAA,CAAA;AAAA,EACN,KAAO,EAAA,CAAA;AACX,CAAA,CAAA;AA0DO,MAAM,UAA6B,CAAA;AAAA,EACtC,MAAA,CAAA;AAAA,EACiB,qBAAA,CAAA;AAAA,EAEjB,WAAA,CAAY,QAAgB,QAAoB,EAAA;AAC5C,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAK,IAAA,CAAA,qBAAA,GAAwB,yBAAyB,QAAQ,CAAA,CAAA;AAAA,GAClE;AAAA,EAEA,OAAU,GAAA;AACN,IAAO,OAAA,IAAA,CAAK,mBAAmB,OAAO,CAAA,CAAA;AAAA,GAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAA,CAAM,YAA4B,MAAmB,EAAA;AACjD,IAAK,IAAA,CAAA,MAAA,CAAO,OAAS,EAAA,OAAA,EAAS,MAAM,CAAA,CAAA;AAAA,GACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAA,CAAK,YAA4B,MAAmB,EAAA;AAChD,IAAK,IAAA,CAAA,MAAA,CAAO,MAAQ,EAAA,OAAA,EAAS,MAAM,CAAA,CAAA;AAAA,GACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAA,CAAK,YAA4B,MAAmB,EAAA;AAChD,IAAK,IAAA,CAAA,MAAA,CAAO,MAAQ,EAAA,OAAA,EA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AAO,OAAA,OAAA,CAAA;AAAA,GACf;AACJ,CAAA;AAEA,SAAS,yBAAyB,QAAoB,EAAA;AAClD,EAAA,OAAO,gBAAgB,QAAQ,CAAA,CAAA;AACnC,CAAA;AAEA,SAAS,iBAAiB,cAAkC,EAAA;AACxD,EAAA,IAAI,CAAC,cAAgB,EAAA;AACjB,IAAO,OAAA,MAAA,CAAA;AAAA,GACX;AAEA,EAAA,QAAQ,cAAgB;AAAA,IACpB,KAAK,OAAA,CAAA;AAAA,IACL,KAAK,MAAA,CAAA;AAAA,IACL,KAAK,MAAA,CAAA;AAAA,IACL,KAAK,OAAA;AACD,MAAO,OAAA,cAAA,CAAA;AAAA,IACX;AACI,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAsB,mBAAA,EAAA,cAAA,CAAA,+CAAA,CAAA;AAAA,OAC1B,CAAA;AAAA,GACR;AACJ;;;;"}
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @open-pioneer/core
2
+
3
+ This package contains basic utility functions and classes used by the @open-pioneer project.
4
+
5
+ ## Events
6
+
7
+ The package exports the `EventEmitter` class that supports emitting and subscribing to user defined events.
8
+
9
+ ## Errors
10
+
11
+ The `Error` class extends JavaScript's global error class with a user defined `id` value that
12
+ can be used to explicitly identify error conditions.
13
+
14
+ ```js
15
+ import { Error } from "@open-pioneer/core";
16
+ throw new Error("my-error:identifier", "This is the error message");
17
+ ```
18
+
19
+ `Error` also exposes the optional `cause` attribute that allows nesting of error instances.
20
+ Note that browser support for that property is still required:
21
+
22
+ ```js
23
+ import { Error, getErrorChain } from "@open-pioneer/core";
24
+
25
+ try {
26
+ someFunctionThatCanThrow();
27
+ } catch (e) {
28
+ throw new Error("my-error:higher-level-error-id", "Error text", { cause: e });
29
+ }
30
+
31
+ // getErrorChain gathers the error and all its causes (if any) into an array:
32
+ const errors = getErrorChain(error);
33
+ ```
34
+
35
+ ## Resources
36
+
37
+ The `Resource` type exported from this package is used by objects with a destructor.
38
+ All object needing some cleanup action to be called should use the `destroy` method for consistency and easier handling.
39
+
40
+ ## Logger
41
+
42
+ The 'Logger' class provides a logger for standardized application wide logging.
43
+ The log level is configured globally in the vite.config.js.
44
+
45
+ To create a logger instance, call the `createLogger` method.
46
+ It takes a prefix (string) to prepend to each message.
47
+ Use `:` as a separator to encode hierarchical names (e.g. `"some-package:SomeClass"`).
48
+
49
+ The logger provides log methods for the following log levels with the following order: DEBUG < INFO < WARN < ERROR.
50
+
51
+ For example (as class attribute):
52
+
53
+ ```ts
54
+ import { createLogger, Logger } from "@open-pioneer/core";
55
+
56
+ export class LoggerTestExample {
57
+ private logger: Logger;
58
+ constructor() {
59
+ this.logger = createLogger("example-package:LoggerTestExample");
60
+ }
61
+
62
+ testMethod() {
63
+ this.logger.warn("example message", { testLog: 123, text: "this is a text" });
64
+ }
65
+ }
66
+ ```
67
+
68
+ Or as a shared logger at module scope:
69
+
70
+ ```ts
71
+ import { createLogger } from "@open-pioneer/core";
72
+ const LOG = createLogger("example-package");
73
+ ```
package/error.js ADDED
@@ -0,0 +1,38 @@
1
+ const GlobalError = globalThis.Error;
2
+ class Error extends GlobalError {
3
+ /** Unique error id */
4
+ id;
5
+ /** Human readable error message */
6
+ text;
7
+ constructor(id, text, options) {
8
+ super(`${id}: ${text}`, options);
9
+ this.id = id;
10
+ this.text = text;
11
+ }
12
+ }
13
+ function getErrorChain(err) {
14
+ const chain = [];
15
+ do {
16
+ chain.push(err);
17
+ const cause = err.cause;
18
+ if (!(cause instanceof GlobalError)) {
19
+ break;
20
+ }
21
+ err = cause;
22
+ } while (1);
23
+ return chain;
24
+ }
25
+ function isAbortError(err) {
26
+ return err && typeof err === "object" && "name" in err && err.name === "AbortError";
27
+ }
28
+ function throwAbortError() {
29
+ throw createAbortError();
30
+ }
31
+ function createAbortError() {
32
+ const err = new globalThis.Error("Aborted");
33
+ err.name = "AbortError";
34
+ return err;
35
+ }
36
+
37
+ export { Error, createAbortError, getErrorChain, isAbortError, throwAbortError };
38
+ //# sourceMappingURL=error.js.map
package/error.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/core/error.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nconst GlobalError = globalThis.Error;\n\n// 'cause' property is missing in typescript typings\ndeclare global {\n interface ErrorConstructor {\n new (\n message?: string,\n options?: {\n cause?: unknown;\n }\n ): globalThis.Error;\n }\n}\n\n/**\n * A custom error class that enforces the use of error ids.\n *\n * An error must be constructed from a (computer-readable) id and a human readable informational text.\n * An optional `cause` option can be passed to indicate the nested reason for an error.\n *\n * # Conventions\n *\n * Error ids should be scoped to a package to avoid conflicts.\n * Each package should pick a sensible namespace prefix.\n *\n * An example for a good error id is `runtime:dependency-cycle`.\n */\nexport class Error extends GlobalError {\n /** Unique error id */\n public readonly id: string;\n\n /** Human readable error message */\n public readonly text: string;\n\n constructor(id: string, text: string, options?: { cause?: unknown }) {\n super(`${id}: ${text}`, options);\n this.id = id;\n this.text = text;\n }\n}\n\n/**\n * Returns the error chain for the given `err`, starting with this error.\n * The error chain contains the error itself and all its causes.\n * The first entry is `err` itself.\n */\nexport function getErrorChain(err: globalThis.Error): globalThis.Error[] {\n const chain: globalThis.Error[] = [];\n do {\n chain.push(err);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cause = (err as any).cause as unknown;\n if (!(cause instanceof GlobalError)) {\n break;\n }\n err = cause;\n } while (1); // eslint-disable-line no-constant-condition\n return chain;\n}\n\n/**\n * Returns true if the error represents an abort error.\n */\nexport function isAbortError(err: unknown) {\n return err && typeof err === \"object\" && \"name\" in err && err.name === \"AbortError\";\n}\n\n/**\n * Throws an abort error (`.name` === `\"AbortError\"`).\n */\nexport function throwAbortError(): never {\n throw createAbortError();\n}\n\n/**\n * Returns an abort error (`.name` === `\"AbortError\"`).\n */\nexport function createAbortError(): globalThis.Error {\n const err = new globalThis.Error(\"Aborted\");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A,CAAA;AACX;;;;"}
package/events.js ADDED
@@ -0,0 +1,74 @@
1
+ const state = Symbol("EventEmitterState");
2
+ class EventEmitter {
3
+ [state] = new EventEmitterState();
4
+ /**
5
+ * Registers the given listener function as an event handler for `eventName`.
6
+ *
7
+ * The listener function should be unregistered by destroying the returned {@link Resource}
8
+ * when it is no longer needed.
9
+ */
10
+ on(eventName, listener) {
11
+ return this[state].on(eventName, {
12
+ listener
13
+ });
14
+ }
15
+ /**
16
+ * Registers the given listener function to listen for `eventName` events _once_.
17
+ * The listener function will automatically be unregistered after it has been called.
18
+ *
19
+ * The listener function should be unregistered by destroying the returned {@link Resource}.
20
+ */
21
+ once(eventName, listener) {
22
+ return this[state].on(eventName, {
23
+ listener,
24
+ once: true
25
+ });
26
+ }
27
+ /**
28
+ * Emits an event of the given name and calls the registered event handlers.
29
+ *
30
+ * _Note:_ event handlers run synchronously.
31
+ * After `emit()` has completed, all listeners will already have been invoked.
32
+ */
33
+ emit(eventName, ...args) {
34
+ this[state].emit(eventName, args[0]);
35
+ }
36
+ }
37
+ class EventEmitterState {
38
+ handlers = /* @__PURE__ */ new Map();
39
+ on(name, handler) {
40
+ let handlers = this.handlers.get(name);
41
+ if (!handlers) {
42
+ handlers = /* @__PURE__ */ new Set();
43
+ this.handlers.set(name, handlers);
44
+ }
45
+ handlers.add(handler);
46
+ return {
47
+ destroy() {
48
+ handler.removed = true;
49
+ handlers?.delete(handler);
50
+ handlers = void 0;
51
+ }
52
+ };
53
+ }
54
+ emit(name, event) {
55
+ const handlers = this.handlers.get(name);
56
+ if (!handlers) {
57
+ return;
58
+ }
59
+ const copy = [...handlers];
60
+ for (const handler of copy) {
61
+ if (handler.removed) {
62
+ continue;
63
+ }
64
+ if (handler.once) {
65
+ handler.removed = true;
66
+ handlers.delete(handler);
67
+ }
68
+ handler.listener(event);
69
+ }
70
+ }
71
+ }
72
+
73
+ export { EventEmitter };
74
+ //# sourceMappingURL=events.js.map
package/events.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/core/events.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { Resource } from \"./resources\";\n\nconst state = Symbol(\"EventEmitterState\");\n\nexport type EventNames<Events extends Record<string, unknown>> = keyof Events & string;\n\ntype ArgType<T> = [T] extends [void] ? [] : [event: T];\n\ntype EventType<Events extends Record<string, unknown>, Name extends keyof Events> = ArgType<\n Events[Name]\n>;\n\n/**\n * A support class that implements emitting and listening for events.\n *\n * This class supports inheritance or direct use:\n *\n * ```js\n * const emitter = new EventEmitter();\n * class MyClass extends EventEmitter {};\n * ```\n *\n * When using this class from TypeScript, declare your supported event\n * types using an interface first:\n *\n * ```ts\n * interface Events {\n * // key: event name, value: event type\n * \"mouse-clicked\": MouseEvent;\n * }\n *\n * const emitter = new EventEmitter<Events>();\n * emitter.on(\"mouse-clicked\", (event) => {\n * // event is a MouseEvent\n * });\n * emitter.emit(\"mouse-clicked\", new MouseEvent(...));\n * ```\n */\nexport class EventEmitter<Events extends {}> {\n private [state] = new EventEmitterState();\n\n /**\n * Registers the given listener function as an event handler for `eventName`.\n *\n * The listener function should be unregistered by destroying the returned {@link Resource}\n * when it is no longer needed.\n */\n on<Name extends EventNames<Events>>(\n eventName: Name,\n listener: (...args: EventType<Events, Name>) => void\n ): Resource {\n return this[state].on(eventName, {\n listener: listener as InternalListener\n });\n }\n\n /**\n * Registers the given listener function to listen for `eventName` events _once_.\n * The listener function will automatically be unregistered after it has been called.\n *\n * The listener function should be unregistered by destroying the returned {@link Resource}.\n */\n once<Name extends EventNames<Events>>(\n eventName: Name,\n listener: (...args: EventType<Events, Name>) => void\n ): Resource {\n return this[state].on(eventName, {\n listener: listener as InternalListener,\n once: true\n });\n }\n\n /**\n * Emits an event of the given name and calls the registered event handlers.\n *\n * _Note:_ event handlers run synchronously.\n * After `emit()` has completed, all listeners will already have been invoked.\n */\n emit<Name extends EventNames<Events>>(eventName: Name, ...args: EventType<Events, Name>): void {\n this[state].emit(eventName, args[0]);\n }\n}\n\n/**\n * Read-only version of the {@link EventEmitter} interface that only allows listening for events.\n */\nexport type EventSource<Events extends {}> = Pick<EventEmitter<Events>, \"on\" | \"once\">;\n\ntype InternalListener = (event: unknown) => void;\n\ninterface EventHandler {\n once?: boolean;\n removed?: boolean;\n listener: InternalListener;\n}\n\nclass EventEmitterState {\n private handlers = new Map<string, Set<EventHandler>>();\n\n on(name: string, handler: EventHandler): Resource {\n let handlers = this.handlers.get(name);\n if (!handlers) {\n handlers = new Set();\n this.handlers.set(name, handlers);\n }\n handlers.add(handler);\n return {\n destroy() {\n handler.removed = true;\n handlers?.delete(handler);\n handlers = undefined;\n }\n };\n }\n\n emit(name: string, event: unknown) {\n const handlers = this.handlers.get(name);\n if (!handlers) {\n return;\n }\n\n // Copy to allow (de-) registration of handlers during emit.\n // This is convenient for correctness but may been further optimization\n // if events are emitted frequently.\n const copy = [...handlers];\n for (const handler of copy) {\n if (handler.removed) {\n continue;\n }\n\n if (handler.once) {\n handler.removed = true;\n handlers.delete(handler);\n }\n handler.listener(event);\n }\n }\n}\n"],"names":[],"mappings":"AAIA,MAAM,KAAA,GAAQ,OAAO,mBAAmB,CAAA,CAAA;AAoCjC,MAAM,YAAgC,CAAA;AAAA,EACzC,CAAS,KAAK,IAAI,IAAI,iBAAkB,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxC,EAAA,CACI,WACA,QACQ,EAAA;AACR,IAAA,OAAO,IAAK,CAAA,KAAK,CAAE,CAAA,EAAA,CAAG,SAAW,EAAA;AAAA,MAC7B,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAA,CACI,WACA,QACQ,EAAA;AACR,IAAA,OAAO,IAAK,CAAA,KAAK,CAAE,CAAA,EAAA,CAAG,SAAW,EAAA;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MAAA,IAAI,QAAQ,OAAS,EAAA;AACjB,QAAA,SAAA;AAAA,OACJ;AAEA,MAAA,IAAI,QAAQ,IAAM,EAAA;AACd,QAAA,OAAA,CAAQ,OAAU,GAAA,IAAA,CAAA;AAClB,QAAA,QAAA,CAAS,OAAO,OAAO,CAAA,CAAA;AAAA,OAC3B;AACA,MAAA,OAAA,CAAQ,SAAS,KAAK,CAAA,CAAA;AAAA,KAC1B;AAAA,GACJ;AACJ;;;;"}
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { Error, createAbortError, getErrorChain, isAbortError, throwAbortError } from './error.js';
2
+ export { EventEmitter } from './events.js';
3
+ export { destroyResource } from './resources.js';
4
+ export { createLogger } from './Logger.js';
5
+ export { createManualPromise } from './utils.js';
6
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "type": "module",
3
+ "name": "@open-pioneer/core",
4
+ "version": "0.1.0",
5
+ "license": "Apache-2.0",
6
+ "exports": {
7
+ "./package.json": "./package.json",
8
+ ".": {
9
+ "import": "./index.js"
10
+ }
11
+ },
12
+ "openPioneerFramework": {
13
+ "services": [],
14
+ "i18n": {
15
+ "languages": []
16
+ },
17
+ "ui": {
18
+ "references": []
19
+ },
20
+ "properties": [],
21
+ "packageFormatVersion": "1.0.0"
22
+ }
23
+ }
package/resources.js ADDED
@@ -0,0 +1,7 @@
1
+ function destroyResource(resource) {
2
+ resource?.destroy();
3
+ return void 0;
4
+ }
5
+
6
+ export { destroyResource };
7
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/core/resources.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\n/**\n * An object that has some cleanup code associated with it.\n */\nexport interface Resource {\n /** A function that releases any state held by the resource. */\n destroy(): void;\n}\n\n/**\n * A helper function that invokes `destroy()` on the given resource and returns undefined.\n *\n * Example:\n *\n * ```js\n * class Holder {\n * private myResource: Resource | undefined;\n *\n * destroy() {\n * this.myResource = destroyResource(this.myResource);\n * }\n * }\n * ```\n */\nexport function destroyResource<R extends Resource>(resource: R | undefined): undefined {\n resource?.destroy();\n return undefined;\n}\n"],"names":[],"mappings":"AAyBO,SAAS,gBAAoC,QAAoC,EAAA;AACpF,EAAA,QAAA,EAAU,OAAQ,EAAA,CAAA;AAClB,EAAO,OAAA,KAAA,CAAA,CAAA;AACX;;;;"}
package/utils.js ADDED
@@ -0,0 +1,16 @@
1
+ function createManualPromise() {
2
+ let resolve;
3
+ let reject;
4
+ const promise = new Promise((res, rej) => {
5
+ resolve = res;
6
+ reject = rej;
7
+ });
8
+ return {
9
+ promise,
10
+ resolve,
11
+ reject
12
+ };
13
+ }
14
+
15
+ export { createManualPromise };
16
+ //# sourceMappingURL=utils.js.map
package/utils.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/core/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * A manual promise that also exposes its `resolve` and `reject` functions.\n *\n * The user must take care to always call either `resolve` or `reject` at least once,\n * otherwise clients waiting for the `promise` may wait forever.\n */\nexport interface ManualPromise<T> {\n promise: Promise<T>;\n resolve(value: T): void;\n reject(error: unknown): void;\n}\n\nexport function createManualPromise<T>(): ManualPromise<T> {\n let resolve!: (value: T) => void;\n let reject!: (error: unknown) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return {\n promise,\n resolve,\n reject\n };\n}\n"],"names":[],"mappings":"AAeO,SAAS,mBAA2C,GAAA;AACvD,EAAI,IAAA,OAAA,CAAA;AACJ,EAAI,IAAA,MAAA,CAAA;AACJ,EAAA,MAAM,OAAU,GAAA,IAAI,OAAW,CAAA,CAAC,KAAK,GAAQ,KAAA;AACzC,IAAU,OAAA,GAAA,GAAA,CAAA;AACV,IAAS,MAAA,GAAA,GAAA,CAAA;AAAA,GACZ,CAAA,CAAA;AACD,EAAO,OAAA;AAAA,IACH,OAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,GACJ,CAAA;AACJ;;;;"}