lucid-extension-sdk 0.0.237 → 0.0.239
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.
- package/core/data/datasource/datasourceutils.js +2 -1
- package/core/data/datasource/semanticcollection.d.ts +13 -0
- package/core/data/datasource/semanticcollection.js +18 -0
- package/core/data/datasource/spreadsheetpossibledatatypes.d.ts +2 -0
- package/core/data/datasource/spreadsheetpossibledatatypes.js +13 -0
- package/dataconnector/datasourceupdatetypes.d.ts +10 -1
- package/dataconnector/datasourceupdatetypes.js +13 -8
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ const checks_1 = require("../../checks");
|
|
|
6
6
|
const scalarfieldtype_1 = require("../fieldtypedefinition/scalarfieldtype");
|
|
7
7
|
const alphabet_1 = require("./alphabet");
|
|
8
8
|
const datasourcetype_1 = require("./datasourcetype");
|
|
9
|
+
const spreadsheetpossibledatatypes_1 = require("./spreadsheetpossibledatatypes");
|
|
9
10
|
const upstreamupdatetype_1 = require("./upstreamupdatetype");
|
|
10
11
|
/** @ignore */
|
|
11
12
|
function _alphabetize(n) {
|
|
@@ -77,7 +78,7 @@ function makePrimaryCollectionSchema(rawSchemaFields, data, schemaFromData) {
|
|
|
77
78
|
schemaFields.forEach((field, index) => {
|
|
78
79
|
const finalFieldName = makeNameReadablyUnique(field, usedFieldsNormalized);
|
|
79
80
|
usedFieldsNormalized.add(normalizeName(finalFieldName));
|
|
80
|
-
fields.push({ 'Name': finalFieldName, 'Type':
|
|
81
|
+
fields.push({ 'Name': finalFieldName, 'Type': spreadsheetpossibledatatypes_1.SpreadSheetPossibleDataTypes });
|
|
81
82
|
oldToNewFields.set(rawSchemaFields[index], finalFieldName);
|
|
82
83
|
});
|
|
83
84
|
const oldPrimaryKeys = (_b = schemaFromData === null || schemaFromData === void 0 ? void 0 : schemaFromData.primaryKey) !== null && _b !== void 0 ? _b : [];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to define what a collection implicitly represents.
|
|
3
|
+
*
|
|
4
|
+
* SemanticCollection.Items indicates that the collection's contents should be visualized as distinct elements (such as cards) that can be compared.
|
|
5
|
+
*
|
|
6
|
+
* We currently only have one value in this enum. More will be added in the future.
|
|
7
|
+
*
|
|
8
|
+
* The values in this enum are purposely generic.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum SemanticCollection {
|
|
11
|
+
Items = "Items"
|
|
12
|
+
}
|
|
13
|
+
export declare const isSemanticCollection: (x: unknown) => x is SemanticCollection.Items;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSemanticCollection = exports.SemanticCollection = void 0;
|
|
4
|
+
const validators_1 = require("../../validators/validators");
|
|
5
|
+
/**
|
|
6
|
+
* Used to define what a collection implicitly represents.
|
|
7
|
+
*
|
|
8
|
+
* SemanticCollection.Items indicates that the collection's contents should be visualized as distinct elements (such as cards) that can be compared.
|
|
9
|
+
*
|
|
10
|
+
* We currently only have one value in this enum. More will be added in the future.
|
|
11
|
+
*
|
|
12
|
+
* The values in this enum are purposely generic.
|
|
13
|
+
*/
|
|
14
|
+
var SemanticCollection;
|
|
15
|
+
(function (SemanticCollection) {
|
|
16
|
+
SemanticCollection["Items"] = "Items";
|
|
17
|
+
})(SemanticCollection || (exports.SemanticCollection = SemanticCollection = {}));
|
|
18
|
+
exports.isSemanticCollection = (0, validators_1.enumValidator)(SemanticCollection);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpreadSheetPossibleDataTypes = void 0;
|
|
4
|
+
const scalarfieldtype_1 = require("../fieldtypedefinition/scalarfieldtype");
|
|
5
|
+
exports.SpreadSheetPossibleDataTypes = [
|
|
6
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.BOOLEAN,
|
|
7
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.NUMBER,
|
|
8
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.STRING,
|
|
9
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.NULL,
|
|
10
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.CURRENCY,
|
|
11
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.DATE,
|
|
12
|
+
scalarfieldtype_1.ScalarFieldTypeEnum.COLOR,
|
|
13
|
+
];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SemanticCollection } from '../core/data/datasource/semanticcollection';
|
|
1
2
|
import { UpstreamPatchType } from '../core/data/datasource/upstreampatchtype';
|
|
2
3
|
import { SerializedFieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
|
|
3
4
|
import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
|
|
@@ -40,9 +41,13 @@ type SerializedSchemaForApi = {
|
|
|
40
41
|
'primaryKey': string[];
|
|
41
42
|
'fieldLabelOverrides'?: SerializedLabelOverrides | undefined;
|
|
42
43
|
};
|
|
44
|
+
type serializedPropertiesForApi = {
|
|
45
|
+
'Represents': SemanticCollection[];
|
|
46
|
+
};
|
|
43
47
|
export interface SerializedCollectionPatch {
|
|
44
48
|
'schema'?: SerializedSchemaForApi;
|
|
45
49
|
'itemsPatch': SerializedItemsPatch;
|
|
50
|
+
'properties'?: serializedPropertiesForApi;
|
|
46
51
|
}
|
|
47
52
|
export declare class ItemsPatchInexhaustive {
|
|
48
53
|
/**
|
|
@@ -64,8 +69,9 @@ export declare class ItemsPatchInexhaustive {
|
|
|
64
69
|
}
|
|
65
70
|
export declare class ItemsPatchExhaustive {
|
|
66
71
|
items: Map<string, SerializedFields>;
|
|
72
|
+
renamingMap?: Map<string, string | null> | undefined;
|
|
67
73
|
errors?: Map<string, SerializedLucidDictionary> | undefined;
|
|
68
|
-
constructor(items: Map<string, SerializedFields>, errors?: Map<string, SerializedLucidDictionary> | undefined);
|
|
74
|
+
constructor(items: Map<string, SerializedFields>, renamingMap?: Map<string, string | null> | undefined, errors?: Map<string, SerializedLucidDictionary> | undefined);
|
|
69
75
|
}
|
|
70
76
|
export type ItemsPatch = {
|
|
71
77
|
/**
|
|
@@ -84,6 +90,7 @@ export type SerializedItemsPatch = {
|
|
|
84
90
|
'errors'?: Record<string, SerializedLucidDictionary>;
|
|
85
91
|
} | {
|
|
86
92
|
'exhaustiveItems': Record<string, SerializedFields>;
|
|
93
|
+
'renamingMap'?: Record<string, string | null>;
|
|
87
94
|
'errors'?: Record<string, SerializedLucidDictionary>;
|
|
88
95
|
};
|
|
89
96
|
export declare function serializeItemsPatch(patch: ItemsPatch): SerializedItemsPatch;
|
|
@@ -105,6 +112,8 @@ export interface CollectionPatch {
|
|
|
105
112
|
schema?: SchemaDefinition;
|
|
106
113
|
/** The patch to apply to the collection */
|
|
107
114
|
patch: ItemsPatch;
|
|
115
|
+
/** What the collection implicitly represents **/
|
|
116
|
+
represents?: SemanticCollection[];
|
|
108
117
|
}
|
|
109
118
|
/** @ignore */
|
|
110
119
|
export declare function serializeFieldDefinitionForApi(field: FieldDefinition): SerializedFieldDefinitionForApi;
|
|
@@ -20,24 +20,23 @@ class ItemsPatchInexhaustive {
|
|
|
20
20
|
}
|
|
21
21
|
exports.ItemsPatchInexhaustive = ItemsPatchInexhaustive;
|
|
22
22
|
class ItemsPatchExhaustive {
|
|
23
|
-
constructor(items, errors) {
|
|
23
|
+
constructor(items, renamingMap, errors) {
|
|
24
24
|
this.items = items;
|
|
25
|
+
this.renamingMap = renamingMap;
|
|
25
26
|
this.errors = errors;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
exports.ItemsPatchExhaustive = ItemsPatchExhaustive;
|
|
29
30
|
function serializeErrors(errors) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
errors.forEach((dictionary, key) => (serializedErrors[key] = dictionary));
|
|
35
|
-
return { 'errors': serializedErrors };
|
|
31
|
+
return errors && { 'errors': (0, object_1.fromEntries)(errors) };
|
|
32
|
+
}
|
|
33
|
+
function serializeRenamingMap(renamingMap) {
|
|
34
|
+
return renamingMap && { 'renamingMap': (0, object_1.fromEntries)(renamingMap) };
|
|
36
35
|
}
|
|
37
36
|
function serializeItemsPatch(patch) {
|
|
38
37
|
var _a;
|
|
39
38
|
if (patch instanceof ItemsPatchExhaustive) {
|
|
40
|
-
return Object.assign({ 'exhaustiveItems': (0, object_1.fromEntries)(patch.items.entries()) }, serializeErrors(patch.errors));
|
|
39
|
+
return Object.assign(Object.assign({ 'exhaustiveItems': (0, object_1.fromEntries)(patch.items.entries()) }, serializeRenamingMap(patch.renamingMap)), serializeErrors(patch.errors));
|
|
41
40
|
}
|
|
42
41
|
else {
|
|
43
42
|
return Object.assign({ 'items': (0, object_1.fromEntries)(patch.items.entries()), 'itemsDeleted': (_a = patch.itemsDeleted) !== null && _a !== void 0 ? _a : [] }, serializeErrors(patch.errors));
|
|
@@ -68,10 +67,16 @@ function serializeSchemaForApi(schema) {
|
|
|
68
67
|
'fieldLabelOverrides': schema.fieldLabels,
|
|
69
68
|
};
|
|
70
69
|
}
|
|
70
|
+
function serializeRepresentsAsPropertyForApi(represents) {
|
|
71
|
+
return {
|
|
72
|
+
'Represents': represents, // key needs to match 'Represents' key in cake/app/webroot/ts/property/collection/collectionproperties.ts
|
|
73
|
+
};
|
|
74
|
+
}
|
|
71
75
|
function serializeCollectionPatch(patch) {
|
|
72
76
|
return {
|
|
73
77
|
'schema': patch.schema && serializeSchemaForApi(patch.schema),
|
|
74
78
|
'itemsPatch': serializeItemsPatch(patch.patch),
|
|
79
|
+
'properties': patch.represents && serializeRepresentsAsPropertyForApi(patch.represents),
|
|
75
80
|
};
|
|
76
81
|
}
|
|
77
82
|
exports.serializeCollectionPatch = serializeCollectionPatch;
|