lucid-extension-sdk
Advanced tools
Comparing version 0.0.234 to 0.0.236
@@ -6,2 +6,3 @@ import { FieldConstraintDefinition } from '../../data/schemadefinition'; | ||
import { ScalarFieldTypeEnum } from './fieldtypedefinition/scalarfieldtype'; | ||
import { SemanticFields } from './fieldtypedefinition/semanticfields'; | ||
import { SemanticKind } from './fieldtypedefinition/semantickind'; | ||
@@ -21,7 +22,7 @@ import { SerializedColorObject, SerializedLucidCurrency, SerializedLucidDateObject, SerializedLucidDictionary } from './serializedfield/serializedfields'; | ||
*/ | ||
export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, SemanticFieldTypes extends SemanticKind, Fields extends { | ||
export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, Fields extends { | ||
[Name in Names]: { | ||
type: Types; | ||
constraints?: readonly Constraint[]; | ||
mapping?: readonly SemanticFieldTypes[] | undefined; | ||
mapping?: readonly SemanticKind[] | readonly SemanticFields[] | undefined; | ||
}; | ||
@@ -37,3 +38,3 @@ }, PrimaryKey extends keyof Fields>({ primaryKey, fields }: { | ||
constraints: FieldConstraintDefinition[]; | ||
mapping: SemanticFieldTypes[]; | ||
mapping: readonly SemanticKind[] | readonly SemanticFields[]; | ||
}[]; | ||
@@ -84,3 +85,3 @@ primaryKey: FormattedPrimaryKey<Fields, PrimaryKey>; | ||
type: Readonly<FieldTypeDefinition>; | ||
mapping?: undefined | readonly SemanticKind[]; | ||
mapping?: undefined | readonly SemanticKind[] | readonly SemanticFields[]; | ||
}; | ||
@@ -87,0 +88,0 @@ }; |
@@ -0,1 +1,5 @@ | ||
import { SemanticFields } from './semanticfields'; | ||
/** | ||
* @deprecated use SemanticFields instead. SemanticKind has not been removed to ensure backwards compatability. | ||
*/ | ||
export declare enum SemanticKind { | ||
@@ -21,1 +25,2 @@ Id = "id", | ||
export declare const isSemanticKind: (x: unknown) => x is SemanticKind; | ||
export declare function semanticKindToSemanticFields(semanticField: SemanticKind | SemanticFields): SemanticFields | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSemanticKind = exports.SemanticKind = void 0; | ||
exports.semanticKindToSemanticFields = exports.isSemanticKind = exports.SemanticKind = void 0; | ||
const validators_1 = require("../../validators/validators"); | ||
const semanticfields_1 = require("./semanticfields"); | ||
/** | ||
* @deprecated use SemanticFields instead. SemanticKind has not been removed to ensure backwards compatability. | ||
*/ | ||
var SemanticKind; | ||
@@ -26,1 +30,47 @@ (function (SemanticKind) { | ||
exports.isSemanticKind = (0, validators_1.enumValidator)(SemanticKind); | ||
function semanticKindToSemanticFields(semanticField) { | ||
if ((0, semanticfields_1.isSemanticFields)(semanticField)) { | ||
return semanticField; | ||
} | ||
else { | ||
switch (semanticField) { | ||
case SemanticKind.Id: | ||
return undefined; | ||
case SemanticKind.Title: | ||
return semanticfields_1.SemanticFields.Title; | ||
case SemanticKind.Name: | ||
return semanticfields_1.SemanticFields.User; | ||
case SemanticKind.Image: | ||
return semanticfields_1.SemanticFields.ImageUrl; | ||
case SemanticKind.Description: | ||
return semanticfields_1.SemanticFields.Description; | ||
case SemanticKind.Assignee: | ||
return semanticfields_1.SemanticFields.User; | ||
case SemanticKind.Estimate: | ||
return semanticfields_1.SemanticFields.Estimate; | ||
case SemanticKind.Status: | ||
return semanticfields_1.SemanticFields.Status; | ||
case SemanticKind.IssueType: | ||
return semanticfields_1.SemanticFields.IssueType; | ||
case SemanticKind.Priority: | ||
return semanticfields_1.SemanticFields.Priority; | ||
case SemanticKind.Project: | ||
return semanticfields_1.SemanticFields.Project; | ||
case SemanticKind.Reporter: | ||
return semanticfields_1.SemanticFields.Reporter; | ||
case SemanticKind.StartTime: | ||
return semanticfields_1.SemanticFields.Time; | ||
case SemanticKind.EndTime: | ||
return semanticfields_1.SemanticFields.EndTime; | ||
case SemanticKind.GroupByHint: | ||
return undefined; | ||
case SemanticKind.PrimaryKeyReference: | ||
return undefined; | ||
case SemanticKind.URL: | ||
return semanticfields_1.SemanticFields.SourceItemUrl; | ||
default: | ||
return undefined; | ||
} | ||
} | ||
} | ||
exports.semanticKindToSemanticFields = semanticKindToSemanticFields; |
import { isString } from '../../checks'; | ||
import { JsonSerializable } from '../../jsonserializable'; | ||
import { SerializedFieldTypeDefinition, isSerializedFieldTypeDefinition } from '../fieldtypedefinition/fieldtypedefinition'; | ||
import { SemanticFields } from '../fieldtypedefinition/semanticfields'; | ||
import { SemanticKind } from '../fieldtypedefinition/semantickind'; | ||
@@ -28,3 +29,3 @@ export declare enum FieldConstraintType { | ||
'SyncSchema'?: string | undefined; | ||
'Mapping'?: readonly SemanticKind[] | undefined; | ||
'Mapping'?: readonly SemanticFields[] | readonly SemanticKind[] | undefined; | ||
}; | ||
@@ -39,3 +40,3 @@ export declare const isSerializedFieldDefinition: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{ | ||
SyncSchema: (x: unknown) => x is string | undefined; | ||
Mapping: (x: unknown) => x is SemanticKind[] | undefined; | ||
Mapping: (x: unknown) => x is SemanticFields[] | SemanticKind[] | undefined; | ||
}>; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const fieldtypedefinition_1 = require("../fieldtypedefinition/fieldtypedefinition"); | ||
const semanticfields_1 = require("../fieldtypedefinition/semanticfields"); | ||
const semantickind_1 = require("../fieldtypedefinition/semantickind"); | ||
@@ -30,3 +31,3 @@ // The options here must match com.lucidchart.data.model.fielddefinition.FieldConstraintType on the backend | ||
'SyncSchema': (0, validators_1.option)(checks_1.isString), | ||
'Mapping': (0, validators_1.option)((0, validators_1.arrayValidator)((0, validators_1.stringEnumValidator)(semantickind_1.SemanticKind))), | ||
'Mapping': (0, validators_1.option)((0, validators_1.either)((0, validators_1.arrayValidator)(semanticfields_1.isSemanticFields), (0, validators_1.arrayValidator)(semantickind_1.isSemanticKind))), | ||
}); |
import { isNumber, isUndefined } from '../core/checks'; | ||
import { FieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition'; | ||
import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields'; | ||
import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind'; | ||
@@ -54,3 +55,3 @@ import { FieldConstraintType, SerializedFieldConstraint, SerializedFieldDefinition } from '../core/data/serializedfield/serializedfielddefinition'; | ||
constraints?: FieldConstraintDefinition[] | undefined; | ||
mapping?: readonly SemanticKind[] | undefined; | ||
mapping?: readonly SemanticFields[] | readonly SemanticKind[] | undefined; | ||
} | ||
@@ -57,0 +58,0 @@ /** |
import { UpstreamPatchType } from '../core/data/datasource/upstreampatchtype'; | ||
import { SerializedFieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition'; | ||
import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields'; | ||
import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind'; | ||
@@ -35,3 +36,3 @@ import { FieldConstraintType } from '../core/data/serializedfield/serializedfielddefinition'; | ||
'syncSchema'?: string; | ||
'mapping'?: readonly SemanticKind[]; | ||
'mapping'?: readonly SemanticKind[] | readonly SemanticFields[]; | ||
}; | ||
@@ -38,0 +39,0 @@ type SerializedSchemaForApi = { |
{ | ||
"name": "lucid-extension-sdk", | ||
"version": "0.0.234", | ||
"version": "0.0.236", | ||
"description": "Utility classes for writing Lucid Software editor extensions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
731725
284
16977