lucid-extension-sdk
Advanced tools
Comparing version 0.0.46 to 0.0.49
{ | ||
"name": "lucid-extension-sdk", | ||
"version": "0.0.46", | ||
"version": "0.0.49", | ||
"description": "Utility classes for writing Lucid Software editor extensions", | ||
@@ -5,0 +5,0 @@ "main": "sdk/index.js", |
@@ -8,2 +8,3 @@ import { CollectionDefinition } from '../../data/collectiondefinition'; | ||
import { isSerializedFieldType, SerializedFieldType } from '../data/serializedfield/serializedfields'; | ||
import { CardIntegrationConfig } from './cardintegrationconfig'; | ||
/** For fields with Option or ApiOption type, the label and value for each available option */ | ||
@@ -76,21 +77,2 @@ export interface ExtensionCardFieldOption { | ||
export declare function deserializeCardFieldArrayDefinition(fields: SerializedExtensionCardFieldDefinition[]): ExtensionCardFieldDefinition[]; | ||
export interface CardIntegrationConfig { | ||
/** | ||
* The data fields to be displayed on cards, as data-linked text fields | ||
*/ | ||
fieldNames: string[]; | ||
/** | ||
* The field name to use as the displayed ID of the card, if any | ||
*/ | ||
idFieldName?: string; | ||
} | ||
/** @ignore */ | ||
export declare type SerializedCardIntegrationConfig = { | ||
'f': string[]; | ||
'id'?: string; | ||
}; | ||
/** @ignore */ | ||
export declare function serializeCardIntegrationConfig(config: CardIntegrationConfig): SerializedCardIntegrationConfig; | ||
/** @ignore */ | ||
export declare function deserializeCardIntegrationConfig(raw: SerializedCardIntegrationConfig): CardIntegrationConfig; | ||
export interface CardIntegration { | ||
@@ -97,0 +79,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deserializeCardIntegrationConfig = exports.serializeCardIntegrationConfig = exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldConstraint = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0; | ||
exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldConstraint = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0; | ||
const schemadefinition_1 = require("../../data/schemadefinition"); | ||
@@ -67,17 +67,1 @@ const checks_1 = require("../checks"); | ||
exports.deserializeCardFieldArrayDefinition = deserializeCardFieldArrayDefinition; | ||
/** @ignore */ | ||
function serializeCardIntegrationConfig(config) { | ||
return { | ||
'f': config.fieldNames, | ||
'id': config.idFieldName, | ||
}; | ||
} | ||
exports.serializeCardIntegrationConfig = serializeCardIntegrationConfig; | ||
/** @ignore */ | ||
function deserializeCardIntegrationConfig(raw) { | ||
return { | ||
fieldNames: raw['f'], | ||
idFieldName: raw['id'], | ||
}; | ||
} | ||
exports.deserializeCardIntegrationConfig = deserializeCardIntegrationConfig; |
@@ -7,4 +7,3 @@ import { CollectionEnumFieldType, SerializedCollectionEnumFieldType } from './collectionenumfieldtype'; | ||
export declare type AnyFieldTypeArrayDefinition = FieldTypeArray | NDimensionalFieldTypeArray; | ||
export declare function isAnyFieldTypeArray(fieldType: BaseFieldTypeDefinition): fieldType is AnyFieldTypeArrayDefinition; | ||
export declare type BaseFieldTypeDefinition = ScalarFieldTypeEnum | LiteralFieldType | AnyFieldTypeArrayDefinition | CollectionEnumFieldType; | ||
export declare type BaseFieldTypeDefinition = ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray | NDimensionalFieldTypeArray | CollectionEnumFieldType; | ||
export declare type SerializedBaseFieldTypeDefinition = ScalarFieldTypeEnum | SerializedLiteralFieldType | SerializedFieldTypeArray | SerializedNDimensionalFieldTypeArray | SerializedCollectionEnumFieldType; | ||
@@ -11,0 +10,0 @@ export declare function isBaseFieldTypeDefinition(fieldType: any): fieldType is BaseFieldTypeDefinition; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSerializedBaseFieldTypeDefinition = exports.deserializeBaseFieldTypeDefinition = exports.serializeBaseFieldTypeDefinition = exports.isBaseFieldTypeDefinition = exports.isAnyFieldTypeArray = void 0; | ||
exports.isSerializedBaseFieldTypeDefinition = exports.deserializeBaseFieldTypeDefinition = exports.serializeBaseFieldTypeDefinition = exports.isBaseFieldTypeDefinition = void 0; | ||
const checks_1 = require("../../checks"); | ||
@@ -10,10 +10,7 @@ const collectionenumfieldtype_1 = require("./collectionenumfieldtype"); | ||
const scalarfieldtype_1 = require("./scalarfieldtype"); | ||
function isAnyFieldTypeArray(fieldType) { | ||
return fieldType instanceof fieldtypearray_1.FieldTypeArray || fieldType instanceof ndimensionalfieldtypearray_1.NDimensionalFieldTypeArray; | ||
} | ||
exports.isAnyFieldTypeArray = isAnyFieldTypeArray; | ||
function isBaseFieldTypeDefinition(fieldType) { | ||
return ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(fieldType) || | ||
(0, literalfieldtype_1.isLiteralFieldType)(fieldType) || | ||
isAnyFieldTypeArray(fieldType) || | ||
fieldType instanceof fieldtypearray_1.FieldTypeArray || | ||
fieldType instanceof ndimensionalfieldtypearray_1.NDimensionalFieldTypeArray || | ||
(0, collectionenumfieldtype_1.isCollectionEnumFieldType)(fieldType)); | ||
@@ -20,0 +17,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { FieldTypeDefinition } from './fieldtypedefinition'; | ||
export declare const CollectionEnumFieldTypeKey = "COLLECTION_ENUM"; | ||
@@ -25,3 +26,3 @@ /** | ||
} | ||
export declare const isCollectionEnumFieldType: (fieldType: any) => fieldType is CollectionEnumFieldType; | ||
export declare const isCollectionEnumFieldType: (fieldType: FieldTypeDefinition) => fieldType is CollectionEnumFieldType; | ||
export declare type SerializedCollectionEnumFieldType = { | ||
@@ -28,0 +29,0 @@ [CollectionEnumFieldTypeKey]: string; |
import { CollectionEnumFieldType, SerializedCollectionEnumFieldType } from './collectionenumfieldtype'; | ||
import { LiteralFieldType, SerializedLiteralFieldType } from './literalfieldtype'; | ||
import { ScalarFieldTypeEnum } from './scalarfieldtype'; | ||
export declare class FieldTypeArray { | ||
readonly validTypesArray: (ScalarFieldTypeEnum | CollectionEnumFieldType | LiteralFieldType | FieldTypeArray)[]; | ||
constructor(validTypesArray: (ScalarFieldTypeEnum | CollectionEnumFieldType | LiteralFieldType | FieldTypeArray)[]); | ||
getInnerTypes(): (CollectionEnumFieldType | ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[]; | ||
getInnerNonArrayTypes(): (CollectionEnumFieldType | ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[]; | ||
export declare abstract class BaseFieldTypeArray<Type> { | ||
readonly validTypesArray: Type[]; | ||
constructor(validTypesArray: Type[]); | ||
protected abstract serializeType(t: Type): SerializedFieldTypeArray['validTypes']['0']; | ||
getInnerTypes(): Type[]; | ||
getInnerNonArrayTypes(): Exclude<Type, BaseFieldTypeArray<Type>>[]; | ||
serialize(): SerializedFieldTypeArray; | ||
} | ||
export declare function isValidTypeForFieldTypeArray(fieldType: any): fieldType is ScalarFieldTypeEnum | LiteralFieldType | CollectionEnumFieldType | FieldTypeArray; | ||
export declare type FieldTypeArraySubTypes = ScalarFieldTypeEnum | CollectionEnumFieldType | LiteralFieldType | FieldTypeArray; | ||
export declare class FieldTypeArray extends BaseFieldTypeArray<FieldTypeArraySubTypes> { | ||
protected serializeType(t: FieldTypeArraySubTypes): string | SerializedCollectionEnumFieldType | ScalarFieldTypeEnum | SerializedFieldTypeArray; | ||
} | ||
export declare type SerializedFieldTypeArray = { | ||
@@ -13,0 +17,0 @@ 'ND': false; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deserializeFieldTypeArray = exports.isSerializedFieldTypeArray = exports.isValidTypeForFieldTypeArray = exports.FieldTypeArray = void 0; | ||
exports.deserializeFieldTypeArray = exports.isSerializedFieldTypeArray = exports.FieldTypeArray = exports.BaseFieldTypeArray = void 0; | ||
const checks_1 = require("../../checks"); | ||
@@ -8,3 +8,3 @@ const collectionenumfieldtype_1 = require("./collectionenumfieldtype"); | ||
const scalarfieldtype_1 = require("./scalarfieldtype"); | ||
class FieldTypeArray { | ||
class BaseFieldTypeArray { | ||
constructor(validTypesArray) { | ||
@@ -17,3 +17,3 @@ this.validTypesArray = validTypesArray; | ||
getInnerNonArrayTypes() { | ||
return this.validTypesArray.filter((innerType) => (0, scalarfieldtype_1.isScalarFieldTypeEnum)(innerType) || (0, literalfieldtype_1.isLiteralFieldType)(innerType)); | ||
return this.validTypesArray.filter((innerType) => !(innerType instanceof BaseFieldTypeArray)); | ||
} | ||
@@ -23,14 +23,13 @@ serialize() { | ||
'ND': false, | ||
'validTypes': this.validTypesArray.map((t) => ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(t) ? t : t.serialize())), | ||
'validTypes': this.validTypesArray.map((t) => this.serializeType(t)), | ||
}; | ||
} | ||
} | ||
exports.BaseFieldTypeArray = BaseFieldTypeArray; | ||
class FieldTypeArray extends BaseFieldTypeArray { | ||
serializeType(t) { | ||
return (0, scalarfieldtype_1.isScalarFieldTypeEnum)(t) ? t : t.serialize(); | ||
} | ||
} | ||
exports.FieldTypeArray = FieldTypeArray; | ||
function isValidTypeForFieldTypeArray(fieldType) { | ||
return ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(fieldType) || | ||
(0, literalfieldtype_1.isLiteralFieldType)(fieldType) || | ||
(0, collectionenumfieldtype_1.isCollectionEnumFieldType)(fieldType) || | ||
fieldType instanceof FieldTypeArray); | ||
} | ||
exports.isValidTypeForFieldTypeArray = isValidTypeForFieldTypeArray; | ||
function isSerializedFieldTypeArray(fieldType, validateTypeCheck) { | ||
@@ -37,0 +36,0 @@ return ((0, checks_1.isObject)(fieldType) && |
import { BaseFieldTypeDefinition, SerializedBaseFieldTypeDefinition } from './basefieldtypedefinition'; | ||
import { NDimensionalFieldTypeArray } from './ndimensionalfieldtypearray'; | ||
import { ScalarFieldTypeEnum } from './scalarfieldtype'; | ||
export declare type FieldTypeDefinition = BaseFieldTypeDefinition | BaseFieldTypeDefinition[]; | ||
export declare function fieldTypesEqual(a: FieldTypeDefinition, b: FieldTypeDefinition, checkEnumCollectionId?: boolean): boolean; | ||
export declare function isSubtypeOfFieldType(subType: FieldTypeDefinition, superTypes: FieldTypeDefinition): boolean; | ||
export declare const AnyFieldType: (ScalarFieldTypeEnum | NDimensionalFieldTypeArray)[]; | ||
export declare function isAnyFieldType(type: FieldTypeDefinition): boolean; | ||
export declare const serializeFieldTypeDefinition: (fieldType: FieldTypeDefinition) => SerializedFieldTypeDefinition; | ||
export declare function serializeFieldTypeDefinition(fieldType: BaseFieldTypeDefinition): SerializedBaseFieldTypeDefinition; | ||
export declare function serializeFieldTypeDefinition(fieldType: FieldTypeDefinition): SerializedFieldTypeDefinition; | ||
export declare const deserializeFieldTypeDefinition: (serializedFieldType: SerializedFieldTypeDefinition) => FieldTypeDefinition; | ||
export declare const SerializedAnyFieldType: SerializedFieldTypeDefinition; | ||
export declare type SerializedFieldTypeDefinition = SerializedBaseFieldTypeDefinition | SerializedBaseFieldTypeDefinition[]; | ||
export declare function isSerializedFieldTypeDefinition(definition: any): definition is SerializedFieldTypeDefinition; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSerializedFieldTypeDefinition = exports.SerializedAnyFieldType = exports.deserializeFieldTypeDefinition = exports.serializeFieldTypeDefinition = exports.isAnyFieldType = exports.AnyFieldType = exports.isSubtypeOfFieldType = exports.fieldTypesEqual = void 0; | ||
exports.isSerializedFieldTypeDefinition = exports.deserializeFieldTypeDefinition = exports.serializeFieldTypeDefinition = exports.fieldTypesEqual = void 0; | ||
const checks_1 = require("../../checks"); | ||
@@ -10,3 +10,2 @@ const basefieldtypedefinition_1 = require("./basefieldtypedefinition"); | ||
const ndimensionalfieldtypearray_1 = require("./ndimensionalfieldtypearray"); | ||
const scalarfieldtype_1 = require("./scalarfieldtype"); | ||
function fieldTypesEqual(a, b, checkEnumCollectionId = true) { | ||
@@ -58,79 +57,3 @@ if (a === b) { | ||
exports.fieldTypesEqual = fieldTypesEqual; | ||
function isSubtypeOfFieldType(subType, superTypes) { | ||
if (!(0, checks_1.isArray)(superTypes)) { | ||
superTypes = [superTypes]; | ||
} | ||
if ((0, checks_1.isArray)(subType)) { | ||
return subType.every((one) => isSubtypeOfFieldType(one, superTypes)); | ||
} | ||
if (superTypes.includes(scalarfieldtype_1.ScalarFieldTypeEnum.ANY)) { | ||
return true; | ||
} | ||
if ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(subType)) { | ||
return superTypes.includes(subType); | ||
} | ||
if ((0, literalfieldtype_1.isLiteralFieldType)(subType)) { | ||
if (superTypes.includes(subType.getScalarFieldType())) { | ||
return true; | ||
} | ||
const superLiteralTypes = superTypes.filter(literalfieldtype_1.isLiteralFieldType); | ||
if (superLiteralTypes.find((superLiteralType) => subType.getLiteral() === superLiteralType.getLiteral())) { | ||
return true; | ||
} | ||
const superArrayTypes = superTypes.filter(basefieldtypedefinition_1.isAnyFieldTypeArray); | ||
for (const superArrayType of superArrayTypes) { | ||
if (isSubtypeOfFieldType(subType, superArrayType.getInnerTypes())) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
if ((0, collectionenumfieldtype_1.isCollectionEnumFieldType)(subType)) { | ||
return superTypes.filter(collectionenumfieldtype_1.isCollectionEnumFieldType).some((ce) => ce.collectionId === subType.collectionId); | ||
} | ||
if ((0, ndimensionalfieldtypearray_1.isNDimensionalFieldTypeArray)(subType)) { | ||
const superNArrayTypes = superTypes.filter(ndimensionalfieldtypearray_1.isNDimensionalFieldTypeArray); | ||
return !!superNArrayTypes.find((superNArrayType) => isSubtypeOfFieldType(subType.validTypesArray, superNArrayType.validTypesArray)); | ||
} | ||
const subTypeArrayInnerTypes = subType.getInnerTypes(); | ||
const superArrayTypes = superTypes.filter(basefieldtypedefinition_1.isAnyFieldTypeArray); | ||
for (const superArrayType of superArrayTypes) { | ||
if (isSubtypeOfFieldType(subTypeArrayInnerTypes, superArrayType.getInnerTypes())) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
exports.isSubtypeOfFieldType = isSubtypeOfFieldType; | ||
exports.AnyFieldType = [...scalarfieldtype_1.AnyScalarFieldType, new ndimensionalfieldtypearray_1.NDimensionalFieldTypeArray(scalarfieldtype_1.AnyScalarFieldType)]; | ||
function isAnyFieldType(type) { | ||
let nArray; | ||
if (type === scalarfieldtype_1.ScalarFieldTypeEnum.ANY || | ||
type === exports.AnyFieldType || | ||
((0, checks_1.isArray)(type) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NUMBER) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.STRING) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.BOOLEAN) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.COLOR) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DATE) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NULL) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DICTIONARY) && | ||
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.CURRENCY) && | ||
!type.some(literalfieldtype_1.isLiteralFieldType) && | ||
(nArray = type.find(ndimensionalfieldtypearray_1.isNDimensionalFieldTypeArray)) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NUMBER) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.STRING) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.BOOLEAN) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.COLOR) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DATE) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DICTIONARY) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NULL) && | ||
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.CURRENCY) && | ||
!nArray.validTypesArray.some(literalfieldtype_1.isLiteralFieldType))) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
exports.isAnyFieldType = isAnyFieldType; | ||
const serializeFieldTypeDefinition = (fieldType) => { | ||
function serializeFieldTypeDefinition(fieldType) { | ||
if ((0, checks_1.isArray)(fieldType)) { | ||
@@ -142,3 +65,3 @@ return fieldType.map(basefieldtypedefinition_1.serializeBaseFieldTypeDefinition); | ||
} | ||
}; | ||
} | ||
exports.serializeFieldTypeDefinition = serializeFieldTypeDefinition; | ||
@@ -152,3 +75,2 @@ const deserializeFieldTypeDefinition = (serializedFieldType) => { | ||
exports.deserializeFieldTypeDefinition = deserializeFieldTypeDefinition; | ||
exports.SerializedAnyFieldType = (0, exports.serializeFieldTypeDefinition)(exports.AnyFieldType); | ||
function isSerializedFieldTypeDefinition(definition) { | ||
@@ -155,0 +77,0 @@ if ((0, checks_1.isArray)(definition)) { |
@@ -5,2 +5,3 @@ "use strict"; | ||
const cardintegration_1 = require("../core/cardintegration/cardintegration"); | ||
const cardintegrationconfig_1 = require("../core/cardintegration/cardintegrationconfig"); | ||
const collectiondefinition_1 = require("../data/collectiondefinition"); | ||
@@ -30,3 +31,3 @@ const collectionproxy_1 = require("../data/collectionproxy"); | ||
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client); | ||
return (0, cardintegration_1.serializeCardIntegrationConfig)(await card.getDefaultConfig(collection)); | ||
return (0, cardintegrationconfig_1.serializeCardIntegrationConfig)(await card.getDefaultConfig(collection)); | ||
}); | ||
@@ -33,0 +34,0 @@ let showIntroActionName = undefined; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
370047
162
8791