@uniformdev/mesh-sdk 17.5.0 → 17.5.1-alpha.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +78 -78
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,82 +1,5 @@
1
+ import { DataSourceInfo, DataType, DataResourceVariables, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataSource } from '@uniformdev/canvas';
1
2
  import { Emitter } from 'mitt';
2
- import { RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataSource, DataSourceInfo, DataType, DataResourceVariables } from '@uniformdev/canvas';
3
-
4
- /** Core shared generic for a mesh location context */
5
- interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TValue, TType extends MeshLocationTypes = MeshLocationTypes> {
6
- /** The current location type (where in the Uniform app the mesh app is rendering) */
7
- type: TType;
8
- /** If true, any editable fields on the current location should be disabled as the user does not have permission or otherwise cannot change them. */
9
- isReadOnly: boolean;
10
- /** @deprecated use value property instead */
11
- getValue: () => TValue;
12
- /** The current value of the location. Some locations have fixed types (i.e. dataType), and others have user-selected types (i.e. paramType) */
13
- value: TValue;
14
- /**
15
- * Sets the current value of the location.
16
- * All locations other than 'settings' update into a parent form state and should be updated live as changes occur in the Mesh app.
17
- * The 'settings' location writes to the database each time its value is set, and it should be treated as a form with a submit button.
18
- */
19
- setValue: (value: TSetValue, options?: SetValueOptions) => Promise<void>;
20
- /** @deprecated use metadata property instead */
21
- getMetadata: () => TMetadata;
22
- /**
23
- * Gets the current location metadata, context data which is provided from the Uniform app to assist in rendering the Mesh UI
24
- * Each location has a specific type of metadata that it is provided, which is typed automatically when the location is known.
25
- */
26
- metadata: TMetadata;
27
- /**
28
- * Instructs Uniform to set the validity of the location in the parent app.
29
- * @deprecated - use setValue(value, validationResult) instead
30
- */
31
- setValidationResult: (value: ValidationResult) => Promise<void>;
32
- /**
33
- * Context of a location when it is rendering inside a dialog in the Uniform app.
34
- * This is set when:
35
- * - You pop out the app using sdk.openCurrentLocationDialog() so the location is rendered in a dialog for more screen space
36
- * - The current location is a named dialog that was opened from the location using sdk.openLocationDialog()
37
- *
38
- * This is undefined when the current location is not a dialog.
39
- */
40
- dialogContext?: DialogContext & {
41
- /** Parameters passed to the dialog when it was opened */
42
- params: unknown;
43
- /**
44
- * Returns a result to the dialog opener.
45
- */
46
- returnDialogValue: (value: unknown) => Promise<void>;
47
- };
48
- }
49
- /**
50
- * Known location types that can be passed to a mesh location
51
- */
52
- declare type MeshLocationTypes = 'paramType' | 'paramTypeConfig' | 'settings' | 'dataSource' | 'dataType' | 'dataTypeInstance';
53
- declare type SetValueOptions = ValidationResult;
54
-
55
- declare type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
56
- rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
57
- parameterConfiguration: TParamConfiguration;
58
- component: Omit<ComponentInstance, 'slots' | '_parameters' | '_id'>;
59
- componentDefinitions: Record<string, ComponentDefinition | undefined>;
60
- parameterDefinition: ComponentDefinitionParameter;
61
- settings: TIntegrationConfiguration;
62
- projectId: string;
63
- };
64
- declare type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
65
-
66
- declare type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
67
- settings: TIntegrationConfiguration;
68
- projectId: string;
69
- };
70
- declare type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
71
-
72
- declare type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, undefined, TSettingsType, 'settings'>;
73
-
74
- declare type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'headers' | 'parameters' | 'variables'>;
75
- declare type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = {
76
- settings: TIntegrationConfiguration;
77
- projectId: string;
78
- };
79
- declare type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
80
3
 
81
4
  declare type DataTypeValue = Pick<DataType, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
82
5
  declare type DataConnectorInfo = {
@@ -100,6 +23,19 @@ declare type DataTypeInstanceLocationMetadata<TIntegrationConfiguration = unknow
100
23
  };
101
24
  declare type DataTypeInstanceLocation = MeshLocationCore<DataResourceVariables, DataTypeInstanceLocationMetadata, DataResourceVariables, 'dataTypeInstance'>;
102
25
 
26
+ declare type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
27
+ rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
28
+ parameterConfiguration: TParamConfiguration;
29
+ component: Omit<ComponentInstance, 'slots' | '_parameters' | '_id'>;
30
+ componentDefinitions: Record<string, ComponentDefinition | undefined>;
31
+ parameterDefinition: ComponentDefinitionParameter;
32
+ settings: TIntegrationConfiguration;
33
+ projectId: string;
34
+ };
35
+ declare type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
36
+
37
+ declare type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, undefined, TSettingsType, 'settings'>;
38
+
103
39
  /**
104
40
  * Defines methods used for interacting with a Mesh location
105
41
  * To receive useful typings, check the `type` property of the location to narrow the typing.
@@ -188,6 +124,70 @@ declare type ValidationResult = {
188
124
  isValid: true;
189
125
  };
190
126
 
127
+ /** Core shared generic for a mesh location context */
128
+ interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TValue, TType extends MeshLocationTypes = MeshLocationTypes> {
129
+ /** The current location type (where in the Uniform app the mesh app is rendering) */
130
+ type: TType;
131
+ /** If true, any editable fields on the current location should be disabled as the user does not have permission or otherwise cannot change them. */
132
+ isReadOnly: boolean;
133
+ /** @deprecated use value property instead */
134
+ getValue: () => TValue;
135
+ /** The current value of the location. Some locations have fixed types (i.e. dataType), and others have user-selected types (i.e. paramType) */
136
+ value: TValue;
137
+ /**
138
+ * Sets the current value of the location.
139
+ * All locations other than 'settings' update into a parent form state and should be updated live as changes occur in the Mesh app.
140
+ * The 'settings' location writes to the database each time its value is set, and it should be treated as a form with a submit button.
141
+ */
142
+ setValue: (value: TSetValue, options?: SetValueOptions) => Promise<void>;
143
+ /** @deprecated use metadata property instead */
144
+ getMetadata: () => TMetadata;
145
+ /**
146
+ * Gets the current location metadata, context data which is provided from the Uniform app to assist in rendering the Mesh UI
147
+ * Each location has a specific type of metadata that it is provided, which is typed automatically when the location is known.
148
+ */
149
+ metadata: TMetadata;
150
+ /**
151
+ * Instructs Uniform to set the validity of the location in the parent app.
152
+ * @deprecated - use setValue(value, validationResult) instead
153
+ */
154
+ setValidationResult: (value: ValidationResult) => Promise<void>;
155
+ /**
156
+ * Context of a location when it is rendering inside a dialog in the Uniform app.
157
+ * This is set when:
158
+ * - You pop out the app using sdk.openCurrentLocationDialog() so the location is rendered in a dialog for more screen space
159
+ * - The current location is a named dialog that was opened from the location using sdk.openLocationDialog()
160
+ *
161
+ * This is undefined when the current location is not a dialog.
162
+ */
163
+ dialogContext?: DialogContext & {
164
+ /** Parameters passed to the dialog when it was opened */
165
+ params: unknown;
166
+ /**
167
+ * Returns a result to the dialog opener.
168
+ */
169
+ returnDialogValue: (value: unknown) => Promise<void>;
170
+ };
171
+ }
172
+ /**
173
+ * Known location types that can be passed to a mesh location
174
+ */
175
+ declare type MeshLocationTypes = 'paramType' | 'paramTypeConfig' | 'settings' | 'dataSource' | 'dataType' | 'dataTypeInstance';
176
+ declare type SetValueOptions = ValidationResult;
177
+
178
+ declare type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'headers' | 'parameters' | 'variables'>;
179
+ declare type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = {
180
+ settings: TIntegrationConfiguration;
181
+ projectId: string;
182
+ };
183
+ declare type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
184
+
185
+ declare type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
186
+ settings: TIntegrationConfiguration;
187
+ projectId: string;
188
+ };
189
+ declare type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
190
+
191
191
  interface SdkWindow {
192
192
  /** The current window object. */
193
193
  instance: Window;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk",
3
- "version": "17.5.0",
3
+ "version": "17.5.1-alpha.130+3fac779b1",
4
4
  "description": "Uniform Mesh Framework SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@uniformdev/canvas": "^17.5.0",
32
+ "@uniformdev/canvas": "^17.5.1-alpha.130+3fac779b1",
33
33
  "mitt": "^3.0.0"
34
34
  },
35
- "gitHead": "de1f52defe798010336e1dd3b2732fce359855fb"
35
+ "gitHead": "3fac779b1b42a1afeb05156cb51768a98573438f"
36
36
  }