@cplace/mcp-server 1.16.0 → 2.1.0
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/README.md +37 -110
- package/dist/backend-capabilities.d.ts +15 -1
- package/dist/backend-capabilities.d.ts.map +1 -1
- package/dist/backend-capabilities.js +26 -1
- package/dist/backend-capabilities.js.map +1 -1
- package/dist/capability-gating.d.ts +35 -0
- package/dist/capability-gating.d.ts.map +1 -0
- package/dist/capability-gating.js +169 -0
- package/dist/capability-gating.js.map +1 -0
- package/dist/index.js +88 -41
- package/dist/index.js.map +1 -1
- package/dist/lint-on-write.d.ts +14 -0
- package/dist/lint-on-write.d.ts.map +1 -0
- package/dist/lint-on-write.js +29 -0
- package/dist/lint-on-write.js.map +1 -0
- package/dist/plugin-registry.d.ts +1 -1
- package/dist/plugin-registry.d.ts.map +1 -1
- package/dist/plugin-registry.js +28 -13
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugins/core/widget-specifications/cf.cplace.platform.tableWidget/search.md +10 -0
- package/dist/plugins/core/widget-specifications/cf.platform.connectedBarChart/search.md +6 -0
- package/dist/plugins/core/widget-specifications/cf.platform.connectedPieChart/search.md +6 -0
- package/dist/plugins/core/widget-specifications/cf.platform.embeddedSearchAsList/search.md +6 -0
- package/dist/plugins/core/widget-specifications/cf.platform.embeddedSearchAsTable/search.md +6 -0
- package/dist/plugins/low-code.d.ts.map +1 -1
- package/dist/plugins/low-code.js +5 -0
- package/dist/plugins/low-code.js.map +1 -1
- package/dist/searchConversion.d.ts +6 -0
- package/dist/searchConversion.d.ts.map +1 -1
- package/dist/searchConversion.js +219 -132
- package/dist/searchConversion.js.map +1 -1
- package/dist/searchEditorShape.d.ts +10 -0
- package/dist/searchEditorShape.d.ts.map +1 -0
- package/dist/searchEditorShape.js +103 -0
- package/dist/searchEditorShape.js.map +1 -0
- package/dist/searchSchema.d.ts +119 -119
- package/dist/searchSchema.d.ts.map +1 -1
- package/dist/searchSchema.js +102 -50
- package/dist/searchSchema.js.map +1 -1
- package/dist/session-responses.d.ts +23 -0
- package/dist/session-responses.d.ts.map +1 -0
- package/dist/session-responses.js +17 -0
- package/dist/session-responses.js.map +1 -0
- package/dist/strict-schemas.d.ts +8 -0
- package/dist/strict-schemas.d.ts.map +1 -0
- package/dist/strict-schemas.js +202 -0
- package/dist/strict-schemas.js.map +1 -0
- package/dist/tools/app-configuration.d.ts +1 -0
- package/dist/tools/app-configuration.d.ts.map +1 -1
- package/dist/tools/app-configuration.js +1 -0
- package/dist/tools/app-configuration.js.map +1 -1
- package/dist/tools/apps-catalog.d.ts.map +1 -1
- package/dist/tools/apps-catalog.js +11 -5
- package/dist/tools/apps-catalog.js.map +1 -1
- package/dist/tools/change-listeners.d.ts +2 -0
- package/dist/tools/change-listeners.d.ts.map +1 -1
- package/dist/tools/change-listeners.js +42 -16
- package/dist/tools/change-listeners.js.map +1 -1
- package/dist/tools/common-schemas.d.ts +5 -0
- package/dist/tools/common-schemas.d.ts.map +1 -1
- package/dist/tools/common-schemas.js +13 -0
- package/dist/tools/common-schemas.js.map +1 -1
- package/dist/tools/csv-export.d.ts +122 -119
- package/dist/tools/csv-export.d.ts.map +1 -1
- package/dist/tools/csv-export.js +17 -2
- package/dist/tools/csv-export.js.map +1 -1
- package/dist/tools/enum-providers.d.ts.map +1 -1
- package/dist/tools/enum-providers.js +21 -7
- package/dist/tools/enum-providers.js.map +1 -1
- package/dist/tools/get-operations.d.ts +1 -1
- package/dist/tools/get-operations.d.ts.map +1 -1
- package/dist/tools/get-operations.js +3 -1
- package/dist/tools/get-operations.js.map +1 -1
- package/dist/tools/job-scripts.d.ts.map +1 -1
- package/dist/tools/job-scripts.js +19 -11
- package/dist/tools/job-scripts.js.map +1 -1
- package/dist/tools/layout-richstring-widgets.d.ts +2 -2
- package/dist/tools/layout-richstring-widgets.d.ts.map +1 -1
- package/dist/tools/layout-richstring-widgets.js +16 -6
- package/dist/tools/layout-richstring-widgets.js.map +1 -1
- package/dist/tools/layout.d.ts +115 -2
- package/dist/tools/layout.d.ts.map +1 -1
- package/dist/tools/layout.js +39 -14
- package/dist/tools/layout.js.map +1 -1
- package/dist/tools/linting.d.ts +1 -1
- package/dist/tools/linting.js +1 -1
- package/dist/tools/linting.js.map +1 -1
- package/dist/tools/page-action-simulation.d.ts +51 -1
- package/dist/tools/page-action-simulation.d.ts.map +1 -1
- package/dist/tools/page-action-simulation.js +2 -2
- package/dist/tools/page-action-simulation.js.map +1 -1
- package/dist/tools/page-actions.d.ts.map +1 -1
- package/dist/tools/page-actions.js +19 -11
- package/dist/tools/page-actions.js.map +1 -1
- package/dist/tools/pages.d.ts +3 -3
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +54 -15
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/ppt-export-schemas.d.ts +6 -6
- package/dist/tools/ppt-export.d.ts +4 -4
- package/dist/tools/profile-management.d.ts +4 -0
- package/dist/tools/profile-management.d.ts.map +1 -1
- package/dist/tools/profile-management.js +6 -4
- package/dist/tools/profile-management.js.map +1 -1
- package/dist/tools/resource-planner-widget.d.ts +4 -4
- package/dist/tools/richstring-widgets.js +3 -3
- package/dist/tools/richstring-widgets.js.map +1 -1
- package/dist/tools/script.d.ts +25 -2
- package/dist/tools/script.d.ts.map +1 -1
- package/dist/tools/script.js +5 -4
- package/dist/tools/script.js.map +1 -1
- package/dist/tools/search.d.ts +142 -122
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +71 -23
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/system.d.ts +2 -1
- package/dist/tools/system.d.ts.map +1 -1
- package/dist/tools/system.js +2 -2
- package/dist/tools/system.js.map +1 -1
- package/dist/tools/type-management.d.ts +15 -14
- package/dist/tools/type-management.d.ts.map +1 -1
- package/dist/tools/type-management.js +168 -51
- package/dist/tools/type-management.js.map +1 -1
- package/dist/tools/validators.d.ts +1 -1
- package/dist/tools/validators.d.ts.map +1 -1
- package/dist/tools/validators.js +24 -8
- package/dist/tools/validators.js.map +1 -1
- package/dist/tools/version-check.d.ts +3 -2
- package/dist/tools/version-check.d.ts.map +1 -1
- package/dist/tools/version-check.js +39 -101
- package/dist/tools/version-check.js.map +1 -1
- package/dist/tools/widget-simulation-legacy.d.ts +50 -0
- package/dist/tools/widget-simulation-legacy.d.ts.map +1 -0
- package/dist/tools/widget-simulation-legacy.js +99 -0
- package/dist/tools/widget-simulation-legacy.js.map +1 -0
- package/dist/tools/widget-simulation.d.ts +1 -0
- package/dist/tools/widget-simulation.d.ts.map +1 -1
- package/dist/tools/widget-simulation.js +3 -1
- package/dist/tools/widget-simulation.js.map +1 -1
- package/dist/tools/wizards.d.ts.map +1 -1
- package/dist/tools/wizards.js +3 -2
- package/dist/tools/wizards.js.map +1 -1
- package/dist/tools/workflow-execution.d.ts +1 -0
- package/dist/tools/workflow-execution.d.ts.map +1 -1
- package/dist/tools/workflow-execution.js +5 -1
- package/dist/tools/workflow-execution.js.map +1 -1
- package/dist/tools/workflow-scripts.d.ts +2 -2
- package/dist/tools/workflow-scripts.d.ts.map +1 -1
- package/dist/tools/workflow-scripts.js +21 -11
- package/dist/tools/workflow-scripts.js.map +1 -1
- package/dist/tools/workflow.d.ts +5 -2
- package/dist/tools/workflow.d.ts.map +1 -1
- package/dist/tools/workflow.js +26 -3
- package/dist/tools/workflow.js.map +1 -1
- package/dist/tools/workspace-core.d.ts +3 -2
- package/dist/tools/workspace-core.d.ts.map +1 -1
- package/dist/tools/workspace-core.js +26 -8
- package/dist/tools/workspace-core.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -0
- package/dist/utils.js.map +1 -1
- package/package.json +4 -4
package/dist/plugins/low-code.js
CHANGED
|
@@ -13,6 +13,7 @@ import { registerPageActionsTools, PAGE_ACTIONS_TOOL_DEFINITIONS } from '../tool
|
|
|
13
13
|
import { registerJobScheduleTriggerTools, JOB_SCHEDULE_TRIGGER_TOOL_DEFINITIONS, } from '../tools/job-schedule-trigger.js';
|
|
14
14
|
import { registerWorkflowExecutionTools, WORKFLOW_EXECUTION_TOOL_DEFINITIONS, } from '../tools/workflow-execution.js';
|
|
15
15
|
import { registerWidgetSimulationTools, WIDGET_SIMULATION_TOOL_DEFINITIONS, } from '../tools/widget-simulation.js';
|
|
16
|
+
import { registerWidgetSimulationLegacyTool, WIDGET_SIMULATION_LEGACY_TOOL_DEFINITIONS, } from '../tools/widget-simulation-legacy.js';
|
|
16
17
|
import { registerPageActionSimulationTools, PAGE_ACTION_SIMULATION_TOOL_DEFINITIONS, } from '../tools/page-action-simulation.js';
|
|
17
18
|
import { registerEnumProviderSimulationTools, ENUM_PROVIDER_SIMULATION_TOOL_DEFINITIONS, } from '../tools/enum-provider-simulation.js';
|
|
18
19
|
import { fileURLToPath } from 'url';
|
|
@@ -65,6 +66,10 @@ export const lowCodePlugin = {
|
|
|
65
66
|
register: registerWorkflowExecutionTools,
|
|
66
67
|
toolDefinitions: WORKFLOW_EXECUTION_TOOL_DEFINITIONS,
|
|
67
68
|
},
|
|
69
|
+
'widget-simulation-legacy': {
|
|
70
|
+
register: registerWidgetSimulationLegacyTool,
|
|
71
|
+
toolDefinitions: WIDGET_SIMULATION_LEGACY_TOOL_DEFINITIONS,
|
|
72
|
+
},
|
|
68
73
|
'widget-simulation': {
|
|
69
74
|
register: registerWidgetSimulationTools,
|
|
70
75
|
toolDefinitions: WIDGET_SIMULATION_TOOL_DEFINITIONS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"low-code.js","sourceRoot":"","sources":["../../src/plugins/low-code.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EACL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,GACj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AE;QACtF,aAAa,EAAE;YACb,QAAQ,EAAE,uBAAuB;YACjC,eAAe,EAAE,4BAA4B;SAC9C;QACD,cAAc,EAAE;YACd,QAAQ,EAAE,wBAAwB;YAClC,eAAe,EAAE,6BAA6B;SAC/C;QACD,sBAAsB,EAAE;YACtB,QAAQ,EAAE,+BAA+B;YACzC,eAAe,EAAE,qCAAqC;SACvD;QACD,oBAAoB,EAAE;YACpB,QAAQ,EAAE,8BAA8B;YACxC,eAAe,EAAE,mCAAmC;SACrD;QAED,0BAA0B,EAAE;YAC1B,QAAQ,EAAE,kCAAkC;YAC5C,eAAe,EAAE,yCAAyC;SAC3D;QACD,mBAAmB,EAAE;YACnB,QAAQ,EAAE,6BAA6B;YACvC,eAAe,EAAE,kCAAkC;SACpD;QACD,wBAAwB,EAAE;YACxB,QAAQ,EAAE,iCAAiC;YAC3C,eAAe,EAAE,uCAAuC;SACzD;QACD,0BAA0B,EAAE;YAC1B,QAAQ,EAAE,mCAAmC;YAC7C,eAAe,EAAE,yCAAyC;SAC3D;KACF;CACF,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare function convertSearchFilterToCplaceFormat(simplifiedFilter: any): any;
|
|
2
|
+
export interface SearchContext {
|
|
3
|
+
embeddingEntityUID?: string;
|
|
4
|
+
connectedTableSelectionUID?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function findMissingSearchContext(filter: unknown, context: SearchContext): string | undefined;
|
|
7
|
+
export declare function usesBeginsWith(filter: unknown): boolean;
|
|
2
8
|
//# sourceMappingURL=searchConversion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchConversion.d.ts","sourceRoot":"","sources":["../src/searchConversion.ts"],"names":[],"mappings":"AAGA,wBAAgB,iCAAiC,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"searchConversion.d.ts","sourceRoot":"","sources":["../src/searchConversion.ts"],"names":[],"mappings":"AAGA,wBAAgB,iCAAiC,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,CAwf5E;AAED,MAAM,WAAW,aAAa;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AA6CD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,GACrB,MAAM,GAAG,SAAS,CAmBpB;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAQvD"}
|
package/dist/searchConversion.js
CHANGED
|
@@ -4,14 +4,14 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
4
4
|
function convertCondition(condition) {
|
|
5
5
|
if (condition.and) {
|
|
6
6
|
return {
|
|
7
|
-
type:
|
|
8
|
-
subFilters: condition.and.map((subCondition) => convertCondition(subCondition))
|
|
7
|
+
type: 'And',
|
|
8
|
+
subFilters: condition.and.map((subCondition) => convertCondition(subCondition)),
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
if (condition.or) {
|
|
12
12
|
return {
|
|
13
|
-
type:
|
|
14
|
-
subFilters: condition.or.map((subCondition) => convertCondition(subCondition))
|
|
13
|
+
type: 'Or',
|
|
14
|
+
subFilters: condition.or.map((subCondition) => convertCondition(subCondition)),
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
if (condition.attribute) {
|
|
@@ -57,26 +57,26 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
57
57
|
}
|
|
58
58
|
else if (condition.name) {
|
|
59
59
|
return {
|
|
60
|
-
type:
|
|
61
|
-
attribute:
|
|
62
|
-
operator:
|
|
63
|
-
string: condition.name.equals
|
|
60
|
+
type: 'BuiltinAttributeValue',
|
|
61
|
+
attribute: 'name',
|
|
62
|
+
operator: 'equals',
|
|
63
|
+
string: condition.name.equals,
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
else if (condition.creator) {
|
|
67
67
|
return {
|
|
68
|
-
type:
|
|
69
|
-
attribute:
|
|
70
|
-
operator:
|
|
71
|
-
reference: condition.creator.equals
|
|
68
|
+
type: 'BuiltinAttributeValue',
|
|
69
|
+
attribute: 'creator',
|
|
70
|
+
operator: 'equals',
|
|
71
|
+
reference: condition.creator.equals,
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
else if (condition.modifier) {
|
|
75
75
|
return {
|
|
76
|
-
type:
|
|
77
|
-
attribute:
|
|
78
|
-
operator:
|
|
79
|
-
reference: condition.modifier.equals
|
|
76
|
+
type: 'BuiltinAttributeValue',
|
|
77
|
+
attribute: 'modifier',
|
|
78
|
+
operator: 'equals',
|
|
79
|
+
reference: condition.modifier.equals,
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
throw new Error(`Unsupported filter condition: ${JSON.stringify(condition)}. Valid format example: [{"attribute": "cf.example.attr", "string": {"equals": "value"}}]. Each condition needs an 'attribute' key plus a type key (string/number/date/reference/boolean), or use 'and'/'or' for logical combinations, or 'name'/'creator'/'modifier' for builtin attributes.`);
|
|
@@ -86,51 +86,55 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
86
86
|
const attribute = condition.attribute;
|
|
87
87
|
if (stringFilter.equals !== undefined) {
|
|
88
88
|
return {
|
|
89
|
-
type:
|
|
89
|
+
type: 'CustomAttributeValue',
|
|
90
90
|
attribute,
|
|
91
|
-
operator:
|
|
92
|
-
string: stringFilter.equals
|
|
91
|
+
operator: 'equals',
|
|
92
|
+
string: stringFilter.equals,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
else if (stringFilter.not_equals !== undefined) {
|
|
96
96
|
return {
|
|
97
|
-
type:
|
|
98
|
-
subFilters: [
|
|
99
|
-
|
|
97
|
+
type: 'Not',
|
|
98
|
+
subFilters: [
|
|
99
|
+
{
|
|
100
|
+
type: 'CustomAttributeValue',
|
|
100
101
|
attribute,
|
|
101
|
-
operator:
|
|
102
|
-
string: stringFilter.not_equals
|
|
103
|
-
}
|
|
102
|
+
operator: 'equals',
|
|
103
|
+
string: stringFilter.not_equals,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
else if (stringFilter.contains !== undefined) {
|
|
107
109
|
return {
|
|
108
|
-
type:
|
|
110
|
+
type: 'CustomAttributeFulltext',
|
|
109
111
|
attribute,
|
|
110
|
-
text: stringFilter.contains
|
|
112
|
+
text: stringFilter.contains,
|
|
111
113
|
};
|
|
112
114
|
}
|
|
113
115
|
else if (stringFilter.beginsWith !== undefined) {
|
|
114
116
|
return {
|
|
115
|
-
type:
|
|
117
|
+
type: 'CustomAttributeValue',
|
|
116
118
|
attribute,
|
|
117
|
-
operator:
|
|
118
|
-
string: stringFilter.beginsWith
|
|
119
|
+
operator: 'begins',
|
|
120
|
+
string: stringFilter.beginsWith,
|
|
119
121
|
};
|
|
120
122
|
}
|
|
121
123
|
else if (stringFilter.is_empty === true) {
|
|
122
124
|
return {
|
|
123
|
-
type:
|
|
125
|
+
type: 'CustomAttributeEmpty',
|
|
124
126
|
attribute,
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
129
|
else if (stringFilter.is_not_empty === true) {
|
|
128
130
|
return {
|
|
129
|
-
type:
|
|
130
|
-
subFilters: [
|
|
131
|
-
|
|
131
|
+
type: 'Not',
|
|
132
|
+
subFilters: [
|
|
133
|
+
{
|
|
134
|
+
type: 'CustomAttributeEmpty',
|
|
132
135
|
attribute,
|
|
133
|
-
}
|
|
136
|
+
},
|
|
137
|
+
],
|
|
134
138
|
};
|
|
135
139
|
}
|
|
136
140
|
throw new Error(`Unsupported string filter: ${JSON.stringify(stringFilter)}`);
|
|
@@ -140,68 +144,72 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
140
144
|
const attribute = condition.attribute;
|
|
141
145
|
if (numberFilter.equals !== undefined) {
|
|
142
146
|
return {
|
|
143
|
-
type:
|
|
147
|
+
type: 'CustomAttributeValue',
|
|
144
148
|
attribute,
|
|
145
|
-
operator:
|
|
146
|
-
number: numberFilter.equals
|
|
149
|
+
operator: 'equals',
|
|
150
|
+
number: numberFilter.equals,
|
|
147
151
|
};
|
|
148
152
|
}
|
|
149
153
|
else if (numberFilter.greater_than !== undefined) {
|
|
150
154
|
return {
|
|
151
|
-
type:
|
|
155
|
+
type: 'CustomAttributeValue',
|
|
152
156
|
attribute,
|
|
153
|
-
operator:
|
|
154
|
-
number: numberFilter.greater_than
|
|
157
|
+
operator: 'greaterThan',
|
|
158
|
+
number: numberFilter.greater_than,
|
|
155
159
|
};
|
|
156
160
|
}
|
|
157
161
|
else if (numberFilter.greater_than_or_equal_to !== undefined) {
|
|
158
162
|
return {
|
|
159
|
-
type:
|
|
163
|
+
type: 'CustomAttributeValue',
|
|
160
164
|
attribute,
|
|
161
|
-
operator:
|
|
162
|
-
number: numberFilter.greater_than_or_equal_to
|
|
165
|
+
operator: 'greaterEquals',
|
|
166
|
+
number: numberFilter.greater_than_or_equal_to,
|
|
163
167
|
};
|
|
164
168
|
}
|
|
165
169
|
else if (numberFilter.less_than !== undefined) {
|
|
166
170
|
return {
|
|
167
|
-
type:
|
|
171
|
+
type: 'CustomAttributeValue',
|
|
168
172
|
attribute,
|
|
169
|
-
operator:
|
|
170
|
-
number: numberFilter.less_than
|
|
173
|
+
operator: 'lessThan',
|
|
174
|
+
number: numberFilter.less_than,
|
|
171
175
|
};
|
|
172
176
|
}
|
|
173
177
|
else if (numberFilter.less_than_or_equal_to !== undefined) {
|
|
174
178
|
return {
|
|
175
|
-
type:
|
|
179
|
+
type: 'CustomAttributeValue',
|
|
176
180
|
attribute,
|
|
177
|
-
operator:
|
|
178
|
-
number: numberFilter.less_than_or_equal_to
|
|
181
|
+
operator: 'lessEquals',
|
|
182
|
+
number: numberFilter.less_than_or_equal_to,
|
|
179
183
|
};
|
|
180
184
|
}
|
|
181
185
|
else if (numberFilter.not_equals !== undefined) {
|
|
182
186
|
return {
|
|
183
|
-
type:
|
|
184
|
-
subFilters: [
|
|
185
|
-
|
|
187
|
+
type: 'Not',
|
|
188
|
+
subFilters: [
|
|
189
|
+
{
|
|
190
|
+
type: 'CustomAttributeValue',
|
|
186
191
|
attribute,
|
|
187
|
-
operator:
|
|
188
|
-
number: numberFilter.not_equals
|
|
189
|
-
}
|
|
192
|
+
operator: 'equals',
|
|
193
|
+
number: numberFilter.not_equals,
|
|
194
|
+
},
|
|
195
|
+
],
|
|
190
196
|
};
|
|
191
197
|
}
|
|
192
198
|
else if (numberFilter.is_empty === true) {
|
|
193
199
|
return {
|
|
194
|
-
type:
|
|
200
|
+
type: 'CustomAttributeEmpty',
|
|
195
201
|
attribute,
|
|
196
202
|
};
|
|
197
203
|
}
|
|
198
204
|
else if (numberFilter.is_not_empty === true) {
|
|
199
205
|
return {
|
|
200
|
-
type:
|
|
201
|
-
subFilters: [
|
|
202
|
-
|
|
206
|
+
type: 'Not',
|
|
207
|
+
subFilters: [
|
|
208
|
+
{
|
|
209
|
+
type: 'CustomAttributeEmpty',
|
|
203
210
|
attribute,
|
|
204
|
-
}
|
|
211
|
+
},
|
|
212
|
+
],
|
|
205
213
|
};
|
|
206
214
|
}
|
|
207
215
|
throw new Error(`Unsupported number filter: ${JSON.stringify(numberFilter)}`);
|
|
@@ -213,79 +221,88 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
213
221
|
}
|
|
214
222
|
return dateValue;
|
|
215
223
|
}
|
|
224
|
+
function lastMillisecondBefore(date) {
|
|
225
|
+
const [year, month, day] = date.split('-').map(Number);
|
|
226
|
+
const previousDay = new Date(Date.UTC(year, month - 1, day - 1)).toISOString().slice(0, 10);
|
|
227
|
+
return `${previousDay}T23:59:59.999`;
|
|
228
|
+
}
|
|
216
229
|
function convertDateCondition(condition) {
|
|
217
230
|
const dateFilter = condition.date;
|
|
218
231
|
const attribute = condition.attribute;
|
|
219
232
|
if (dateFilter.equals !== undefined) {
|
|
220
|
-
validateDateForSearchFilter(dateFilter.equals,
|
|
233
|
+
validateDateForSearchFilter(dateFilter.equals, 'equals');
|
|
221
234
|
return {
|
|
222
|
-
type:
|
|
235
|
+
type: 'CustomAttributeValue',
|
|
223
236
|
attribute,
|
|
224
|
-
operator:
|
|
225
|
-
date: transformDateForSearch(dateFilter.equals)
|
|
237
|
+
operator: 'equals',
|
|
238
|
+
date: transformDateForSearch(dateFilter.equals),
|
|
226
239
|
};
|
|
227
240
|
}
|
|
228
241
|
else if (dateFilter.not_equals !== undefined) {
|
|
229
|
-
validateDateForSearchFilter(dateFilter.not_equals,
|
|
242
|
+
validateDateForSearchFilter(dateFilter.not_equals, 'not_equals');
|
|
230
243
|
return {
|
|
231
|
-
type:
|
|
232
|
-
subFilters: [
|
|
233
|
-
|
|
244
|
+
type: 'Not',
|
|
245
|
+
subFilters: [
|
|
246
|
+
{
|
|
247
|
+
type: 'CustomAttributeValue',
|
|
234
248
|
attribute,
|
|
235
|
-
operator:
|
|
236
|
-
date: transformDateForSearch(dateFilter.not_equals)
|
|
237
|
-
}
|
|
249
|
+
operator: 'equals',
|
|
250
|
+
date: transformDateForSearch(dateFilter.not_equals),
|
|
251
|
+
},
|
|
252
|
+
],
|
|
238
253
|
};
|
|
239
254
|
}
|
|
240
255
|
else if (dateFilter.after !== undefined) {
|
|
241
|
-
validateDateForSearchFilter(dateFilter.after,
|
|
256
|
+
validateDateForSearchFilter(dateFilter.after, 'after');
|
|
242
257
|
return {
|
|
243
|
-
type:
|
|
258
|
+
type: 'CustomAttributeValue',
|
|
244
259
|
attribute,
|
|
245
|
-
operator:
|
|
246
|
-
date: transformDateForSearch(dateFilter.after)
|
|
260
|
+
operator: 'greaterThan',
|
|
261
|
+
date: transformDateForSearch(dateFilter.after),
|
|
247
262
|
};
|
|
248
263
|
}
|
|
249
264
|
else if (dateFilter.before !== undefined) {
|
|
250
|
-
validateDateForSearchFilter(dateFilter.before,
|
|
265
|
+
validateDateForSearchFilter(dateFilter.before, 'before');
|
|
251
266
|
return {
|
|
252
|
-
type:
|
|
267
|
+
type: 'CustomAttributeValue',
|
|
253
268
|
attribute,
|
|
254
|
-
operator:
|
|
255
|
-
date: transformDateForSearch(dateFilter.before)
|
|
269
|
+
operator: 'lessThan',
|
|
270
|
+
date: transformDateForSearch(dateFilter.before),
|
|
256
271
|
};
|
|
257
272
|
}
|
|
258
273
|
else if (dateFilter.on_or_after !== undefined) {
|
|
259
|
-
validateDateForSearchFilter(dateFilter.on_or_after,
|
|
274
|
+
validateDateForSearchFilter(dateFilter.on_or_after, 'on_or_after');
|
|
260
275
|
return {
|
|
261
|
-
type:
|
|
276
|
+
type: 'CustomAttributeValue',
|
|
262
277
|
attribute,
|
|
263
|
-
operator:
|
|
264
|
-
date:
|
|
278
|
+
operator: 'greaterThan',
|
|
279
|
+
date: lastMillisecondBefore(dateFilter.on_or_after),
|
|
265
280
|
};
|
|
266
281
|
}
|
|
267
282
|
else if (dateFilter.on_or_before !== undefined) {
|
|
268
|
-
validateDateForSearchFilter(dateFilter.on_or_before,
|
|
283
|
+
validateDateForSearchFilter(dateFilter.on_or_before, 'on_or_before');
|
|
269
284
|
return {
|
|
270
|
-
type:
|
|
285
|
+
type: 'CustomAttributeValue',
|
|
271
286
|
attribute,
|
|
272
|
-
operator:
|
|
273
|
-
date: transformDateForSearch(dateFilter.on_or_before)
|
|
287
|
+
operator: 'lessEquals',
|
|
288
|
+
date: transformDateForSearch(dateFilter.on_or_before),
|
|
274
289
|
};
|
|
275
290
|
}
|
|
276
291
|
else if (dateFilter.is_empty === true) {
|
|
277
292
|
return {
|
|
278
|
-
type:
|
|
293
|
+
type: 'CustomAttributeEmpty',
|
|
279
294
|
attribute,
|
|
280
295
|
};
|
|
281
296
|
}
|
|
282
297
|
else if (dateFilter.is_not_empty === true) {
|
|
283
298
|
return {
|
|
284
|
-
type:
|
|
285
|
-
subFilters: [
|
|
286
|
-
|
|
299
|
+
type: 'Not',
|
|
300
|
+
subFilters: [
|
|
301
|
+
{
|
|
302
|
+
type: 'CustomAttributeEmpty',
|
|
287
303
|
attribute,
|
|
288
|
-
}
|
|
304
|
+
},
|
|
305
|
+
],
|
|
289
306
|
};
|
|
290
307
|
}
|
|
291
308
|
throw new Error(`Unsupported date filter: ${JSON.stringify(dateFilter)}`);
|
|
@@ -295,36 +312,40 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
295
312
|
const attribute = condition.attribute;
|
|
296
313
|
if (referenceFilter.equals !== undefined) {
|
|
297
314
|
return {
|
|
298
|
-
type:
|
|
315
|
+
type: 'CustomAttributeValue',
|
|
299
316
|
attribute,
|
|
300
|
-
operator:
|
|
301
|
-
reference: referenceFilter.equals
|
|
317
|
+
operator: 'equals',
|
|
318
|
+
reference: referenceFilter.equals,
|
|
302
319
|
};
|
|
303
320
|
}
|
|
304
321
|
else if (referenceFilter.not_equals !== undefined) {
|
|
305
322
|
return {
|
|
306
|
-
type:
|
|
307
|
-
subFilters: [
|
|
308
|
-
|
|
323
|
+
type: 'Not',
|
|
324
|
+
subFilters: [
|
|
325
|
+
{
|
|
326
|
+
type: 'CustomAttributeValue',
|
|
309
327
|
attribute,
|
|
310
|
-
operator:
|
|
311
|
-
reference: referenceFilter.not_equals
|
|
312
|
-
}
|
|
328
|
+
operator: 'equals',
|
|
329
|
+
reference: referenceFilter.not_equals,
|
|
330
|
+
},
|
|
331
|
+
],
|
|
313
332
|
};
|
|
314
333
|
}
|
|
315
334
|
else if (referenceFilter.is_empty === true) {
|
|
316
335
|
return {
|
|
317
|
-
type:
|
|
336
|
+
type: 'CustomAttributeEmpty',
|
|
318
337
|
attribute,
|
|
319
338
|
};
|
|
320
339
|
}
|
|
321
340
|
else if (referenceFilter.is_not_empty === true) {
|
|
322
341
|
return {
|
|
323
|
-
type:
|
|
324
|
-
subFilters: [
|
|
325
|
-
|
|
342
|
+
type: 'Not',
|
|
343
|
+
subFilters: [
|
|
344
|
+
{
|
|
345
|
+
type: 'CustomAttributeEmpty',
|
|
326
346
|
attribute,
|
|
327
|
-
}
|
|
347
|
+
},
|
|
348
|
+
],
|
|
328
349
|
};
|
|
329
350
|
}
|
|
330
351
|
throw new Error(`Unsupported reference filter: ${JSON.stringify(referenceFilter)}`);
|
|
@@ -334,21 +355,23 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
334
355
|
const attribute = condition.attribute;
|
|
335
356
|
if (booleanFilter.equals !== undefined) {
|
|
336
357
|
return {
|
|
337
|
-
type:
|
|
358
|
+
type: 'CustomAttributeValue',
|
|
338
359
|
attribute,
|
|
339
|
-
operator:
|
|
340
|
-
boolean: booleanFilter.equals
|
|
360
|
+
operator: 'equals',
|
|
361
|
+
boolean: booleanFilter.equals,
|
|
341
362
|
};
|
|
342
363
|
}
|
|
343
364
|
else if (booleanFilter.not_equals !== undefined) {
|
|
344
365
|
return {
|
|
345
|
-
type:
|
|
346
|
-
subFilters: [
|
|
347
|
-
|
|
366
|
+
type: 'Not',
|
|
367
|
+
subFilters: [
|
|
368
|
+
{
|
|
369
|
+
type: 'CustomAttributeValue',
|
|
348
370
|
attribute,
|
|
349
|
-
operator:
|
|
350
|
-
boolean: booleanFilter.not_equals
|
|
351
|
-
}
|
|
371
|
+
operator: 'equals',
|
|
372
|
+
boolean: booleanFilter.not_equals,
|
|
373
|
+
},
|
|
374
|
+
],
|
|
352
375
|
};
|
|
353
376
|
}
|
|
354
377
|
throw new Error(`Unsupported boolean filter: ${JSON.stringify(booleanFilter)}`);
|
|
@@ -356,17 +379,17 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
356
379
|
function convertRelativeReferenceCondition(condition) {
|
|
357
380
|
const filter = condition.relativeReference;
|
|
358
381
|
return {
|
|
359
|
-
type:
|
|
382
|
+
type: 'RelativeCustomReference',
|
|
360
383
|
attribute: filter.attribute,
|
|
361
|
-
referenceOperator: filter.operator
|
|
384
|
+
referenceOperator: filter.operator,
|
|
362
385
|
};
|
|
363
386
|
}
|
|
364
387
|
function convertRelativeDateCondition(condition) {
|
|
365
388
|
const filter = condition.relativeDate;
|
|
366
389
|
const result = {
|
|
367
|
-
type:
|
|
390
|
+
type: 'RelativeCustomDate',
|
|
368
391
|
attribute: filter.attribute,
|
|
369
|
-
operator: filter.operator
|
|
392
|
+
operator: filter.operator,
|
|
370
393
|
};
|
|
371
394
|
if (filter.offset !== undefined) {
|
|
372
395
|
result.offset = filter.offset;
|
|
@@ -379,17 +402,17 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
379
402
|
function convertRelativeStringCondition(condition) {
|
|
380
403
|
const filter = condition.relativeString;
|
|
381
404
|
return {
|
|
382
|
-
type:
|
|
405
|
+
type: 'RelativeCustomString',
|
|
383
406
|
attribute: filter.attribute,
|
|
384
|
-
sourceAttribute: filter.sourceAttribute
|
|
407
|
+
sourceAttribute: filter.sourceAttribute,
|
|
385
408
|
};
|
|
386
409
|
}
|
|
387
410
|
function convertRelativeNumberCondition(condition) {
|
|
388
411
|
const filter = condition.relativeNumber;
|
|
389
412
|
const result = {
|
|
390
|
-
type:
|
|
413
|
+
type: 'RelativeCustomNumber',
|
|
391
414
|
attribute: filter.attribute,
|
|
392
|
-
sourceAttribute: filter.sourceAttribute
|
|
415
|
+
sourceAttribute: filter.sourceAttribute,
|
|
393
416
|
};
|
|
394
417
|
if (filter.operator) {
|
|
395
418
|
result.operator = filter.operator;
|
|
@@ -402,29 +425,29 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
402
425
|
function convertRelativeBooleanCondition(condition) {
|
|
403
426
|
const filter = condition.relativeBoolean;
|
|
404
427
|
return {
|
|
405
|
-
type:
|
|
428
|
+
type: 'RelativeCustomBoolean',
|
|
406
429
|
attribute: filter.attribute,
|
|
407
|
-
sourceAttribute: filter.sourceAttribute
|
|
430
|
+
sourceAttribute: filter.sourceAttribute,
|
|
408
431
|
};
|
|
409
432
|
}
|
|
410
433
|
function convertRelativeSpaceCondition(_condition) {
|
|
411
434
|
return {
|
|
412
|
-
type:
|
|
435
|
+
type: 'RelativeSpace',
|
|
413
436
|
};
|
|
414
437
|
}
|
|
415
438
|
function convertRelativeUidCondition(condition) {
|
|
416
439
|
const filter = condition.relativeUid;
|
|
417
440
|
return {
|
|
418
|
-
type:
|
|
419
|
-
referenceOperator: filter.operator
|
|
441
|
+
type: 'RelativeUid',
|
|
442
|
+
referenceOperator: filter.operator,
|
|
420
443
|
};
|
|
421
444
|
}
|
|
422
445
|
function convertRelativeBuiltinReferenceCondition(condition) {
|
|
423
446
|
const filter = condition.relativeBuiltinReference;
|
|
424
447
|
return {
|
|
425
|
-
type:
|
|
448
|
+
type: 'RelativeBuiltinReference',
|
|
426
449
|
attribute: filter.attribute,
|
|
427
|
-
referenceOperator: filter.operator
|
|
450
|
+
referenceOperator: filter.operator,
|
|
428
451
|
};
|
|
429
452
|
}
|
|
430
453
|
if (Array.isArray(simplifiedFilter)) {
|
|
@@ -436,7 +459,71 @@ export function convertSearchFilterToCplaceFormat(simplifiedFilter) {
|
|
|
436
459
|
cplaceFilters.push(convertCondition(simplifiedFilter));
|
|
437
460
|
}
|
|
438
461
|
return {
|
|
439
|
-
filters: cplaceFilters
|
|
462
|
+
filters: cplaceFilters,
|
|
440
463
|
};
|
|
441
464
|
}
|
|
465
|
+
function contextForReferenceOperator(operator) {
|
|
466
|
+
if (operator === 'embeddingCustomEntity' ||
|
|
467
|
+
operator === 'parentOfEmbeddingPage' ||
|
|
468
|
+
operator.startsWith('ba_') ||
|
|
469
|
+
operator.startsWith('ca_')) {
|
|
470
|
+
return 'embeddingEntityUID';
|
|
471
|
+
}
|
|
472
|
+
if (operator === 'connectedTable' || operator.startsWith('ctca_')) {
|
|
473
|
+
return 'connectedTableSelectionUID';
|
|
474
|
+
}
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
function requiredContext(condition) {
|
|
478
|
+
for (const key of ['relativeSpace', 'relativeString', 'relativeNumber', 'relativeBoolean']) {
|
|
479
|
+
if (condition[key])
|
|
480
|
+
return { parameter: 'embeddingEntityUID', what: key };
|
|
481
|
+
}
|
|
482
|
+
const relativeTo = condition.relativeDate?.relativeToAttribute;
|
|
483
|
+
if (relativeTo && relativeTo !== '_lastLogin') {
|
|
484
|
+
return {
|
|
485
|
+
parameter: 'embeddingEntityUID',
|
|
486
|
+
what: `relativeDate with relativeToAttribute "${relativeTo}"`,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
for (const key of ['relativeReference', 'relativeBuiltinReference', 'relativeUid']) {
|
|
490
|
+
const operator = condition[key]?.operator;
|
|
491
|
+
const parameter = typeof operator === 'string' ? contextForReferenceOperator(operator) : undefined;
|
|
492
|
+
if (parameter)
|
|
493
|
+
return { parameter, what: `${key} with operator "${operator}"` };
|
|
494
|
+
}
|
|
495
|
+
return undefined;
|
|
496
|
+
}
|
|
497
|
+
export function findMissingSearchContext(filter, context) {
|
|
498
|
+
if (Array.isArray(filter)) {
|
|
499
|
+
for (const entry of filter) {
|
|
500
|
+
const message = findMissingSearchContext(entry, context);
|
|
501
|
+
if (message)
|
|
502
|
+
return message;
|
|
503
|
+
}
|
|
504
|
+
return undefined;
|
|
505
|
+
}
|
|
506
|
+
if (!filter || typeof filter !== 'object')
|
|
507
|
+
return undefined;
|
|
508
|
+
const condition = filter;
|
|
509
|
+
if (condition.and || condition.or) {
|
|
510
|
+
return findMissingSearchContext([...(condition.and ?? []), ...(condition.or ?? [])], context);
|
|
511
|
+
}
|
|
512
|
+
const required = requiredContext(condition);
|
|
513
|
+
if (!required || context[required.parameter])
|
|
514
|
+
return undefined;
|
|
515
|
+
return (`The condition ${required.what} needs ${required.parameter}. Without it, cplace would skip the ` +
|
|
516
|
+
`condition and search without it. Pass ${required.parameter}, or remove the condition.`);
|
|
517
|
+
}
|
|
518
|
+
export function usesBeginsWith(filter) {
|
|
519
|
+
if (Array.isArray(filter))
|
|
520
|
+
return filter.some(usesBeginsWith);
|
|
521
|
+
if (!filter || typeof filter !== 'object')
|
|
522
|
+
return false;
|
|
523
|
+
const condition = filter;
|
|
524
|
+
if (condition.and || condition.or) {
|
|
525
|
+
return usesBeginsWith(condition.and ?? []) || usesBeginsWith(condition.or ?? []);
|
|
526
|
+
}
|
|
527
|
+
return condition.string?.beginsWith !== undefined;
|
|
528
|
+
}
|
|
442
529
|
//# sourceMappingURL=searchConversion.js.map
|