lucid-extension-sdk 0.0.375 → 0.0.377
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/commandtypes.d.ts +4 -0
- package/core/cardintegration/cardintegrationparams.d.ts +4 -0
- package/core/cardintegration/dependencymappingphrases.d.ts +5 -0
- package/core/cardintegration/lucidcardintegrationregistry.js +11 -0
- package/dataconnector/datasourceupdatetypes.d.ts +13 -4
- package/dataconnector/datasourceupdatetypes.js +22 -7
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -36,6 +36,10 @@ interface DependenciesForItemParam {
|
|
|
36
36
|
export interface DependenciesForItemsParam {
|
|
37
37
|
'dfi': DependenciesForItemParam[];
|
|
38
38
|
}
|
|
39
|
+
export interface DependencyMappingItemLabelPhraseParam {
|
|
40
|
+
'ci': string;
|
|
41
|
+
'pk': string;
|
|
42
|
+
}
|
|
39
43
|
/** @ignore */
|
|
40
44
|
export interface CustomImportParam {
|
|
41
45
|
'd': JsonSerializable;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataItemProxy } from '../../data/dataitemproxy';
|
|
1
2
|
interface DependencyManagerEmptyStatePhrasesType {
|
|
2
3
|
readonly multipleIssueKeyWithNoLink?: string;
|
|
3
4
|
readonly createLinkInstruction?: string;
|
|
@@ -27,5 +28,9 @@ export interface DependencyMappingPhrasesType {
|
|
|
27
28
|
cardLabel?: (locale: string, count: number) => string;
|
|
28
29
|
manager?: DependencyManagerPhrasesType;
|
|
29
30
|
edit?: DependencyEditPhrasesType;
|
|
31
|
+
/**
|
|
32
|
+
* This function is used to map the dataItemProxy to item label phrase.
|
|
33
|
+
*/
|
|
34
|
+
itemLabelPhrase?: (dataItem: DataItemProxy) => string;
|
|
30
35
|
}
|
|
31
36
|
export {};
|
|
@@ -47,6 +47,7 @@ class LucidCardIntegrationRegistry {
|
|
|
47
47
|
const manager = dependencyMappingPhrases.manager;
|
|
48
48
|
const emptyState = manager === null || manager === void 0 ? void 0 : manager.emptyState;
|
|
49
49
|
const edit = dependencyMappingPhrases.edit;
|
|
50
|
+
const itemLabelPhrase = dependencyMappingPhrases.itemLabelPhrase;
|
|
50
51
|
// Strings that appear on the canvas must calculate their locale at runtime,
|
|
51
52
|
// so all users get canvas content in the same locale
|
|
52
53
|
const cardLabelActionName = dependencyMappingPhrases.cardLabel
|
|
@@ -73,6 +74,15 @@ class LucidCardIntegrationRegistry {
|
|
|
73
74
|
return (_a = edit === null || edit === void 0 ? void 0 : edit.selectedIssueHeading) === null || _a === void 0 ? void 0 : _a.call(edit, key);
|
|
74
75
|
});
|
|
75
76
|
}
|
|
77
|
+
let itemLabelPhraseActionName = undefined;
|
|
78
|
+
if (itemLabelPhrase) {
|
|
79
|
+
itemLabelPhraseActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
80
|
+
client.registerAction(itemLabelPhraseActionName, ({ 'ci': ci, 'pk': pk }) => {
|
|
81
|
+
const collectionProxy = new collectionproxy_1.CollectionProxy(ci, client);
|
|
82
|
+
const itemProxy = new dataitemproxy_1.DataItemProxy(pk, collectionProxy, client);
|
|
83
|
+
return itemLabelPhrase(itemProxy);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
76
86
|
serialized['dmp'] = {
|
|
77
87
|
'ep': dependencyMappingPhrases.entrypoint,
|
|
78
88
|
'cl': cardLabelActionName,
|
|
@@ -105,6 +115,7 @@ class LucidCardIntegrationRegistry {
|
|
|
105
115
|
'sih': selectedIssueHeadingActionName,
|
|
106
116
|
}
|
|
107
117
|
: undefined,
|
|
118
|
+
'ilp': itemLabelPhraseActionName,
|
|
108
119
|
};
|
|
109
120
|
}
|
|
110
121
|
if (cardIntegration.importDependencies) {
|
|
@@ -11,7 +11,7 @@ import { SerializedFields, SerializedLucidDictionary } from '../core/data/serial
|
|
|
11
11
|
import { SerializedLabelOverrides } from '../core/data/serializedfield/serializedschema';
|
|
12
12
|
import { JsonSerializable } from '../core/jsonserializable';
|
|
13
13
|
import { DataUpdateFilterType } from '../data/dataupdatefiltertype';
|
|
14
|
-
import { FieldDefinition, SchemaDefinition } from '../data/schemadefinition';
|
|
14
|
+
import { FieldConstraintDefinition, FieldDefinition, SchemaDefinition } from '../data/schemadefinition';
|
|
15
15
|
/**
|
|
16
16
|
* Container for an update to a data source
|
|
17
17
|
*/
|
|
@@ -32,7 +32,7 @@ export type DataSourceRequest = {
|
|
|
32
32
|
/** The level of permission the request has to create data */
|
|
33
33
|
creationPermission?: UpdateCreationPermission;
|
|
34
34
|
};
|
|
35
|
-
type SerializedFieldConstraintForApi = {
|
|
35
|
+
export type SerializedFieldConstraintForApi = {
|
|
36
36
|
'type': FieldConstraintType;
|
|
37
37
|
'details'?: JsonSerializable;
|
|
38
38
|
};
|
|
@@ -66,6 +66,7 @@ export declare class ItemsPatchInexhaustive {
|
|
|
66
66
|
/** Items to remove from the collection, based on the same primary key algorithm. */
|
|
67
67
|
itemsDeleted?: string[] | undefined;
|
|
68
68
|
errors?: Map<string, SerializedLucidDictionary> | undefined;
|
|
69
|
+
fieldConstraintsPerItem?: Map<string, Map<string, FieldConstraintDefinition[]>> | undefined;
|
|
69
70
|
private readonly _brand;
|
|
70
71
|
constructor(
|
|
71
72
|
/**
|
|
@@ -74,15 +75,16 @@ export declare class ItemsPatchInexhaustive {
|
|
|
74
75
|
**/
|
|
75
76
|
items: Map<string, SerializedFields>,
|
|
76
77
|
/** Items to remove from the collection, based on the same primary key algorithm. */
|
|
77
|
-
itemsDeleted?: string[] | undefined, errors?: Map<string, SerializedLucidDictionary> | undefined);
|
|
78
|
+
itemsDeleted?: string[] | undefined, errors?: Map<string, SerializedLucidDictionary> | undefined, fieldConstraintsPerItem?: Map<string, Map<string, FieldConstraintDefinition[]>> | undefined);
|
|
78
79
|
}
|
|
79
80
|
export declare class ItemsPatchExhaustive {
|
|
80
81
|
items: Map<string, SerializedFields>;
|
|
81
82
|
rekeyingMap?: Map<string, string | null> | undefined;
|
|
82
83
|
fieldNamesChanged?: Map<string, string | null> | undefined;
|
|
83
84
|
errors?: Map<string, SerializedLucidDictionary> | undefined;
|
|
85
|
+
fieldConstraintsPerItem?: Map<string, Map<string, FieldConstraintDefinition[]>> | undefined;
|
|
84
86
|
private readonly _brand;
|
|
85
|
-
constructor(items: Map<string, SerializedFields>, rekeyingMap?: Map<string, string | null> | undefined, fieldNamesChanged?: Map<string, string | null> | undefined, errors?: Map<string, SerializedLucidDictionary> | undefined);
|
|
87
|
+
constructor(items: Map<string, SerializedFields>, rekeyingMap?: Map<string, string | null> | undefined, fieldNamesChanged?: Map<string, string | null> | undefined, errors?: Map<string, SerializedLucidDictionary> | undefined, fieldConstraintsPerItem?: Map<string, Map<string, FieldConstraintDefinition[]>> | undefined);
|
|
86
88
|
}
|
|
87
89
|
export type ItemsPatch = {
|
|
88
90
|
/**
|
|
@@ -94,16 +96,23 @@ export type ItemsPatch = {
|
|
|
94
96
|
itemsDeleted?: string[];
|
|
95
97
|
/** Errors found while patching the items */
|
|
96
98
|
errors?: Map<string, SerializedLucidDictionary>;
|
|
99
|
+
/**
|
|
100
|
+
*Constraints that can be defined on a per-item basis to conditionally lock fields for a specific item.
|
|
101
|
+
*The key for this map is the primary key of an item, and the value is a map from the name a field on that item to the constraints that should be applied to that field.
|
|
102
|
+
*/
|
|
103
|
+
fieldConstraintsPerItem?: Map<string, Map<string, FieldConstraintDefinition[]>>;
|
|
97
104
|
} | ItemsPatchInexhaustive | ItemsPatchExhaustive;
|
|
98
105
|
export type SerializedItemsPatch = {
|
|
99
106
|
'items': Record<string, SerializedFields>;
|
|
100
107
|
'itemsDeleted': string[];
|
|
101
108
|
'errors'?: Record<string, SerializedLucidDictionary>;
|
|
109
|
+
'fieldConstraintsPerItem'?: Record<string, Record<string, SerializedFieldConstraintForApi[]>>;
|
|
102
110
|
} | {
|
|
103
111
|
'exhaustiveItems': Record<string, SerializedFields>;
|
|
104
112
|
'rekeyingMap'?: Record<string, string | null>;
|
|
105
113
|
'fieldNamesChanged'?: Record<string, string | null>;
|
|
106
114
|
'errors'?: Record<string, SerializedLucidDictionary>;
|
|
115
|
+
'fieldConstraintsPerItem'?: Record<string, Record<string, SerializedFieldConstraintForApi[]>>;
|
|
107
116
|
};
|
|
108
117
|
export declare function serializeItemsPatch(patch: ItemsPatch): SerializedItemsPatch;
|
|
109
118
|
/**
|
|
@@ -13,40 +13,55 @@ class ItemsPatchInexhaustive {
|
|
|
13
13
|
**/
|
|
14
14
|
items,
|
|
15
15
|
/** Items to remove from the collection, based on the same primary key algorithm. */
|
|
16
|
-
itemsDeleted, errors) {
|
|
16
|
+
itemsDeleted, errors, fieldConstraintsPerItem) {
|
|
17
17
|
this.items = items;
|
|
18
18
|
this.itemsDeleted = itemsDeleted;
|
|
19
19
|
this.errors = errors;
|
|
20
|
+
this.fieldConstraintsPerItem = fieldConstraintsPerItem;
|
|
20
21
|
this._brand = ItemsPatchInexhaustive;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
exports.ItemsPatchInexhaustive = ItemsPatchInexhaustive;
|
|
24
25
|
class ItemsPatchExhaustive {
|
|
25
|
-
constructor(items, rekeyingMap, fieldNamesChanged, errors) {
|
|
26
|
+
constructor(items, rekeyingMap, fieldNamesChanged, errors, fieldConstraintsPerItem) {
|
|
26
27
|
this.items = items;
|
|
27
28
|
this.rekeyingMap = rekeyingMap;
|
|
28
29
|
this.fieldNamesChanged = fieldNamesChanged;
|
|
29
30
|
this.errors = errors;
|
|
31
|
+
this.fieldConstraintsPerItem = fieldConstraintsPerItem;
|
|
30
32
|
this._brand = ItemsPatchExhaustive;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
exports.ItemsPatchExhaustive = ItemsPatchExhaustive;
|
|
34
|
-
function serializeErrors(errors) {
|
|
35
|
-
return errors && { 'errors': (0, object_1.fromEntries)(errors) };
|
|
36
|
-
}
|
|
37
36
|
function serializeRekeyingMap(rekeyingMap) {
|
|
38
37
|
return rekeyingMap && { 'rekeyingMap': (0, object_1.fromEntries)(rekeyingMap) };
|
|
39
38
|
}
|
|
40
39
|
function serializeFieldNamesChanged(fieldNamesChanged) {
|
|
41
40
|
return fieldNamesChanged && { 'fieldNamesChanged': (0, object_1.fromEntries)(fieldNamesChanged) };
|
|
42
41
|
}
|
|
42
|
+
function serializeErrors(errors) {
|
|
43
|
+
return errors && { 'errors': (0, object_1.fromEntries)(errors) };
|
|
44
|
+
}
|
|
45
|
+
function serializeFieldConstraintsPerItem(fieldConstraintsPerItem) {
|
|
46
|
+
if (!fieldConstraintsPerItem) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const result = {};
|
|
50
|
+
fieldConstraintsPerItem.forEach((fieldNameToConstraints, key) => {
|
|
51
|
+
result[key] = {};
|
|
52
|
+
fieldNameToConstraints.forEach((constraints, fieldName) => {
|
|
53
|
+
result[key][fieldName] = constraints.map(serializeFieldConstraintForApi);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return { fieldConstraintsPerItem: result };
|
|
57
|
+
}
|
|
43
58
|
function serializeItemsPatch(patch) {
|
|
44
59
|
var _a;
|
|
45
60
|
if (patch instanceof ItemsPatchExhaustive) {
|
|
46
|
-
return Object.assign(Object.assign(Object.assign({ 'exhaustiveItems': (0, object_1.fromEntries)(patch.items.entries()) }, serializeRekeyingMap(patch.rekeyingMap)), serializeFieldNamesChanged(patch.fieldNamesChanged)), serializeErrors(patch.errors));
|
|
61
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ 'exhaustiveItems': (0, object_1.fromEntries)(patch.items.entries()) }, serializeRekeyingMap(patch.rekeyingMap)), serializeFieldNamesChanged(patch.fieldNamesChanged)), serializeErrors(patch.errors)), serializeFieldConstraintsPerItem(patch.fieldConstraintsPerItem));
|
|
47
62
|
}
|
|
48
63
|
else {
|
|
49
|
-
return Object.assign({ 'items': (0, object_1.fromEntries)(patch.items.entries()), 'itemsDeleted': (_a = patch.itemsDeleted) !== null && _a !== void 0 ? _a : [] }, serializeErrors(patch.errors));
|
|
64
|
+
return Object.assign(Object.assign({ 'items': (0, object_1.fromEntries)(patch.items.entries()), 'itemsDeleted': (_a = patch.itemsDeleted) !== null && _a !== void 0 ? _a : [] }, serializeErrors(patch.errors)), serializeFieldConstraintsPerItem(patch.fieldConstraintsPerItem));
|
|
50
65
|
}
|
|
51
66
|
}
|
|
52
67
|
exports.serializeItemsPatch = serializeItemsPatch;
|