lucid-extension-sdk 0.0.336 → 0.0.337
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.
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* Integration Simplicity: Simplifies the process of integrating new data sources into Lucid by mapping to an established set of Lucid Fields.
|
|
15
15
|
* Feature Compatibility: Allows for seamless use of Lucid’s intelligent features across all data, regardless of its origin.
|
|
16
16
|
* Data Organization: Provides a structured approach to organizing and grouping data within the Lucid ecosystem.
|
|
17
|
+
*
|
|
18
|
+
* Must be kept in sync with src/jvm/com/lucidchart/data/model/fielddefinition/LucidFields.scala
|
|
17
19
|
*/
|
|
18
20
|
export declare enum LucidFields {
|
|
19
21
|
/**
|
|
@@ -18,6 +18,8 @@ const validators_1 = require("../../validators/validators");
|
|
|
18
18
|
* Integration Simplicity: Simplifies the process of integrating new data sources into Lucid by mapping to an established set of Lucid Fields.
|
|
19
19
|
* Feature Compatibility: Allows for seamless use of Lucid’s intelligent features across all data, regardless of its origin.
|
|
20
20
|
* Data Organization: Provides a structured approach to organizing and grouping data within the Lucid ecosystem.
|
|
21
|
+
*
|
|
22
|
+
* Must be kept in sync with src/jvm/com/lucidchart/data/model/fielddefinition/LucidFields.scala
|
|
21
23
|
*/
|
|
22
24
|
var LucidFields;
|
|
23
25
|
(function (LucidFields) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LucidFields } from '../fieldtypedefinition/lucidfields';
|
|
2
|
+
export type SerializedLucidFieldDefaults = {
|
|
3
|
+
[key in LucidFields]?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const isSerializedLucidFieldDefaults: (defaults: any) => defaults is SerializedLucidFieldDefaults;
|
|
6
|
+
export declare function serializeLucidFieldDefaults(defaults: LucidFieldDefaults): SerializedLucidFieldDefaults;
|
|
7
|
+
export type LucidFieldDefaults = Map<LucidFields, string>;
|
|
8
|
+
export declare function isLucidFieldDefaults(data: any): data is LucidFieldDefaults;
|
|
9
|
+
export declare class LucidFieldDefaultsFactory {
|
|
10
|
+
static deserializeLucidFieldDefaults(serializeDefaults: SerializedLucidFieldDefaults): LucidFieldDefaults;
|
|
11
|
+
/**
|
|
12
|
+
* Merge two LucidFieldDefaults together, with `first` taking precedence over `second`.
|
|
13
|
+
* @param first prioritized defaults
|
|
14
|
+
* @param second secondary defaults to be merged
|
|
15
|
+
* @returns merged LucidFieldDefaults
|
|
16
|
+
*/
|
|
17
|
+
static merge(first: LucidFieldDefaults, second: LucidFieldDefaults): LucidFieldDefaults;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LucidFieldDefaultsFactory = exports.isLucidFieldDefaults = exports.serializeLucidFieldDefaults = exports.isSerializedLucidFieldDefaults = void 0;
|
|
4
|
+
const checks_1 = require("../../checks");
|
|
5
|
+
const lucidfields_1 = require("../fieldtypedefinition/lucidfields");
|
|
6
|
+
exports.isSerializedLucidFieldDefaults = (0, checks_1.isRecord)(checks_1.isString);
|
|
7
|
+
function serializeLucidFieldDefaults(defaults) {
|
|
8
|
+
const res = {};
|
|
9
|
+
for (const [key, value] of defaults.entries()) {
|
|
10
|
+
res[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
exports.serializeLucidFieldDefaults = serializeLucidFieldDefaults;
|
|
15
|
+
function isLucidFieldDefaults(data) {
|
|
16
|
+
return data instanceof Map && [...data.keys()].every((key) => key in lucidfields_1.LucidFields);
|
|
17
|
+
}
|
|
18
|
+
exports.isLucidFieldDefaults = isLucidFieldDefaults;
|
|
19
|
+
class LucidFieldDefaultsFactory {
|
|
20
|
+
static deserializeLucidFieldDefaults(serializeDefaults) {
|
|
21
|
+
const res = new Map();
|
|
22
|
+
for (const [key, value] of Object.entries(serializeDefaults)) {
|
|
23
|
+
if ((0, lucidfields_1.isLucidFields)(key)) {
|
|
24
|
+
res.set(key, value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Merge two LucidFieldDefaults together, with `first` taking precedence over `second`.
|
|
31
|
+
* @param first prioritized defaults
|
|
32
|
+
* @param second secondary defaults to be merged
|
|
33
|
+
* @returns merged LucidFieldDefaults
|
|
34
|
+
*/
|
|
35
|
+
static merge(first, second) {
|
|
36
|
+
return new Map([...second.entries(), ...first.entries()]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.LucidFieldDefaultsFactory = LucidFieldDefaultsFactory;
|