Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bfwk/dp-editor

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bfwk/dp-editor - npm Package Compare versions

Comparing version 0.7.8 to 0.7.9

10

CHANGELOG.md

@@ -6,3 +6,3 @@ # Change Log

## [0.7.8](https://github.com/salesforce/builder-framework/compare/v0.7.7...v0.7.8) (2021-08-23)
## [0.7.9](https://github.com/salesforce/builder-framework/compare/v0.7.8...v0.7.9) (2021-08-27)

@@ -12,2 +12,8 @@

* missing property values for oneOf editor @W-9751351 ([#231](https://github.com/salesforce/builder-framework/issues/231)) ([a04934a](https://github.com/salesforce/builder-framework/commit/a04934a0d166e6cc8fb8895de2c0fea06aa0fa40))
* dp apex picklist & misc ui fixes ([#234](https://github.com/salesforce/builder-framework/issues/234)) ([269e6a6](https://github.com/salesforce/builder-framework/commit/269e6a6276c995176eb9d797093bf2847163bd72))
* fixes for error marking on dpList ([#235](https://github.com/salesforce/builder-framework/issues/235)) ([7f76d85](https://github.com/salesforce/builder-framework/commit/7f76d85b01f6cb58f7fbac04ca130898ec07e8e5))
### Features
* Add undo/redo for DP Editor @W-9480045 ([#237](https://github.com/salesforce/builder-framework/issues/237)) ([1f4e607](https://github.com/salesforce/builder-framework/commit/1f4e60757a52575f8bdbc96d6b7f24ad7844604f))

98

dist/index.js

@@ -1,2 +0,2 @@

import { UPDATE_DP, ADD_DP } from '@bfwk/document-model';
import { UPDATE_DP, ADD_DP, GET_DATA_PROVIDERS_SELECTOR } from '@bfwk/document-model';
import { ObservableCreator, clone, generateGuid } from '@bfwk/utils';

@@ -19,3 +19,4 @@ import { PropertySheetFactoryBuilder } from '@bfwk/property-editor';

this.editorData.suppressPublish = true;
this.editorData.enableExpressions = true;
this.editorData.enableExpressions = false;
this.editorData.builderOnlyExpressionValidation = true;
this.observable = this.observableCreator.createObservable();

@@ -29,6 +30,8 @@ }

setState(newState) {
// TODO
// to be added when this is treated as a sub property sheet to the full component property sheet
}
// this is the equivalent of the setState call, but made from the DPEditorManager on docmodel change
set dpConfig(dpConfigValue) {
this._dpConfigValue = dpConfigValue;
this.observableCreator.emit(this._dpConfigValue);
}

@@ -77,4 +80,19 @@ get dpConfig() {

}
static isValidDP(properties) {
for (const propValue of Object.values(properties)) {
const pValue = propValue;
const errors = pValue.errors;
if (!errors.valid()) {
return false;
}
}
return true;
}
static convertDPValueToDPPayload(dpValue, output) {
return { ...dpValue, output: output ? output : {} };
const properties = dpValue.properties;
return {
...dpValue,
output: output ? output : {},
isValid: DPEditor.isValidDP(properties),
};
}

@@ -113,2 +131,11 @@ getAvailableDataProviders() {

}
getPicklistSchema(dpValue, picklistPropertyName) {
const dataSourceSchema = this.dataProviderService.getDataProviderGroupSelectorSchema(dpValue.dataSource);
const dataSourcePropertyValues = this.dataProviderService.getDataProviderGroupPicklistPropertyValues(dpValue.dataSource, picklistPropertyName);
// get the schema from the DataSource
// tweak for the Endpoints enum/picklist
// get the propertystate from the DataProviderConfiguration
const revisedDataSourceSchema = this.patchEndpoints(dataSourceSchema, picklistPropertyName, dataSourcePropertyValues);
return revisedDataSourceSchema;
}
async getDataSourceInputSheet(dpValue) {

@@ -119,10 +146,10 @@ let dataSourceSchema = this.dataProviderService.getDataProviderGroupSelectorSchema(dpValue.dataSource);

if (dpValue.dataSource.name.toLowerCase() === 'sobjects') {
const picklistPropertyName = 'recordType';
const dataSourcePropertyValues = this.dataProviderService.getDataProviderGroupPicklistPropertyValues(dpValue.dataSource, picklistPropertyName);
// get the schema from the DataSource
// tweak for the Endpoints enum/picklist
// get the propertystate from the DataProviderConfiguration
const revisedDataSourceSchema = this.patchEndpoints(dataSourceSchema, picklistPropertyName, dataSourcePropertyValues);
dataSourceSchema = revisedDataSourceSchema;
dataSourceSchema = this.getPicklistSchema(dpValue, 'recordType');
}
else if (dpValue.dataSource.name.toLowerCase() === 'apex') {
dataSourceSchema = this.getPicklistSchema(dpValue, 'apexMethod');
}
else {
dataSourceSchema = this.dataProviderService.getDataProviderGroupSelectorSchema(dpValue.dataSource);
}
return this.propertySheetFactory.createMetadataDrivenPropertySheet({

@@ -163,2 +190,19 @@ get: () => {

}
static convertDataProviderGroup(connector) {
return {
name: connector.name,
dataSource: connector.dataSource,
label: connector.label ? connector.label : undefined,
id: connector.id ? connector.id : undefined,
};
}
static convertDataProviderNodeToDataProviderConfiguration(dpNode) {
return {
id: dpNode.id,
name: dpNode.name,
attachment: dpNode.attachment,
dataSource: DPEditor.convertDataProviderGroup(dpNode.dataSource),
properties: dpNode.properties,
};
}
}

@@ -171,2 +215,3 @@

this.observableCreator = new ObservableCreator();
this.dpEditorMap = new Map();
this.dataProviderService = dataProviderService;

@@ -228,18 +273,22 @@ this.publisher = publisher;

}
async handleDPDelete() {
// docmodel action for dp delete
// dispatch
}
async handleDocumentModelChange() {
/*const getEventsSelector = this.documentModel.getSelector(GET_DIS_SELECTOR);
const diNodes: DINode[] = getEventsSelector
? getEventsSelector(this.documentModel.getState(), {})
: [];
diNodes.forEach(diNode => {
const id = diNode.id;
const diEditor = this.diEditorMap.get(id);
if (diEditor) {
diEditor.diValue = DIEditor.convertDINodeToDIValue(diNode);
}
});*/
const getDPSelector = this.documentModel.getSelector(GET_DATA_PROVIDERS_SELECTOR);
const dpNodes = getDPSelector
? getDPSelector(this.documentModel.getState(), {})
: [];
dpNodes.forEach(dpNode => {
const id = dpNode.id;
const dpEditor = this.dpEditorMap.get(id);
if (dpEditor) {
dpEditor.dpConfig = dpNode;
}
});
}
createDPEditor(initialDPValue) {
const dpEditor = new DPEditor(this.dataProviderService, this.publisher, initialDPValue, [], this.propertySheetFactory, this.builderSpecificData);
// this.diEditorMap.set(initialDIValue.id, diEditor);
this.dpEditorMap.set(initialDPValue.id, dpEditor);
return dpEditor;

@@ -446,3 +495,4 @@ }

input1: {
type: 'string',
type: 'integer',
maximum: 5,
},

@@ -449,0 +499,0 @@ },

@@ -1,2 +0,2 @@

import { Observable } from '@bfwk/utils';
import { Observable, Guid } from '@bfwk/utils';
import { PubSubEvent, PubSub } from '@bfwk/pub-sub';

@@ -19,2 +19,3 @@ import { ErrorHandler } from '@bfwk/error-handler';

private propertySheetFactory;
protected dpEditorMap: Map<Guid, DPEditor>;
constructor(dataProviderService: DataProviderService, publisher: PubSub, errorHandler: ErrorHandler, documentModel: DocumentModel, instrumentationService: InstrumentationService, customEditorsByPropertyType?: Map<string, string>, builderSpecificData?: any);

@@ -24,2 +25,3 @@ createNewDP(componentInstanceId: ComponentInstanceIdentifier): DataProviderConfiguration;

protected handleDPEdit(event: PubSubEvent): Promise<void>;
protected handleDPDelete(): Promise<void>;
private handleDocumentModelChange;

@@ -26,0 +28,0 @@ createDPEditor(initialDPValue: DataProviderConfiguration): DPEditor;

@@ -54,2 +54,3 @@ import { JsonSchema } from '@lcem/unified-view-model';

private publishChange;
static isValidDP(properties: DPPropertyValues): boolean;
static convertDPValueToDPPayload(dpValue: DataProviderConfiguration, output?: JsonSchema): DataProviderNode;

@@ -60,5 +61,8 @@ getAvailableDataProviders(): DataProviderGroup[];

private patchEndpoints;
private getPicklistSchema;
getDataSourceInputSheet(dpValue: DataProviderConfiguration): Promise<PropertySheet | undefined>;
getDataSourcePropertiesSheet(partialDP: DataProviderConfiguration): Promise<PropertySheet | undefined>;
private extractDPProperties;
private static convertDataProviderGroup;
static convertDataProviderNodeToDataProviderConfiguration(dpNode: DataProviderNode): DataProviderConfiguration;
}
{
"name": "@bfwk/dp-editor",
"version": "0.7.8",
"version": "0.7.9",
"description": "DataProvider Editor",

@@ -31,10 +31,10 @@ "type": "module",

"dependencies": {
"@bfwk/command": "0.7.8",
"@bfwk/data-service": "0.7.8",
"@bfwk/document-model": "0.7.8",
"@bfwk/error-handler": "0.7.8",
"@bfwk/instrumentation": "0.7.8",
"@bfwk/property-editor": "0.7.8",
"@bfwk/pub-sub": "0.7.8",
"@bfwk/utils": "0.7.8",
"@bfwk/command": "0.7.9",
"@bfwk/data-service": "0.7.9",
"@bfwk/document-model": "0.7.9",
"@bfwk/error-handler": "0.7.9",
"@bfwk/instrumentation": "0.7.9",
"@bfwk/property-editor": "0.7.9",
"@bfwk/pub-sub": "0.7.9",
"@bfwk/utils": "0.7.9",
"@lcem/declarative-type": "0.6.23",

@@ -41,0 +41,0 @@ "@lcem/unified-view-model": "0.6.23"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc