@masterteam/formula-builder 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterteam/formula-builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"directory": "../../../dist/masterteam/formula-builder",
|
|
6
6
|
"linkDirectory": true,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"tailwindcss": "^4.2.2",
|
|
21
21
|
"tailwindcss-primeui": "^0.6.1",
|
|
22
22
|
"@masterteam/icons": "^0.0.17",
|
|
23
|
-
"@masterteam/components": "^0.0.
|
|
23
|
+
"@masterteam/components": "^0.0.227"
|
|
24
24
|
},
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"exports": {
|
|
@@ -11,6 +11,8 @@ type ValidationResult = ValidationResult$1;
|
|
|
11
11
|
type AutocompleteResponse = AutocompleteResponse$1;
|
|
12
12
|
interface AutocompleteRequest extends AutocompleteRequest$1 {
|
|
13
13
|
moduleId?: number;
|
|
14
|
+
/** Canonical context id, e.g. `Module:123` / `Level:5/Module:10`. */
|
|
15
|
+
contextKey?: string;
|
|
14
16
|
}
|
|
15
17
|
/** Validation request payload (for API calls) */
|
|
16
18
|
interface ValidationRequest {
|
|
@@ -19,6 +21,8 @@ interface ValidationRequest {
|
|
|
19
21
|
levelSchemaId?: number;
|
|
20
22
|
moduleId?: number;
|
|
21
23
|
templateId?: number;
|
|
24
|
+
/** Canonical context id, e.g. `Module:123` / `Level:5/Module:10`. */
|
|
25
|
+
contextKey?: string;
|
|
22
26
|
}
|
|
23
27
|
/** Function catalog response from API */
|
|
24
28
|
interface FunctionCatalogResponse {
|
|
@@ -64,8 +68,37 @@ interface FormulaEngineSchemaDescriptor {
|
|
|
64
68
|
generatedAt?: string;
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
/**
|
|
72
|
+
* How the backend resolves a formula's execution surface for a context.
|
|
73
|
+
* `InlineCurrentOnly` — standalone module / current-only authoring (only
|
|
74
|
+
* `@Current::Property` is valid); `EntityBacked` — full workspace/level
|
|
75
|
+
* authoring with navigation scopes. Serialized as strings by the API.
|
|
76
|
+
*/
|
|
77
|
+
type FormulaExecutionProfile = 'InlineCurrentOnly' | 'EntityBacked' | (string & {});
|
|
78
|
+
/**
|
|
79
|
+
* The kind of context a `contextKey` resolves to. `StandaloneModule` is a
|
|
80
|
+
* module opened without a workspace/level (e.g. `General Task`) addressed as
|
|
81
|
+
* `Module:{moduleId}`. Serialized as strings by the API.
|
|
82
|
+
*/
|
|
83
|
+
type FormulaContextKind = 'StandaloneModule' | (string & {});
|
|
67
84
|
interface FormulaBuilderContextResponse {
|
|
68
85
|
schemaId: number;
|
|
86
|
+
/**
|
|
87
|
+
* Canonical schema id to use for subsequent properties/next-tokens calls.
|
|
88
|
+
* For standalone modules this equals the module id. Falls back to `schemaId`
|
|
89
|
+
* when the backend omits it.
|
|
90
|
+
*/
|
|
91
|
+
formulaSchemaId?: number;
|
|
92
|
+
/** Canonical context identifier the response was resolved from. */
|
|
93
|
+
contextKey?: string;
|
|
94
|
+
contextKind?: FormulaContextKind;
|
|
95
|
+
executionProfile?: FormulaExecutionProfile;
|
|
96
|
+
/**
|
|
97
|
+
* Scope tokens the FE may surface for this context. Standalone modules
|
|
98
|
+
* return only `['Current']`. When present, the builder gates visible
|
|
99
|
+
* navigation scopes to this list.
|
|
100
|
+
*/
|
|
101
|
+
supportedScopeTokens?: string[];
|
|
69
102
|
contextEntityTypeKey?: string;
|
|
70
103
|
schemaDescriptor: FormulaEngineSchemaDescriptor;
|
|
71
104
|
currentProperties: FormulaPropertyDescriptor[];
|
|
@@ -131,6 +164,15 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
131
164
|
readonly levelSchemaId: _angular_core.InputSignal<number | undefined>;
|
|
132
165
|
/** Optional module ID when the formula is scoped inside a level-linked module */
|
|
133
166
|
readonly moduleId: _angular_core.InputSignal<number | undefined>;
|
|
167
|
+
/**
|
|
168
|
+
* Canonical context identifier — `Module:{id}` / `Level:{id}` /
|
|
169
|
+
* `Level:{id}/Module:{id}`. When set it is the source of truth for the
|
|
170
|
+
* context kind and execution profile: it is the only way to address a
|
|
171
|
+
* standalone module (no workspace/level schema), and the builder loads its
|
|
172
|
+
* context, scopes, functions and validation through it. When omitted the
|
|
173
|
+
* legacy `levelSchemaId` + `moduleId` flow is used unchanged.
|
|
174
|
+
*/
|
|
175
|
+
readonly contextKey: _angular_core.InputSignal<string | undefined>;
|
|
134
176
|
/** Optional current context entity key, e.g. LevelData or Risk */
|
|
135
177
|
readonly contextEntityTypeKey: _angular_core.InputSignal<string | undefined>;
|
|
136
178
|
/** Template ID for validation context */
|
|
@@ -165,6 +207,27 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
165
207
|
readonly expression: _angular_core.Signal<string>;
|
|
166
208
|
readonly resolvedContextEntityTypeKey: _angular_core.Signal<string | undefined>;
|
|
167
209
|
readonly isModuleContext: _angular_core.Signal<boolean>;
|
|
210
|
+
/** Trimmed canonical context key, or undefined when not supplied. */
|
|
211
|
+
readonly resolvedContextKey: _angular_core.Signal<string | undefined>;
|
|
212
|
+
/**
|
|
213
|
+
* True when authoring is current-only (a standalone module / `Module:{id}`).
|
|
214
|
+
* Prefers the resolved context (execution profile / kind) once loaded, and
|
|
215
|
+
* falls back to the shape of the context key before the context arrives so
|
|
216
|
+
* navigation scopes never flash for a standalone module.
|
|
217
|
+
*/
|
|
218
|
+
readonly isCurrentOnlyContext: _angular_core.Signal<boolean>;
|
|
219
|
+
/**
|
|
220
|
+
* Scope tokens the backend allows for this context, or null when it doesn't
|
|
221
|
+
* constrain them (legacy contexts). Used to gate the visible navigation.
|
|
222
|
+
*/
|
|
223
|
+
readonly supportedScopeTokens: _angular_core.Signal<string[] | null>;
|
|
224
|
+
/**
|
|
225
|
+
* Schema id for downstream properties / next-token / validation calls. The
|
|
226
|
+
* context response is authoritative (a standalone module resolves its own
|
|
227
|
+
* `formulaSchemaId`); falls back to the `levelSchemaId` input for legacy
|
|
228
|
+
* flows and before the context loads.
|
|
229
|
+
*/
|
|
230
|
+
readonly effectiveSchemaId: _angular_core.Signal<number | undefined>;
|
|
168
231
|
readonly autocompleteProvider: (request: AutocompleteRequest) => Observable<AutocompleteResponse | null>;
|
|
169
232
|
private fetchAutocomplete$;
|
|
170
233
|
/** Editor mode */
|
|
@@ -327,7 +390,7 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
327
390
|
private buildLookupValueResponse;
|
|
328
391
|
getOperatorDisplayName(token: string): string;
|
|
329
392
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaBuilder, never>;
|
|
330
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaBuilder, "mt-formula-builder", never, { "propertiesByPath": { "alias": "propertiesByPath"; "required": false; "isSignal": true; }; "levelSchemaId": { "alias": "levelSchemaId"; "required": false; "isSignal": true; }; "moduleId": { "alias": "moduleId"; "required": false; "isSignal": true; }; "contextEntityTypeKey": { "alias": "contextEntityTypeKey"; "required": false; "isSignal": true; }; "templateId": { "alias": "templateId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hideToolbar": { "alias": "hideToolbar"; "required": false; "isSignal": true; }; "hideStatusBar": { "alias": "hideStatusBar"; "required": false; "isSignal": true; }; "toolbarTabs": { "alias": "toolbarTabs"; "required": false; "isSignal": true; }; "codeOnly": { "alias": "codeOnly"; "required": false; "isSignal": true; }; "builderOnly": { "alias": "builderOnly"; "required": false; "isSignal": true; }; "valueMode": { "alias": "valueMode"; "required": false; "isSignal": true; }; "isProcessBuilder": { "alias": "isProcessBuilder"; "required": false; "isSignal": true; }; }, { "validationChange": "validationChange"; "tokensChange": "tokensChange"; }, never, never, true, never>;
|
|
393
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaBuilder, "mt-formula-builder", never, { "propertiesByPath": { "alias": "propertiesByPath"; "required": false; "isSignal": true; }; "levelSchemaId": { "alias": "levelSchemaId"; "required": false; "isSignal": true; }; "moduleId": { "alias": "moduleId"; "required": false; "isSignal": true; }; "contextKey": { "alias": "contextKey"; "required": false; "isSignal": true; }; "contextEntityTypeKey": { "alias": "contextEntityTypeKey"; "required": false; "isSignal": true; }; "templateId": { "alias": "templateId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hideToolbar": { "alias": "hideToolbar"; "required": false; "isSignal": true; }; "hideStatusBar": { "alias": "hideStatusBar"; "required": false; "isSignal": true; }; "toolbarTabs": { "alias": "toolbarTabs"; "required": false; "isSignal": true; }; "codeOnly": { "alias": "codeOnly"; "required": false; "isSignal": true; }; "builderOnly": { "alias": "builderOnly"; "required": false; "isSignal": true; }; "valueMode": { "alias": "valueMode"; "required": false; "isSignal": true; }; "isProcessBuilder": { "alias": "isProcessBuilder"; "required": false; "isSignal": true; }; }, { "validationChange": "validationChange"; "tokensChange": "tokensChange"; }, never, never, true, never>;
|
|
331
394
|
}
|
|
332
395
|
|
|
333
396
|
type FormulaApiMode$1 = 'default' | 'current-only';
|
|
@@ -335,14 +398,22 @@ declare class FormulaContextService {
|
|
|
335
398
|
private readonly http;
|
|
336
399
|
private readonly apiUrl;
|
|
337
400
|
private getBaseUrl;
|
|
401
|
+
private buildLegacyContextUrl;
|
|
338
402
|
private unwrapResponse;
|
|
339
403
|
private readonly contextCache;
|
|
340
404
|
private readonly propertiesCache;
|
|
341
405
|
private readonly nextTokensCache;
|
|
342
406
|
private readonly propertyItemsCache;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
407
|
+
/**
|
|
408
|
+
* Load the builder context. When `contextKey` is provided it is the canonical
|
|
409
|
+
* context identifier (`Module:123` / `Level:5` / `Level:5/Module:10`) and the
|
|
410
|
+
* context-key endpoint is used — this is the only way to address a standalone
|
|
411
|
+
* module, which has no workspace/level schema id. Otherwise the legacy
|
|
412
|
+
* schema-id path endpoint is used unchanged.
|
|
413
|
+
*/
|
|
414
|
+
loadContext(schemaId: number | undefined, moduleId?: number, contextEntityTypeKey?: string, mode?: FormulaApiMode$1, contextKey?: string): Observable<FormulaBuilderContextResponse | null>;
|
|
415
|
+
getScopeProperties(schemaId: number, component: string | undefined, tablePath: string, moduleId?: number, mode?: FormulaApiMode$1, contextKey?: string): Observable<FormulaPropertyDescriptor[]>;
|
|
416
|
+
getNextTokens(schemaId: number, component: string, tablePath: string, moduleId?: number, mode?: FormulaApiMode$1, contextKey?: string): Observable<FormulaBuilderNextTokensResponse | null>;
|
|
346
417
|
/**
|
|
347
418
|
* Selectable values for a lookup / status / lookup-matrix property.
|
|
348
419
|
* The backend responds 400 (VAL_001) for any non-lookup property, which we
|
|
@@ -382,9 +453,9 @@ declare class FormulaValidatorService {
|
|
|
382
453
|
/** Setup debounced validation stream */
|
|
383
454
|
private setupValidationStream;
|
|
384
455
|
/** Validate formula (debounced) */
|
|
385
|
-
validate(formula: string, knownProperties?: string[], levelSchemaId?: number, moduleId?: number, templateId?: number, apiMode?: FormulaApiMode): void;
|
|
456
|
+
validate(formula: string, knownProperties?: string[], levelSchemaId?: number, moduleId?: number, templateId?: number, apiMode?: FormulaApiMode, contextKey?: string): void;
|
|
386
457
|
/** Validate formula immediately (no debounce) */
|
|
387
|
-
validateImmediate(formula: string, knownProperties?: string[], levelSchemaId?: number, moduleId?: number, templateId?: number, apiMode?: FormulaApiMode): Observable<ValidationResult>;
|
|
458
|
+
validateImmediate(formula: string, knownProperties?: string[], levelSchemaId?: number, moduleId?: number, templateId?: number, apiMode?: FormulaApiMode, contextKey?: string): Observable<ValidationResult>;
|
|
388
459
|
/** Call validation API */
|
|
389
460
|
private callValidateApi;
|
|
390
461
|
/** Reset validation state */
|