lucid-extension-sdk 0.0.434 → 0.0.436
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 +28 -0
- package/commandtypes.js +2 -0
- package/core/cardintegration/cardintegrationautosyncconfig.d.ts +23 -0
- package/core/cardintegration/cardintegrationautosyncconfig.js +2 -0
- package/core/cardintegration/cardintegrationparams.d.ts +11 -0
- package/core/cardintegration/carduseraccessresult.d.ts +18 -0
- package/core/cardintegration/carduseraccessresult.js +13 -0
- package/core/cardintegration/lucidcardintegration.d.ts +10 -0
- package/core/cardintegration/lucidcardintegrationregistry.js +37 -0
- package/core/data/fieldspecification.d.ts +5 -2
- package/core/data/fieldspecification.js +2 -1
- package/core/data/lucidicon.d.ts +4 -4
- package/core/data/lucidicon.js +2 -2
- package/core/data/serializedfield/serializeddisplayoption.d.ts +17 -0
- package/core/data/serializedfield/serializeddisplayoption.js +18 -0
- package/core/data/serializedfield/serializedfielddefinition.d.ts +6 -0
- package/core/data/serializedfield/serializedfielddefinition.js +2 -0
- package/core/data/serializedfield/serializedfields.d.ts +9 -1
- package/core/data/serializedfield/serializedfields.js +3 -3
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +3 -2
- package/data/branchedcollectionid.js +0 -2
- package/data/displayoptiondefinition.d.ts +14 -0
- package/data/displayoptiondefinition.js +31 -0
- package/data/fieldconstraintdefinition.d.ts +58 -0
- package/data/fieldconstraintdefinition.js +49 -0
- package/data/schemadefinition.d.ts +10 -58
- package/data/schemadefinition.js +17 -47
- package/dataconnector/datasourceclient.d.ts +7 -0
- package/dataconnector/datasourceclient.js +26 -0
- package/dataconnector/datasourceupdatetypes.d.ts +8 -1
- package/dataconnector/datasourceupdatetypes.js +11 -3
- package/editorclient.d.ts +13 -0
- package/editorclient.js +17 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare const enum CommandName {
|
|
|
46
46
|
CalculateHash = "hsh",
|
|
47
47
|
CanEditPackageSettings = "ceps",
|
|
48
48
|
CancelDragBlockToCanvas = "cdc",
|
|
49
|
+
CheckUserFlagAssignment = "cufa",
|
|
49
50
|
Confirm = "c",
|
|
50
51
|
CreateBlock = "cb",
|
|
51
52
|
CreateCards = "ca",
|
|
@@ -77,6 +78,7 @@ export declare const enum CommandName {
|
|
|
77
78
|
GetCurrentPage = "gcp",
|
|
78
79
|
GetCustomShape = "gcs",
|
|
79
80
|
GetDataItemField = "gdif",
|
|
81
|
+
GetDeveloperModeStatus = "gdms",
|
|
80
82
|
GetDocumentAccessPermission = "gdap",
|
|
81
83
|
GetDocumentChunks = "gdc",
|
|
82
84
|
GetDocumentId = "gdid",
|
|
@@ -252,6 +254,10 @@ export type CommandArgs = {
|
|
|
252
254
|
query: CancelDragBlockToCanvasQuery;
|
|
253
255
|
result: CancelDragBlockToCanvasResult;
|
|
254
256
|
};
|
|
257
|
+
[CommandName.CheckUserFlagAssignment]: {
|
|
258
|
+
query: CheckUserFlagAssignmentQuery;
|
|
259
|
+
result: CheckUserFlagAssignmentResult;
|
|
260
|
+
};
|
|
255
261
|
[CommandName.Confirm]: {
|
|
256
262
|
query: ConfirmQuery;
|
|
257
263
|
result: ConfirmResult;
|
|
@@ -376,6 +382,10 @@ export type CommandArgs = {
|
|
|
376
382
|
query: GetDataItemFieldQuery;
|
|
377
383
|
result: GetDataItemFieldResult;
|
|
378
384
|
};
|
|
385
|
+
[CommandName.GetDeveloperModeStatus]: {
|
|
386
|
+
query: GetDeveloperModeStatusQuery;
|
|
387
|
+
result: GetDeveloperModeStatusResult;
|
|
388
|
+
};
|
|
379
389
|
[CommandName.GetDocumentAccessPermission]: {
|
|
380
390
|
query: GetDocumentAccessPermissionQuery;
|
|
381
391
|
result: GetDocumentAccessPermissionResult;
|
|
@@ -735,6 +745,11 @@ export type AddCardsActions = {
|
|
|
735
745
|
/** Create card action */
|
|
736
746
|
'cc': string;
|
|
737
747
|
};
|
|
748
|
+
export type AutoSyncSettings = {
|
|
749
|
+
'h': string;
|
|
750
|
+
'gsf': string;
|
|
751
|
+
'sqs'?: string | undefined;
|
|
752
|
+
};
|
|
738
753
|
export type SerializedFieldConfiguration = {
|
|
739
754
|
/** Callback to get field definitions for all fields supported by the card integration */
|
|
740
755
|
'gf': string;
|
|
@@ -799,6 +814,8 @@ export type AddCardIntegrationQuery = {
|
|
|
799
814
|
} | undefined;
|
|
800
815
|
/** If specified, add-card settings */
|
|
801
816
|
'ac'?: AddCardsActions | undefined;
|
|
817
|
+
/** If specified, auto sync settings */
|
|
818
|
+
'as'?: AutoSyncSettings | undefined;
|
|
802
819
|
/** Whether to enable dependency mapping for this integration */
|
|
803
820
|
'sdm'?: boolean;
|
|
804
821
|
/**
|
|
@@ -884,6 +901,10 @@ export type AddCardIntegrationQuery = {
|
|
|
884
901
|
'd': string;
|
|
885
902
|
'cb': string;
|
|
886
903
|
} | undefined;
|
|
904
|
+
/**
|
|
905
|
+
* whether the user has access to items
|
|
906
|
+
*/
|
|
907
|
+
'hait'?: string | undefined;
|
|
887
908
|
};
|
|
888
909
|
export type AddCardIntegrationResult = undefined;
|
|
889
910
|
/** @ignore */
|
|
@@ -1375,6 +1396,8 @@ export type GetDataItemFieldQuery = {
|
|
|
1375
1396
|
'f': string;
|
|
1376
1397
|
};
|
|
1377
1398
|
export type GetDataItemFieldResult = SerializedFieldType;
|
|
1399
|
+
export type GetDeveloperModeStatusQuery = void;
|
|
1400
|
+
export type GetDeveloperModeStatusResult = boolean;
|
|
1378
1401
|
export type GetDocumentAccessPermissionQuery = void;
|
|
1379
1402
|
export type GetDocumentAccessPermissionResult = DocumentAccessPermission;
|
|
1380
1403
|
export declare enum GetDocumentChunksType {
|
|
@@ -1990,4 +2013,9 @@ export type ZOrderQuery = {
|
|
|
1990
2013
|
'o': ZOrderOperation;
|
|
1991
2014
|
};
|
|
1992
2015
|
export type ZOrderResult = undefined;
|
|
2016
|
+
export type CheckUserFlagAssignmentQuery = {
|
|
2017
|
+
/** The name of the flag that will be checked */
|
|
2018
|
+
'f': string;
|
|
2019
|
+
};
|
|
2020
|
+
export type CheckUserFlagAssignmentResult = boolean;
|
|
1993
2021
|
export {};
|
package/commandtypes.js
CHANGED
|
@@ -23,6 +23,7 @@ exports.commandTitles = new Map([
|
|
|
23
23
|
["b" /* CommandName.Bootstrap */, 'Bootstrap'],
|
|
24
24
|
["ceps" /* CommandName.CanEditPackageSettings */, 'CanEditPackageSettings'],
|
|
25
25
|
["cdc" /* CommandName.CancelDragBlockToCanvas */, 'CancelDragBlockToCanvas'],
|
|
26
|
+
["cufa" /* CommandName.CheckUserFlagAssignment */, 'CheckUserFlagAssignment'],
|
|
26
27
|
["c" /* CommandName.Confirm */, 'Confirm'],
|
|
27
28
|
["cb" /* CommandName.CreateBlock */, 'CreateBlock'],
|
|
28
29
|
["cc" /* CommandName.CreateCollection */, 'CreateCollection'],
|
|
@@ -50,6 +51,7 @@ exports.commandTitles = new Map([
|
|
|
50
51
|
["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
|
|
51
52
|
["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
|
|
52
53
|
["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
|
|
54
|
+
["gdms" /* CommandName.GetDeveloperModeStatus */, 'GetDeveloperModeStatus'],
|
|
53
55
|
["gdap" /* CommandName.GetDocumentAccessPermission */, 'GetDocumentAccessPermission'],
|
|
54
56
|
["gdc" /* CommandName.GetDocumentChunks */, 'GetDocumentChunks'],
|
|
55
57
|
["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
2
|
+
import { ExtensionCardFieldDefinition, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
3
|
+
export interface CardIntegrationAutoSyncConfig {
|
|
4
|
+
/**
|
|
5
|
+
* The header to display for the integration. For example, the Jira integration displays "JQL query sync"
|
|
6
|
+
*/
|
|
7
|
+
header: string;
|
|
8
|
+
/**
|
|
9
|
+
* Callback that should return a single field that users can use to determine which instance, workspace,
|
|
10
|
+
* organization (or any equivalent field for an extension) so that the data source id can be caluclated
|
|
11
|
+
*
|
|
12
|
+
* The value is the syncDataSourceIdNonce. If this is the same no matter what, return a single ExtensionCardField
|
|
13
|
+
* with a single ExtensionCardFieldOption in ExtensionCardField.options
|
|
14
|
+
*/
|
|
15
|
+
getSyncDataSourceIdField: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Perform a search on the query string. This should support pagination.
|
|
18
|
+
*
|
|
19
|
+
* The syncDataSourceIdNonce is provided in otherFields
|
|
20
|
+
* @returns either an error AutoSyncError or an array of issues / tasks / cards represented as an AutoSyncRow
|
|
21
|
+
*/
|
|
22
|
+
searchQueryString?: (queryString: string, otherFields: Map<string, SerializedFieldType>, pageNumber: number, nextPageToken: string | undefined) => Promise<SearchResult>;
|
|
23
|
+
}
|
|
@@ -23,6 +23,12 @@ export interface SearchParam {
|
|
|
23
23
|
'o': number;
|
|
24
24
|
'l': number;
|
|
25
25
|
}
|
|
26
|
+
export interface QuerySearchParam {
|
|
27
|
+
'qs': string;
|
|
28
|
+
'of': [string, SerializedFieldType][];
|
|
29
|
+
'pn': number;
|
|
30
|
+
'npt': string | undefined;
|
|
31
|
+
}
|
|
26
32
|
/** @ignore */
|
|
27
33
|
export interface ImportParam {
|
|
28
34
|
'pks': string[];
|
|
@@ -90,4 +96,9 @@ export interface FieldLabelIconsCallbackParam {
|
|
|
90
96
|
export interface ImportFromSerializedFieldsCallbackParam {
|
|
91
97
|
'sf': SerializedFields[];
|
|
92
98
|
}
|
|
99
|
+
/** @ignore */
|
|
100
|
+
export interface HasAccessToItemsParam {
|
|
101
|
+
'ek': string;
|
|
102
|
+
'dk'?: string;
|
|
103
|
+
}
|
|
93
104
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SerializedFieldConstraint } from '../data/serializedfield/serializedfielddefinition';
|
|
2
|
+
/**
|
|
3
|
+
* Defines whether the current user has access to an item.
|
|
4
|
+
*/
|
|
5
|
+
export interface CardUserAccessResult {
|
|
6
|
+
hasPermission: boolean;
|
|
7
|
+
constraints: {
|
|
8
|
+
fieldName: string;
|
|
9
|
+
constraints?: SerializedFieldConstraint[];
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export declare function serializeCardUserAccessResult(result: CardUserAccessResult): {
|
|
13
|
+
hp: boolean;
|
|
14
|
+
c: {
|
|
15
|
+
fn: string;
|
|
16
|
+
cs: SerializedFieldConstraint[] | undefined;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeCardUserAccessResult = void 0;
|
|
4
|
+
function serializeCardUserAccessResult(result) {
|
|
5
|
+
return {
|
|
6
|
+
'hp': result.hasPermission,
|
|
7
|
+
'c': result.constraints.map((c) => ({
|
|
8
|
+
'fn': c.fieldName,
|
|
9
|
+
'cs': c.constraints,
|
|
10
|
+
})),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.serializeCardUserAccessResult = serializeCardUserAccessResult;
|
|
@@ -7,7 +7,9 @@ import { SerializedFieldType, SerializedFields } from '../data/serializedfield/s
|
|
|
7
7
|
import { ImportCardFromDetails } from '../importcardfromdetails/importcardfromdetails';
|
|
8
8
|
import { ImportCardFromPastedLinkCallback } from '../importcardfrompastedlink/importcardfrompastedlinkcallback';
|
|
9
9
|
import { DependenciesForItems, ExtensionCardFieldDefinition, ExtensionFieldConfiguration, ImportResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
10
|
+
import { CardIntegrationAutoSyncConfig } from './cardintegrationautosyncconfig';
|
|
10
11
|
import { CardIntegrationConfig } from './cardintegrationconfig';
|
|
12
|
+
import { CardUserAccessResult } from './carduseraccessresult';
|
|
11
13
|
import { DependencyMappingPhrasesType } from './dependencymappingphrases';
|
|
12
14
|
import { LucidCardIntegrationCustomImportModal } from './lucidcardintegrationcustomimportmodal';
|
|
13
15
|
import { LucidCardIntegrationStandardImportModal } from './lucidcardintegrationstandardimportmodal';
|
|
@@ -115,6 +117,10 @@ export declare abstract class LucidCardIntegration {
|
|
|
115
117
|
primaryKey: string;
|
|
116
118
|
}>;
|
|
117
119
|
};
|
|
120
|
+
/**
|
|
121
|
+
* If specified, allows the user to use query to sync with timelines.
|
|
122
|
+
*/
|
|
123
|
+
autoSync?: CardIntegrationAutoSyncConfig;
|
|
118
124
|
showCardImport(name: string): import("../../commandtypes").ImportCardsResult;
|
|
119
125
|
showDependencyMapping?: boolean;
|
|
120
126
|
/**
|
|
@@ -143,4 +149,8 @@ export declare abstract class LucidCardIntegration {
|
|
|
143
149
|
* the import.
|
|
144
150
|
*/
|
|
145
151
|
importFromSerializedFields?: (data: SerializedFields[]) => Promise<ImportCardFromDetails>;
|
|
152
|
+
/**
|
|
153
|
+
* @experimental When defined, allows the extension to make cards that the user doesn't have access to view-only.
|
|
154
|
+
*/
|
|
155
|
+
hasAccessToItems?: (editedKey: string, dependencyKey: string | undefined) => Promise<CardUserAccessResult>;
|
|
146
156
|
}
|
|
@@ -10,6 +10,7 @@ const checks_1 = require("../checks");
|
|
|
10
10
|
const importcardfromdetails_1 = require("../importcardfromdetails/importcardfromdetails");
|
|
11
11
|
const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
|
|
12
12
|
const cardintegrationconfig_1 = require("./cardintegrationconfig");
|
|
13
|
+
const carduseraccessresult_1 = require("./carduseraccessresult");
|
|
13
14
|
const lucidcardintegrationcustomimportmodal_1 = require("./lucidcardintegrationcustomimportmodal");
|
|
14
15
|
class LucidCardIntegrationRegistry {
|
|
15
16
|
static nextHookName() {
|
|
@@ -172,6 +173,7 @@ class LucidCardIntegrationRegistry {
|
|
|
172
173
|
},
|
|
173
174
|
})),
|
|
174
175
|
'ipsr': searchResult.itemsPerSearchResult,
|
|
176
|
+
'e': searchResult.error,
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
179
|
static registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized) {
|
|
@@ -341,6 +343,33 @@ class LucidCardIntegrationRegistry {
|
|
|
341
343
|
};
|
|
342
344
|
});
|
|
343
345
|
}
|
|
346
|
+
if (cardIntegration.autoSync) {
|
|
347
|
+
const autoSync = cardIntegration.autoSync;
|
|
348
|
+
serialized['as'] = {
|
|
349
|
+
'h': autoSync.header,
|
|
350
|
+
'gsf': LucidCardIntegrationRegistry.nextHookName(),
|
|
351
|
+
};
|
|
352
|
+
client.registerAction(serialized['as']['gsf'], async ({ 'i': inputSoFar }) => {
|
|
353
|
+
const result = await autoSync.getSyncDataSourceIdField(new Map(inputSoFar));
|
|
354
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
355
|
+
});
|
|
356
|
+
if (autoSync.searchQueryString) {
|
|
357
|
+
serialized['as']['sqs'] = LucidCardIntegrationRegistry.nextHookName();
|
|
358
|
+
client.registerAction(serialized['as']['sqs'], async ({ 'qs': queryString, 'of': otherFields, 'pn': pageNumber, 'npt': nextPageToken, }) => {
|
|
359
|
+
var _a;
|
|
360
|
+
const result = await ((_a = autoSync.searchQueryString) === null || _a === void 0 ? void 0 : _a.call(autoSync, queryString, new Map(otherFields), pageNumber, nextPageToken));
|
|
361
|
+
if (result) {
|
|
362
|
+
return this.serializeSearchResult(result);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
return this.serializeSearchResult({
|
|
366
|
+
searchResults: [],
|
|
367
|
+
error: 'Unknown Error Occurred',
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
344
373
|
if (cardIntegration.fieldConfiguration.customFieldDisplaySettings) {
|
|
345
374
|
serialized['fc']['cfds'] = {
|
|
346
375
|
'd': cardIntegration.fieldConfiguration.customFieldDisplaySettings.defaultToMultilineText,
|
|
@@ -358,6 +387,14 @@ class LucidCardIntegrationRegistry {
|
|
|
358
387
|
return (0, importcardfromdetails_1.serializeImportCardFromDetails)(result);
|
|
359
388
|
});
|
|
360
389
|
}
|
|
390
|
+
if (cardIntegration.hasAccessToItems) {
|
|
391
|
+
const hasAccessToItemsActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
392
|
+
serialized['hait'] = hasAccessToItemsActionName;
|
|
393
|
+
client.registerAction(hasAccessToItemsActionName, async ({ 'ek': editedKey, 'dk': dependencyKey }) => {
|
|
394
|
+
const result = await cardIntegration.hasAccessToItems(editedKey, dependencyKey);
|
|
395
|
+
return (0, carduseraccessresult_1.serializeCardUserAccessResult)(result);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
361
398
|
client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
|
|
362
399
|
}
|
|
363
400
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DisplayOptionDefinition } from '../../data/displayoptiondefinition';
|
|
2
|
+
import { FieldConstraintDefinition } from '../../data/fieldconstraintdefinition';
|
|
2
3
|
import { CollectionEnumFieldType } from './fieldtypedefinition/collectionenumfieldtype';
|
|
3
4
|
import { DeserializedMapEnumFieldType } from './fieldtypedefinition/deserializedmapenumfieldtype';
|
|
4
5
|
import { FieldTypeArray } from './fieldtypedefinition/fieldtypearray';
|
|
@@ -25,11 +26,12 @@ type TsTypeOf<X> = X extends ScalarFieldTypeEnum.ANY ? unknown : X extends Scala
|
|
|
25
26
|
* additional (and valuable) user functionality. This includes better support in the edit panel, and better user facing
|
|
26
27
|
* descriptions of your fields.
|
|
27
28
|
*/
|
|
28
|
-
export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, Fields extends {
|
|
29
|
+
export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, DisplayOption extends DisplayOptionDefinition, Fields extends {
|
|
29
30
|
[Name in Names]: {
|
|
30
31
|
type: Types;
|
|
31
32
|
constraints?: readonly Constraint[];
|
|
32
33
|
mapping?: readonly SemanticKind[] | readonly SemanticFields[] | readonly LucidFields[] | undefined;
|
|
34
|
+
displayOptions?: readonly DisplayOption[] | undefined;
|
|
33
35
|
};
|
|
34
36
|
}, PrimaryKey extends keyof Fields>({ primaryKey, fields }: {
|
|
35
37
|
primaryKey: PrimaryKey[];
|
|
@@ -41,6 +43,7 @@ export declare function declareSchema<Names extends string, Types extends Readon
|
|
|
41
43
|
type: FieldTypeDefinition;
|
|
42
44
|
constraints: FieldConstraintDefinition[];
|
|
43
45
|
mapping: readonly SemanticKind[] | readonly SemanticFields[] | readonly LucidFields[];
|
|
46
|
+
displayOptions: readonly DisplayOption[];
|
|
44
47
|
}[];
|
|
45
48
|
primaryKey: FormattedPrimaryKey<Fields, PrimaryKey>;
|
|
46
49
|
fromItemsSparse: (items: PartialItemType<typeof fields, PrimaryKey>[]) => Map<string, PartialItemType<Fields, PrimaryKey>>;
|
|
@@ -22,12 +22,13 @@ function declareSchema({ primaryKey, fields }) {
|
|
|
22
22
|
const primaryKeyObj = new FormattedPrimaryKey(...primaryKey);
|
|
23
23
|
return {
|
|
24
24
|
example: fields,
|
|
25
|
-
array: Object.entries(fields).map(([name, { type, constraints, mapping }]) => {
|
|
25
|
+
array: Object.entries(fields).map(([name, { type, constraints, mapping, displayOptions: displayOptions }]) => {
|
|
26
26
|
return {
|
|
27
27
|
'name': name,
|
|
28
28
|
'type': isArrayAndAssertReadonly(type) ? type.slice() : type,
|
|
29
29
|
'constraints': constraints,
|
|
30
30
|
'mapping': mapping,
|
|
31
|
+
'displayOptions': displayOptions,
|
|
31
32
|
};
|
|
32
33
|
}),
|
|
33
34
|
primaryKey: primaryKeyObj,
|
package/core/data/lucidicon.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SerializedLucidIconData } from './serializedfield/serializedfields';
|
|
2
2
|
/**
|
|
3
|
-
* Creates icon data as a
|
|
3
|
+
* Creates icon data as a SerializedLucidIconData.
|
|
4
4
|
* Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
|
|
5
5
|
* @param icon - The URL or SVG data for the icon
|
|
6
6
|
* @param ariaLabel - The accessible label for the icon
|
|
7
7
|
* @param tooltipLabel - Optional tooltip text
|
|
8
|
-
* @returns A
|
|
8
|
+
* @returns A SerializedLucidIconData with the keys: icon, ariaLabel, and tooltipLabel (if provided)
|
|
9
9
|
*/
|
|
10
|
-
export declare function createLucidIconData(icon: string, ariaLabel: string, tooltipLabel?: string):
|
|
10
|
+
export declare function createLucidIconData(icon: string, ariaLabel: string, tooltipLabel?: string): SerializedLucidIconData;
|
package/core/data/lucidicon.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLucidIconData = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Creates icon data as a
|
|
5
|
+
* Creates icon data as a SerializedLucidIconData.
|
|
6
6
|
* Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
|
|
7
7
|
* @param icon - The URL or SVG data for the icon
|
|
8
8
|
* @param ariaLabel - The accessible label for the icon
|
|
9
9
|
* @param tooltipLabel - Optional tooltip text
|
|
10
|
-
* @returns A
|
|
10
|
+
* @returns A SerializedLucidIconData with the keys: icon, ariaLabel, and tooltipLabel (if provided)
|
|
11
11
|
*/
|
|
12
12
|
function createLucidIconData(icon, ariaLabel, tooltipLabel) {
|
|
13
13
|
return {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UnsafeJsonSerializableOrUndefined } from '../../jsonserializable';
|
|
2
|
+
/**
|
|
3
|
+
* @experimental
|
|
4
|
+
* The options here must match com.lucidchart.data.model.fielddefinition.DisplayOptionType on the backend
|
|
5
|
+
*/
|
|
6
|
+
export declare enum DisplayOptionType {
|
|
7
|
+
DisplayMultiUserSelect = "displayMultiUserSelect"
|
|
8
|
+
}
|
|
9
|
+
export declare const isDisplayOptionType: (x: unknown) => x is DisplayOptionType.DisplayMultiUserSelect;
|
|
10
|
+
export type SerializedDisplayOption = {
|
|
11
|
+
'Type': DisplayOptionType;
|
|
12
|
+
'Details'?: UnsafeJsonSerializableOrUndefined;
|
|
13
|
+
};
|
|
14
|
+
export declare const isSerializedDisplayOption: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
15
|
+
Type: (x: unknown) => x is DisplayOptionType.DisplayMultiUserSelect;
|
|
16
|
+
Details: (x: unknown) => x is UnsafeJsonSerializableOrUndefined;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSerializedDisplayOption = exports.isDisplayOptionType = exports.DisplayOptionType = void 0;
|
|
4
|
+
const jsonserializable_1 = require("../../jsonserializable");
|
|
5
|
+
const validators_1 = require("../../validators/validators");
|
|
6
|
+
/**
|
|
7
|
+
* @experimental
|
|
8
|
+
* The options here must match com.lucidchart.data.model.fielddefinition.DisplayOptionType on the backend
|
|
9
|
+
*/
|
|
10
|
+
var DisplayOptionType;
|
|
11
|
+
(function (DisplayOptionType) {
|
|
12
|
+
DisplayOptionType["DisplayMultiUserSelect"] = "displayMultiUserSelect";
|
|
13
|
+
})(DisplayOptionType || (exports.DisplayOptionType = DisplayOptionType = {}));
|
|
14
|
+
exports.isDisplayOptionType = (0, validators_1.enumValidator)(DisplayOptionType);
|
|
15
|
+
exports.isSerializedDisplayOption = (0, validators_1.objectValidator)({
|
|
16
|
+
'Type': (0, validators_1.enumValidator)(DisplayOptionType),
|
|
17
|
+
'Details': (0, validators_1.option)(jsonserializable_1.isJsonSerializableOrUndefined),
|
|
18
|
+
});
|
|
@@ -4,6 +4,7 @@ import { SerializedFieldTypeDefinition, isSerializedFieldTypeDefinition } from '
|
|
|
4
4
|
import { LucidFields } from '../fieldtypedefinition/lucidfields';
|
|
5
5
|
import { SemanticFields } from '../fieldtypedefinition/semanticfields';
|
|
6
6
|
import { SemanticKind } from '../fieldtypedefinition/semantickind';
|
|
7
|
+
import { SerializedDisplayOption } from './serializeddisplayoption';
|
|
7
8
|
export declare enum FieldConstraintType {
|
|
8
9
|
REQUIRED = "required",
|
|
9
10
|
LOCKED = "locked",
|
|
@@ -31,6 +32,7 @@ export type SerializedFieldDefinition = {
|
|
|
31
32
|
'Constraints'?: SerializedFieldConstraint[] | undefined;
|
|
32
33
|
'SyncSchema'?: string | undefined;
|
|
33
34
|
'Mapping'?: readonly LucidFields[] | readonly SemanticFields[] | readonly SemanticKind[] | undefined;
|
|
35
|
+
'DisplayOptions'?: SerializedDisplayOption[] | undefined;
|
|
34
36
|
};
|
|
35
37
|
export declare const isSerializedFieldDefinition: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
36
38
|
Name: typeof isString;
|
|
@@ -42,4 +44,8 @@ export declare const isSerializedFieldDefinition: (subject: unknown) => subject
|
|
|
42
44
|
}>[] | undefined;
|
|
43
45
|
SyncSchema: (x: unknown) => x is string | undefined;
|
|
44
46
|
Mapping: (x: unknown) => x is LucidFields[] | SemanticKind[] | undefined;
|
|
47
|
+
DisplayOptions: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
|
|
48
|
+
Type: (x: unknown) => x is import("./serializeddisplayoption").DisplayOptionType.DisplayMultiUserSelect;
|
|
49
|
+
Details: (x: unknown) => x is UnsafeJsonSerializableOrUndefined;
|
|
50
|
+
}>[] | undefined;
|
|
45
51
|
}>;
|
|
@@ -6,6 +6,7 @@ const validators_1 = require("../../validators/validators");
|
|
|
6
6
|
const fieldtypedefinition_1 = require("../fieldtypedefinition/fieldtypedefinition");
|
|
7
7
|
const lucidfields_1 = require("../fieldtypedefinition/lucidfields");
|
|
8
8
|
const semantickind_1 = require("../fieldtypedefinition/semantickind");
|
|
9
|
+
const serializeddisplayoption_1 = require("./serializeddisplayoption");
|
|
9
10
|
// The options here must match com.lucidchart.data.model.fielddefinition.FieldConstraintType on the backend
|
|
10
11
|
var FieldConstraintType;
|
|
11
12
|
(function (FieldConstraintType) {
|
|
@@ -30,4 +31,5 @@ exports.isSerializedFieldDefinition = (0, validators_1.strictObjectValidator)({
|
|
|
30
31
|
'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldConstraint)),
|
|
31
32
|
'SyncSchema': (0, validators_1.option)(checks_1.isString),
|
|
32
33
|
'Mapping': (0, validators_1.option)((0, validators_1.either)((0, validators_1.arrayValidator)(lucidfields_1.isLucidFields), (0, validators_1.arrayValidator)(semantickind_1.isSemanticKind))),
|
|
34
|
+
'DisplayOptions': (0, validators_1.option)((0, validators_1.arrayValidator)(serializeddisplayoption_1.isSerializedDisplayOption)),
|
|
33
35
|
});
|
|
@@ -139,7 +139,15 @@ export declare const isSerializedTimeObject: (subject: unknown) => subject is im
|
|
|
139
139
|
minutes: (x: unknown) => x is number | undefined;
|
|
140
140
|
seconds: (x: unknown) => x is number | undefined;
|
|
141
141
|
}>;
|
|
142
|
-
export
|
|
142
|
+
export type SerializedLucidIconData = {
|
|
143
|
+
'dict': {
|
|
144
|
+
'icon': string;
|
|
145
|
+
'ariaLabel': string;
|
|
146
|
+
'tooltipLabel'?: string | undefined;
|
|
147
|
+
'roundedIcon'?: boolean | undefined;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
export declare const isSerializedLucidIconData: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
143
151
|
dict: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
144
152
|
icon: typeof isString;
|
|
145
153
|
ariaLabel: typeof isString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.
|
|
3
|
+
exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidIconData = exports.isSerializedTimeObject = exports.isSerializedLucidDateRangeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidAvatarDataDictionary = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
|
|
4
4
|
const checks_1 = require("../../checks");
|
|
5
5
|
const validators_1 = require("../../validators/validators");
|
|
6
6
|
function isSerializedColorObjectFieldType(value) {
|
|
@@ -44,7 +44,7 @@ exports.isSerializedTimeObject = (0, validators_1.objectValidator)({
|
|
|
44
44
|
'minutes': (0, validators_1.option)(checks_1.isNumber),
|
|
45
45
|
'seconds': (0, validators_1.option)(checks_1.isNumber),
|
|
46
46
|
});
|
|
47
|
-
exports.
|
|
47
|
+
exports.isSerializedLucidIconData = (0, validators_1.objectValidator)({
|
|
48
48
|
'dict': (0, validators_1.objectValidator)({
|
|
49
49
|
'icon': checks_1.isString,
|
|
50
50
|
'ariaLabel': checks_1.isString,
|
|
@@ -64,7 +64,7 @@ function isSerializedFieldType(value) {
|
|
|
64
64
|
(0, exports.isSerializedLucidDateRangeObject)(value) ||
|
|
65
65
|
(0, exports.isSerializedTimeObject)(value) ||
|
|
66
66
|
isSerializedColorObjectFieldType(value) ||
|
|
67
|
-
(0, exports.
|
|
67
|
+
(0, exports.isSerializedLucidIconData)(value) ||
|
|
68
68
|
(0, exports.isSerializedLucidAvatarDataDictionary)(value));
|
|
69
69
|
}
|
|
70
70
|
exports.isSerializedFieldType = isSerializedFieldType;
|
|
@@ -7,7 +7,7 @@ import { FieldDescriptor } from '../cardintegration/lucidcardintegration';
|
|
|
7
7
|
import { isArray, isString } from '../checks';
|
|
8
8
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
9
9
|
import { SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
10
|
-
import { SerializedFieldType,
|
|
10
|
+
import { SerializedFieldType, SerializedLucidIconData, isSerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
11
11
|
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
12
12
|
export interface ExtensionCardFieldOption {
|
|
13
13
|
label: string;
|
|
@@ -161,6 +161,7 @@ export interface SearchResultPerCollection {
|
|
|
161
161
|
export interface SearchResult {
|
|
162
162
|
searchResults: SearchResultPerCollection[];
|
|
163
163
|
itemsPerSearchResult?: number | undefined;
|
|
164
|
+
error?: string | undefined;
|
|
164
165
|
}
|
|
165
166
|
export declare const isSearchResult: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
166
167
|
searchResults: typeof isArray;
|
|
@@ -275,4 +276,4 @@ export type ExtensionFieldConfiguration = {
|
|
|
275
276
|
* Maps item field names to icons that show next to the field labels in the card details panel.
|
|
276
277
|
* Use the `createLucidIconData()` helper to format the icon data in this map.
|
|
277
278
|
*/
|
|
278
|
-
export type ExtensionCardFieldLabelIcons = Map<string,
|
|
279
|
+
export type ExtensionCardFieldLabelIcons = Map<string, SerializedLucidIconData>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.patchCollectionIdFromPossibleBranchedCollectionId = exports.branchedCollectionId = void 0;
|
|
4
|
-
// LAL-1631: make sure references to this method are correct
|
|
5
4
|
/** @ignore */
|
|
6
5
|
function branchedCollectionId(upstreamId) {
|
|
7
6
|
return upstreamId + '_b';
|
|
8
7
|
}
|
|
9
8
|
exports.branchedCollectionId = branchedCollectionId;
|
|
10
|
-
// LAL-1631: make sure references to this method are correct
|
|
11
9
|
/** @ignore */
|
|
12
10
|
function patchCollectionIdFromPossibleBranchedCollectionId(branchId) {
|
|
13
11
|
if (branchId && branchId.endsWith('_b')) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isUndefined } from '../core/checks';
|
|
2
|
+
import { DisplayOptionType, SerializedDisplayOption } from '../core/data/serializedfield/serializeddisplayoption';
|
|
3
|
+
export interface DisplayMultiUserEditDisplayOptionDefinition {
|
|
4
|
+
type: DisplayOptionType.DisplayMultiUserSelect;
|
|
5
|
+
value?: undefined;
|
|
6
|
+
}
|
|
7
|
+
export type DisplayOptionDefinition = DisplayMultiUserEditDisplayOptionDefinition;
|
|
8
|
+
export declare function createDisplayOptionDefinition(type: DisplayOptionType, value?: number): DisplayOptionDefinition;
|
|
9
|
+
export declare const isDisplayOptionDefinition: (subject: unknown) => subject is import("..").DestructureGuardedTypeObj<{
|
|
10
|
+
type: (x: unknown) => x is DisplayOptionType.DisplayMultiUserSelect;
|
|
11
|
+
value: typeof isUndefined;
|
|
12
|
+
}>;
|
|
13
|
+
/** @ignore */
|
|
14
|
+
export declare function serializeDisplayOptionDefinition(option: DisplayOptionDefinition): SerializedDisplayOption;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeDisplayOptionDefinition = exports.isDisplayOptionDefinition = exports.createDisplayOptionDefinition = void 0;
|
|
4
|
+
const assertnever_1 = require("../core/assertnever");
|
|
5
|
+
const checks_1 = require("../core/checks");
|
|
6
|
+
const serializeddisplayoption_1 = require("../core/data/serializedfield/serializeddisplayoption");
|
|
7
|
+
const validators_1 = require("../core/validators/validators");
|
|
8
|
+
function createDisplayOptionDefinition(type, value) {
|
|
9
|
+
switch (type) {
|
|
10
|
+
case serializeddisplayoption_1.DisplayOptionType.DisplayMultiUserSelect:
|
|
11
|
+
if (value !== undefined) {
|
|
12
|
+
throw new Error('Invalid display option value');
|
|
13
|
+
}
|
|
14
|
+
return { type };
|
|
15
|
+
default:
|
|
16
|
+
(0, assertnever_1.assertNever)(type);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.createDisplayOptionDefinition = createDisplayOptionDefinition;
|
|
20
|
+
exports.isDisplayOptionDefinition = (0, validators_1.objectValidator)({
|
|
21
|
+
'type': serializeddisplayoption_1.isDisplayOptionType,
|
|
22
|
+
'value': checks_1.isUndefined, // value is always undefined for now, update as more complex options are added
|
|
23
|
+
});
|
|
24
|
+
/** @ignore */
|
|
25
|
+
function serializeDisplayOptionDefinition(option) {
|
|
26
|
+
return {
|
|
27
|
+
'Type': option.type,
|
|
28
|
+
'Details': option.value,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.serializeDisplayOptionDefinition = serializeDisplayOptionDefinition;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { isNumber, isUndefined } from '../core/checks';
|
|
2
|
+
import { FieldConstraintType, SerializedFieldConstraint } from '../core/data/serializedfield/serializedfielddefinition';
|
|
3
|
+
export interface RequiredFieldConstraintDefinition {
|
|
4
|
+
type: FieldConstraintType.REQUIRED;
|
|
5
|
+
value?: undefined;
|
|
6
|
+
reason?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface LockedFieldConstraintDefinition {
|
|
9
|
+
type: FieldConstraintType.LOCKED;
|
|
10
|
+
value?: undefined;
|
|
11
|
+
reason?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface MinValueFieldConstraintDefinition {
|
|
14
|
+
type: FieldConstraintType.MIN_VALUE;
|
|
15
|
+
value: number;
|
|
16
|
+
reason?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface MaxValueFieldConstraintDefinition {
|
|
19
|
+
type: FieldConstraintType.MAX_VALUE;
|
|
20
|
+
value: number;
|
|
21
|
+
reason?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface SingleLineFieldConstraintDefinition {
|
|
24
|
+
type: FieldConstraintType.SINGLE_LINE_ONLY;
|
|
25
|
+
value?: undefined;
|
|
26
|
+
reason?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface NoWhitespaceFieldConstraintDefinition {
|
|
29
|
+
type: FieldConstraintType.NO_WHITESPACE;
|
|
30
|
+
value?: undefined;
|
|
31
|
+
reason?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface UniqueEditFieldConstraintDefinition {
|
|
34
|
+
type: FieldConstraintType.UNIQUE_EDIT;
|
|
35
|
+
value?: undefined;
|
|
36
|
+
reason?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface MaxLengthConstraintDefinition {
|
|
39
|
+
type: FieldConstraintType.MAX_LENGTH;
|
|
40
|
+
value: number;
|
|
41
|
+
reason?: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition;
|
|
44
|
+
export declare function createFieldConstraintDefinition(type: FieldConstraintType, value?: number, reason?: string): FieldConstraintDefinition;
|
|
45
|
+
export declare function minMaxFieldConstraintValidator(val: unknown): val is FieldConstraintType.MIN_VALUE | FieldConstraintType.MAX_VALUE | FieldConstraintType.MAX_LENGTH;
|
|
46
|
+
export declare const isFieldConstraintDefinition: (x: unknown) => x is {
|
|
47
|
+
type?: FieldConstraintType | undefined;
|
|
48
|
+
} & {
|
|
49
|
+
type: FieldConstraintType;
|
|
50
|
+
} & (import("..").DestructureGuardedTypeObj<{
|
|
51
|
+
type: typeof minMaxFieldConstraintValidator;
|
|
52
|
+
value: typeof isNumber;
|
|
53
|
+
}> | import("..").DestructureGuardedTypeObj<{
|
|
54
|
+
type: (x: unknown) => x is FieldConstraintType.REQUIRED | FieldConstraintType.LOCKED | FieldConstraintType.SINGLE_LINE_ONLY | FieldConstraintType.NO_WHITESPACE | FieldConstraintType.UNIQUE_EDIT;
|
|
55
|
+
value: typeof isUndefined;
|
|
56
|
+
}>);
|
|
57
|
+
/** @ignore */
|
|
58
|
+
export declare function serializeFieldConstraintDefinition(constraint: FieldConstraintDefinition): SerializedFieldConstraint;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeFieldConstraintDefinition = exports.isFieldConstraintDefinition = exports.minMaxFieldConstraintValidator = exports.createFieldConstraintDefinition = void 0;
|
|
4
|
+
const assertnever_1 = require("../core/assertnever");
|
|
5
|
+
const checks_1 = require("../core/checks");
|
|
6
|
+
const serializedfielddefinition_1 = require("../core/data/serializedfield/serializedfielddefinition");
|
|
7
|
+
const validators_1 = require("../core/validators/validators");
|
|
8
|
+
function createFieldConstraintDefinition(type, value, reason) {
|
|
9
|
+
switch (type) {
|
|
10
|
+
case serializedfielddefinition_1.FieldConstraintType.REQUIRED:
|
|
11
|
+
case serializedfielddefinition_1.FieldConstraintType.LOCKED:
|
|
12
|
+
return Object.assign({ type }, (reason && { reason }));
|
|
13
|
+
case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
|
|
14
|
+
case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
|
|
15
|
+
case serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH:
|
|
16
|
+
if (value === undefined) {
|
|
17
|
+
throw new Error('Invalid constraint value');
|
|
18
|
+
}
|
|
19
|
+
return Object.assign({ type, value }, (reason && { reason }));
|
|
20
|
+
case serializedfielddefinition_1.FieldConstraintType.SINGLE_LINE_ONLY:
|
|
21
|
+
case serializedfielddefinition_1.FieldConstraintType.NO_WHITESPACE:
|
|
22
|
+
case serializedfielddefinition_1.FieldConstraintType.UNIQUE_EDIT:
|
|
23
|
+
if (value !== undefined) {
|
|
24
|
+
throw new Error('Invalid constraint value');
|
|
25
|
+
}
|
|
26
|
+
return Object.assign({ type }, (reason && { reason }));
|
|
27
|
+
default:
|
|
28
|
+
(0, assertnever_1.assertNever)(type);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.createFieldConstraintDefinition = createFieldConstraintDefinition;
|
|
32
|
+
function minMaxFieldConstraintValidator(val) {
|
|
33
|
+
return (val === serializedfielddefinition_1.FieldConstraintType.MIN_VALUE ||
|
|
34
|
+
val === serializedfielddefinition_1.FieldConstraintType.MAX_VALUE ||
|
|
35
|
+
val === serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH);
|
|
36
|
+
}
|
|
37
|
+
exports.minMaxFieldConstraintValidator = minMaxFieldConstraintValidator;
|
|
38
|
+
exports.isFieldConstraintDefinition = (0, validators_1.both)((0, validators_1.objectValidator)({
|
|
39
|
+
'type': serializedfielddefinition_1.isFieldConstraintType,
|
|
40
|
+
}), (0, validators_1.either)((0, validators_1.objectValidator)({ 'type': minMaxFieldConstraintValidator, 'value': checks_1.isNumber }), (0, validators_1.objectValidator)({ 'type': (0, validators_1.exclude)(serializedfielddefinition_1.isFieldConstraintType, minMaxFieldConstraintValidator), 'value': checks_1.isUndefined })));
|
|
41
|
+
/** @ignore */
|
|
42
|
+
function serializeFieldConstraintDefinition(constraint) {
|
|
43
|
+
return {
|
|
44
|
+
'Type': constraint.type,
|
|
45
|
+
'Details': constraint.value,
|
|
46
|
+
'Reason': constraint.reason,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.serializeFieldConstraintDefinition = serializeFieldConstraintDefinition;
|
|
@@ -1,64 +1,11 @@
|
|
|
1
|
-
import { isNumber, isUndefined } from '../core/checks';
|
|
2
1
|
import { FieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
|
|
3
2
|
import { LucidFields } from '../core/data/fieldtypedefinition/lucidfields';
|
|
4
3
|
import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
|
|
5
4
|
import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
|
|
6
|
-
import {
|
|
5
|
+
import { SerializedFieldDefinition } from '../core/data/serializedfield/serializedfielddefinition';
|
|
7
6
|
import { SerializedSchema } from '../core/data/serializedfield/serializedschema';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
value?: undefined;
|
|
11
|
-
reason?: string | undefined;
|
|
12
|
-
}
|
|
13
|
-
export interface LockedFieldConstraintDefinition {
|
|
14
|
-
type: FieldConstraintType.LOCKED;
|
|
15
|
-
value?: undefined;
|
|
16
|
-
reason?: string | undefined;
|
|
17
|
-
}
|
|
18
|
-
export interface MinValueFieldConstraintDefinition {
|
|
19
|
-
type: FieldConstraintType.MIN_VALUE;
|
|
20
|
-
value: number;
|
|
21
|
-
reason?: string | undefined;
|
|
22
|
-
}
|
|
23
|
-
export interface MaxValueFieldConstraintDefinition {
|
|
24
|
-
type: FieldConstraintType.MAX_VALUE;
|
|
25
|
-
value: number;
|
|
26
|
-
reason?: string | undefined;
|
|
27
|
-
}
|
|
28
|
-
export interface SingleLineFieldConstraintDefinition {
|
|
29
|
-
type: FieldConstraintType.SINGLE_LINE_ONLY;
|
|
30
|
-
value?: undefined;
|
|
31
|
-
reason?: string | undefined;
|
|
32
|
-
}
|
|
33
|
-
export interface NoWhitespaceFieldConstraintDefinition {
|
|
34
|
-
type: FieldConstraintType.NO_WHITESPACE;
|
|
35
|
-
value?: undefined;
|
|
36
|
-
reason?: string | undefined;
|
|
37
|
-
}
|
|
38
|
-
export interface UniqueEditFieldConstraintDefinition {
|
|
39
|
-
type: FieldConstraintType.UNIQUE_EDIT;
|
|
40
|
-
value?: undefined;
|
|
41
|
-
reason?: string | undefined;
|
|
42
|
-
}
|
|
43
|
-
export interface MaxLengthConstraintDefinition {
|
|
44
|
-
type: FieldConstraintType.MAX_LENGTH;
|
|
45
|
-
value: number;
|
|
46
|
-
reason?: string | undefined;
|
|
47
|
-
}
|
|
48
|
-
export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition;
|
|
49
|
-
export declare function createFieldConstraintDefinition(type: FieldConstraintType, value?: number, reason?: string): FieldConstraintDefinition;
|
|
50
|
-
export declare function minMaxFieldConstraintValidator(val: unknown): val is FieldConstraintType.MIN_VALUE | FieldConstraintType.MAX_VALUE | FieldConstraintType.MAX_LENGTH;
|
|
51
|
-
export declare const isFieldConstraintDefinition: (x: unknown) => x is {
|
|
52
|
-
type?: FieldConstraintType | undefined;
|
|
53
|
-
} & {
|
|
54
|
-
type: FieldConstraintType;
|
|
55
|
-
} & (import("..").DestructureGuardedTypeObj<{
|
|
56
|
-
type: typeof minMaxFieldConstraintValidator;
|
|
57
|
-
value: typeof isNumber;
|
|
58
|
-
}> | import("..").DestructureGuardedTypeObj<{
|
|
59
|
-
type: (x: unknown) => x is FieldConstraintType.REQUIRED | FieldConstraintType.LOCKED | FieldConstraintType.SINGLE_LINE_ONLY | FieldConstraintType.NO_WHITESPACE | FieldConstraintType.UNIQUE_EDIT;
|
|
60
|
-
value: typeof isUndefined;
|
|
61
|
-
}>);
|
|
7
|
+
import { DisplayOptionDefinition } from './displayoptiondefinition';
|
|
8
|
+
import { FieldConstraintDefinition } from './fieldconstraintdefinition';
|
|
62
9
|
/**
|
|
63
10
|
* The definition for a field to be included in a [SchemaDefinition](#interfaces_data_schemadefinition-SchemaDefinition)
|
|
64
11
|
*/
|
|
@@ -67,6 +14,13 @@ export interface FieldDefinition {
|
|
|
67
14
|
type: FieldTypeDefinition;
|
|
68
15
|
constraints?: FieldConstraintDefinition[] | undefined;
|
|
69
16
|
mapping?: readonly LucidFields[] | readonly SemanticFields[] | readonly SemanticKind[] | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @experimental
|
|
19
|
+
* If specified, a list of options indicating how the field should be displayed
|
|
20
|
+
* in the UI. This is particularly useful when collection enums are of a certain
|
|
21
|
+
* data type that should be rendered differently.
|
|
22
|
+
*/
|
|
23
|
+
displayOptions?: readonly DisplayOptionDefinition[] | undefined;
|
|
70
24
|
}
|
|
71
25
|
/**
|
|
72
26
|
* Definition of a schema for creating a [Collection](#classes_data_collectionproxy-CollectionProxy)
|
|
@@ -85,8 +39,6 @@ export interface SchemaDefinition {
|
|
|
85
39
|
fieldLabels?: Record<string, string>;
|
|
86
40
|
}
|
|
87
41
|
/** @ignore */
|
|
88
|
-
export declare function serializeFieldConstraintDefinition(constraint: FieldConstraintDefinition): SerializedFieldConstraint;
|
|
89
|
-
/** @ignore */
|
|
90
42
|
export declare function serializeFieldDefinition(field: FieldDefinition): SerializedFieldDefinition;
|
|
91
43
|
/** @ignore */
|
|
92
44
|
export declare function serializeSchemaDefinition(def: SchemaDefinition): SerializedSchema;
|
package/data/schemadefinition.js
CHANGED
|
@@ -1,53 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSchemaDefinition = exports.parseFieldDefinition = exports.serializeSchemaDefinition = exports.serializeFieldDefinition =
|
|
4
|
-
const assertnever_1 = require("../core/assertnever");
|
|
3
|
+
exports.parseSchemaDefinition = exports.parseFieldDefinition = exports.serializeSchemaDefinition = exports.serializeFieldDefinition = void 0;
|
|
5
4
|
const checks_1 = require("../core/checks");
|
|
6
5
|
const fieldtypedefinition_1 = require("../core/data/fieldtypedefinition/fieldtypedefinition");
|
|
6
|
+
const serializeddisplayoption_1 = require("../core/data/serializedfield/serializeddisplayoption");
|
|
7
7
|
const serializedfielddefinition_1 = require("../core/data/serializedfield/serializedfielddefinition");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
switch (type) {
|
|
11
|
-
case serializedfielddefinition_1.FieldConstraintType.REQUIRED:
|
|
12
|
-
case serializedfielddefinition_1.FieldConstraintType.LOCKED:
|
|
13
|
-
return Object.assign({ type }, (reason && { reason }));
|
|
14
|
-
case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
|
|
15
|
-
case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
|
|
16
|
-
case serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH:
|
|
17
|
-
if (value === undefined) {
|
|
18
|
-
throw new Error('Invalid constraint value');
|
|
19
|
-
}
|
|
20
|
-
return Object.assign({ type, value }, (reason && { reason }));
|
|
21
|
-
case serializedfielddefinition_1.FieldConstraintType.SINGLE_LINE_ONLY:
|
|
22
|
-
case serializedfielddefinition_1.FieldConstraintType.NO_WHITESPACE:
|
|
23
|
-
case serializedfielddefinition_1.FieldConstraintType.UNIQUE_EDIT:
|
|
24
|
-
if (value !== undefined) {
|
|
25
|
-
throw new Error('Invalid constraint value');
|
|
26
|
-
}
|
|
27
|
-
return Object.assign({ type }, (reason && { reason }));
|
|
28
|
-
default:
|
|
29
|
-
(0, assertnever_1.assertNever)(type);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.createFieldConstraintDefinition = createFieldConstraintDefinition;
|
|
33
|
-
function minMaxFieldConstraintValidator(val) {
|
|
34
|
-
return (val === serializedfielddefinition_1.FieldConstraintType.MIN_VALUE ||
|
|
35
|
-
val === serializedfielddefinition_1.FieldConstraintType.MAX_VALUE ||
|
|
36
|
-
val === serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH);
|
|
37
|
-
}
|
|
38
|
-
exports.minMaxFieldConstraintValidator = minMaxFieldConstraintValidator;
|
|
39
|
-
exports.isFieldConstraintDefinition = (0, validators_1.both)((0, validators_1.objectValidator)({
|
|
40
|
-
'type': serializedfielddefinition_1.isFieldConstraintType,
|
|
41
|
-
}), (0, validators_1.either)((0, validators_1.objectValidator)({ 'type': minMaxFieldConstraintValidator, 'value': checks_1.isNumber }), (0, validators_1.objectValidator)({ 'type': (0, validators_1.exclude)(serializedfielddefinition_1.isFieldConstraintType, minMaxFieldConstraintValidator), 'value': checks_1.isUndefined })));
|
|
42
|
-
/** @ignore */
|
|
43
|
-
function serializeFieldConstraintDefinition(constraint) {
|
|
44
|
-
return {
|
|
45
|
-
'Type': constraint.type,
|
|
46
|
-
'Details': constraint.value,
|
|
47
|
-
'Reason': constraint.reason,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
exports.serializeFieldConstraintDefinition = serializeFieldConstraintDefinition;
|
|
8
|
+
const displayoptiondefinition_1 = require("./displayoptiondefinition");
|
|
9
|
+
const fieldconstraintdefinition_1 = require("./fieldconstraintdefinition");
|
|
51
10
|
/** @ignore */
|
|
52
11
|
function serializeFieldDefinition(field) {
|
|
53
12
|
const serialized = {
|
|
@@ -55,7 +14,10 @@ function serializeFieldDefinition(field) {
|
|
|
55
14
|
'Type': (0, fieldtypedefinition_1.serializeFieldTypeDefinition)(field.type),
|
|
56
15
|
};
|
|
57
16
|
if (field.constraints) {
|
|
58
|
-
serialized['Constraints'] = field.constraints.map(serializeFieldConstraintDefinition);
|
|
17
|
+
serialized['Constraints'] = field.constraints.map(fieldconstraintdefinition_1.serializeFieldConstraintDefinition);
|
|
18
|
+
}
|
|
19
|
+
if (field.displayOptions) {
|
|
20
|
+
serialized['DisplayOptions'] = field.displayOptions.map(displayoptiondefinition_1.serializeDisplayOptionDefinition);
|
|
59
21
|
}
|
|
60
22
|
if (field.mapping) {
|
|
61
23
|
serialized['Mapping'] = field.mapping;
|
|
@@ -74,7 +36,7 @@ function serializeSchemaDefinition(def) {
|
|
|
74
36
|
exports.serializeSchemaDefinition = serializeSchemaDefinition;
|
|
75
37
|
/** @ignore */
|
|
76
38
|
function parseFieldDefinition(field) {
|
|
77
|
-
var _a;
|
|
39
|
+
var _a, _b;
|
|
78
40
|
return {
|
|
79
41
|
name: field['Name'],
|
|
80
42
|
type: (0, fieldtypedefinition_1.deserializeFieldTypeDefinition)(field['Type']),
|
|
@@ -103,6 +65,14 @@ function parseFieldDefinition(field) {
|
|
|
103
65
|
}
|
|
104
66
|
}),
|
|
105
67
|
mapping: field['Mapping'],
|
|
68
|
+
displayOptions: (_b = field['DisplayOptions']) === null || _b === void 0 ? void 0 : _b.map((option) => {
|
|
69
|
+
switch (option['Type']) {
|
|
70
|
+
case serializeddisplayoption_1.DisplayOptionType.DisplayMultiUserSelect:
|
|
71
|
+
return { type: option['Type'] };
|
|
72
|
+
default:
|
|
73
|
+
throw new Error('Invalid display option format');
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
106
76
|
};
|
|
107
77
|
}
|
|
108
78
|
exports.parseFieldDefinition = parseFieldDefinition;
|
|
@@ -35,6 +35,13 @@ export declare class DataSourceClient {
|
|
|
35
35
|
getMetadata(keys: string[], prefixes?: string[]): Promise<MetadataRecord[]>;
|
|
36
36
|
/** @ignore until metadata endpoints are made part of the public API */
|
|
37
37
|
patchMetadata(patches: MetadataPatch[]): Promise<MetadataPatchResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* @ignore as this is primarily an internal-use method.
|
|
40
|
+
* Checks the current value of the given feature flag. This cannot take into account any local overrides, and can
|
|
41
|
+
* only be used for feature flags (not other forms of AB test). This method reads feature flag values from our
|
|
42
|
+
* "frontend" selection of feature flags.
|
|
43
|
+
*/
|
|
44
|
+
getFeatureFlagValue(flagName: string): Promise<boolean>;
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
47
|
* A version of the DataSourceClient that you can use for any automated tests of your data connector.
|
|
@@ -204,6 +204,32 @@ class DataSourceClient {
|
|
|
204
204
|
await (0, throwunsuccessful_1.throwUnsuccessful)(response, 'patching data source`s metadata');
|
|
205
205
|
return { status: 'NoContent' };
|
|
206
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* @ignore as this is primarily an internal-use method.
|
|
209
|
+
* Checks the current value of the given feature flag. This cannot take into account any local overrides, and can
|
|
210
|
+
* only be used for feature flags (not other forms of AB test). This method reads feature flag values from our
|
|
211
|
+
* "frontend" selection of feature flags.
|
|
212
|
+
*/
|
|
213
|
+
async getFeatureFlagValue(flagName) {
|
|
214
|
+
const flagRequest = await this.fetchMethod(`${this.urls.main}features/frontend`, {
|
|
215
|
+
'method': 'GET',
|
|
216
|
+
'headers': {
|
|
217
|
+
'Content-Type': 'application/json',
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
if (!flagRequest.ok) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
const response = await flagRequest.json();
|
|
224
|
+
const featureFlagResponseObjectValidator = (0, validators_1.objectValidator)({
|
|
225
|
+
featureFlags: (0, validators_1.objectOfValidator)(checks_1.isBoolean, checks_1.isString),
|
|
226
|
+
});
|
|
227
|
+
if (!featureFlagResponseObjectValidator(response)) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
const flagValue = response.featureFlags[flagName];
|
|
231
|
+
return !!flagValue;
|
|
232
|
+
}
|
|
207
233
|
}
|
|
208
234
|
exports.DataSourceClient = DataSourceClient;
|
|
209
235
|
/**
|
|
@@ -6,12 +6,14 @@ import { SerializedFieldTypeDefinition } from '../core/data/fieldtypedefinition/
|
|
|
6
6
|
import { LucidFields } from '../core/data/fieldtypedefinition/lucidfields';
|
|
7
7
|
import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
|
|
8
8
|
import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
|
|
9
|
+
import { DisplayOptionType } from '../core/data/serializedfield/serializeddisplayoption';
|
|
9
10
|
import { FieldConstraintType } from '../core/data/serializedfield/serializedfielddefinition';
|
|
10
11
|
import { SerializedFields, SerializedLucidDictionary } from '../core/data/serializedfield/serializedfields';
|
|
11
12
|
import { SerializedLabelOverrides } from '../core/data/serializedfield/serializedschema';
|
|
12
13
|
import { UnsafeJsonSerializableOrUndefined } from '../core/jsonserializable';
|
|
13
14
|
import { DataUpdateFilterType } from '../data/dataupdatefiltertype';
|
|
14
|
-
import { FieldConstraintDefinition
|
|
15
|
+
import { FieldConstraintDefinition } from '../data/fieldconstraintdefinition';
|
|
16
|
+
import { FieldDefinition, SchemaDefinition } from '../data/schemadefinition';
|
|
15
17
|
/**
|
|
16
18
|
* Container for an update to a data source
|
|
17
19
|
*/
|
|
@@ -37,12 +39,17 @@ export type SerializedFieldConstraintForApi = {
|
|
|
37
39
|
'details'?: UnsafeJsonSerializableOrUndefined;
|
|
38
40
|
'reason'?: string | undefined;
|
|
39
41
|
};
|
|
42
|
+
export type SerializedDisplayOptionForApi = {
|
|
43
|
+
'type': DisplayOptionType;
|
|
44
|
+
'details'?: UnsafeJsonSerializableOrUndefined;
|
|
45
|
+
};
|
|
40
46
|
type SerializedFieldDefinitionForApi = {
|
|
41
47
|
'name': string;
|
|
42
48
|
'type': SerializedFieldTypeDefinition;
|
|
43
49
|
'constraints': SerializedFieldConstraintForApi[];
|
|
44
50
|
'syncSchema'?: string;
|
|
45
51
|
'mapping'?: readonly SemanticKind[] | readonly LucidFields[] | readonly SemanticFields[];
|
|
52
|
+
'displayOptions'?: SerializedDisplayOptionForApi[];
|
|
46
53
|
};
|
|
47
54
|
export type SerializedSchemaForApi = {
|
|
48
55
|
'fields': SerializedFieldDefinitionForApi[];
|
|
@@ -74,20 +74,27 @@ function serializeFieldConstraintForApi(constraint) {
|
|
|
74
74
|
'reason': constraint.reason,
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
function serializeDisplayOptionForApi(option) {
|
|
78
|
+
return {
|
|
79
|
+
'type': option.type,
|
|
80
|
+
'details': option.value,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
77
83
|
/** @ignore */
|
|
78
84
|
function serializeFieldDefinitionForApi(field) {
|
|
79
|
-
var _a;
|
|
85
|
+
var _a, _b, _c;
|
|
80
86
|
return {
|
|
81
87
|
'name': field.name,
|
|
82
88
|
'type': (0, fieldtypedefinition_1.serializeFieldTypeDefinition)(field.type),
|
|
83
|
-
'constraints': ((_a = field.constraints)
|
|
89
|
+
'constraints': (_b = (_a = field.constraints) === null || _a === void 0 ? void 0 : _a.map(serializeFieldConstraintForApi)) !== null && _b !== void 0 ? _b : [],
|
|
84
90
|
'mapping': field.mapping,
|
|
91
|
+
'displayOptions': (_c = field.displayOptions) === null || _c === void 0 ? void 0 : _c.map(serializeDisplayOptionForApi),
|
|
85
92
|
};
|
|
86
93
|
}
|
|
87
94
|
exports.serializeFieldDefinitionForApi = serializeFieldDefinitionForApi;
|
|
88
95
|
function serializeSchemaForApi(schema) {
|
|
89
96
|
return {
|
|
90
|
-
'fields': schema.fields.map(
|
|
97
|
+
'fields': schema.fields.map(serializeFieldDefinitionForApi),
|
|
91
98
|
'primaryKey': schema.primaryKey,
|
|
92
99
|
'fieldLabelOverrides': schema.fieldLabels,
|
|
93
100
|
};
|
|
@@ -174,3 +181,4 @@ const assertIsJustRenamed = () => undefined;
|
|
|
174
181
|
assertIsJustRenamed();
|
|
175
182
|
assertIsJustRenamed();
|
|
176
183
|
assertIsJustRenamed();
|
|
184
|
+
assertIsJustRenamed();
|
package/editorclient.d.ts
CHANGED
|
@@ -361,6 +361,12 @@ export declare class EditorClient {
|
|
|
361
361
|
* @hidden
|
|
362
362
|
*/
|
|
363
363
|
protected listenToEditor(): void;
|
|
364
|
+
/**
|
|
365
|
+
* @ignore Until releasing developer mode
|
|
366
|
+
* Check to know if the editor is currently in developer mode
|
|
367
|
+
* @returns true if the editor is in developer mode, false otherwise
|
|
368
|
+
*/
|
|
369
|
+
getDeveloperModeStatus(): boolean;
|
|
364
370
|
/**
|
|
365
371
|
* Display an alert modal to the user
|
|
366
372
|
* @param text Body text to display in the alert modal
|
|
@@ -431,5 +437,12 @@ export declare class EditorClient {
|
|
|
431
437
|
*/
|
|
432
438
|
/** @ignore because our documentation gets generated incorrectly for an as-yet unknown reason. It seems to refer to the HashAlgorithmEnum with an incorrect link. */
|
|
433
439
|
hash(algorithm: HashAlgorithmEnum, string: string): string;
|
|
440
|
+
/**
|
|
441
|
+
* @ignore as this is primarily an internal-use method.
|
|
442
|
+
*
|
|
443
|
+
* Checks the current value of the given feature flag for the current user. This takes into
|
|
444
|
+
* account any local overrides, and can only be used for feature flags (not other forms of AB test).
|
|
445
|
+
*/
|
|
446
|
+
checkUserFlagAssignment(flagName: string): boolean;
|
|
434
447
|
constructor();
|
|
435
448
|
}
|
package/editorclient.js
CHANGED
|
@@ -615,6 +615,14 @@ class EditorClient {
|
|
|
615
615
|
return (_a = this.callbacks.get(msg['id'])) === null || _a === void 0 ? void 0 : _a(msg);
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* @ignore Until releasing developer mode
|
|
620
|
+
* Check to know if the editor is currently in developer mode
|
|
621
|
+
* @returns true if the editor is in developer mode, false otherwise
|
|
622
|
+
*/
|
|
623
|
+
getDeveloperModeStatus() {
|
|
624
|
+
return this.sendCommand("gdms" /* CommandName.GetDeveloperModeStatus */, undefined);
|
|
625
|
+
}
|
|
618
626
|
/**
|
|
619
627
|
* Display an alert modal to the user
|
|
620
628
|
* @param text Body text to display in the alert modal
|
|
@@ -723,6 +731,15 @@ class EditorClient {
|
|
|
723
731
|
hash(algorithm, string) {
|
|
724
732
|
return this.sendCommand("hsh" /* CommandName.CalculateHash */, { 'a': algorithm, 's': string });
|
|
725
733
|
}
|
|
734
|
+
/**
|
|
735
|
+
* @ignore as this is primarily an internal-use method.
|
|
736
|
+
*
|
|
737
|
+
* Checks the current value of the given feature flag for the current user. This takes into
|
|
738
|
+
* account any local overrides, and can only be used for feature flags (not other forms of AB test).
|
|
739
|
+
*/
|
|
740
|
+
checkUserFlagAssignment(flagName) {
|
|
741
|
+
return this.sendCommand("cufa" /* CommandName.CheckUserFlagAssignment */, { 'f': flagName });
|
|
742
|
+
}
|
|
726
743
|
constructor() {
|
|
727
744
|
this.nextId = 0;
|
|
728
745
|
this.callbacks = new Map();
|