@limetech/lime-web-components 6.4.0 → 6.5.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 +16 -0
- package/dist/action/action.d.ts +305 -13
- package/dist/action/action.d.ts.map +1 -1
- package/dist/application/decorators/application.d.ts +57 -3
- package/dist/application/decorators/application.d.ts.map +1 -1
- package/dist/application/decorators/session.d.ts +44 -3
- package/dist/application/decorators/session.d.ts.map +1 -1
- package/dist/application/decorators/user.d.ts +47 -3
- package/dist/application/decorators/user.d.ts.map +1 -1
- package/dist/application/repository.d.ts +102 -5
- package/dist/application/repository.d.ts.map +1 -1
- package/dist/application/session.d.ts +105 -15
- package/dist/application/session.d.ts.map +1 -1
- package/dist/application/user.d.ts +122 -13
- package/dist/application/user.d.ts.map +1 -1
- package/dist/commandbus/commandbus.d.ts +364 -23
- package/dist/commandbus/commandbus.d.ts.map +1 -1
- package/dist/conditionregistry/conditionregistry.d.ts +310 -27
- package/dist/conditionregistry/conditionregistry.d.ts.map +1 -1
- package/dist/config/decorator.d.ts +50 -3
- package/dist/config/decorator.d.ts.map +1 -1
- package/dist/config/repository.d.ts +131 -10
- package/dist/config/repository.d.ts.map +1 -1
- package/dist/core/context.d.ts +94 -4
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/lime-web-component.d.ts +59 -3
- package/dist/core/lime-web-component.d.ts.map +1 -1
- package/dist/core/metadata.d.ts +113 -13
- package/dist/core/metadata.d.ts.map +1 -1
- package/dist/core/platform.d.ts +175 -14
- package/dist/core/platform.d.ts.map +1 -1
- package/dist/core/state.d.ts +138 -14
- package/dist/core/state.d.ts.map +1 -1
- package/dist/datetimeformatter/datetimeformatter.d.ts +97 -34
- package/dist/datetimeformatter/datetimeformatter.d.ts.map +1 -1
- package/dist/device/decorator.d.ts +56 -4
- package/dist/device/decorator.d.ts.map +1 -1
- package/dist/device/device.d.ts +51 -6
- package/dist/device/device.d.ts.map +1 -1
- package/dist/dialog/dialog.d.ts +155 -19
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/limeobject/file.d.ts +6 -0
- package/dist/limeobject/file.d.ts.map +1 -1
- package/package.json +10 -9
package/dist/core/context.d.ts
CHANGED
|
@@ -1,19 +1,109 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Describes the context in which a Lime Web Component is running.
|
|
3
|
+
*
|
|
4
|
+
* The context provides information about the current business object (limetype and ID)
|
|
5
|
+
* that the component is associated with. This allows components to load and interact
|
|
6
|
+
* with the relevant data based on where they are displayed in the application.
|
|
7
|
+
*
|
|
8
|
+
* Contexts can be nested when components are embedded within other components,
|
|
9
|
+
* allowing for hierarchical relationships between different views.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Component running in a customer detail view
|
|
14
|
+
* const context: LimeWebComponentContext = {
|
|
15
|
+
* limetype: 'customer',
|
|
16
|
+
* id: 12345
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* // Component on a list view (no specific record)
|
|
20
|
+
* const listContext: LimeWebComponentContext = {
|
|
21
|
+
* limetype: 'customer',
|
|
22
|
+
* id: null
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* // Nested context - contact list within a customer view
|
|
26
|
+
* const nestedContext: LimeWebComponentContext = {
|
|
27
|
+
* limetype: 'contact',
|
|
28
|
+
* id: null,
|
|
29
|
+
* parent: {
|
|
30
|
+
* limetype: 'customer',
|
|
31
|
+
* id: 12345
|
|
32
|
+
* }
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Load related data based on parent context
|
|
39
|
+
* const repo = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
40
|
+
*
|
|
41
|
+
* if (context.parent?.limetype === 'customer' && context.parent.id) {
|
|
42
|
+
* const result = await repo.loadObjects('contact', {
|
|
43
|
+
* filter: {
|
|
44
|
+
* key: 'customer',
|
|
45
|
+
* op: '=',
|
|
46
|
+
* exp: context.parent.id
|
|
47
|
+
* }
|
|
48
|
+
* });
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
3
52
|
* @public
|
|
4
53
|
* @group Core
|
|
5
54
|
*/
|
|
6
55
|
export interface LimeWebComponentContext {
|
|
7
56
|
/**
|
|
8
|
-
* The name of the
|
|
57
|
+
* The name of the {@link LimeType} for this context.
|
|
58
|
+
*
|
|
59
|
+
* This identifies what type of business object the component is working with
|
|
60
|
+
* (e.g., 'customer', 'contact', 'deal', 'invoice'). Can be `null` if the
|
|
61
|
+
* component is not associated with a specific limetype.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* if (context.limetype === 'customer') {
|
|
66
|
+
* // Load customer-specific data and features
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
9
69
|
*/
|
|
10
70
|
limetype: string | null;
|
|
11
71
|
/**
|
|
12
|
-
* The
|
|
72
|
+
* The ID of the specific limeobject (record) in this context.
|
|
73
|
+
*
|
|
74
|
+
* When set, indicates the component is viewing/editing a specific record.
|
|
75
|
+
* When `null`, the component may be on a list view or creating a new record.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* if (context.id) {
|
|
80
|
+
* // Load and display the specific record
|
|
81
|
+
* const object = await repo.loadObject(context.limetype, context.id);
|
|
82
|
+
* } else {
|
|
83
|
+
* // Show list view or new record form
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
13
86
|
*/
|
|
14
87
|
id: number | null;
|
|
15
88
|
/**
|
|
16
|
-
* Optional parent context
|
|
89
|
+
* Optional parent context when this component is nested within another.
|
|
90
|
+
*
|
|
91
|
+
* Used when components are embedded in other components to maintain the
|
|
92
|
+
* relationship hierarchy. For example, a contact list component shown
|
|
93
|
+
* within a customer detail view would have the customer as its parent context.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* // Check if running within another context
|
|
98
|
+
* if (context.parent) {
|
|
99
|
+
* console.log(`Nested within ${context.parent.limetype}`);
|
|
100
|
+
*
|
|
101
|
+
* // Load data filtered by parent
|
|
102
|
+
* if (context.parent.id) {
|
|
103
|
+
* const relatedRecords = await loadRelatedToParent(context.parent);
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
17
107
|
*/
|
|
18
108
|
parent?: LimeWebComponentContext;
|
|
19
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,WAAW,uBAAuB;IACpC;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;;;;;;;;;;;;;OAeG;IACH,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAElB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;CACpC"}
|
|
@@ -1,17 +1,73 @@
|
|
|
1
1
|
import { LimeWebComponentContext } from './context';
|
|
2
2
|
import { LimeWebComponentPlatform } from './platform';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Base interface that all Lime Web Components must implement.
|
|
5
|
+
*
|
|
6
|
+
* This interface ensures that every component has access to the {@link LimeWebComponentPlatform}
|
|
7
|
+
* service container and understands its {@link LimeWebComponentContext} within the application.
|
|
8
|
+
* In Stencil components, these are injected as properties using the `@Prop` decorator.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Access services through platform
|
|
13
|
+
* const repo = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
14
|
+
*
|
|
15
|
+
* // Use context to understand where component is running
|
|
16
|
+
* console.log(`Running for ${context.limetype} with id ${context.id}`);
|
|
17
|
+
*
|
|
18
|
+
* // Load the current object if context has an ID
|
|
19
|
+
* if (context.id) {
|
|
20
|
+
* const limeObject = await repo.loadObject(context.limetype, context.id);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Check if running in a nested context
|
|
27
|
+
* if (context.parent) {
|
|
28
|
+
* console.log(`Parent: ${context.parent.limetype}/${context.parent.id}`);
|
|
29
|
+
* console.log(`Current: ${context.limetype}`);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* The platform and context properties are fundamental to component operation:
|
|
35
|
+
* - `platform` provides access to all services (repositories, HTTP, command bus, etc.)
|
|
36
|
+
* - `context` describes where the component is running (which limetype, which record)
|
|
37
|
+
*
|
|
5
38
|
* @public
|
|
6
39
|
* @group Core
|
|
7
40
|
*/
|
|
8
41
|
export interface LimeWebComponent {
|
|
9
42
|
/**
|
|
10
|
-
* Reference to the platform
|
|
43
|
+
* Reference to the platform service container.
|
|
44
|
+
*
|
|
45
|
+
* Use this to access all platform services like repositories, HTTP client,
|
|
46
|
+
* command bus, navigator, and more. The platform instance is shared across
|
|
47
|
+
* all components in the same application context.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const http = platform.get(PlatformServiceName.Http);
|
|
52
|
+
* const commandBus = platform.get(PlatformServiceName.CommandBus);
|
|
53
|
+
* ```
|
|
11
54
|
*/
|
|
12
55
|
platform: LimeWebComponentPlatform;
|
|
13
56
|
/**
|
|
14
|
-
* The context this component
|
|
57
|
+
* The context describing where this component is running.
|
|
58
|
+
*
|
|
59
|
+
* The context provides information about the current limetype and record ID
|
|
60
|
+
* (if viewing/editing a specific record). Components can use this to load
|
|
61
|
+
* relevant data and understand their operating environment.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* // Load current record if we have an ID
|
|
66
|
+
* if (context.id) {
|
|
67
|
+
* const repo = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
68
|
+
* const object = await repo.loadObject(context.limetype, context.id);
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
15
71
|
*/
|
|
16
72
|
context: LimeWebComponentContext;
|
|
17
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lime-web-component.d.ts","sourceRoot":"","sources":["../../src/core/lime-web-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"lime-web-component.d.ts","sourceRoot":"","sources":["../../src/core/lime-web-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;;;;;;;OAYG;IACH,QAAQ,EAAE,wBAAwB,CAAC;IAEnC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAE,uBAAuB,CAAC;CACpC"}
|
package/dist/core/metadata.d.ts
CHANGED
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
import { Icon } from './icon';
|
|
2
2
|
import { LimeWebComponentPlatform } from './platform';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Extensible metadata for registered resources in the Lime CRM platform.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* This metadata structure is used to describe various resources like web components,
|
|
7
|
+
* commands, actions, and other extensible elements. It provides a consistent way to
|
|
8
|
+
* attach human-readable information, icons, tags, and configuration components to
|
|
9
|
+
* any registered resource.
|
|
10
|
+
*
|
|
11
|
+
* Resources that use this metadata include:
|
|
12
|
+
* - Web components (via WebComponentRegistry)
|
|
13
|
+
* - Commands (via CommandBus and `@Command` decorator)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Register a web component with metadata
|
|
18
|
+
* registry.register('customer-insights', {
|
|
19
|
+
* title: 'Customer Insights',
|
|
20
|
+
* description: 'Advanced analytics dashboard for customer behavior',
|
|
21
|
+
* icon: 'chart-line',
|
|
22
|
+
* tags: ['card-widget', 'start-page'],
|
|
23
|
+
* configComponent: {
|
|
24
|
+
* name: 'customer-insights-config',
|
|
25
|
+
* props: { defaultView: 'monthly' }
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Register a command with metadata
|
|
33
|
+
* @Command({ id: 'export-to-excel' })
|
|
34
|
+
* class ExportToExcelCommand {
|
|
35
|
+
* // Command implementation
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // Metadata is provided when registering the command
|
|
39
|
+
* commandBus.register(ExportToExcelCommand, handler, {
|
|
40
|
+
* title: 'Export to Excel',
|
|
41
|
+
* description: 'Export selected records to Microsoft Excel',
|
|
42
|
+
* icon: { name: 'file-excel', color: 'green' },
|
|
43
|
+
* tags: ['bulk-object']
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
8
46
|
*
|
|
9
47
|
* @see {@link WebComponentRegistry.register | WebComponentRegistry.register}
|
|
10
48
|
* @see {@link CommandBus | CommandBus}
|
|
@@ -14,45 +52,107 @@ import { LimeWebComponentPlatform } from './platform';
|
|
|
14
52
|
*/
|
|
15
53
|
export type ConfigMetadata = {
|
|
16
54
|
/**
|
|
17
|
-
* Human
|
|
55
|
+
* Human-readable display name for the resource.
|
|
56
|
+
*
|
|
57
|
+
* This should be a concise, user-friendly name that appears in UI elements
|
|
58
|
+
* like menus, toolbars, and configuration screens.
|
|
18
59
|
*/
|
|
19
60
|
title?: string;
|
|
20
61
|
/**
|
|
21
|
-
*
|
|
62
|
+
* Detailed description of what the resource does.
|
|
63
|
+
*
|
|
64
|
+
* Provide helpful context about the resource's purpose, functionality,
|
|
65
|
+
* and any important usage notes. This typically appears in tooltips or
|
|
66
|
+
* help documentation.
|
|
22
67
|
*/
|
|
23
68
|
description?: string;
|
|
24
69
|
/**
|
|
25
|
-
* Icon
|
|
70
|
+
* Icon to visually represent the resource.
|
|
71
|
+
*
|
|
72
|
+
* Can be either a string referencing an icon name from the icon library,
|
|
73
|
+
* or an Icon object with additional properties like color and style.
|
|
26
74
|
*/
|
|
27
75
|
icon?: string | Icon;
|
|
28
76
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
77
|
+
* Semantic tags for categorization and context-aware filtering.
|
|
78
|
+
*
|
|
79
|
+
* Tags help the platform determine where a component can be placed and when
|
|
80
|
+
* it is relevant for a given context. These tags typically describe the slot
|
|
81
|
+
* types or contexts that the component is suited for.
|
|
82
|
+
*
|
|
83
|
+
* The available tags are platform-specific and depend on the extensibility
|
|
84
|
+
* points provided by the host application.
|
|
31
85
|
*/
|
|
32
86
|
tags?: string[];
|
|
33
87
|
/**
|
|
34
|
-
*
|
|
88
|
+
* Optional configuration UI component for this resource.
|
|
89
|
+
*
|
|
90
|
+
* Specifies a web component that provides a configuration interface for
|
|
91
|
+
* customizing the resource's behavior. This is typically used in admin
|
|
92
|
+
* interfaces or setup wizards.
|
|
35
93
|
*/
|
|
36
94
|
configComponent?: {
|
|
37
95
|
/**
|
|
38
|
-
* Tag name of the web component
|
|
96
|
+
* Tag name of the configuration web component.
|
|
97
|
+
*
|
|
98
|
+
* Must be a registered web component that can receive the specified props.
|
|
39
99
|
*/
|
|
40
100
|
name: string;
|
|
41
101
|
/**
|
|
42
|
-
*
|
|
102
|
+
* Initial properties to pass to the configuration component.
|
|
103
|
+
*
|
|
104
|
+
* These props configure the initial state of the configuration UI.
|
|
43
105
|
*/
|
|
44
106
|
props?: Record<string, unknown>;
|
|
45
107
|
};
|
|
46
108
|
};
|
|
47
109
|
/**
|
|
48
|
-
* Metadata
|
|
110
|
+
* Metadata describing a package or addon using Lime Web Components.
|
|
111
|
+
*
|
|
112
|
+
* This metadata is defined in the package's `package.json` file under the
|
|
113
|
+
* `lime` field. The system reads this metadata before installing
|
|
114
|
+
* a package to ensure compatibility between the package and the target
|
|
115
|
+
* Lime CRM client environment.
|
|
116
|
+
*
|
|
117
|
+
* Packages should declare which platforms they support to prevent installation
|
|
118
|
+
* in incompatible environments.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```json
|
|
122
|
+
* // In package.json
|
|
123
|
+
* {
|
|
124
|
+
* "name": "my-addon",
|
|
125
|
+
* "version": "1.0.0",
|
|
126
|
+
* "lime": {
|
|
127
|
+
* "platforms": ["LimeCRMWebClient", "LimeCRMDesktopClient"]
|
|
128
|
+
* }
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
49
131
|
*
|
|
50
132
|
* @group Core
|
|
51
133
|
* @beta
|
|
52
134
|
*/
|
|
53
135
|
export interface LimePackageMetadata {
|
|
54
136
|
/**
|
|
55
|
-
*
|
|
137
|
+
* List of platform types this package is compatible with.
|
|
138
|
+
*
|
|
139
|
+
* If specified, the package will only be loaded on the listed platforms.
|
|
140
|
+
* Omitting this field means the package is compatible with all platforms.
|
|
141
|
+
*
|
|
142
|
+
* Platform types:
|
|
143
|
+
* - `LimeCRMWebClient` - Standard web browser client
|
|
144
|
+
* - `LimeCRMDesktopClient` - Desktop application client
|
|
145
|
+
* - `LimeCRMWebAdminClient` - Administrative web interface
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```json
|
|
149
|
+
* // Web-only package
|
|
150
|
+
* {
|
|
151
|
+
* "lime": {
|
|
152
|
+
* "platforms": ["LimeCRMWebClient", "LimeCRMWebAdminClient"]
|
|
153
|
+
* }
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
56
156
|
*/
|
|
57
157
|
platforms?: Array<LimeWebComponentPlatform['type']>;
|
|
58
158
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/core/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAK9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/core/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAK9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE;QACd;;;;WAIG;QACH,IAAI,EAAE,MAAM,CAAC;QAEb;;;;WAIG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;CACL,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC;CACvD"}
|
package/dist/core/platform.d.ts
CHANGED
|
@@ -1,53 +1,214 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Service container for the Lime CRM platform
|
|
2
|
+
* Service container for the Lime CRM platform that provides access to all platform services.
|
|
3
|
+
*
|
|
4
|
+
* The platform acts as a service locator for accessing repositories, the command bus,
|
|
5
|
+
* HTTP client, and other services throughout the application. It is used by web components
|
|
6
|
+
* (injected via Stencil's `@Prop` decorator), command handlers, and other parts of the system.
|
|
7
|
+
*
|
|
8
|
+
* The platform type indicates which Lime CRM client is hosting the component:
|
|
9
|
+
* - `LimeCRMWebClient`: Standard web client
|
|
10
|
+
* - `LimeCRMDesktopClient`: Desktop application client
|
|
11
|
+
* - `LimeCRMWebAdminClient`: Administrative web interface
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Get core services
|
|
16
|
+
* const http = platform.get(PlatformServiceName.Http);
|
|
17
|
+
* const commandBus = platform.get(PlatformServiceName.CommandBus);
|
|
18
|
+
* const limetypes = platform.get(PlatformServiceName.LimeTypeRepository);
|
|
19
|
+
*
|
|
20
|
+
* // Check platform type for conditional logic
|
|
21
|
+
* if (platform.type === 'LimeCRMDesktopClient') {
|
|
22
|
+
* // Desktop-specific functionality
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Check feature switches
|
|
26
|
+
* if (platform.isFeatureEnabled('newFeature')) {
|
|
27
|
+
* // Use new feature
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Register a custom service (third-party plugins)
|
|
34
|
+
* platform.register('myPlugin.analytics', new AnalyticsService());
|
|
35
|
+
*
|
|
36
|
+
* // Later retrieve it
|
|
37
|
+
* const analytics = platform.get('myPlugin.analytics');
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
3
40
|
* @public
|
|
4
41
|
* @group Core
|
|
5
42
|
*/
|
|
6
43
|
export interface LimeWebComponentPlatform {
|
|
44
|
+
/**
|
|
45
|
+
* The type of Lime CRM client currently running.
|
|
46
|
+
* Use this to conditionally enable features based on the client environment.
|
|
47
|
+
*/
|
|
7
48
|
type: 'LimeCRMWebClient' | 'LimeCRMDesktopClient' | 'LimeCRMWebAdminClient';
|
|
8
49
|
/**
|
|
9
|
-
* Get a service
|
|
50
|
+
* Get a service from the platform container.
|
|
51
|
+
*
|
|
52
|
+
* Services are accessed through the `PlatformServiceName` enum, which can be extended
|
|
53
|
+
* by third-party modules using module augmentation.
|
|
54
|
+
*
|
|
55
|
+
* @param name - The name of the service to retrieve
|
|
56
|
+
* @returns The requested service instance
|
|
10
57
|
*
|
|
11
|
-
* @
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const http = platform.get(PlatformServiceName.Http);
|
|
61
|
+
* const repository = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
62
|
+
* ```
|
|
12
63
|
*/
|
|
13
64
|
get(name: string): any;
|
|
14
65
|
/**
|
|
15
|
-
* Check if a service is currently registered on the platform
|
|
66
|
+
* Check if a service is currently registered on the platform.
|
|
16
67
|
*
|
|
17
|
-
*
|
|
68
|
+
* Useful for optional dependencies or checking service availability.
|
|
69
|
+
*
|
|
70
|
+
* @param name - The name of the service to check
|
|
71
|
+
* @returns `true` if the service is registered, `false` otherwise
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* if (platform.has(PlatformServiceName.Analytics)) {
|
|
76
|
+
* const tracker = platform.get(PlatformServiceName.Analytics);
|
|
77
|
+
* tracker.track('event');
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
18
80
|
*/
|
|
19
81
|
has(name: string): boolean;
|
|
20
82
|
/**
|
|
21
|
-
* Register a service on the platform
|
|
83
|
+
* Register a service on the platform for use throughout the application.
|
|
84
|
+
*
|
|
85
|
+
* Service names are typically defined in the `PlatformServiceName` enum through module
|
|
86
|
+
* augmentation. This ensures type safety and prevents naming conflicts.
|
|
87
|
+
*
|
|
88
|
+
* @param name - The name to register the service under
|
|
89
|
+
* @param service - The service instance to register
|
|
22
90
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const SERVICE_NAME = 'myPlugin.cache';
|
|
94
|
+
* PlatformServiceName.MyCache = SERVICE_NAME;
|
|
25
95
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
96
|
+
* declare module '@limetech/lime-web-components' {
|
|
97
|
+
* interface PlatformServiceNameType {
|
|
98
|
+
* MyCache: typeof SERVICE_NAME;
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* interface LimeWebComponentPlatform {
|
|
102
|
+
* get(name: PlatformServiceNameType['MyCache']): CacheService;
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
*
|
|
106
|
+
* // Register the service
|
|
107
|
+
* platform.register(PlatformServiceName.MyCache, new CacheService());
|
|
108
|
+
* ```
|
|
28
109
|
*/
|
|
29
110
|
register(name: string, service: any): void;
|
|
30
111
|
/**
|
|
31
|
-
* Check if a feature is enabled
|
|
112
|
+
* Check if a feature is enabled in the current environment.
|
|
113
|
+
*
|
|
114
|
+
* Feature switches allow gradual rollout of new functionality and
|
|
115
|
+
* environment-specific behavior. Features can be enabled/disabled
|
|
116
|
+
* at the application, user, or system level.
|
|
117
|
+
*
|
|
118
|
+
* @param name - Name of the feature switch to check
|
|
119
|
+
* @returns `true` if the feature is enabled, `false` otherwise
|
|
32
120
|
*
|
|
33
|
-
* @
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* // Use feature switches for gradual rollout
|
|
124
|
+
* if (platform.isFeatureEnabled('advancedSearch')) {
|
|
125
|
+
* return new AdvancedSearchComponent();
|
|
126
|
+
* } else {
|
|
127
|
+
* return new BasicSearchComponent();
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
34
130
|
*/
|
|
35
131
|
isFeatureEnabled(name: keyof FeatureSwitches): boolean;
|
|
36
132
|
}
|
|
37
133
|
/**
|
|
38
|
-
* Core platform service names
|
|
134
|
+
* Core platform service names for accessing built-in services via the platform.
|
|
135
|
+
*
|
|
136
|
+
* Use these strongly-typed keys to retrieve platform services.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const http = platform.get(PlatformServiceName.Http);
|
|
141
|
+
* const commandBus = platform.get(PlatformServiceName.CommandBus);
|
|
142
|
+
* const limeObjects = platform.get(PlatformServiceName.LimeObjectRepository);
|
|
143
|
+
* const limeTypes = platform.get(PlatformServiceName.LimeTypeRepository);
|
|
144
|
+
* const navigator = platform.get(PlatformServiceName.Navigator);
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* Available services include:
|
|
149
|
+
* - `Http` - HTTP client for API requests
|
|
150
|
+
* - `CommandBus` - Command pattern implementation for actions
|
|
151
|
+
* - `LimeObjectRepository` - CRUD operations for business objects
|
|
152
|
+
* - `LimeTypeRepository` - Schema and metadata access
|
|
153
|
+
* - `Navigator` - Client-side routing
|
|
154
|
+
* - `EventDispatcher` - Event pub/sub system
|
|
155
|
+
* - `Translator` - Localization service
|
|
156
|
+
* - And many more...
|
|
157
|
+
*
|
|
39
158
|
* @public
|
|
40
159
|
* @group Core
|
|
41
160
|
*/
|
|
42
161
|
export declare const PlatformServiceName: PlatformServiceNameType;
|
|
43
162
|
/**
|
|
163
|
+
* Interface for platform service names that gets augmented by each service module.
|
|
164
|
+
*
|
|
165
|
+
* Each platform service extends this interface through module augmentation to add
|
|
166
|
+
* its service name. This pattern provides compile-time type safety for service names.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* // How services augment this interface (done internally by each service):
|
|
171
|
+
* const SERVICE_NAME = 'http';
|
|
172
|
+
* PlatformServiceName.Http = SERVICE_NAME;
|
|
173
|
+
*
|
|
174
|
+
* declare module '@limetech/lime-web-components' {
|
|
175
|
+
* interface PlatformServiceNameType {
|
|
176
|
+
* Http: typeof SERVICE_NAME;
|
|
177
|
+
* }
|
|
178
|
+
*
|
|
179
|
+
* interface LimeWebComponentPlatform {
|
|
180
|
+
* get(name: PlatformServiceNameType['Http']): HttpService;
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
44
185
|
* @public
|
|
45
186
|
* @group Core
|
|
46
187
|
*/
|
|
47
188
|
export interface PlatformServiceNameType {
|
|
48
189
|
}
|
|
49
190
|
/**
|
|
50
|
-
* Available feature switches
|
|
191
|
+
* Available feature switches for conditional functionality.
|
|
192
|
+
*
|
|
193
|
+
* Feature switches enable gradual rollout and A/B testing of new features.
|
|
194
|
+
* This interface is augmented by feature modules to register their switches.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* // How features augment this interface:
|
|
199
|
+
* declare module '@limetech/lime-web-components' {
|
|
200
|
+
* interface FeatureSwitches {
|
|
201
|
+
* advancedSearch: boolean;
|
|
202
|
+
* newUIDesign: boolean;
|
|
203
|
+
* betaFeatures: boolean;
|
|
204
|
+
* }
|
|
205
|
+
* }
|
|
206
|
+
*
|
|
207
|
+
* // Usage in components:
|
|
208
|
+
* if (platform.isFeatureEnabled('advancedSearch')) {
|
|
209
|
+
* // Enable advanced search functionality
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
51
212
|
*
|
|
52
213
|
* @public
|
|
53
214
|
* @group Core
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/core/platform.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/core/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,WAAW,wBAAwB;IACrC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,GAAG,sBAAsB,GAAG,uBAAuB,CAAC;IAE5E;;;;;;;;;;;;;;OAcG;IAEH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAEvB;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IAEH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IAE3C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,eAAe,GAAG,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,uBAEK,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,uBAAuB;CAAG;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,eAAe;CAAG"}
|