@qoretechnologies/reqraft 0.10.41-pr.95.g294e5aa → 0.10.41
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/.claude/CLAUDE.md +12 -0
- package/.tasks/INDEX.md +1 -0
- package/.tasks/TEMPLATE_TOKEN_GRAMMAR.md +72 -0
- package/dist/components/codeSize/index.d.ts +37 -0
- package/dist/components/codeSize/index.d.ts.map +1 -0
- package/dist/components/codeSize/index.js +87 -0
- package/dist/components/codeSize/index.js.map +1 -0
- package/dist/components/form/engine/CompactRow.d.ts +20 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +284 -42
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
- package/dist/components/form/engine/CompactToolbar.js +72 -72
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +48 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +163 -75
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.js +102 -87
- package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
- package/dist/components/form/engine/compactRowStyles.d.ts +2 -0
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +22 -5
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.d.ts +8 -0
- package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.js.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts +57 -1
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +143 -4
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/fields/Field.d.ts.map +1 -1
- package/dist/components/form/fields/Field.js +1 -1
- package/dist/components/form/fields/Field.js.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +12 -2
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.js +16 -6
- package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.js +44 -26
- package/dist/components/form/fields/array/ArrayAuto.js.map +1 -1
- package/dist/components/form/fields/array/ArrayAutoField.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAutoField.js +42 -25
- package/dist/components/form/fields/array/ArrayAutoField.js.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +32 -4
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/dist/components/form/fields/long-string/LongString.d.ts +9 -1
- package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
- package/dist/components/form/fields/long-string/LongString.js +25 -4
- package/dist/components/form/fields/long-string/LongString.js.map +1 -1
- package/dist/components/form/fields/template/ExampleValueModal.d.ts +29 -0
- package/dist/components/form/fields/template/ExampleValueModal.d.ts.map +1 -0
- package/dist/components/form/fields/template/ExampleValueModal.js +122 -0
- package/dist/components/form/fields/template/ExampleValueModal.js.map +1 -0
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +3 -3
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
- package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateField.js +35 -6
- package/dist/components/form/fields/template/TemplateField.js.map +1 -1
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts +2 -0
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts.map +1 -0
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.js +9 -0
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.js.map +1 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/helpers/common.d.ts +8 -1
- package/dist/helpers/common.d.ts.map +1 -1
- package/dist/helpers/common.js +9 -1
- package/dist/helpers/common.js.map +1 -1
- package/dist/helpers/optionUiTypes.d.ts +30 -0
- package/dist/helpers/optionUiTypes.d.ts.map +1 -0
- package/dist/helpers/optionUiTypes.js +148 -0
- package/dist/helpers/optionUiTypes.js.map +1 -0
- package/dist/helpers/options.d.ts +19 -0
- package/dist/helpers/options.d.ts.map +1 -1
- package/dist/helpers/options.js +25 -1
- package/dist/helpers/options.js.map +1 -1
- package/dist/helpers/providerValue.d.ts +68 -0
- package/dist/helpers/providerValue.d.ts.map +1 -0
- package/dist/helpers/providerValue.js +50 -0
- package/dist/helpers/providerValue.js.map +1 -0
- package/dist/helpers/singleLineString.d.ts +37 -0
- package/dist/helpers/singleLineString.d.ts.map +1 -0
- package/dist/helpers/singleLineString.js +66 -0
- package/dist/helpers/singleLineString.js.map +1 -0
- package/dist/helpers/templates.d.ts +100 -0
- package/dist/helpers/templates.d.ts.map +1 -1
- package/dist/helpers/templates.js +237 -4
- package/dist/helpers/templates.js.map +1 -1
- package/dist/helpers/validations.d.ts +103 -2
- package/dist/helpers/validations.d.ts.map +1 -1
- package/dist/helpers/validations.js +858 -91
- package/dist/helpers/validations.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/codeSize/index.tsx +79 -0
- package/src/components/form/engine/CompactRow.tsx +407 -34
- package/src/components/form/engine/CompactToolbar.tsx +105 -98
- package/src/components/form/engine/FormEngine.stories.tsx +863 -12
- package/src/components/form/engine/FormEngine.tsx +183 -33
- package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +110 -103
- package/src/components/form/engine/_structuredData/SchemaDataView.tsx +132 -80
- package/src/components/form/engine/compactRowStyles.ts +44 -1
- package/src/components/form/engine/compactToolbarContext.ts +8 -0
- package/src/components/form/engine/readFirst.ts +163 -4
- package/src/components/form/fields/Field.tsx +3 -1
- package/src/components/form/fields/allowed-values/AllowedValues.tsx +24 -2
- package/src/components/form/fields/array/ArrayAuto.tsx +23 -4
- package/src/components/form/fields/array/ArrayAutoField.stories.tsx +134 -0
- package/src/components/form/fields/array/ArrayAutoField.tsx +22 -4
- package/src/components/form/fields/auto/AutoFormField.tsx +31 -1
- package/src/components/form/fields/long-string/LongString.tsx +46 -5
- package/src/components/form/fields/schema-definition/SchemaDefinitionField.stories.tsx +5 -0
- package/src/components/form/fields/template/ExampleValueModal.stories.tsx +114 -0
- package/src/components/form/fields/template/ExampleValueModal.tsx +99 -0
- package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +8 -4
- package/src/components/form/fields/template/TemplateField.stories.tsx +314 -1
- package/src/components/form/fields/template/TemplateField.tsx +47 -8
- package/src/components/form/fields/template/__fixtures__/longExampleValue.ts +7 -0
- package/src/components/form/index.tsx +1 -0
- package/src/helpers/common.ts +11 -1
- package/src/helpers/optionUiTypes.ts +153 -0
- package/src/helpers/options.ts +23 -0
- package/src/helpers/providerValue.ts +125 -0
- package/src/helpers/singleLineString.ts +61 -0
- package/src/helpers/templates.ts +272 -3
- package/src/helpers/validations.ts +1177 -109
- package/src/hooks/useWebSocket/useWebsocket.stories.tsx +23 -2
- package/src/index.tsx +2 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Qorus option `ui_type` vocabulary.
|
|
4
|
+
*
|
|
5
|
+
* A `ui_type` names the widget an option is rendered with, and — because the
|
|
6
|
+
* widget decides what a complete value looks like — it is also what
|
|
7
|
+
* `validateField` switches on. Both readers have to agree about which strings
|
|
8
|
+
* are in the vocabulary, so the lists live here rather than beside either one.
|
|
9
|
+
*
|
|
10
|
+
* Grouped by what the group means to a reader, not by alphabet: the scalar
|
|
11
|
+
* types hold a single value, the collection types hold several, the choice
|
|
12
|
+
* types pick from a supplied set, and the interface types name another Qorus
|
|
13
|
+
* object by its name — which is why `isOptionInterfaceUiType` is enough for
|
|
14
|
+
* validation to treat the whole group as a non-empty string.
|
|
15
|
+
*/
|
|
16
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
17
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
18
|
+
if (ar || !(i in from)) {
|
|
19
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
20
|
+
ar[i] = from[i];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.isKnownQorusUiType = exports.isOptionInterfaceUiType = exports.isOptionUiType = exports.KNOWN_QORUS_UI_TYPES = exports.LEGACY_FIELD_UI_TYPES = exports.OPTION_UI_TYPES = exports.OPTION_CUSTOM_UI_TYPES = exports.OPTION_INTERFACE_UI_TYPES = exports.OPTION_CHOICE_UI_TYPES = exports.OPTION_COLLECTION_UI_TYPES = exports.OPTION_SCALAR_UI_TYPES = void 0;
|
|
27
|
+
exports.OPTION_SCALAR_UI_TYPES = [
|
|
28
|
+
'string',
|
|
29
|
+
'long-string',
|
|
30
|
+
'data',
|
|
31
|
+
'binary',
|
|
32
|
+
'richtext',
|
|
33
|
+
'bool',
|
|
34
|
+
'boolean',
|
|
35
|
+
'date',
|
|
36
|
+
'int',
|
|
37
|
+
'integer',
|
|
38
|
+
'float',
|
|
39
|
+
'number',
|
|
40
|
+
'byte-size',
|
|
41
|
+
'url',
|
|
42
|
+
'code-editor',
|
|
43
|
+
'rgbcolor',
|
|
44
|
+
'any',
|
|
45
|
+
'auto',
|
|
46
|
+
// semantic string formats (string-backed types that carry a UI-renderable identity; see the qore
|
|
47
|
+
// DataProvider QoreStringFormatDataType)
|
|
48
|
+
'email',
|
|
49
|
+
'uri',
|
|
50
|
+
'uuid',
|
|
51
|
+
'hostname',
|
|
52
|
+
'ipv4',
|
|
53
|
+
'ipv6',
|
|
54
|
+
'phone',
|
|
55
|
+
];
|
|
56
|
+
exports.OPTION_COLLECTION_UI_TYPES = [
|
|
57
|
+
'hash',
|
|
58
|
+
'free-hash',
|
|
59
|
+
'list',
|
|
60
|
+
'free-list',
|
|
61
|
+
'option_hash',
|
|
62
|
+
'file',
|
|
63
|
+
'file-as-string',
|
|
64
|
+
'collection-documents',
|
|
65
|
+
];
|
|
66
|
+
exports.OPTION_CHOICE_UI_TYPES = [
|
|
67
|
+
'enum',
|
|
68
|
+
'select-string',
|
|
69
|
+
'select-array',
|
|
70
|
+
'multi-select',
|
|
71
|
+
];
|
|
72
|
+
exports.OPTION_INTERFACE_UI_TYPES = [
|
|
73
|
+
'workflow',
|
|
74
|
+
'service',
|
|
75
|
+
'job',
|
|
76
|
+
'connection',
|
|
77
|
+
'mapper',
|
|
78
|
+
'class',
|
|
79
|
+
'value-map',
|
|
80
|
+
'fsm',
|
|
81
|
+
'qog',
|
|
82
|
+
'api-schema',
|
|
83
|
+
'auth-profile',
|
|
84
|
+
'ai-collection',
|
|
85
|
+
'ai-endpoint',
|
|
86
|
+
'ai-guardrail',
|
|
87
|
+
'ml-model',
|
|
88
|
+
'release-config',
|
|
89
|
+
'alertrule',
|
|
90
|
+
'alertsilence',
|
|
91
|
+
'installed-release',
|
|
92
|
+
'business-process',
|
|
93
|
+
'schema',
|
|
94
|
+
'test',
|
|
95
|
+
];
|
|
96
|
+
exports.OPTION_CUSTOM_UI_TYPES = [
|
|
97
|
+
'processor',
|
|
98
|
+
'processor-mappings',
|
|
99
|
+
'data-provider',
|
|
100
|
+
'tool-catalog',
|
|
101
|
+
'schema-definition',
|
|
102
|
+
'test-cases',
|
|
103
|
+
'test-value-contract',
|
|
104
|
+
'dpql',
|
|
105
|
+
'active-windows',
|
|
106
|
+
];
|
|
107
|
+
exports.OPTION_UI_TYPES = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], exports.OPTION_SCALAR_UI_TYPES, true), exports.OPTION_COLLECTION_UI_TYPES, true), exports.OPTION_CHOICE_UI_TYPES, true), exports.OPTION_INTERFACE_UI_TYPES, true), exports.OPTION_CUSTOM_UI_TYPES, true);
|
|
108
|
+
exports.LEGACY_FIELD_UI_TYPES = [
|
|
109
|
+
'api-manager',
|
|
110
|
+
'array',
|
|
111
|
+
'array-auto',
|
|
112
|
+
'array-of-pairs',
|
|
113
|
+
'class-array',
|
|
114
|
+
'class-connectors',
|
|
115
|
+
'constant-array',
|
|
116
|
+
'context-selector',
|
|
117
|
+
'cron',
|
|
118
|
+
'data-provider-options',
|
|
119
|
+
'file-array',
|
|
120
|
+
'fsm-list',
|
|
121
|
+
'function-array',
|
|
122
|
+
'http-content',
|
|
123
|
+
'method-name',
|
|
124
|
+
'opcua-method-arguments',
|
|
125
|
+
'opcua-write-values',
|
|
126
|
+
'options',
|
|
127
|
+
'select',
|
|
128
|
+
'service-events',
|
|
129
|
+
'service-webhooks',
|
|
130
|
+
'type-selector',
|
|
131
|
+
];
|
|
132
|
+
exports.KNOWN_QORUS_UI_TYPES = __spreadArray(__spreadArray([], exports.OPTION_UI_TYPES, true), exports.LEGACY_FIELD_UI_TYPES, true);
|
|
133
|
+
var optionUiTypeSet = new Set(exports.OPTION_UI_TYPES);
|
|
134
|
+
var interfaceUiTypeSet = new Set(exports.OPTION_INTERFACE_UI_TYPES);
|
|
135
|
+
var knownQorusUiTypeSet = new Set(exports.KNOWN_QORUS_UI_TYPES);
|
|
136
|
+
var isOptionUiType = function (type) {
|
|
137
|
+
return typeof type === 'string' && optionUiTypeSet.has(type);
|
|
138
|
+
};
|
|
139
|
+
exports.isOptionUiType = isOptionUiType;
|
|
140
|
+
var isOptionInterfaceUiType = function (type) {
|
|
141
|
+
return typeof type === 'string' && interfaceUiTypeSet.has(type);
|
|
142
|
+
};
|
|
143
|
+
exports.isOptionInterfaceUiType = isOptionInterfaceUiType;
|
|
144
|
+
var isKnownQorusUiType = function (type) {
|
|
145
|
+
return typeof type === 'string' && knownQorusUiTypeSet.has(type);
|
|
146
|
+
};
|
|
147
|
+
exports.isKnownQorusUiType = isKnownQorusUiType;
|
|
148
|
+
//# sourceMappingURL=optionUiTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionUiTypes.js","sourceRoot":"","sources":["../../src/helpers/optionUiTypes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;AAEU,QAAA,sBAAsB,GAAG;IACpC,QAAQ;IACR,aAAa;IACb,MAAM;IACN,QAAQ;IACR,UAAU;IACV,MAAM;IACN,SAAS;IACT,MAAM;IACN,KAAK;IACL,SAAS;IACT,OAAO;IACP,QAAQ;IACR,WAAW;IACX,KAAK;IACL,aAAa;IACb,UAAU;IACV,KAAK;IACL,MAAM;IACN,iGAAiG;IACjG,yCAAyC;IACzC,OAAO;IACP,KAAK;IACL,MAAM;IACN,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;CACC,CAAC;AAEE,QAAA,0BAA0B,GAAG;IACxC,MAAM;IACN,WAAW;IACX,MAAM;IACN,WAAW;IACX,aAAa;IACb,MAAM;IACN,gBAAgB;IAChB,sBAAsB;CACd,CAAC;AAEE,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,cAAc;IACd,cAAc;CACN,CAAC;AAEE,QAAA,yBAAyB,GAAG;IACvC,UAAU;IACV,SAAS;IACT,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,WAAW;IACX,KAAK;IACL,KAAK;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KAAK,QAAQ,IAAI,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC;AAAxD,CAAwD,CAAC;AAD9C,QAAA,uBAAuB,2BACuB;AAEpD,IAAM,kBAAkB,GAAG,UAAC,IAAa;IAC9C,OAAA,OAAO,IAAI,KAAK,QAAQ,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC;AAAzD,CAAyD,CAAC;AAD/C,QAAA,kBAAkB,sBAC6B"}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { IQorusFormSchema } from '@qoretechnologies/ts-toolkit';
|
|
2
2
|
export declare const getOptionsFromRequiredGroups: (schema: IQorusFormSchema, groups: string[], currentOption?: string) => string[];
|
|
3
3
|
export declare const getRequiredOptionMessage: (schema: IQorusFormSchema, groups: string[], currentField: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* The value of one element of a list field.
|
|
6
|
+
*
|
|
7
|
+
* A list element arrives in either of two shapes, and both are legitimate. The
|
|
8
|
+
* editor keeps each element in a `{value, type}` envelope while the form is
|
|
9
|
+
* being worked on — that is what `formatToServerValue` writes — while a value
|
|
10
|
+
* read back from storage holds what the server contract asks for, which for a
|
|
11
|
+
* list of strings is the bare strings.
|
|
12
|
+
*
|
|
13
|
+
* Reaching straight for `.value` answered `undefined` for every stored element.
|
|
14
|
+
* On a read that emptied the row; on a validation pass it failed the element as
|
|
15
|
+
* empty; and on an autosaving form the emptiness was then written back over the
|
|
16
|
+
* stored value. One helper so the readers cannot disagree about which shape
|
|
17
|
+
* they are looking at.
|
|
18
|
+
*
|
|
19
|
+
* An array is never an envelope — a rich-text document is itself an array, and
|
|
20
|
+
* `'value' in []` is false anyway, but saying so keeps the intent legible.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getListElementValue: (element: unknown) => unknown;
|
|
4
23
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/helpers/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,8BAA8B,CAAC;AAEvF,eAAO,MAAM,4BAA4B,WAC/B,gBAAgB,UAChB,MAAM,EAAE,kBACA,MAAM,KACrB,MAAM,EAQR,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAC3B,gBAAgB,UAChB,MAAM,EAAE,gBACF,MAAM,KACnB,MAUF,CAAC"}
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/helpers/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,8BAA8B,CAAC;AAEvF,eAAO,MAAM,4BAA4B,WAC/B,gBAAgB,UAChB,MAAM,EAAE,kBACA,MAAM,KACrB,MAAM,EAQR,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAC3B,gBAAgB,UAChB,MAAM,EAAE,gBACF,MAAM,KACnB,MAUF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,YAAa,OAAO,KAAG,OAG5C,CAAC"}
|
package/dist/helpers/options.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRequiredOptionMessage = exports.getOptionsFromRequiredGroups = void 0;
|
|
3
|
+
exports.getListElementValue = exports.getRequiredOptionMessage = exports.getOptionsFromRequiredGroups = void 0;
|
|
4
4
|
var getOptionsFromRequiredGroups = function (schema, groups, currentOption) {
|
|
5
5
|
return Object.keys(schema)
|
|
6
6
|
.filter(function (option) {
|
|
@@ -22,4 +22,28 @@ var getRequiredOptionMessage = function (schema, groups, currentField) {
|
|
|
22
22
|
return "This field or ".concat(requiredOptions, " is required");
|
|
23
23
|
};
|
|
24
24
|
exports.getRequiredOptionMessage = getRequiredOptionMessage;
|
|
25
|
+
/**
|
|
26
|
+
* The value of one element of a list field.
|
|
27
|
+
*
|
|
28
|
+
* A list element arrives in either of two shapes, and both are legitimate. The
|
|
29
|
+
* editor keeps each element in a `{value, type}` envelope while the form is
|
|
30
|
+
* being worked on — that is what `formatToServerValue` writes — while a value
|
|
31
|
+
* read back from storage holds what the server contract asks for, which for a
|
|
32
|
+
* list of strings is the bare strings.
|
|
33
|
+
*
|
|
34
|
+
* Reaching straight for `.value` answered `undefined` for every stored element.
|
|
35
|
+
* On a read that emptied the row; on a validation pass it failed the element as
|
|
36
|
+
* empty; and on an autosaving form the emptiness was then written back over the
|
|
37
|
+
* stored value. One helper so the readers cannot disagree about which shape
|
|
38
|
+
* they are looking at.
|
|
39
|
+
*
|
|
40
|
+
* An array is never an envelope — a rich-text document is itself an array, and
|
|
41
|
+
* `'value' in []` is false anyway, but saying so keeps the intent legible.
|
|
42
|
+
*/
|
|
43
|
+
var getListElementValue = function (element) {
|
|
44
|
+
return element && typeof element === 'object' && !Array.isArray(element) && 'value' in element ?
|
|
45
|
+
element.value
|
|
46
|
+
: element;
|
|
47
|
+
};
|
|
48
|
+
exports.getListElementValue = getListElementValue;
|
|
25
49
|
//# sourceMappingURL=options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/helpers/options.ts"],"names":[],"mappings":";;;AAEO,IAAM,4BAA4B,GAAG,UAC1C,MAAwB,EACxB,MAAgB,EAChB,aAAsB;IAEtB,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SACvB,MAAM,CAAC,UAAC,MAAM;;QACb,OAAO,MAAC,MAAM,CAAC,MAAM,CAA2B,CAAC,eAAe,0CAAE,IAAI,CAAC,UAAC,KAAK;YAC3E,OAAA,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAtB,CAAsB,CACvB,CAAC;IACJ,CAAC,CAAC;SACD,MAAM,CAAC,UAAC,MAAM,IAAK,OAAA,MAAM,KAAK,aAAa,EAAxB,CAAwB,CAAC,CAAC;AAClD,CAAC,CAAC;AAZW,QAAA,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AA4B,EAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC;SAC/E,GAAG,CAAC,UAAC,MAAM,IAAK,OAAC,MAAM,CAAC,MAAM,CAA2B,CAAC,YAAY,EAAtD,CAAsD,CAAC;SACvE,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,OAAO,wBAAiB,eAAe,iBAAc,CAAC;AACxD,CAAC,CAAC;AAdW,QAAA,wBAAwB,4BAcnC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACI,IAAM,mBAAmB,GAAG,UAAC,OAAgB;IAClD,OAAA,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,OAAO,CAAC,CAAC;QACtF,OAA8B,CAAC,KAAK;QACvC,CAAC,CAAC,OAAO;AAFT,CAES,CAAC;AAHC,QAAA,mBAAmB,uBAGpB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TQorusForm } from '@qoretechnologies/ts-toolkit';
|
|
2
|
+
export type TRecordType = 'search' | 'search-single' | 'create' | 'update' | 'delete';
|
|
3
|
+
export type TRealRecordType = 'read' | 'create' | 'update' | 'delete';
|
|
4
|
+
export type TProviderTypeSupports = {
|
|
5
|
+
[key in `supports_${TRealRecordType}`]?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type TProviderTypeArgs = {
|
|
8
|
+
[key in `${TRecordType}_args`]?: TQorusForm | TQorusForm[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A data-provider selection, in the shape the form holds it.
|
|
12
|
+
*
|
|
13
|
+
* The `supports_*` flags say which record operations the selected provider can
|
|
14
|
+
* perform; validation reads them to decide whether a provider is a legitimate
|
|
15
|
+
* target for the operation the field was configured for.
|
|
16
|
+
*/
|
|
17
|
+
export interface IProviderType extends TProviderTypeSupports, TProviderTypeArgs {
|
|
18
|
+
type: string;
|
|
19
|
+
name: string;
|
|
20
|
+
path?: string;
|
|
21
|
+
options?: TQorusForm;
|
|
22
|
+
subtype?: 'request' | 'response';
|
|
23
|
+
hasApiContext?: boolean;
|
|
24
|
+
optionsChanged?: boolean;
|
|
25
|
+
searchOptionsChanged?: boolean;
|
|
26
|
+
desc?: string;
|
|
27
|
+
use_args?: boolean;
|
|
28
|
+
args?: any;
|
|
29
|
+
up?: boolean;
|
|
30
|
+
supports_request?: boolean;
|
|
31
|
+
supports_messages?: 'ASYNC' | 'SYNC' | 'NONE';
|
|
32
|
+
supports_observable?: boolean;
|
|
33
|
+
transaction_management?: boolean;
|
|
34
|
+
record_requires_search_options?: boolean;
|
|
35
|
+
create_args_freeform?: TQorusForm[];
|
|
36
|
+
is_api_call?: boolean;
|
|
37
|
+
search_options?: TQorusForm;
|
|
38
|
+
descriptions?: string[];
|
|
39
|
+
message_id?: string;
|
|
40
|
+
message?: {
|
|
41
|
+
type: string;
|
|
42
|
+
value: any;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A provider value as an object, from either representation a caller may hold.
|
|
47
|
+
*
|
|
48
|
+
* A provider reaches the form either already expanded into `IProviderType`, or
|
|
49
|
+
* as the flat path string the server stores — `"factory/db{driver=pgsql}/table"`
|
|
50
|
+
* or the plain `"type/name/path"`. Returns `null` for anything that is neither,
|
|
51
|
+
* so a caller reports an invalid value rather than reading fields off nothing.
|
|
52
|
+
*/
|
|
53
|
+
export declare const maybeBuildOptionProvider: (provider: unknown) => IProviderType | null;
|
|
54
|
+
/**
|
|
55
|
+
* An FSM variable action — which variable, and what is done to it.
|
|
56
|
+
*
|
|
57
|
+
* The provider half is `Partial<IProviderType>` because the action's own
|
|
58
|
+
* `action_type` decides which provider fields have to be there; validation
|
|
59
|
+
* re-runs the matching provider validator over the merged value rather than
|
|
60
|
+
* duplicating those rules here.
|
|
61
|
+
*/
|
|
62
|
+
export type TVariableActionValue = {
|
|
63
|
+
var_type: 'globalvar' | 'localvar' | 'autovar';
|
|
64
|
+
var_name: string;
|
|
65
|
+
transaction_action?: 'commit' | 'rollback' | 'begin-transaction';
|
|
66
|
+
action_type?: 'search' | 'search-single' | 'update' | 'create' | 'delete' | 'transaction' | 'send-message' | 'apicall';
|
|
67
|
+
} & Partial<IProviderType>;
|
|
68
|
+
//# sourceMappingURL=providerValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerValue.d.ts","sourceRoot":"","sources":["../../src/helpers/providerValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACtF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG;KACjC,GAAG,IAAI,YAAY,eAAe,EAAE,CAAC,CAAC,EAAE,OAAO;CACjD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;KAC7B,GAAG,IAAI,GAAG,WAAW,OAAO,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE;CAC3D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,aAAc,SAAQ,qBAAqB,EAAE,iBAAiB;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAC9C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,GAAG,CAAC;KACZ,CAAC;CACH;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,aAAc,OAAO,KAAG,aAAa,GAAG,IA4C5E,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,mBAAmB,CAAC;IACjE,WAAW,CAAC,EACR,QAAQ,GACR,eAAe,GACf,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,cAAc,GACd,SAAS,CAAC;CACf,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maybeBuildOptionProvider = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A provider value as an object, from either representation a caller may hold.
|
|
6
|
+
*
|
|
7
|
+
* A provider reaches the form either already expanded into `IProviderType`, or
|
|
8
|
+
* as the flat path string the server stores — `"factory/db{driver=pgsql}/table"`
|
|
9
|
+
* or the plain `"type/name/path"`. Returns `null` for anything that is neither,
|
|
10
|
+
* so a caller reports an invalid value rather than reading fields off nothing.
|
|
11
|
+
*/
|
|
12
|
+
var maybeBuildOptionProvider = function (provider) {
|
|
13
|
+
if (!provider) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if (typeof provider === 'object') {
|
|
17
|
+
return provider;
|
|
18
|
+
}
|
|
19
|
+
if (typeof provider !== 'string') {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (provider.startsWith('factory')) {
|
|
23
|
+
var fixedProvider = provider.endsWith('/') ? provider : "".concat(provider, "/");
|
|
24
|
+
var factoryType = fixedProvider.split('/')[0];
|
|
25
|
+
var factoryName = fixedProvider.substring(fixedProvider.indexOf('/') + 1, fixedProvider.lastIndexOf('{'));
|
|
26
|
+
var options = fixedProvider.substring(fixedProvider.indexOf('{') + 1, fixedProvider.lastIndexOf('}'));
|
|
27
|
+
var optionsObject = options
|
|
28
|
+
.split(',')
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.reduce(function (result, option) {
|
|
31
|
+
var _a = option.split('='), key = _a[0], value = _a[1];
|
|
32
|
+
result[key] = value;
|
|
33
|
+
return result;
|
|
34
|
+
}, {});
|
|
35
|
+
var result = {
|
|
36
|
+
type: factoryType,
|
|
37
|
+
name: factoryName,
|
|
38
|
+
path: fixedProvider.substring(fixedProvider.lastIndexOf('}/') + 2),
|
|
39
|
+
options: optionsObject,
|
|
40
|
+
};
|
|
41
|
+
if (provider.includes('?options_changed')) {
|
|
42
|
+
result.optionsChanged = true;
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
var _a = provider.split('/'), type = _a[0], name = _a[1], path = _a.slice(2);
|
|
47
|
+
return { type: type, name: name, path: path.join('/') };
|
|
48
|
+
};
|
|
49
|
+
exports.maybeBuildOptionProvider = maybeBuildOptionProvider;
|
|
50
|
+
//# sourceMappingURL=providerValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerValue.js","sourceRoot":"","sources":["../../src/helpers/providerValue.ts"],"names":[],"mappings":";;;AAiDA;;;;;;;GAOG;AACI,IAAM,wBAAwB,GAAG,UAAC,QAAiB;IACxD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAyB,CAAC;IACnC,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACnC,IAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAG,QAAQ,MAAG,CAAC;QAClE,IAAA,WAAW,GAAI,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,GAA5B,CAA6B;QAC/C,IAAM,WAAW,GAAG,aAAa,CAAC,SAAS,CACzC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAC9B,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAC/B,CAAC;QACF,IAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CACrC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAC9B,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAC/B,CAAC;QACF,IAAM,aAAa,GAAG,OAAO;aAC1B,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,OAAO,CAAC;aACf,MAAM,CAAyB,UAAC,MAAM,EAAE,MAAM;YACvC,IAAA,KAAe,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAA/B,GAAG,QAAA,EAAE,KAAK,QAAqB,CAAC;YACvC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,OAAO,MAAM,CAAC;QAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,IAAM,MAAM,GAAkB;YAC5B,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,OAAO,EAAE,aAAsC;SAChD,CAAC;QACF,IAAI,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;QAC/B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEK,IAAA,KAAwB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAA1C,IAAI,QAAA,EAAE,IAAI,QAAA,EAAK,IAAI,cAAuB,CAAC;IAClD,OAAO,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9C,CAAC,CAAC;AA5CW,QAAA,wBAAwB,4BA4CnC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which string field types hold one line, and how to keep them that way.
|
|
3
|
+
*
|
|
4
|
+
* The server already draws this distinction and the IDE was throwing it away:
|
|
5
|
+
* a service's `name` is declared `ui_type: "string"` while its `description` is
|
|
6
|
+
* `ui_type: "long-string"` with `markdown: True` (see `ServiceMetadata.qc`).
|
|
7
|
+
* Every one of them — plus `email`, `uuid`, `hostname`, `ipv4`, `ipv6` and
|
|
8
|
+
* `phone` — rendered through the same growing textarea, so a technical name, a
|
|
9
|
+
* version and an IP address all accepted Enter.
|
|
10
|
+
*
|
|
11
|
+
* That is not a cosmetic problem. These values become YAML keys, class names,
|
|
12
|
+
* URLs and identifiers; a newline in one of them is invalid input that the form
|
|
13
|
+
* happily accepted and passed on, and the operator had no way to see it.
|
|
14
|
+
*
|
|
15
|
+
* The rule is the server's own contract, stated once here rather than guessed
|
|
16
|
+
* per field, and it is enforced in `LongString.tsx`.
|
|
17
|
+
*
|
|
18
|
+
* It lives in reqraft rather than in a consumer because the consumer is not the
|
|
19
|
+
* only renderer: qorus-ide fixed this in its OWN long-string field, and every
|
|
20
|
+
* form that goes through FormEngine — which is where an alert rule's Internal
|
|
21
|
+
* Name, Name and Short Description are — reaches THIS one instead. The fix was
|
|
22
|
+
* real and the field in front of the operator still took Enter.
|
|
23
|
+
*/
|
|
24
|
+
/** True when a string field of this type holds a single line. */
|
|
25
|
+
export declare const isSingleLineStringType: (type?: string) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Flattens any line break to a single space.
|
|
28
|
+
*
|
|
29
|
+
* A space rather than nothing, because the newline is usually where a word
|
|
30
|
+
* boundary was — pasting two lines into a name should read as two words, not
|
|
31
|
+
* one run-together one. CR, LF and CRLF all collapse to one space, and the
|
|
32
|
+
* result is trimmed of leading/trailing whitespace the break introduced.
|
|
33
|
+
*/
|
|
34
|
+
export declare const flattenToSingleLine: (value: string) => string;
|
|
35
|
+
/** True when the value carries a line break this field should not hold. */
|
|
36
|
+
export declare const hasLineBreak: (value: string) => boolean;
|
|
37
|
+
//# sourceMappingURL=singleLineString.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleLineString.d.ts","sourceRoot":"","sources":["../../src/helpers/singleLineString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAsBH,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,OACT,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,MACM,CAAC;AAE3D,2EAA2E;AAC3E,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAA8B,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Which string field types hold one line, and how to keep them that way.
|
|
4
|
+
*
|
|
5
|
+
* The server already draws this distinction and the IDE was throwing it away:
|
|
6
|
+
* a service's `name` is declared `ui_type: "string"` while its `description` is
|
|
7
|
+
* `ui_type: "long-string"` with `markdown: True` (see `ServiceMetadata.qc`).
|
|
8
|
+
* Every one of them — plus `email`, `uuid`, `hostname`, `ipv4`, `ipv6` and
|
|
9
|
+
* `phone` — rendered through the same growing textarea, so a technical name, a
|
|
10
|
+
* version and an IP address all accepted Enter.
|
|
11
|
+
*
|
|
12
|
+
* That is not a cosmetic problem. These values become YAML keys, class names,
|
|
13
|
+
* URLs and identifiers; a newline in one of them is invalid input that the form
|
|
14
|
+
* happily accepted and passed on, and the operator had no way to see it.
|
|
15
|
+
*
|
|
16
|
+
* The rule is the server's own contract, stated once here rather than guessed
|
|
17
|
+
* per field, and it is enforced in `LongString.tsx`.
|
|
18
|
+
*
|
|
19
|
+
* It lives in reqraft rather than in a consumer because the consumer is not the
|
|
20
|
+
* only renderer: qorus-ide fixed this in its OWN long-string field, and every
|
|
21
|
+
* form that goes through FormEngine — which is where an alert rule's Internal
|
|
22
|
+
* Name, Name and Short Description are — reaches THIS one instead. The fix was
|
|
23
|
+
* real and the field in front of the operator still took Enter.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.hasLineBreak = exports.flattenToSingleLine = exports.isSingleLineStringType = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* The string types that hold exactly one line — the ones routed to a textarea
|
|
29
|
+
* today.
|
|
30
|
+
*
|
|
31
|
+
* Listed explicitly rather than derived by excluding the document types,
|
|
32
|
+
* because the two directions fail very differently. Missing a single-line type
|
|
33
|
+
* here leaves it behaving as it does now — no worse. Wrongly treating a new
|
|
34
|
+
* DOCUMENT type as single-line would flatten a user's text as they typed it,
|
|
35
|
+
* which is data loss. So an unrecognised type stays multi-line.
|
|
36
|
+
*/
|
|
37
|
+
var SINGLE_LINE_STRING_TYPES = new Set([
|
|
38
|
+
'string',
|
|
39
|
+
'email',
|
|
40
|
+
'uuid',
|
|
41
|
+
'hostname',
|
|
42
|
+
'ipv4',
|
|
43
|
+
'ipv6',
|
|
44
|
+
'phone',
|
|
45
|
+
]);
|
|
46
|
+
/** True when a string field of this type holds a single line. */
|
|
47
|
+
var isSingleLineStringType = function (type) {
|
|
48
|
+
return !!type && SINGLE_LINE_STRING_TYPES.has(type);
|
|
49
|
+
};
|
|
50
|
+
exports.isSingleLineStringType = isSingleLineStringType;
|
|
51
|
+
/**
|
|
52
|
+
* Flattens any line break to a single space.
|
|
53
|
+
*
|
|
54
|
+
* A space rather than nothing, because the newline is usually where a word
|
|
55
|
+
* boundary was — pasting two lines into a name should read as two words, not
|
|
56
|
+
* one run-together one. CR, LF and CRLF all collapse to one space, and the
|
|
57
|
+
* result is trimmed of leading/trailing whitespace the break introduced.
|
|
58
|
+
*/
|
|
59
|
+
var flattenToSingleLine = function (value) {
|
|
60
|
+
return value.replace(/\r\n|\r|\n/g, ' ').replace(/ {2,}/g, ' ');
|
|
61
|
+
};
|
|
62
|
+
exports.flattenToSingleLine = flattenToSingleLine;
|
|
63
|
+
/** True when the value carries a line break this field should not hold. */
|
|
64
|
+
var hasLineBreak = function (value) { return /\r|\n/.test(value); };
|
|
65
|
+
exports.hasLineBreak = hasLineBreak;
|
|
66
|
+
//# sourceMappingURL=singleLineString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleLineString.js","sourceRoot":"","sources":["../../src/helpers/singleLineString.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH;;;;;;;;;GASG;AACH,IAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACvC,QAAQ;IACR,OAAO;IACP,MAAM;IACN,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAEH,iEAAiE;AAC1D,IAAM,sBAAsB,GAAG,UAAC,IAAa;IAClD,OAAA,CAAC,CAAC,IAAI,IAAI,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC;AAA5C,CAA4C,CAAC;AADlC,QAAA,sBAAsB,0BACY;AAE/C;;;;;;;GAOG;AACI,IAAM,mBAAmB,GAAG,UAAC,KAAa;IAC/C,OAAA,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;AAAxD,CAAwD,CAAC;AAD9C,QAAA,mBAAmB,uBAC2B;AAE3D,2EAA2E;AACpE,IAAM,YAAY,GAAG,UAAC,KAAa,IAAc,OAAA,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAnB,CAAmB,CAAC;AAA/D,QAAA,YAAY,gBAAmD"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { IReqoreFormTemplates } from '@qoretechnologies/reqore/dist/components/Textarea';
|
|
2
2
|
import { TReqoreDropdownItem } from '@qoretechnologies/reqore/dist/components/Dropdown/list';
|
|
3
|
+
/**
|
|
4
|
+
* The DOM ceiling for a serialized example value in a picker item — a
|
|
5
|
+
* binary-carrying field's example (e.g. an email attachment body) can be an
|
|
6
|
+
* entire base64 file, and it must not enter the item wholesale. The VISUAL
|
|
7
|
+
* truncation is not this number: past the ceiling the item also gets a
|
|
8
|
+
* single-line-ellipsis description (`descriptionEffect.noWrap`), which cuts at
|
|
9
|
+
* the popover's ACTUAL rendered width — container-intrinsic, no breakpoints —
|
|
10
|
+
* paired with the "?" action that shows the full value.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TEMPLATE_EXAMPLE_PREVIEW_LENGTH = 150;
|
|
3
13
|
/**
|
|
4
14
|
* Shared template string utilities.
|
|
5
15
|
* Used by both validations and TemplateField.
|
|
@@ -15,7 +25,97 @@ export declare const getTemplateTagStyle: (meta?: TTemplateMeta) => {
|
|
|
15
25
|
export declare const isValueTemplate: (value: string) => boolean;
|
|
16
26
|
export declare const getTemplateKey: (value: string) => string;
|
|
17
27
|
export declare const getTemplateValue: (value: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* The canonical template-token grammar (twin of the IDE's
|
|
30
|
+
* `helpers/templateValue.ts` — keep the two in step). A token is
|
|
31
|
+
* `$<key>:<segment>(:<segment>)*` where the key may carry dashes
|
|
32
|
+
* (`-expr`) and every segment is either a plain word or a braced
|
|
33
|
+
* context reference — `{W2n….filename}` — whose content may hold dots,
|
|
34
|
+
* colons, spaces and dashes (`:{deep:test:list}`,
|
|
35
|
+
* `{id.Created by.name}`). `isValueTemplate` above stays deliberately
|
|
36
|
+
* LOOSER (starts with `$`, has `:`): it answers "does the user mean a
|
|
37
|
+
* template here" while typing; use the strict check below when a decision
|
|
38
|
+
* must not misfire on user-typed dollar-strings.
|
|
39
|
+
*/
|
|
40
|
+
export declare const TEMPLATE_TOKEN_SOURCE = "\\$[A-Za-z_][\\w-]*(?::(?:\\{[^}]*\\}|[A-Za-z_][\\w-]*))+";
|
|
41
|
+
/** STRICT whole-value check: the entire string is one well-formed template
|
|
42
|
+
* token (`:{id.path}`, `:item`, …) — nothing before or after.
|
|
43
|
+
* `'$foo: hello'` passes the loose check but not this one. */
|
|
44
|
+
export declare const isCompleteTemplateToken: (value?: unknown) => value is string;
|
|
45
|
+
/** A complete token carrying at least one BRACED context segment —
|
|
46
|
+
* `$data:{W2n….filename}`, `$qore-expr:{1 + 2}`. These are machine-written
|
|
47
|
+
* references nobody types by hand, so a surface may render them as a picker
|
|
48
|
+
* chip. Plain word-path tokens (`$local:id`) stay typeable and belong in the
|
|
49
|
+
* template-offering input (build #123 review). Word segments cannot contain
|
|
50
|
+
* `{`, so `:{` inside a complete token always starts a braced segment. */
|
|
51
|
+
export declare const isBracedTemplateToken: (value?: unknown) => value is string;
|
|
52
|
+
/**
|
|
53
|
+
* The longest catalogue item whose path is a PREFIX of `value`, plus the part
|
|
54
|
+
* of the path it does not cover.
|
|
55
|
+
*
|
|
56
|
+
* A catalogue can only offer what the action's output type declares, so it
|
|
57
|
+
* stops at a list: `choices` is offered, `choices[0].message.content` is not —
|
|
58
|
+
* an operator hand-extends the path past the named field. Such a value has no
|
|
59
|
+
* item to match and used to render as its own raw token. Naming it by its
|
|
60
|
+
* nearest ancestor (`Choices[0].message.content`) keeps the chip readable
|
|
61
|
+
* without inventing a catalogue entry that does not exist.
|
|
62
|
+
*
|
|
63
|
+
* The match must break at a path boundary (`.` or `[`) so `choicesOther` is
|
|
64
|
+
* never named after `choices`, and the token keys must agree so a `$config:`
|
|
65
|
+
* item never names a `$data:` value.
|
|
66
|
+
*/
|
|
67
|
+
export declare const findTemplateByPath: (templates: IReqoreFormTemplates, value: string) => {
|
|
68
|
+
item: TReqoreDropdownItem;
|
|
69
|
+
remainder: string;
|
|
70
|
+
} | undefined;
|
|
18
71
|
export declare const findTemplate: (templates: IReqoreFormTemplates, value: string) => TReqoreDropdownItem | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The one answer to "what is this reference called?", so a value reads the
|
|
74
|
+
* same in the picker chip, the read-only tag and the compact row's summary.
|
|
75
|
+
* Exact match first (aliases included), then the nearest catalogue ancestor
|
|
76
|
+
* for a hand-extended path, and finally the raw token — which is honest when
|
|
77
|
+
* the catalogue holds nothing that explains the value.
|
|
78
|
+
*/
|
|
79
|
+
export declare const resolveTemplateLabel: (templates: IReqoreFormTemplates | undefined, value: string) => {
|
|
80
|
+
label: string;
|
|
81
|
+
item?: TReqoreDropdownItem;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* What to call a reference when the catalogue explains nothing about it — the
|
|
85
|
+
* reference's own path, with the token wrapper stripped:
|
|
86
|
+
* `$data:{dc_ai_reply.choices[0].message.content}` reads as
|
|
87
|
+
* `dc_ai_reply.choices[0].message.content`.
|
|
88
|
+
*
|
|
89
|
+
* Surfaces exist with no catalogue at all (the Automation Hub template preview
|
|
90
|
+
* never fetches one), and there the raw token is the only thing left to show.
|
|
91
|
+
* Showing it as `$data:{…}` renders a value as code; showing the path renders
|
|
92
|
+
* it as a name, which is the honest floor.
|
|
93
|
+
*/
|
|
94
|
+
export declare const getTemplateReferencePath: (value: string) => string;
|
|
95
|
+
/**
|
|
96
|
+
* The best available name for a reference, for a surface that must show
|
|
97
|
+
* something readable no matter what: the catalogue's name when it has one,
|
|
98
|
+
* otherwise the bare path. `resolveTemplateLabel` keeps falling back to the
|
|
99
|
+
* raw token, because a picker that cannot resolve a value should say exactly
|
|
100
|
+
* what the value is.
|
|
101
|
+
*/
|
|
102
|
+
export declare const describeTemplateReference: (templates: IReqoreFormTemplates | undefined, value: string) => {
|
|
103
|
+
label: string;
|
|
104
|
+
item?: TReqoreDropdownItem;
|
|
105
|
+
};
|
|
106
|
+
export type TTemplateTextSegment = {
|
|
107
|
+
kind: 'text';
|
|
108
|
+
text: string;
|
|
109
|
+
} | {
|
|
110
|
+
kind: 'token';
|
|
111
|
+
text: string;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Splits prose that embeds template tokens into its literal and token parts —
|
|
115
|
+
* `trim("$data:{…}")` becomes `trim("`, the token, `")`. Used to chip the
|
|
116
|
+
* references inside a rendered expression instead of printing them raw.
|
|
117
|
+
*/
|
|
118
|
+
export declare const splitTemplateTokens: (text?: string) => TTemplateTextSegment[];
|
|
19
119
|
export declare const filterTemplatesByType: (templates?: IReqoreFormTemplates, fieldType?: string, hasArgSchema?: boolean) => IReqoreFormTemplates;
|
|
20
120
|
interface ITemplateItemPayload {
|
|
21
121
|
display_name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/helpers/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/helpers/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,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