@limetech/lime-web-components 6.5.0 → 6.6.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.
@@ -0,0 +1,3 @@
1
+ export * from './logger';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,385 @@
1
+ /**
2
+ * Logger service for writing log messages to configured handlers
3
+ *
4
+ * Loggers are created from a {@link LoggerFactory} with a specific scope/category.
5
+ * All log messages written to a logger will be sent to all handlers configured
6
+ * in the factory.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const logger = loggerFactory.createLogger('my-component');
11
+ *
12
+ * logger.info('Component initialized');
13
+ * logger.debug('Processing data', { itemCount: 42 });
14
+ * logger.warn('Deprecated API usage detected');
15
+ * logger.error('Failed to fetch data', error, { url: '/api/data' });
16
+ * ```
17
+ *
18
+ * @beta
19
+ * @group Logger
20
+ */
21
+ export interface Logger {
22
+ /**
23
+ * The scope/category for this logger instance
24
+ */
25
+ readonly scope: string;
26
+ /**
27
+ * Logs a debug message
28
+ *
29
+ * Use for detailed diagnostic information useful during development and troubleshooting.
30
+ * Debug logs are typically disabled in production and should include technical details
31
+ * like internal state, intermediate values, or execution flow.
32
+ *
33
+ * @param message - The log message
34
+ * @param data - Optional additional data to include with the log entry
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * logger.debug('Cache miss, fetching from API', { key: 'user:123' });
39
+ * logger.debug('Rendering component', { props: componentProps });
40
+ * ```
41
+ */
42
+ debug(message: string, data?: LogData): void;
43
+ /**
44
+ * Logs an informational message
45
+ *
46
+ * Use for significant application events that represent normal behavior.
47
+ * Info logs should capture key milestones, successful operations, or state transitions
48
+ * that are useful for understanding application flow in production.
49
+ *
50
+ * @param message - The log message
51
+ * @param data - Optional additional data to include with the log entry
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * logger.info('User authenticated', { userId: user.id });
56
+ * logger.info('File uploaded successfully', { filename: 'report.pdf', size: 2048 });
57
+ * ```
58
+ */
59
+ info(message: string, data?: LogData): void;
60
+ /**
61
+ * Logs a warning message
62
+ *
63
+ * Use for unexpected situations that don't prevent the application from functioning
64
+ * but may indicate potential issues, deprecated usage, or suboptimal conditions.
65
+ * Warnings should be actionable and suggest something that may need attention.
66
+ *
67
+ * @param message - The log message
68
+ * @param data - Optional additional data to include with the log entry
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * logger.warn('API response time exceeded threshold', { duration: 3500, threshold: 3000 });
73
+ * logger.warn('Using deprecated configuration option', { option: 'legacy_mode' });
74
+ * ```
75
+ */
76
+ warn(message: string, data?: LogData): void;
77
+ /**
78
+ * Logs an error message
79
+ *
80
+ * Use for failures and exceptions that prevent normal operation or indicate
81
+ * something has gone wrong. Error logs should always describe what failed
82
+ * and include relevant context to aid in diagnosis.
83
+ *
84
+ * @param message - The log message
85
+ * @param error - Optional error object
86
+ * @param data - Optional additional data to include with the log entry
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * logger.error('Failed to fetch user data', error, { userId: 123 });
91
+ * logger.error('Invalid configuration detected', undefined, { config: invalidConfig });
92
+ * ```
93
+ */
94
+ error(message: string, error?: Error, data?: LogData): void;
95
+ }
96
+ /**
97
+ * Handler for processing log messages
98
+ *
99
+ * Implementations can handle logs by writing to different outputs such as
100
+ * console, memory, IndexedDB, or external services.
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * class ConsoleHandler implements LogHandler {
105
+ * minLevel = LogLevel.Info;
106
+ *
107
+ * handle(entry: LogEntry): void {
108
+ * const prefix = `[${entry.level.toUpperCase()}] [${entry.scope}]`;
109
+ * console.log(`${prefix} ${entry.message}`, entry.data);
110
+ * }
111
+ * }
112
+ *
113
+ * // Change level at runtime
114
+ * consoleHandler.minLevel = LogLevel.Debug;
115
+ * ```
116
+ *
117
+ * @beta
118
+ * @group Logger
119
+ */
120
+ export interface LogHandler {
121
+ /**
122
+ * Handles a log entry
123
+ *
124
+ * Implementations should handle their own errors internally to ensure
125
+ * reliability. However, any uncaught errors thrown by this method will
126
+ * be caught by the factory to prevent one handler from breaking others.
127
+ * Errors will be logged to the console but will not stop other handlers
128
+ * from receiving the log entry.
129
+ *
130
+ * @param entry - The log entry to handle
131
+ */
132
+ handle(entry: LogEntry): void | Promise<void>;
133
+ /**
134
+ * Minimum log level this handler should receive
135
+ *
136
+ * If specified, the factory will only pass log entries with a level
137
+ * equal to or higher than this value. If not specified, all log
138
+ * entries are passed to the handler.
139
+ *
140
+ * Level priority (lowest to highest): Debug → Info → Warn → Error
141
+ *
142
+ * This can be changed at runtime to dynamically adjust filtering.
143
+ */
144
+ minLevel?: LogLevel;
145
+ }
146
+ /**
147
+ * Extended handler interface for handlers that support log storage and retrieval
148
+ *
149
+ * Handlers like memory and IndexedDB implement this interface to allow
150
+ * querying and exporting stored logs.
151
+ *
152
+ * @remarks
153
+ * Implementations should respect the configured retention policies (`maxEntries`
154
+ * and `maxAge`) to prevent unbounded growth. These limits can be changed at
155
+ * runtime to dynamically adjust retention behavior.
156
+ *
157
+ * For high-volume logging, consider batching writes to reduce overhead.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * class MemoryHandler implements LogStore {
162
+ * maxEntries = 10000;
163
+ * maxAge = 7 * 24 * 60 * 60 * 1000; // 7 days
164
+ *
165
+ * handle(entry: LogEntry): void { }
166
+ * getLogs(): LogEntry[] { return []; }
167
+ * clear(): void { }
168
+ * }
169
+ * ```
170
+ *
171
+ * @beta
172
+ * @group Logger
173
+ */
174
+ export interface LogStore extends LogHandler {
175
+ /**
176
+ * Retrieves all stored log entries
177
+ *
178
+ * @returns Array of all log entries
179
+ */
180
+ getLogs(): LogEntry[] | Promise<LogEntry[]>;
181
+ /**
182
+ * Clears all stored log entries
183
+ */
184
+ clear(): void | Promise<void>;
185
+ /**
186
+ * Maximum number of log entries to retain
187
+ *
188
+ * When the number of stored entries exceeds this limit, the oldest
189
+ * entries should be removed. If not specified, no entry-count limit
190
+ * is enforced.
191
+ *
192
+ * This can be changed at runtime to dynamically adjust retention.
193
+ */
194
+ maxEntries?: number;
195
+ /**
196
+ * Maximum age of log entries in milliseconds
197
+ *
198
+ * Entries older than this age should be removed during cleanup.
199
+ * If not specified, no age-based cleanup is performed.
200
+ *
201
+ * This can be changed at runtime to dynamically adjust retention.
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * // Retain logs for 7 days
206
+ * store.maxAge = 7 * 24 * 60 * 60 * 1000;
207
+ *
208
+ * // Retain logs for 1 hour
209
+ * store.maxAge = 60 * 60 * 1000;
210
+ * ```
211
+ */
212
+ maxAge?: number;
213
+ }
214
+ /**
215
+ * Factory for creating {@link Logger} instances
216
+ *
217
+ * The factory is initialized with one or more log handlers. All loggers created
218
+ * from the factory will write to all configured handlers.
219
+ *
220
+ * @example
221
+ * ```typescript
222
+ * // Get the logger factory from the platform
223
+ * const loggerFactory = platform.get('logger');
224
+ *
225
+ * // Create loggers for different components
226
+ * const httpLogger = loggerFactory.createLogger('http');
227
+ * const authLogger = loggerFactory.createLogger('auth');
228
+ *
229
+ * // Register a custom handler dynamically
230
+ * const customHandler = new MyCustomHandler();
231
+ * loggerFactory.addHandler(customHandler);
232
+ *
233
+ * // Retrieve all logs
234
+ * const allLogs = await loggerFactory.getLogs();
235
+ *
236
+ * // Clear all logs
237
+ * await loggerFactory.clearLogs();
238
+ * ```
239
+ *
240
+ * @beta
241
+ * @group Logger
242
+ */
243
+ export interface LoggerFactory {
244
+ /**
245
+ * Creates a logger instance for a specific scope/category
246
+ *
247
+ * @param scope - The scope or category for the logger (e.g., 'http', 'auth', 'component-name')
248
+ * @returns A logger instance that writes to all configured handlers
249
+ */
250
+ createLogger(scope: string): Logger;
251
+ /**
252
+ * Registers a new handler with the factory
253
+ *
254
+ * The handler will receive all future log entries from all loggers
255
+ * (both existing and newly created). Historical logs are not replayed.
256
+ *
257
+ * @param handler - The handler to register
258
+ */
259
+ addHandler(handler: LogHandler): void;
260
+ /**
261
+ * Removes a handler from the factory
262
+ *
263
+ * @param handler - The handler to remove
264
+ * @returns `true` if the handler was removed, `false` if it was not found
265
+ */
266
+ removeHandler(handler: LogHandler): boolean;
267
+ /**
268
+ * Retrieves logs from all handlers that support storage
269
+ *
270
+ * This method aggregates logs from all handlers that implement {@link LogStore}.
271
+ * Handlers that don't support log retrieval (like console) are ignored.
272
+ *
273
+ * @returns Array of all log entries from all storage handlers
274
+ */
275
+ getLogs(): Promise<LogEntry[]>;
276
+ /**
277
+ * Clears logs from all handlers that support storage
278
+ *
279
+ * This method clears logs from all handlers that implement {@link LogStore}.
280
+ * Handlers that don't support clearing (like console) are ignored.
281
+ */
282
+ clearLogs(): Promise<void>;
283
+ }
284
+ /**
285
+ * Base properties shared by all log entries
286
+ *
287
+ * @beta
288
+ * @group Logger
289
+ */
290
+ interface BaseLogEntry {
291
+ /**
292
+ * The scope/category this log entry belongs to
293
+ */
294
+ scope: string;
295
+ /**
296
+ * The log message
297
+ */
298
+ message: string;
299
+ /**
300
+ * Timestamp when the log entry was created (milliseconds since Unix epoch)
301
+ *
302
+ * Use `Date.now()` to create, `new Date(timestamp)` to convert back to Date object.
303
+ */
304
+ timestamp: number;
305
+ /**
306
+ * Optional additional structured data
307
+ */
308
+ data?: LogData;
309
+ }
310
+ /**
311
+ * Log entry for Debug, Info, and Warn levels
312
+ *
313
+ * @beta
314
+ * @group Logger
315
+ */
316
+ interface StandardLogEntry extends BaseLogEntry {
317
+ level: typeof LogLevel.Debug | typeof LogLevel.Info | typeof LogLevel.Warn;
318
+ }
319
+ /**
320
+ * Log entry for Error level with optional error object
321
+ *
322
+ * @beta
323
+ * @group Logger
324
+ */
325
+ interface ErrorLogEntry extends BaseLogEntry {
326
+ level: typeof LogLevel.Error;
327
+ /**
328
+ * Optional error object
329
+ *
330
+ * @remarks
331
+ * Error objects do not serialize well to JSON - only `name` and `message`
332
+ * are preserved, while `stack` is lost. Storage handlers that persist logs
333
+ * should manually serialize errors before storage:
334
+ *
335
+ * ```typescript
336
+ * const serialized = {
337
+ * name: error.name,
338
+ * message: error.message,
339
+ * stack: error.stack
340
+ * };
341
+ * ```
342
+ */
343
+ error?: Error;
344
+ }
345
+ /**
346
+ * A log entry with type-safe level discrimination
347
+ *
348
+ * When `level` is `LogLevel.Error`, the `error` property is available.
349
+ *
350
+ * @beta
351
+ * @group Logger
352
+ */
353
+ export type LogEntry = StandardLogEntry | ErrorLogEntry;
354
+ /**
355
+ * Log level values
356
+ *
357
+ * @beta
358
+ * @group Logger
359
+ */
360
+ export declare const LogLevel: {
361
+ readonly Debug: "debug";
362
+ readonly Info: "info";
363
+ readonly Warn: "warn";
364
+ readonly Error: "error";
365
+ };
366
+ /**
367
+ * Log level type indicating the severity of a log message
368
+ *
369
+ * @beta
370
+ * @group Logger
371
+ */
372
+ export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
373
+ /**
374
+ * Additional structured data that can be attached to a log entry
375
+ *
376
+ * Values should be JSON-serializable (primitives, arrays, plain objects) to
377
+ * ensure compatibility with storage handlers. Avoid functions, symbols,
378
+ * undefined, and circular references.
379
+ *
380
+ * @beta
381
+ * @group Logger
382
+ */
383
+ export type LogData = Record<string, unknown>;
384
+ export {};
385
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import { LoggerFactory } from './logger';
2
+ declare const SERVICE_NAME = "logger";
3
+ declare module '../core/platform' {
4
+ interface PlatformServiceNameType {
5
+ /**
6
+ * @see {@link LoggerFactory}
7
+ */
8
+ Logger: typeof SERVICE_NAME;
9
+ }
10
+ interface LimeWebComponentPlatform {
11
+ get(name: PlatformServiceNameType['Logger']): LoggerFactory;
12
+ }
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/logger/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,QAAA,MAAM,YAAY,WAAW,CAAC;AAI9B,OAAO,QAAQ,kBAAkB,CAAC;IAC9B,UAAU,uBAAuB;QAC7B;;WAEG;QACH,MAAM,EAAE,OAAO,YAAY,CAAC;KAC/B;IAED,UAAU,wBAAwB;QAC9B,GAAG,CAAC,IAAI,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC;KAC/D;CACJ"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Lime Web Components",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
7
- "main": "dist/index.cjs.js",
7
+ "main": "dist/index.cjs",
8
8
  "module": "dist/index.esm.js",
9
9
  "types": "dist/index.d.ts",
10
10
  "type": "module",
11
11
  "exports": {
12
+ "types": "./dist/index.d.ts",
12
13
  "import": "./dist/index.esm.js",
13
- "require": "./dist/index.cjs.js",
14
- "types": "./dist/index.d.ts"
14
+ "require": "./dist/index.cjs"
15
15
  },
16
16
  "files": [
17
17
  "dist/",
@@ -35,21 +35,21 @@
35
35
  "tslib": "^2.8.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@commitlint/config-conventional": "^20.0.0",
38
+ "@commitlint/config-conventional": "^20.2.0",
39
39
  "@limetech/eslint-config": "^4.0.0",
40
- "@microsoft/api-extractor": "^7.55.1",
41
- "eslint": "^9.39.1",
42
- "expect-type": "^1.2.2",
40
+ "@microsoft/api-extractor": "^7.55.2",
41
+ "eslint": "^9.39.2",
42
+ "expect-type": "^1.3.0",
43
43
  "globals": "^16.5.0",
44
- "jsdom": "^27.2.0",
45
- "replace-in-file": "^8.3.0",
44
+ "jsdom": "^27.3.0",
45
+ "replace-in-file": "^8.4.0",
46
46
  "shelljs": "0.10.0",
47
47
  "typedoc": "^0.23.24",
48
48
  "typedoc-plugin-markdown": "~3.15.0",
49
49
  "typescript": "^4.9.5",
50
- "vite": "^7.2.4",
50
+ "vite": "^7.3.0",
51
51
  "vite-plugin-dts": "^4.5.0",
52
- "vitest": "^4.0.13",
52
+ "vitest": "^4.0.15",
53
53
  "yargs": "^18.0.0"
54
54
  },
55
55
  "keywords": [
package/dist/index.cjs.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("@stencil/core"),c={Route:"route"},re="idle-state";function ne(e){return e&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(e.type)}function oe(e){return e&&["belongsto","hasone"].includes(e.type)}function ie(e){return e&&["time","timeofday","date","year","quarter","month"].includes(e.type)}function se(e){return e&&["string","text","phone","link"].includes(e.type)}function ce(e){return e&&["decimal","percent"].includes(e.type)}const ae="state.limetypes";c.LimeTypeRepository=ae;var _=function(e,t){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},_(e,t)};function h(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function O(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function A(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function R(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function p(e){return typeof e=="function"}function B(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var C=B(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
2
- `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=r}});function w(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var E=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=O(s),u=a.next();!u.done;u=a.next()){var g=u.value;g.remove(this)}}catch(f){t={error:f}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var D=this.initialTeardown;if(p(D))try{D()}catch(f){i=f instanceof C?f.errors:[f]}var I=this._finalizers;if(I){this._finalizers=null;try{for(var y=O(I),m=y.next();!m.done;m=y.next()){var te=m.value;try{N(te)}catch(f){i=i??[],f instanceof C?i=R(R([],A(i)),A(f.errors)):i.push(f)}}}catch(f){n={error:f}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}}if(i)throw new C(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)N(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&w(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&w(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),k=E.EMPTY;function G(e){return e instanceof E||e&&"closed"in e&&p(e.remove)&&p(e.add)&&p(e.unsubscribe)}function N(e){p(e)?e():e.unsubscribe()}var ue={Promise:void 0},le={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,R([e,t],A(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function fe(e){le.setTimeout(function(){throw e})}function M(){}function v(e){e()}var H=function(e){h(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,G(r)&&r.add(n)):n.destination=me,n}return t.create=function(r,n,o){return new j(r,n,o)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(E),pe=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){b(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){b(n)}else b(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){b(r)}},e}(),j=function(e){h(t,e);function t(r,n,o){var i=e.call(this)||this,s;return p(r)||!r?s={next:r??void 0,error:n??void 0,complete:o??void 0}:s=r,i.destination=new pe(s),i}return t}(H);function b(e){fe(e)}function de(e){throw e}var me={closed:!0,next:M,error:de,complete:M},he=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ye(e){return e}function be(e){return e.length===0?ye:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var L=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=Se(t)?t:new j(t,r,n);return v(function(){var s=o,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=T(r),new r(function(o,i){var s=new j({next:function(a){try{t(a)}catch(u){i(u),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[he]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return be(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=T(t),new t(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},e.create=function(t){return new e(t)},e}();function T(e){var t;return(t=e??ue.Promise)!==null&&t!==void 0?t:Promise}function ve(e){return e&&p(e.next)&&p(e.error)&&p(e.complete)}function Se(e){return e&&e instanceof H||ve(e)&&G(e)}var Ee=B(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Q=function(e){h(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new x(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ee},t.prototype.next=function(r){var n=this;v(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=O(n.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(r)}}catch(g){o={error:g}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;v(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;v(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?k:(this.currentObservers=null,a.push(r),new E(function(){n.currentObservers=null,w(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new L;return r.source=this,r},t.create=function(r,n){return new x(r,n)},t}(L),x=function(e){h(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:k},t}(Q),ge=function(e){h(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(Q);function Ce(e){return e}function l(e,t){return(r,n)=>{const o=_e(r,n,e,t);o.length===1&&Oe(r,o)}}const $=new WeakMap,S=new WeakMap,W=new WeakMap;function _e(e,t,r,n){let o=$.get(e);return o||(o=[],$.set(e,o)),o.push({options:r,name:t,optionFactory:n.optionFactory||Ce,service:{name:n.name,method:n.method||"subscribe"}}),o}function Oe(e,t){e.connectedCallback=Y(e.connectedCallback,t),e.componentWillLoad=Ae(e.componentWillLoad,t),e.componentDidUnload=V(e.componentDidUnload),e.disconnectedCallback=V(e.disconnectedCallback)}function Y(e,t){return async function(...r){W.set(this,!0),S.set(this,[]),await q(this);const n=new ge(this.context);we(this,"context",n);for(const o of t)o.options=o.optionFactory(o.options,this),Re(o.options)&&(o.options.context=n),je(this,o);if(e)return e.apply(this,r)}}function Ae(e,t){return async function(...r){return W.get(this)===!0?(await q(this),e?e.apply(this,r):void 0):Y(e,t).apply(this,r)}}function V(e){return async function(...t){let r;return e&&(r=e.apply(this,t)),Pe(this),r}}function Re(e){return"context"in e}function q(e){const t=[];return e.platform||t.push(U(e,"platform")),e.context||t.push(U(e,"context")),t.length===0?Promise.resolve():Promise.all(t)}function U(e,t){const r=F.getElement(e);return new Promise(n=>{Object.defineProperty(r,t,{configurable:!0,set:o=>{delete r[t],r[t]=o,n()}})})}function we(e,t,r){const n=F.getElement(e),{get:o,set:i}=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),t);Object.defineProperty(n,t,{configurable:!0,get:o,set:function(s){i.call(this,s),r.next(s)}})}function je(e,t){const r=Ie(e,t);if(typeof r!="function")return;S.get(e).push(r)}function Pe(e){const t=S.get(e);for(const r of t)r();S.set(e,[])}function De(e,t){return r=>{e[t]=r}}function Ie(e,t){const r={...t.options};Ne(r,e);const n=t.service.name,o=e.platform;if(!o.has(n))throw new Error(`Service ${n} does not exist`);return o.get(n)[t.service.method](De(e,t.name),r)}function Ne(e,t){e.filter&&(e.filter=e.filter.map(r=>r.bind(t))),e.map&&(e.map=e.map.map(r=>r.bind(t)))}function Me(e={}){const t={name:c.LimeTypeRepository};return l(e,t)}function Le(e={}){const t={name:c.LimeTypeRepository};return e.map=[Te,...e.map||[]],e.context=null,l(e,t)}function Te(e){const{limetype:t}=this.context;return e[t]}const xe=e=>t=>Object.values(t).find(P(e));function $e(e,t){return Object.values(e.properties).filter(r=>r.type===t)}function Ve(e,t){return Object.values(e.properties).find(P(t))}function Ue(e,t){return e.properties[t]}const P=e=>t=>t?.label===e,Fe="state.limeobjects";c.LimeObjectRepository=Fe;function Be(e={}){const t={name:c.LimeObjectRepository,optionFactory:He};return l(e,t)}function ke(e={}){const t={name:c.LimeObjectRepository};return e.map=[Ge,...e.map||[]],e.context=null,l(e,t)}function Ge(e){const{limetype:t,id:r}=this.context;if(e[t])return e[t].find(n=>n.id===r)}function He(e,t){return e.getLimetype&&(e.limetype=e.getLimetype(t)),e}var K=(e=>(e.Received="command.received",e.Handled="command.handled",e.Failed="command.failed",e))(K||{});function d(e){return t=>{Qe(t,e.id),We(t,e.id)}}function Qe(e,t){e.commandId=t}function We(e,t){Object.defineProperty(e,Symbol.hasInstance,{value:r=>J(r).includes(t)})}function X(e){return typeof e=="string"?e:e&&e.constructor&&e.constructor.commandId?e.constructor.commandId:e&&e.commandId?e.commandId:null}function J(e){let t=[],r,n=e;for(;r=X(n);)t=[...t,r],n=Object.getPrototypeOf(n);return[...new Set(t)]}const Ye="commandBus";c.CommandBus=Ye;var qe=Object.getOwnPropertyDescriptor,Ke=(e,t,r,n)=>{for(var o=n>1?void 0:n?qe(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=s(o)||o);return o};const Xe="limeobject.bulk-create-dialog";exports.BulkCreateDialogCommand=class{};exports.BulkCreateDialogCommand=Ke([d({id:Xe})],exports.BulkCreateDialogCommand);var Je=Object.getOwnPropertyDescriptor,Ze=(e,t,r,n)=>{for(var o=n>1?void 0:n?Je(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=s(o)||o);return o};const ze="limeobject.create-dialog";exports.CreateLimeobjectDialogCommand=class{constructor(){this.route=!1}};exports.CreateLimeobjectDialogCommand=Ze([d({id:ze})],exports.CreateLimeobjectDialogCommand);var et=Object.getOwnPropertyDescriptor,tt=(e,t,r,n)=>{for(var o=n>1?void 0:n?et(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=s(o)||o);return o};const rt="limeobject.delete-object";exports.DeleteObjectCommand=class{};exports.DeleteObjectCommand=tt([d({id:rt})],exports.DeleteObjectCommand);var nt=Object.getOwnPropertyDescriptor,ot=(e,t,r,n)=>{for(var o=n>1?void 0:n?nt(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=s(o)||o);return o};const it="limeobject.object-access";exports.OpenObjectAccessDialogCommand=class{};exports.OpenObjectAccessDialogCommand=ot([d({id:it})],exports.OpenObjectAccessDialogCommand);var st=Object.getOwnPropertyDescriptor,ct=(e,t,r,n)=>{for(var o=n>1?void 0:n?st(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=s(o)||o);return o};const at="limeobject.save-object";exports.SaveLimeObjectCommand=class{constructor(){this.route=!1}};exports.SaveLimeObjectCommand=ct([d({id:at})],exports.SaveLimeObjectCommand);var Z=(e=>(e.AND="AND",e.OR="OR",e.NOT="!",e.EQUALS="=",e.NOT_EQUALS="!=",e.GREATER=">",e.LESS="<",e.IN="IN",e.BEGINS="=?",e.LIKE="?",e.LESS_OR_EQUAL="<=",e.GREATER_OR_EQUAL=">=",e.ENDS="=$",e))(Z||{});const ut={Count:"COUNT",Sum:"SUM",Average:"AVG",Maximum:"MAX",Minimum:"MIN"},lt="query";c.Query=lt;const ft={Get:"GET",Post:"POST",Put:"PUT",Delete:"DELETE",Patch:"PATCH"},pt="http";c.Http=pt;const dt="eventDispatcher";c.EventDispatcher=dt;const mt="translate";c.Translate=mt;const ht="dialog";c.Dialog=ht;const yt="keybindingRegistry";c.KeybindingRegistry=yt;const bt="navigator";c.Navigator=bt;function vt(e){const t={name:c.Navigator};return l({context:null,...e},t)}var St=Object.getOwnPropertyDescriptor,Et=(e,t,r,n)=>{for(var o=n>1?void 0:n?St(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=s(o)||o);return o};const gt="navigator.navigate";exports.NavigateCommand=class{};exports.NavigateCommand=Et([d({id:gt})],exports.NavigateCommand);const Ct="notifications";c.Notification=Ct;const _t="routeRegistry";c.RouteRegistry=_t;var z=(e=>(e.Pending="PENDING",e.Started="STARTED",e.Retry="RETRY",e.Success="SUCCESS",e.Failure="FAILURE",e))(z||{}),ee=(e=>(e.Created="task.created",e.Success="task.success",e.Failed="task.failed",e))(ee||{});const Ot="state.tasks";c.TaskRepository=Ot;const At="state.configs";c.ConfigRepository=At;function Rt(e){const t={name:c.ConfigRepository};return l(e,t)}const wt="state.device";c.Device=wt;function jt(e={}){const t={name:c.Device};return l(e,t)}const Pt="state.filters";c.FilterRepository=Pt;function Dt(e={}){const t={name:c.FilterRepository};return l(e,t)}const It="state.user-data";c.UserDataRepository=It;function Nt(e={}){const t={name:c.UserDataRepository};return l(e,t)}const Mt="state.application";c.Application=Mt;function Lt(e={}){const t={name:c.Application};return e.map=[Tt,...e.map||[]],l(e,t)}function Tt(e){return e.applicationName}function xt(e={}){const t={name:c.Application};return e.map=[$t,...e.map||[]],l(e,t)}function $t(e){return e.currentUser}function Vt(e={}){const t={name:c.Application};return e.map=[Ut,...e.map||[]],l(e,t)}function Ut(e){return e.session}const Ft="userPreferences";c.UserPreferencesRepository=Ft;const Bt="datetimeformatter";c.DateTimeFormatter=Bt;function kt(e){return e.type==="limeobject"}function Gt(e){return e.type==="action"}const Ht="conditionRegistry";c.ConditionRegistry=Ht;const Qt="viewFactoryRegistry";c.ViewFactoryRegistry=Qt;const Wt="webComponentRegistry";c.WebComponentRegistry=Wt;const Yt="state.notifications";c.NotificationRepository=Yt;const qt="pollerFactory";c.PollerFactory=qt;exports.AggregateOperator=ut;exports.Command=d;exports.CommandEventName=K;exports.HttpMethod=ft;exports.IdleStateEventName=re;exports.Operator=Z;exports.PlatformServiceName=c;exports.SelectApplicationName=Lt;exports.SelectConfig=Rt;exports.SelectCurrentLimeObject=ke;exports.SelectCurrentLimeType=Le;exports.SelectCurrentUser=xt;exports.SelectDevice=jt;exports.SelectFilters=Dt;exports.SelectLimeObjects=Be;exports.SelectLimeTypes=Me;exports.SelectQueryParam=vt;exports.SelectSession=Vt;exports.SelectUserData=Nt;exports.TaskEventType=ee;exports.TaskState=z;exports.findLimetypeByLabel=xe;exports.getCommandId=X;exports.getCommandIds=J;exports.getPropertiesByType=$e;exports.getPropertyByLabel=Ve;exports.getPropertyByName=Ue;exports.hasLabel=P;exports.isActionCondition=Gt;exports.isDate=ie;exports.isFloat=ce;exports.isLimeObjectCondition=kt;exports.isRelation=ne;exports.isSingleRelation=oe;exports.isString=se;
4
- //# sourceMappingURL=index.cjs.js.map