lucid-extension-sdk 0.0.353 → 0.0.355

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.
@@ -18,6 +18,11 @@ type TsTypeOf<X> = X extends ScalarFieldTypeEnum.ANY ? unknown : X extends Scala
18
18
  * There is fromItems which does the above will full type information, and fromItems sparse
19
19
  * which allows all the fields not part of the primaryKey to be undefined. The former should
20
20
  * be used with initial imports, and the latter can be used for updates.
21
+ *
22
+ * If you declare your schema using PrimaryKey values that *exactly* match (case sensitive) the enum values of
23
+ * `collectionenumfieldtype.ts` (e.g. using a key with the value "id" for your ID field) you will be opting in to some
24
+ * additional (and valuable) user functionality. This includes better support in the edit panel, and better user facing
25
+ * descriptions of your fields.
21
26
  */
22
27
  export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, Fields extends {
23
28
  [Name in Names]: {
@@ -12,6 +12,11 @@ function isArrayAndAssertReadonly(val) {
12
12
  * There is fromItems which does the above will full type information, and fromItems sparse
13
13
  * which allows all the fields not part of the primaryKey to be undefined. The former should
14
14
  * be used with initial imports, and the latter can be used for updates.
15
+ *
16
+ * If you declare your schema using PrimaryKey values that *exactly* match (case sensitive) the enum values of
17
+ * `collectionenumfieldtype.ts` (e.g. using a key with the value "id" for your ID field) you will be opting in to some
18
+ * additional (and valuable) user functionality. This includes better support in the edit panel, and better user facing
19
+ * descriptions of your fields.
15
20
  */
16
21
  function declareSchema({ primaryKey, fields }) {
17
22
  const primaryKeyObj = new FormattedPrimaryKey(...primaryKey);
@@ -111,6 +111,13 @@ export declare function objectOfValidator<T>(subValidator: Validator<T>): (x: un
111
111
  * @return A validator for the array type
112
112
  */
113
113
  export declare function nullable<T>(subValidator: (p1: unknown) => p1 is T): (x: unknown) => x is T | null;
114
+ /**
115
+ * Create a validator which allows the target to be either null or satisfy the
116
+ * sub-validator.
117
+ *
118
+ * @return A validator for the array type
119
+ */
120
+ export declare function nullableValidatorWithInvalidElementTracking<T>(subValidator: (p1: unknown, invalidElements?: Map<number, unknown[]>, level?: number) => p1 is T): (subject: unknown, invalidElements?: Map<number, unknown[]>, level?: number) => subject is T | null;
114
121
  /**
115
122
  * Create a validator which allows the target to be undefined or satisfy the
116
123
  * sub-validator.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asAssertion = exports.validatorWithMessage = exports.minLengthValidator = exports.maxLengthValidator = exports.isDate = exports.isPositiveNumber = exports.isSize = exports.isPanelSize = exports.isBoundingBox = exports.isPointLike = exports.isOpacity = exports.isFalse = exports.isTrue = exports.isFlag = exports.isRestrictions = exports.isStringOrNegativeOne = exports.isBooleanOrEmptyString = exports.isNumberOrEmptyString = exports.isSet = exports.propertyValidator = exports.exclude = exports.both = exports.either = exports.isNullOption = exports.nullableOption = exports.option = exports.nullable = exports.objectOfValidator = exports.typedRecordValidator = exports.recordValidator = exports.strictObjectValidator = exports.partialObjectValidator = exports.objectValidatorWithInvalidFieldTracking = exports.objectValidator = exports.mapValidator = exports.someValidator = exports.someValue = exports.tupleValidator = exports.arrayValidatorWithInvalidElementTracking = exports.arrayValidator = exports.rangeValidator = exports.enumValidator = exports.stringEnumValidator = void 0;
3
+ exports.asAssertion = exports.validatorWithMessage = exports.minLengthValidator = exports.maxLengthValidator = exports.isDate = exports.isPositiveNumber = exports.isSize = exports.isPanelSize = exports.isBoundingBox = exports.isPointLike = exports.isOpacity = exports.isFalse = exports.isTrue = exports.isFlag = exports.isRestrictions = exports.isStringOrNegativeOne = exports.isBooleanOrEmptyString = exports.isNumberOrEmptyString = exports.isSet = exports.propertyValidator = exports.exclude = exports.both = exports.either = exports.isNullOption = exports.nullableOption = exports.option = exports.nullableValidatorWithInvalidElementTracking = exports.nullable = exports.objectOfValidator = exports.typedRecordValidator = exports.recordValidator = exports.strictObjectValidator = exports.partialObjectValidator = exports.objectValidatorWithInvalidFieldTracking = exports.objectValidator = exports.mapValidator = exports.someValidator = exports.someValue = exports.tupleValidator = exports.arrayValidatorWithInvalidElementTracking = exports.arrayValidator = exports.rangeValidator = exports.enumValidator = exports.stringEnumValidator = void 0;
4
4
  const checks_1 = require("../checks");
5
5
  /*********************************************************************************
6
6
  * Validator generators: These functions construct new composite validators
@@ -269,6 +269,18 @@ function nullable(subValidator) {
269
269
  };
270
270
  }
271
271
  exports.nullable = nullable;
272
+ /**
273
+ * Create a validator which allows the target to be either null or satisfy the
274
+ * sub-validator.
275
+ *
276
+ * @return A validator for the array type
277
+ */
278
+ function nullableValidatorWithInvalidElementTracking(subValidator) {
279
+ return (subject, invalidElements, level = 0) => {
280
+ return subject === null || subValidator(subject, invalidElements, level);
281
+ };
282
+ }
283
+ exports.nullableValidatorWithInvalidElementTracking = nullableValidatorWithInvalidElementTracking;
272
284
  /**
273
285
  * Create a validator which allows the target to be undefined or satisfy the
274
286
  * sub-validator.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.353",
3
+ "version": "0.0.355",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",