lucid-extension-sdk 0.0.74 → 0.0.75
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/package.json +1 -1
- package/sdk/core/cardintegration/{cardintegration.d.ts → cardintegrationdefinitions.d.ts} +0 -94
- package/sdk/core/cardintegration/{cardintegration.js → cardintegrationdefinitions.js} +0 -0
- package/sdk/core/cardintegration/taskmanagementcardintegration.d.ts +100 -0
- package/sdk/core/cardintegration/taskmanagementcardintegration.js +12 -0
- package/sdk/core/cardintegration/taskmanagementcardintegrationdefinitions.d.ts +44 -0
- package/sdk/core/cardintegration/taskmanagementcardintegrationdefinitions.js +2 -0
- package/sdk/core/cardintegration/taskmangementcardregistry.d.ts +14 -0
- package/sdk/core/cardintegration/taskmangementcardregistry.js +119 -0
- package/sdk/index.d.ts +3 -2
- package/sdk/index.js +3 -2
- package/sdk/document/taskmanagementcardintegration.d.ts +0 -17
- package/sdk/document/taskmanagementcardintegration.js +0 -126
package/package.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { CollectionDefinition } from '../../data/collectiondefinition';
|
|
2
|
-
import { CollectionProxy } from '../../data/collectionproxy';
|
|
3
|
-
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
4
1
|
import { FieldDefinition } from '../../data/schemadefinition';
|
|
5
2
|
import { isString } from '../checks';
|
|
6
3
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
7
4
|
import { FieldConstraintType, SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
8
5
|
import { isSerializedFieldType, SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
9
|
-
import { CardIntegrationConfig } from './cardintegrationconfig';
|
|
10
6
|
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
11
7
|
export interface ExtensionCardFieldOption {
|
|
12
8
|
label: string;
|
|
@@ -87,93 +83,3 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
87
83
|
export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
|
|
88
84
|
/** @ignore */
|
|
89
85
|
export declare function deserializeCardFieldArrayDefinition(fields: SerializedExtensionCardFieldDefinition[]): ExtensionCardFieldDefinition[];
|
|
90
|
-
export interface CardIntegration {
|
|
91
|
-
/**
|
|
92
|
-
* Label used to identify the integration, e.g. "Jira", which will be used in menu items, etc.
|
|
93
|
-
* Should be unique within any given extension.
|
|
94
|
-
*/
|
|
95
|
-
label: string;
|
|
96
|
-
/**
|
|
97
|
-
* Label used to identify one card worth of data, e.g. "Jira task"
|
|
98
|
-
*/
|
|
99
|
-
itemLabel: string;
|
|
100
|
-
/**
|
|
101
|
-
* Label used to identify multiple cards worth of data, e.g. "Jira tasks"
|
|
102
|
-
*/
|
|
103
|
-
itemsLabel: string;
|
|
104
|
-
/**
|
|
105
|
-
* URL for an icon to display in toolbars, etc. Should be at least 24x24.
|
|
106
|
-
*/
|
|
107
|
-
iconUrl: string;
|
|
108
|
-
/**
|
|
109
|
-
* The name of the data connector associated with the card integration.
|
|
110
|
-
*/
|
|
111
|
-
dataConnectorName: string;
|
|
112
|
-
fieldConfiguration: {
|
|
113
|
-
/**
|
|
114
|
-
* Callback to provide a list of all supported field names for the card integration.
|
|
115
|
-
*/
|
|
116
|
-
getAllFields: (collection: CollectionProxy) => Promise<string[]>;
|
|
117
|
-
/**
|
|
118
|
-
* Callback that handled changes in the fields the user wants to be displayed in the card integration.
|
|
119
|
-
* If this callback is not provided then the user will not be shown the modal to configure fields.
|
|
120
|
-
*/
|
|
121
|
-
onSelectedFieldsChange?: (dataSource: DataSourceProxy, selectedFields: string[]) => Promise<void>;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* If specified, and the user hasn't yet authorized the data connector for this extension,
|
|
125
|
-
* this should show the user an intro dialog or take some other action.
|
|
126
|
-
*/
|
|
127
|
-
showIntro?: () => void;
|
|
128
|
-
/**
|
|
129
|
-
* Provide the default configuration for a new import
|
|
130
|
-
*/
|
|
131
|
-
getDefaultConfig: (collection: CollectionProxy) => Promise<CardIntegrationConfig>;
|
|
132
|
-
/**
|
|
133
|
-
* If specified, allow the user to import cards using the standard card-import modal.
|
|
134
|
-
*/
|
|
135
|
-
importModal?: {
|
|
136
|
-
/**
|
|
137
|
-
* Given the values entered by the user so far into search fields, return the list of all search fields
|
|
138
|
-
* to display in the search form.
|
|
139
|
-
*/
|
|
140
|
-
getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
141
|
-
/**
|
|
142
|
-
* Given values entered by the user into the search fields so far, return a collection of data to
|
|
143
|
-
* display in the results table.
|
|
144
|
-
*/
|
|
145
|
-
search: (fields: Map<string, SerializedFieldType>) => Promise<{
|
|
146
|
-
data: CollectionDefinition;
|
|
147
|
-
fields: ExtensionCardFieldDefinition[];
|
|
148
|
-
}>;
|
|
149
|
-
/**
|
|
150
|
-
* The user checked the boxes beside the given list of items in the collection returned from search().
|
|
151
|
-
* Import them, and return the collection and primary keys in that final collection that were imported.
|
|
152
|
-
*
|
|
153
|
-
* The config provided here is only used on the first import from a given source; on subsequent imports,
|
|
154
|
-
* the existing config will remain unchanged to preserve any customizations by the user.
|
|
155
|
-
*/
|
|
156
|
-
import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<{
|
|
157
|
-
collection: CollectionProxy;
|
|
158
|
-
primaryKeys: string[];
|
|
159
|
-
}>;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* If specified, allow the user to create new cards and convert other shapes to cards
|
|
163
|
-
*/
|
|
164
|
-
addCard?: {
|
|
165
|
-
/**
|
|
166
|
-
* Given the values entered by the user so far into input fields, return the list of all input fields
|
|
167
|
-
* to display in the create-card form.
|
|
168
|
-
*/
|
|
169
|
-
getInputFields: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
170
|
-
/**
|
|
171
|
-
* Given the values entered by the user into input fields, create a new data record to represent the
|
|
172
|
-
* created card, and return information about that record.
|
|
173
|
-
*/
|
|
174
|
-
createCardData: (input: Map<string, SerializedFieldType>) => Promise<{
|
|
175
|
-
collection: CollectionProxy;
|
|
176
|
-
primaryKey: string;
|
|
177
|
-
}>;
|
|
178
|
-
};
|
|
179
|
-
}
|
|
File without changes
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { CollectionDefinition } from '../../data/collectiondefinition';
|
|
2
|
+
import { CollectionProxy } from '../../data/collectionproxy';
|
|
3
|
+
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
4
|
+
import { EditorClient } from '../../editorclient';
|
|
5
|
+
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
6
|
+
import { CardIntegrationConfig } from './cardintegrationconfig';
|
|
7
|
+
import { ExtensionCardFieldDefinition } from './cardintegrationdefinitions';
|
|
8
|
+
export declare abstract class TaskManagementCardIntegration {
|
|
9
|
+
private readonly client;
|
|
10
|
+
constructor(client: EditorClient);
|
|
11
|
+
/**
|
|
12
|
+
* Label used to identify the integration, e.g. "Jira", which will be used in menu items, etc.
|
|
13
|
+
* Should be unique within any given extension.
|
|
14
|
+
*/
|
|
15
|
+
abstract label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Label used to identify one card worth of data, e.g. "Jira task"
|
|
18
|
+
*/
|
|
19
|
+
abstract itemLabel: string;
|
|
20
|
+
/**
|
|
21
|
+
* Label used to identify multiple cards worth of data, e.g. "Jira tasks"
|
|
22
|
+
*/
|
|
23
|
+
abstract itemsLabel: string;
|
|
24
|
+
/**
|
|
25
|
+
* URL for an icon to display in toolbars, etc. Should be at least 24x24.
|
|
26
|
+
*/
|
|
27
|
+
abstract iconUrl: string;
|
|
28
|
+
/**
|
|
29
|
+
* The name of the data connector associated with the card integration.
|
|
30
|
+
*/
|
|
31
|
+
abstract dataConnectorName: string;
|
|
32
|
+
abstract fieldConfiguration: {
|
|
33
|
+
/**
|
|
34
|
+
* Callback to provide a list of all supported field names for the card integration.
|
|
35
|
+
*/
|
|
36
|
+
getAllFields: (collection: CollectionProxy) => Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Callback that handled changes in the fields the user wants to be displayed in the card integration.
|
|
39
|
+
* If this callback is not provided then the user will not be shown the modal to configure fields.
|
|
40
|
+
*/
|
|
41
|
+
onSelectedFieldsChange?: (dataSource: DataSourceProxy, selectedFields: string[]) => Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* If specified, and the user hasn't yet authorized the data connector for this extension,
|
|
45
|
+
* this should show the user an intro dialog or take some other action.
|
|
46
|
+
*/
|
|
47
|
+
abstract showIntro?: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Provide the default configuration for a new import
|
|
50
|
+
*/
|
|
51
|
+
abstract getDefaultConfig: (collection: CollectionProxy) => Promise<CardIntegrationConfig>;
|
|
52
|
+
/**
|
|
53
|
+
* If specified, allow the user to import cards using the standard card-import modal.
|
|
54
|
+
*/
|
|
55
|
+
abstract importModal?: {
|
|
56
|
+
/**
|
|
57
|
+
* Given the values entered by the user so far into search fields, return the list of all search fields
|
|
58
|
+
* to display in the search form.
|
|
59
|
+
*/
|
|
60
|
+
getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Given values entered by the user into the search fields so far, return a collection of data to
|
|
63
|
+
* display in the results table.
|
|
64
|
+
*/
|
|
65
|
+
search: (fields: Map<string, SerializedFieldType>) => Promise<{
|
|
66
|
+
data: CollectionDefinition;
|
|
67
|
+
fields: ExtensionCardFieldDefinition[];
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* The user checked the boxes beside the given list of items in the collection returned from search().
|
|
71
|
+
* Import them, and return the collection and primary keys in that final collection that were imported.
|
|
72
|
+
*
|
|
73
|
+
* The config provided here is only used on the first import from a given source; on subsequent imports,
|
|
74
|
+
* the existing config will remain unchanged to preserve any customizations by the user.
|
|
75
|
+
*/
|
|
76
|
+
import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<{
|
|
77
|
+
collection: CollectionProxy;
|
|
78
|
+
primaryKeys: string[];
|
|
79
|
+
}>;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* If specified, allow the user to create new cards and convert other shapes to cards
|
|
83
|
+
*/
|
|
84
|
+
abstract addCard?: {
|
|
85
|
+
/**
|
|
86
|
+
* Given the values entered by the user so far into input fields, return the list of all input fields
|
|
87
|
+
* to display in the create-card form.
|
|
88
|
+
*/
|
|
89
|
+
getInputFields: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Given the values entered by the user into input fields, create a new data record to represent the
|
|
92
|
+
* created card, and return information about that record.
|
|
93
|
+
*/
|
|
94
|
+
createCardData: (input: Map<string, SerializedFieldType>) => Promise<{
|
|
95
|
+
collection: CollectionProxy;
|
|
96
|
+
primaryKey: string;
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
showCardImport(name: string): import("../../commandtypes").ImportCardsResult;
|
|
100
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskManagementCardIntegration = void 0;
|
|
4
|
+
class TaskManagementCardIntegration {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
showCardImport(name) {
|
|
9
|
+
return this.client.sendCommand("ic" /* CommandName.ImportCards */, name);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.TaskManagementCardIntegration = TaskManagementCardIntegration;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
2
|
+
/** @ignore */
|
|
3
|
+
export interface GetFieldsParam {
|
|
4
|
+
'c': string;
|
|
5
|
+
}
|
|
6
|
+
/** @ignore */
|
|
7
|
+
export interface GetDefaultConfigParam {
|
|
8
|
+
'c': string;
|
|
9
|
+
}
|
|
10
|
+
/** @ignore */
|
|
11
|
+
export interface OnSelectedFieldsChangeParam {
|
|
12
|
+
'ds': string;
|
|
13
|
+
'sf': string[];
|
|
14
|
+
}
|
|
15
|
+
/** @ignore */
|
|
16
|
+
export interface GetSearchFieldsParam {
|
|
17
|
+
's': [string, SerializedFieldType][];
|
|
18
|
+
}
|
|
19
|
+
/** @ignore */
|
|
20
|
+
export interface SearchParam {
|
|
21
|
+
's': [string, SerializedFieldType][];
|
|
22
|
+
}
|
|
23
|
+
/** @ignore */
|
|
24
|
+
export interface ImportParam {
|
|
25
|
+
'pks': string[];
|
|
26
|
+
's': [string, SerializedFieldType][];
|
|
27
|
+
}
|
|
28
|
+
/** @ignore */
|
|
29
|
+
export interface GetInputFieldsParam {
|
|
30
|
+
'i': [string, SerializedFieldType][];
|
|
31
|
+
}
|
|
32
|
+
/** @ignore */
|
|
33
|
+
export interface CreateCardParam {
|
|
34
|
+
'i': [string, SerializedFieldType][];
|
|
35
|
+
}
|
|
36
|
+
/** @ignore */
|
|
37
|
+
export interface GetOptionsParam {
|
|
38
|
+
'i': [string, SerializedFieldType][];
|
|
39
|
+
}
|
|
40
|
+
/** @ignore */
|
|
41
|
+
export interface SearchOptionsParam {
|
|
42
|
+
's': string;
|
|
43
|
+
'i': [string, SerializedFieldType][];
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditorClient } from '../../editorclient';
|
|
2
|
+
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
3
|
+
import { ExtensionCardFieldOption } from './cardintegrationdefinitions';
|
|
4
|
+
import { TaskManagementCardIntegration } from './taskmanagementcardintegration';
|
|
5
|
+
export declare class TaskManagementCardRegistry {
|
|
6
|
+
private static nextHookId;
|
|
7
|
+
private static nextHookName;
|
|
8
|
+
static registerFieldOptionsCallback(client: EditorClient, callback: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string;
|
|
9
|
+
static registerFieldSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string;
|
|
10
|
+
/**
|
|
11
|
+
* Register a card integration.
|
|
12
|
+
*/
|
|
13
|
+
static addCardIntegration(client: EditorClient, cardIntegration: TaskManagementCardIntegration): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskManagementCardRegistry = void 0;
|
|
4
|
+
const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
5
|
+
const collectionproxy_1 = require("../../data/collectionproxy");
|
|
6
|
+
const datasourceproxy_1 = require("../../data/datasourceproxy");
|
|
7
|
+
const cardintegrationconfig_1 = require("./cardintegrationconfig");
|
|
8
|
+
const cardintegrationdefinitions_1 = require("./cardintegrationdefinitions");
|
|
9
|
+
class TaskManagementCardRegistry {
|
|
10
|
+
static nextHookName() {
|
|
11
|
+
return '__taskmanagementcard__hook' + TaskManagementCardRegistry.nextHookId++;
|
|
12
|
+
}
|
|
13
|
+
static registerFieldOptionsCallback(client, callback) {
|
|
14
|
+
const name = TaskManagementCardRegistry.nextHookName();
|
|
15
|
+
client.registerAction(name, async ({ 'i': inputSoFar }) => {
|
|
16
|
+
const result = await callback(new Map(inputSoFar));
|
|
17
|
+
return result.map((option) => (0, cardintegrationdefinitions_1.serializeCardFieldOption)(option));
|
|
18
|
+
});
|
|
19
|
+
return name;
|
|
20
|
+
}
|
|
21
|
+
static registerFieldSearchCallback(client, callback) {
|
|
22
|
+
const name = TaskManagementCardRegistry.nextHookName();
|
|
23
|
+
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText }) => {
|
|
24
|
+
const result = await callback(searchText, new Map(inputSoFar));
|
|
25
|
+
return result.map((option) => (0, cardintegrationdefinitions_1.serializeCardFieldOption)(option));
|
|
26
|
+
});
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Register a card integration.
|
|
31
|
+
*/
|
|
32
|
+
static addCardIntegration(client, cardIntegration) {
|
|
33
|
+
const getFieldsActionName = TaskManagementCardRegistry.nextHookName();
|
|
34
|
+
client.registerAction(getFieldsActionName, async (param) => {
|
|
35
|
+
const collection = new collectionproxy_1.CollectionProxy(param['c'], client);
|
|
36
|
+
const fields = await cardIntegration.fieldConfiguration.getAllFields(collection);
|
|
37
|
+
return fields;
|
|
38
|
+
});
|
|
39
|
+
let onSelectedFieldsChangeActionName = undefined;
|
|
40
|
+
const onSelectedFieldsChange = cardIntegration.fieldConfiguration.onSelectedFieldsChange;
|
|
41
|
+
if (onSelectedFieldsChange) {
|
|
42
|
+
onSelectedFieldsChangeActionName = TaskManagementCardRegistry.nextHookName();
|
|
43
|
+
client.registerAction(onSelectedFieldsChangeActionName, async (param) => {
|
|
44
|
+
const dataSource = new datasourceproxy_1.DataSourceProxy(param['ds'], client);
|
|
45
|
+
await onSelectedFieldsChange(dataSource, param['sf']);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const getDefaultConfigActionName = TaskManagementCardRegistry.nextHookName();
|
|
49
|
+
client.registerAction(getDefaultConfigActionName, async (param) => {
|
|
50
|
+
const collection = new collectionproxy_1.CollectionProxy(param['c'], client);
|
|
51
|
+
return (0, cardintegrationconfig_1.serializeCardIntegrationConfig)(await cardIntegration.getDefaultConfig(collection));
|
|
52
|
+
});
|
|
53
|
+
let showIntroActionName = undefined;
|
|
54
|
+
if (cardIntegration.showIntro) {
|
|
55
|
+
showIntroActionName = TaskManagementCardRegistry.nextHookName();
|
|
56
|
+
client.registerAction(showIntroActionName, cardIntegration.showIntro);
|
|
57
|
+
}
|
|
58
|
+
const serialized = {
|
|
59
|
+
'n': cardIntegration.label,
|
|
60
|
+
'dcn': cardIntegration.dataConnectorName,
|
|
61
|
+
'il': cardIntegration.itemLabel,
|
|
62
|
+
'isl': cardIntegration.itemsLabel,
|
|
63
|
+
'u': cardIntegration.iconUrl,
|
|
64
|
+
'fc': {
|
|
65
|
+
'gf': getFieldsActionName,
|
|
66
|
+
'osfc': onSelectedFieldsChangeActionName,
|
|
67
|
+
},
|
|
68
|
+
'gdc': getDefaultConfigActionName,
|
|
69
|
+
'i': showIntroActionName,
|
|
70
|
+
};
|
|
71
|
+
if (cardIntegration.importModal) {
|
|
72
|
+
const importModal = cardIntegration.importModal;
|
|
73
|
+
serialized['im'] = {
|
|
74
|
+
'gsf': TaskManagementCardRegistry.nextHookName(),
|
|
75
|
+
's': TaskManagementCardRegistry.nextHookName(),
|
|
76
|
+
'i': TaskManagementCardRegistry.nextHookName(),
|
|
77
|
+
};
|
|
78
|
+
client.registerAction(serialized['im']['gsf'], async ({ 's': searchSoFar }) => {
|
|
79
|
+
const result = await importModal.getSearchFields(new Map(searchSoFar));
|
|
80
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
81
|
+
});
|
|
82
|
+
client.registerAction(serialized['im']['s'], async ({ 's': search }) => {
|
|
83
|
+
const result = await importModal.search(new Map(search));
|
|
84
|
+
return {
|
|
85
|
+
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(result.data),
|
|
86
|
+
'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result.fields),
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
|
|
90
|
+
const result = await importModal.import(primaryKeys, new Map(searchFields));
|
|
91
|
+
return {
|
|
92
|
+
'c': result.collection.id,
|
|
93
|
+
'pks': result.primaryKeys,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (cardIntegration.addCard) {
|
|
98
|
+
const addCard = cardIntegration.addCard;
|
|
99
|
+
serialized['ac'] = {
|
|
100
|
+
'gif': TaskManagementCardRegistry.nextHookName(),
|
|
101
|
+
'cc': TaskManagementCardRegistry.nextHookName(),
|
|
102
|
+
};
|
|
103
|
+
client.registerAction(serialized['ac']['gif'], async ({ 'i': inputSoFar }) => {
|
|
104
|
+
const result = await addCard.getInputFields(new Map(inputSoFar));
|
|
105
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
106
|
+
});
|
|
107
|
+
client.registerAction(serialized['ac']['cc'], async ({ 'i': input }) => {
|
|
108
|
+
const result = await addCard.createCardData(new Map(input));
|
|
109
|
+
return {
|
|
110
|
+
'c': result.collection.id,
|
|
111
|
+
'pk': result.primaryKey,
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.TaskManagementCardRegistry = TaskManagementCardRegistry;
|
|
119
|
+
TaskManagementCardRegistry.nextHookId = 0;
|
package/sdk/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './commandtypes';
|
|
2
2
|
export * from './core/base64';
|
|
3
3
|
export * from './core/cardintegration/cardfielddisplaysettings';
|
|
4
|
-
export * from './core/cardintegration/cardintegration';
|
|
5
4
|
export * from './core/cardintegration/cardintegrationconfig';
|
|
5
|
+
export * from './core/cardintegration/cardintegrationdefinitions';
|
|
6
|
+
export * from './core/cardintegration/taskmanagementcardintegration';
|
|
7
|
+
export * from './core/cardintegration/taskmangementcardregistry';
|
|
6
8
|
export * from './core/checks';
|
|
7
9
|
export * from './core/data/fieldtypedefinition/basefieldtypedefinition';
|
|
8
10
|
export * from './core/data/fieldtypedefinition/collectionenumfieldtype';
|
|
@@ -66,7 +68,6 @@ export * from './document/pagedefinition';
|
|
|
66
68
|
export * from './document/pageproxy';
|
|
67
69
|
export * from './document/propertystoreproxy';
|
|
68
70
|
export * from './document/shapedataproxy';
|
|
69
|
-
export * from './document/taskmanagementcardintegration';
|
|
70
71
|
export * from './editorclient';
|
|
71
72
|
export * from './index';
|
|
72
73
|
export * from './math';
|
package/sdk/index.js
CHANGED
|
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./commandtypes"), exports);
|
|
18
18
|
__exportStar(require("./core/base64"), exports);
|
|
19
19
|
__exportStar(require("./core/cardintegration/cardfielddisplaysettings"), exports);
|
|
20
|
-
__exportStar(require("./core/cardintegration/cardintegration"), exports);
|
|
21
20
|
__exportStar(require("./core/cardintegration/cardintegrationconfig"), exports);
|
|
21
|
+
__exportStar(require("./core/cardintegration/cardintegrationdefinitions"), exports);
|
|
22
|
+
__exportStar(require("./core/cardintegration/taskmanagementcardintegration"), exports);
|
|
23
|
+
__exportStar(require("./core/cardintegration/taskmangementcardregistry"), exports);
|
|
22
24
|
__exportStar(require("./core/checks"), exports);
|
|
23
25
|
__exportStar(require("./core/data/fieldtypedefinition/basefieldtypedefinition"), exports);
|
|
24
26
|
__exportStar(require("./core/data/fieldtypedefinition/collectionenumfieldtype"), exports);
|
|
@@ -82,7 +84,6 @@ __exportStar(require("./document/pagedefinition"), exports);
|
|
|
82
84
|
__exportStar(require("./document/pageproxy"), exports);
|
|
83
85
|
__exportStar(require("./document/propertystoreproxy"), exports);
|
|
84
86
|
__exportStar(require("./document/shapedataproxy"), exports);
|
|
85
|
-
__exportStar(require("./document/taskmanagementcardintegration"), exports);
|
|
86
87
|
__exportStar(require("./editorclient"), exports);
|
|
87
88
|
__exportStar(require("./index"), exports);
|
|
88
89
|
__exportStar(require("./math"), exports);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CardIntegration, ExtensionCardFieldOption } from '../core/cardintegration/cardintegration';
|
|
2
|
-
import { SerializedFieldType } from '../core/data/serializedfield/serializedfields';
|
|
3
|
-
import { EditorClient } from '../editorclient';
|
|
4
|
-
export declare class TaskManagementCardIntegration {
|
|
5
|
-
private readonly client;
|
|
6
|
-
constructor(client: EditorClient);
|
|
7
|
-
private static nextHookId;
|
|
8
|
-
private static nextHookName;
|
|
9
|
-
registerFieldOptionsCallback(callback: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string;
|
|
10
|
-
registerFieldSearchCallback(callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string;
|
|
11
|
-
/**
|
|
12
|
-
* Register a new card integration.
|
|
13
|
-
* @param card The definition of the new card integration
|
|
14
|
-
*/
|
|
15
|
-
addCardIntegration(card: CardIntegration): void;
|
|
16
|
-
showCardImport(name: string): import("../commandtypes").ImportCardsResult;
|
|
17
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskManagementCardIntegration = void 0;
|
|
4
|
-
const cardintegration_1 = require("../core/cardintegration/cardintegration");
|
|
5
|
-
const cardintegrationconfig_1 = require("../core/cardintegration/cardintegrationconfig");
|
|
6
|
-
const collectiondefinition_1 = require("../data/collectiondefinition");
|
|
7
|
-
const collectionproxy_1 = require("../data/collectionproxy");
|
|
8
|
-
const datasourceproxy_1 = require("../data/datasourceproxy");
|
|
9
|
-
class TaskManagementCardIntegration {
|
|
10
|
-
constructor(client) {
|
|
11
|
-
this.client = client;
|
|
12
|
-
}
|
|
13
|
-
static nextHookName() {
|
|
14
|
-
return '__taskmanagementcard__hook' + TaskManagementCardIntegration.nextHookId++;
|
|
15
|
-
}
|
|
16
|
-
registerFieldOptionsCallback(callback) {
|
|
17
|
-
const name = TaskManagementCardIntegration.nextHookName();
|
|
18
|
-
this.client.registerAction(name, async ({ 'i': inputSoFar }) => {
|
|
19
|
-
const result = await callback(new Map(inputSoFar));
|
|
20
|
-
return result.map((option) => (0, cardintegration_1.serializeCardFieldOption)(option));
|
|
21
|
-
});
|
|
22
|
-
return name;
|
|
23
|
-
}
|
|
24
|
-
registerFieldSearchCallback(callback) {
|
|
25
|
-
const name = TaskManagementCardIntegration.nextHookName();
|
|
26
|
-
this.client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText }) => {
|
|
27
|
-
const result = await callback(searchText, new Map(inputSoFar));
|
|
28
|
-
return result.map((option) => (0, cardintegration_1.serializeCardFieldOption)(option));
|
|
29
|
-
});
|
|
30
|
-
return name;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Register a new card integration.
|
|
34
|
-
* @param card The definition of the new card integration
|
|
35
|
-
*/
|
|
36
|
-
addCardIntegration(card) {
|
|
37
|
-
const getFieldsActionName = TaskManagementCardIntegration.nextHookName();
|
|
38
|
-
this.client.registerAction(getFieldsActionName, async (param) => {
|
|
39
|
-
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
40
|
-
const fields = await card.fieldConfiguration.getAllFields(collection);
|
|
41
|
-
return fields;
|
|
42
|
-
});
|
|
43
|
-
let onSelectedFieldsChangeActionName = undefined;
|
|
44
|
-
const onSelectedFieldsChange = card.fieldConfiguration.onSelectedFieldsChange;
|
|
45
|
-
if (onSelectedFieldsChange) {
|
|
46
|
-
onSelectedFieldsChangeActionName = TaskManagementCardIntegration.nextHookName();
|
|
47
|
-
this.client.registerAction(onSelectedFieldsChangeActionName, async (param) => {
|
|
48
|
-
const dataSource = new datasourceproxy_1.DataSourceProxy(param['ds'], this.client);
|
|
49
|
-
await onSelectedFieldsChange(dataSource, param['sf']);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const getDefaultConfigActionName = TaskManagementCardIntegration.nextHookName();
|
|
53
|
-
this.client.registerAction(getDefaultConfigActionName, async (param) => {
|
|
54
|
-
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
55
|
-
return (0, cardintegrationconfig_1.serializeCardIntegrationConfig)(await card.getDefaultConfig(collection));
|
|
56
|
-
});
|
|
57
|
-
let showIntroActionName = undefined;
|
|
58
|
-
if (card.showIntro) {
|
|
59
|
-
showIntroActionName = TaskManagementCardIntegration.nextHookName();
|
|
60
|
-
this.client.registerAction(showIntroActionName, card.showIntro);
|
|
61
|
-
}
|
|
62
|
-
const serialized = {
|
|
63
|
-
'n': card.label,
|
|
64
|
-
'dcn': card.dataConnectorName,
|
|
65
|
-
'il': card.itemLabel,
|
|
66
|
-
'isl': card.itemsLabel,
|
|
67
|
-
'u': card.iconUrl,
|
|
68
|
-
'fc': {
|
|
69
|
-
'gf': getFieldsActionName,
|
|
70
|
-
'osfc': onSelectedFieldsChangeActionName,
|
|
71
|
-
},
|
|
72
|
-
'gdc': getDefaultConfigActionName,
|
|
73
|
-
'i': showIntroActionName,
|
|
74
|
-
};
|
|
75
|
-
if (card.importModal) {
|
|
76
|
-
const importModal = card.importModal;
|
|
77
|
-
serialized['im'] = {
|
|
78
|
-
'gsf': TaskManagementCardIntegration.nextHookName(),
|
|
79
|
-
's': TaskManagementCardIntegration.nextHookName(),
|
|
80
|
-
'i': TaskManagementCardIntegration.nextHookName(),
|
|
81
|
-
};
|
|
82
|
-
this.client.registerAction(serialized['im']['gsf'], async ({ 's': searchSoFar }) => {
|
|
83
|
-
const result = await importModal.getSearchFields(new Map(searchSoFar));
|
|
84
|
-
return (0, cardintegration_1.serializeCardFieldArrayDefinition)(result);
|
|
85
|
-
});
|
|
86
|
-
this.client.registerAction(serialized['im']['s'], async ({ 's': search }) => {
|
|
87
|
-
const result = await importModal.search(new Map(search));
|
|
88
|
-
return {
|
|
89
|
-
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(result.data),
|
|
90
|
-
'f': (0, cardintegration_1.serializeCardFieldArrayDefinition)(result.fields),
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
this.client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
|
|
94
|
-
const result = await importModal.import(primaryKeys, new Map(searchFields));
|
|
95
|
-
return {
|
|
96
|
-
'c': result.collection.id,
|
|
97
|
-
'pks': result.primaryKeys,
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (card.addCard) {
|
|
102
|
-
const addCard = card.addCard;
|
|
103
|
-
serialized['ac'] = {
|
|
104
|
-
'gif': TaskManagementCardIntegration.nextHookName(),
|
|
105
|
-
'cc': TaskManagementCardIntegration.nextHookName(),
|
|
106
|
-
};
|
|
107
|
-
this.client.registerAction(serialized['ac']['gif'], async ({ 'i': inputSoFar }) => {
|
|
108
|
-
const result = await addCard.getInputFields(new Map(inputSoFar));
|
|
109
|
-
return (0, cardintegration_1.serializeCardFieldArrayDefinition)(result);
|
|
110
|
-
});
|
|
111
|
-
this.client.registerAction(serialized['ac']['cc'], async ({ 'i': input }) => {
|
|
112
|
-
const result = await addCard.createCardData(new Map(input));
|
|
113
|
-
return {
|
|
114
|
-
'c': result.collection.id,
|
|
115
|
-
'pk': result.primaryKey,
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
this.client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
|
|
120
|
-
}
|
|
121
|
-
showCardImport(name) {
|
|
122
|
-
return this.client.sendCommand("ic" /* CommandName.ImportCards */, name);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.TaskManagementCardIntegration = TaskManagementCardIntegration;
|
|
126
|
-
TaskManagementCardIntegration.nextHookId = 0;
|