lucid-extension-sdk 0.0.405 → 0.0.407

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.
@@ -86,7 +86,6 @@ export type TextBadgeSettings = {
86
86
  maxfontsize?: number | undefined;
87
87
  maxtextwidth?: number | undefined;
88
88
  iswithinpill?: boolean | undefined;
89
- usingcarduirefresh?: boolean | undefined;
90
89
  hasleadingicon?: boolean | undefined;
91
90
  };
92
91
  export interface StencilConfig {
@@ -206,7 +205,6 @@ export declare const isSerializedLucidCardFieldSettings: (subject: unknown) => s
206
205
  maxfontsize: (x: unknown) => x is number | undefined;
207
206
  maxtextwidth: (x: unknown) => x is number | undefined;
208
207
  iswithinpill: (x: unknown) => x is boolean | undefined;
209
- usingcarduirefresh: (x: unknown) => x is boolean | undefined;
210
208
  hasleadingicon: (x: unknown) => x is boolean | undefined;
211
209
  }> | undefined;
212
210
  }> | undefined;
@@ -92,7 +92,6 @@ const isTextBadgeSettings = (0, validators_1.objectValidator)({
92
92
  'maxfontsize': (0, validators_1.option)(checks_1.isNumber),
93
93
  'maxtextwidth': (0, validators_1.option)(checks_1.isNumber),
94
94
  'iswithinpill': (0, validators_1.option)(checks_1.isBoolean),
95
- 'usingcarduirefresh': (0, validators_1.option)(checks_1.isBoolean),
96
95
  'hasleadingicon': (0, validators_1.option)(checks_1.isBoolean),
97
96
  });
98
97
  const isStencilConfig = (0, validators_1.objectValidator)({
@@ -117,7 +116,7 @@ function copyLucidCardFieldDisplaySettings(settings) {
117
116
  exports.copyLucidCardFieldDisplaySettings = copyLucidCardFieldDisplaySettings;
118
117
  /** @ignore */
119
118
  function serializeLucidCardFieldDisplaySettings(settings) {
120
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
119
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
121
120
  return {
122
121
  'StencilConfig': settings.stencilConfig && {
123
122
  'getterKey': settings.stencilConfig.displayType,
@@ -143,8 +142,7 @@ function serializeLucidCardFieldDisplaySettings(settings) {
143
142
  'maxfontsize': (_g = settings.stencilConfig.textBadgeSettings) === null || _g === void 0 ? void 0 : _g.maxfontsize,
144
143
  'maxtextwidth': (_h = settings.stencilConfig.textBadgeSettings) === null || _h === void 0 ? void 0 : _h.maxtextwidth,
145
144
  'iswithinpill': (_j = settings.stencilConfig.textBadgeSettings) === null || _j === void 0 ? void 0 : _j.iswithinpill,
146
- 'usingcarduirefresh': (_k = settings.stencilConfig.textBadgeSettings) === null || _k === void 0 ? void 0 : _k.usingcarduirefresh,
147
- 'hasleadingicon': (_l = settings.stencilConfig.textBadgeSettings) === null || _l === void 0 ? void 0 : _l.hasleadingicon,
145
+ 'hasleadingicon': (_k = settings.stencilConfig.textBadgeSettings) === null || _k === void 0 ? void 0 : _k.hasleadingicon,
148
146
  },
149
147
  },
150
148
  };
@@ -152,7 +150,7 @@ function serializeLucidCardFieldDisplaySettings(settings) {
152
150
  exports.serializeLucidCardFieldDisplaySettings = serializeLucidCardFieldDisplaySettings;
153
151
  /** @ignore */
154
152
  function deserializeLucidCardFieldDisplaySettings(settings) {
155
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
153
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
156
154
  return {
157
155
  stencilConfig: settings['StencilConfig'] && {
158
156
  displayType: settings['StencilConfig']['getterKey'],
@@ -178,8 +176,7 @@ function deserializeLucidCardFieldDisplaySettings(settings) {
178
176
  maxfontsize: (_g = settings['StencilConfig']['textBadgeSettings']) === null || _g === void 0 ? void 0 : _g['maxfontsize'],
179
177
  maxtextwidth: (_h = settings['StencilConfig']['textBadgeSettings']) === null || _h === void 0 ? void 0 : _h['maxtextwidth'],
180
178
  iswithinpill: (_j = settings['StencilConfig']['textBadgeSettings']) === null || _j === void 0 ? void 0 : _j['iswithinpill'],
181
- usingcarduirefresh: (_k = settings['StencilConfig']['textBadgeSettings']) === null || _k === void 0 ? void 0 : _k['usingcarduirefresh'],
182
- hasleadingicon: (_l = settings['StencilConfig']['textBadgeSettings']) === null || _l === void 0 ? void 0 : _l['hasleadingicon'],
179
+ hasleadingicon: (_k = settings['StencilConfig']['textBadgeSettings']) === null || _k === void 0 ? void 0 : _k['hasleadingicon'],
183
180
  },
184
181
  },
185
182
  };
@@ -76,7 +76,6 @@ export declare const isSerializedCardIntegrationConfig: (subject: unknown) => su
76
76
  maxfontsize: (x: unknown) => x is number | undefined;
77
77
  maxtextwidth: (x: unknown) => x is number | undefined;
78
78
  iswithinpill: (x: unknown) => x is boolean | undefined;
79
- usingcarduirefresh: (x: unknown) => x is boolean | undefined;
80
79
  hasleadingicon: (x: unknown) => x is boolean | undefined;
81
80
  }> | undefined;
82
81
  }> | undefined;
@@ -18,10 +18,12 @@ export declare const isFieldConstraintType: (x: unknown) => x is FieldConstraint
18
18
  export type SerializedFieldConstraint = {
19
19
  'Type': FieldConstraintType;
20
20
  'Details'?: UnsafeJsonSerializableOrUndefined;
21
+ 'Reason'?: string | undefined;
21
22
  };
22
23
  export declare const isSerializedFieldConstraint: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
23
24
  Type: (x: unknown) => x is FieldConstraintType;
24
25
  Details: (x: unknown) => x is any;
26
+ Reason: (x: unknown) => x is string | undefined;
25
27
  }>;
26
28
  export type SerializedFieldDefinition = {
27
29
  'Name': string;
@@ -36,6 +38,7 @@ export declare const isSerializedFieldDefinition: (subject: unknown) => subject
36
38
  Constraints: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
37
39
  Type: (x: unknown) => x is FieldConstraintType;
38
40
  Details: (x: unknown) => x is any;
41
+ Reason: (x: unknown) => x is string | undefined;
39
42
  }>[] | undefined;
40
43
  SyncSchema: (x: unknown) => x is string | undefined;
41
44
  Mapping: (x: unknown) => x is LucidFields[] | SemanticKind[] | undefined;
@@ -22,6 +22,7 @@ exports.isFieldConstraintType = (0, validators_1.enumValidator)(FieldConstraintT
22
22
  exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
23
23
  'Type': (0, validators_1.enumValidator)(FieldConstraintType),
24
24
  'Details': (0, validators_1.option)(checks_1.isAny),
25
+ 'Reason': (0, validators_1.option)(checks_1.isString),
25
26
  });
26
27
  exports.isSerializedFieldDefinition = (0, validators_1.strictObjectValidator)({
27
28
  'Name': checks_1.isString,
@@ -105,8 +105,8 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
105
105
  Type: typeof isSerializedFieldTypeDefinition;
106
106
  Constraints: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
107
107
  Type: (x: unknown) => x is import("../data/serializedfield/serializedfielddefinition").FieldConstraintType;
108
- /** The label to display in the UI */
109
- Details: (x: unknown) => x is any;
108
+ Details: (x: unknown) => x is any; /** If defined, the default value for this field */
109
+ Reason: (x: unknown) => x is string | undefined;
110
110
  }>[] | undefined;
111
111
  l: typeof isString;
112
112
  d: (x: unknown) => x is string | undefined;
@@ -8,37 +8,45 @@ import { SerializedSchema } from '../core/data/serializedfield/serializedschema'
8
8
  export interface RequiredFieldConstraintDefinition {
9
9
  type: FieldConstraintType.REQUIRED;
10
10
  value?: undefined;
11
+ reason?: string | undefined;
11
12
  }
12
13
  export interface LockedFieldConstraintDefinition {
13
14
  type: FieldConstraintType.LOCKED;
14
15
  value?: undefined;
16
+ reason?: string | undefined;
15
17
  }
16
18
  export interface MinValueFieldConstraintDefinition {
17
19
  type: FieldConstraintType.MIN_VALUE;
18
20
  value: number;
21
+ reason?: string | undefined;
19
22
  }
20
23
  export interface MaxValueFieldConstraintDefinition {
21
24
  type: FieldConstraintType.MAX_VALUE;
22
25
  value: number;
26
+ reason?: string | undefined;
23
27
  }
24
28
  export interface SingleLineFieldConstraintDefinition {
25
29
  type: FieldConstraintType.SINGLE_LINE_ONLY;
26
30
  value?: undefined;
31
+ reason?: string | undefined;
27
32
  }
28
33
  export interface NoWhitespaceFieldConstraintDefinition {
29
34
  type: FieldConstraintType.NO_WHITESPACE;
30
35
  value?: undefined;
36
+ reason?: string | undefined;
31
37
  }
32
38
  export interface UniqueEditFieldConstraintDefinition {
33
39
  type: FieldConstraintType.UNIQUE_EDIT;
34
40
  value?: undefined;
41
+ reason?: string | undefined;
35
42
  }
36
43
  export interface MaxLengthConstraintDefinition {
37
44
  type: FieldConstraintType.MAX_LENGTH;
38
45
  value: number;
46
+ reason?: string | undefined;
39
47
  }
40
48
  export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition;
41
- export declare function createFieldConstraintDefinition(type: FieldConstraintType, value?: number): FieldConstraintDefinition;
49
+ export declare function createFieldConstraintDefinition(type: FieldConstraintType, value?: number, reason?: string): FieldConstraintDefinition;
42
50
  export declare function minMaxFieldConstraintValidator(val: unknown): val is FieldConstraintType.MIN_VALUE | FieldConstraintType.MAX_VALUE | FieldConstraintType.MAX_LENGTH;
43
51
  export declare const isFieldConstraintDefinition: (x: unknown) => x is {
44
52
  type?: FieldConstraintType | undefined;
@@ -6,25 +6,25 @@ const checks_1 = require("../core/checks");
6
6
  const fieldtypedefinition_1 = require("../core/data/fieldtypedefinition/fieldtypedefinition");
7
7
  const serializedfielddefinition_1 = require("../core/data/serializedfield/serializedfielddefinition");
8
8
  const validators_1 = require("../core/validators/validators");
9
- function createFieldConstraintDefinition(type, value) {
9
+ function createFieldConstraintDefinition(type, value, reason) {
10
10
  switch (type) {
11
11
  case serializedfielddefinition_1.FieldConstraintType.REQUIRED:
12
12
  case serializedfielddefinition_1.FieldConstraintType.LOCKED:
13
- return { type };
13
+ return Object.assign({ type }, (reason && { reason }));
14
14
  case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
15
15
  case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
16
16
  case serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH:
17
17
  if (value === undefined) {
18
18
  throw new Error('Invalid constraint value');
19
19
  }
20
- return { type, value };
20
+ return Object.assign({ type, value }, (reason && { reason }));
21
21
  case serializedfielddefinition_1.FieldConstraintType.SINGLE_LINE_ONLY:
22
22
  case serializedfielddefinition_1.FieldConstraintType.NO_WHITESPACE:
23
23
  case serializedfielddefinition_1.FieldConstraintType.UNIQUE_EDIT:
24
24
  if (value !== undefined) {
25
25
  throw new Error('Invalid constraint value');
26
26
  }
27
- return { type };
27
+ return Object.assign({ type }, (reason && { reason }));
28
28
  default:
29
29
  (0, assertnever_1.assertNever)(type);
30
30
  }
@@ -44,6 +44,7 @@ function serializeFieldConstraintDefinition(constraint) {
44
44
  return {
45
45
  'Type': constraint.type,
46
46
  'Details': constraint.value,
47
+ 'Reason': constraint.reason,
47
48
  };
48
49
  }
49
50
  exports.serializeFieldConstraintDefinition = serializeFieldConstraintDefinition;
@@ -78,6 +79,7 @@ function parseFieldDefinition(field) {
78
79
  name: field['Name'],
79
80
  type: (0, fieldtypedefinition_1.deserializeFieldTypeDefinition)(field['Type']),
80
81
  constraints: (_a = field['Constraints']) === null || _a === void 0 ? void 0 : _a.map((constraint) => {
82
+ var _a, _b;
81
83
  switch (constraint['Type']) {
82
84
  case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
83
85
  case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
@@ -85,13 +87,17 @@ function parseFieldDefinition(field) {
85
87
  if (!(0, checks_1.isNumber)(constraint['Details'])) {
86
88
  throw new Error('Invalid constraint format');
87
89
  }
88
- return { type: constraint['Type'], value: constraint['Details'] };
90
+ return {
91
+ type: constraint['Type'],
92
+ value: constraint['Details'],
93
+ reason: (_a = constraint['Reason']) !== null && _a !== void 0 ? _a : undefined,
94
+ };
89
95
  case serializedfielddefinition_1.FieldConstraintType.REQUIRED:
90
96
  case serializedfielddefinition_1.FieldConstraintType.LOCKED:
91
97
  case serializedfielddefinition_1.FieldConstraintType.SINGLE_LINE_ONLY:
92
98
  case serializedfielddefinition_1.FieldConstraintType.NO_WHITESPACE:
93
99
  case serializedfielddefinition_1.FieldConstraintType.UNIQUE_EDIT:
94
- return { type: constraint['Type'] };
100
+ return { type: constraint['Type'], reason: (_b = constraint['Reason']) !== null && _b !== void 0 ? _b : undefined };
95
101
  default:
96
102
  throw new Error('Invalid constraint format');
97
103
  }
@@ -35,6 +35,7 @@ export type DataSourceRequest = {
35
35
  export type SerializedFieldConstraintForApi = {
36
36
  'type': FieldConstraintType;
37
37
  'details'?: UnsafeJsonSerializableOrUndefined;
38
+ 'reason'?: string | undefined;
38
39
  };
39
40
  type SerializedFieldDefinitionForApi = {
40
41
  'name': string;
@@ -69,6 +69,7 @@ function serializeFieldConstraintForApi(constraint) {
69
69
  return {
70
70
  'type': constraint.type,
71
71
  'details': constraint.value,
72
+ 'reason': constraint.reason,
72
73
  };
73
74
  }
74
75
  /** @ignore */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.405",
3
+ "version": "0.0.407",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",