@contentstack/studio-internal 1.5.0 → 1.7.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/dist/constants/condition.d.ts +46 -0
- package/dist/constants/condition.d.ts.map +1 -1
- package/dist/constants/condition.js +41 -1
- package/dist/constants/condition.js.map +1 -1
- package/dist/index.d.ts +245 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/node.d.ts +18 -6
- package/dist/interfaces/node.d.ts.map +1 -1
- package/dist/interfaces/node.js +31 -2
- package/dist/interfaces/node.js.map +1 -1
- package/dist/types/condition-types.d.ts +56 -2
- package/dist/types/condition-types.d.ts.map +1 -1
- package/dist/utils/condition-hint.d.ts +126 -0
- package/dist/utils/condition-hint.d.ts.map +1 -0
- package/dist/utils/condition-hint.js +352 -0
- package/dist/utils/condition-hint.js.map +1 -0
- package/package.json +3 -4
- package/LICENSE +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../../src/interfaces/node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"node.js","sources":["../../src/interfaces/node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AA2OO,MAAM,IAAI,GAAkB;AACjC,IAAA,SAAS,CACP,IAAU,EACV,IAAU,EACV,UAAgC,EAAE,EAAA;QAElC,MAAM,SAAS,GAAe,EAAE;AAChC,QAAA,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;AAC7C,YAAA,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnC;AACA,QAAA,OAAO,SAAS;IAClB,CAAC;AAED,IAAA,MAAM,CAAC,IAAY,EAAA;AACjB,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE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_OPERATOR } from "../constants/condition";
|
|
2
|
+
import { ARRAY_OPERATORS, TEXT_OPERATORS, MODULAR_BLOCK_OPERATORS, COMPARISON_OPERATORS, BOOLEAN_OPERATORS, SINGLE_SELECT_OPERATORS, MULTI_SELECT_OPERATORS, REFERENCE_OPERATORS, IMAGE_EXTENSION_OPERATOR, EXISTENCE_OPERATORS, EMPTINESS_OPERATORS } from "../constants/condition";
|
|
3
3
|
export type ComparisonOperator = (typeof COMPARISON_OPERATORS)[number]["value"];
|
|
4
4
|
export type StringOperator = (typeof TEXT_OPERATORS)[number]["value"];
|
|
5
5
|
export type ImageExtensionOperator = (typeof IMAGE_EXTENSION_OPERATOR)[number]["value"];
|
|
@@ -10,9 +10,36 @@ export type SingleSelectOperator = (typeof SINGLE_SELECT_OPERATORS)[number]["val
|
|
|
10
10
|
export type MultiSelectOperator = (typeof MULTI_SELECT_OPERATORS)[number]["value"];
|
|
11
11
|
export type SelectOperator = SingleSelectOperator | MultiSelectOperator;
|
|
12
12
|
export type ReferenceOperator = (typeof REFERENCE_OPERATORS)[number]["value"];
|
|
13
|
+
export type ExistenceOperator = (typeof EXISTENCE_OPERATORS)[number]["value"];
|
|
14
|
+
export type EmptinessOperator = (typeof EMPTINESS_OPERATORS)[number]["value"];
|
|
15
|
+
/**
|
|
16
|
+
* The facet of a subject a condition asks about, when it asks about a facet at
|
|
17
|
+
* all — a list's length, a reference's content type, an asset's extension.
|
|
18
|
+
*
|
|
19
|
+
* Lives here beside `Condition` rather than with the derivation helpers because
|
|
20
|
+
* it is now PERSISTED: `subType` below is read by `evaluateCondition`, so it is
|
|
21
|
+
* part of the evaluation contract, not a display concern.
|
|
22
|
+
*/
|
|
23
|
+
export type ConditionSubType = "image_extension" | "image_size" | "ref_content_type" | "block_name" | "length" | "select_options" | "presence";
|
|
13
24
|
export type ConditionBindings = {
|
|
14
25
|
conditionBinding: BindingType;
|
|
15
26
|
dataBinding: BindingType;
|
|
27
|
+
/**
|
|
28
|
+
* The sub-type the author actually chose, recorded so evaluation never has to
|
|
29
|
+
* infer it.
|
|
30
|
+
*
|
|
31
|
+
* `eq` is shared between an identity check and a length comparison, and the
|
|
32
|
+
* field's data type is not stored either, so `Length == 3` and
|
|
33
|
+
* `Block Name == block_1` are otherwise the same shape. Without this, the two
|
|
34
|
+
* are indistinguishable and evaluation has to guess.
|
|
35
|
+
*
|
|
36
|
+
* Optional, and absent on every condition saved before this — and on anything
|
|
37
|
+
* the CLI or the compositions API writes. Evaluation MUST therefore treat its
|
|
38
|
+
* absence as "behave exactly as before": re-interpreting an old condition
|
|
39
|
+
* would change published pages with no edit or publish event, which is the
|
|
40
|
+
* failure ADR 0014 exists to prevent.
|
|
41
|
+
*/
|
|
42
|
+
subType?: ConditionSubType;
|
|
16
43
|
};
|
|
17
44
|
export type NumberCondition = {
|
|
18
45
|
type: "number";
|
|
@@ -66,5 +93,32 @@ export type ImageSizeCondition = {
|
|
|
66
93
|
value: number;
|
|
67
94
|
} & ConditionBindings;
|
|
68
95
|
export type ImageCondition = ImageSizeCondition | ImageExtensionCondition;
|
|
69
|
-
|
|
96
|
+
/**
|
|
97
|
+
* The subject types a presence check (existence or emptiness) can be authored
|
|
98
|
+
* against. Mirrors the `type` of every other condition so a subject keeps
|
|
99
|
+
* describing what it IS even when the operator ignores its value — plus
|
|
100
|
+
* `"file"`, which exists only here because an asset has no comparable value of
|
|
101
|
+
* its own (every other file condition is expressed through a sub-type:
|
|
102
|
+
* `image_extension` / `image_size`).
|
|
103
|
+
*/
|
|
104
|
+
export type PresenceConditionType = "string" | "number" | "boolean" | "date" | "select" | "array" | "reference" | "modular_block" | "file";
|
|
105
|
+
/** @deprecated Use {@link PresenceConditionType}. */
|
|
106
|
+
export type ExistenceConditionType = PresenceConditionType;
|
|
107
|
+
/**
|
|
108
|
+
* A presence check carries no value — the operator asks only about the bound
|
|
109
|
+
* key (existence) or about whether its value is empty. Both apply to every
|
|
110
|
+
* subject type, which is why they share one shape.
|
|
111
|
+
*
|
|
112
|
+
* `value` is required-but-null rather than optional: making it optional widens
|
|
113
|
+
* `Condition["value"]` with `undefined` for every consumer that reads a value
|
|
114
|
+
* off an unnarrowed condition.
|
|
115
|
+
*/
|
|
116
|
+
export type PresenceCondition = {
|
|
117
|
+
type: PresenceConditionType;
|
|
118
|
+
operator: ExistenceOperator | EmptinessOperator;
|
|
119
|
+
value: null;
|
|
120
|
+
} & ConditionBindings;
|
|
121
|
+
/** @deprecated Use {@link PresenceCondition}. */
|
|
122
|
+
export type ExistenceCondition = PresenceCondition;
|
|
123
|
+
export type Condition = NumberCondition | StringCondition | BooleanCondition | ArrayCondition | ModularBlockCondition | DateCondition | SelectCondition | ReferenceCondition | ImageCondition | PresenceCondition;
|
|
70
124
|
//# sourceMappingURL=condition-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-types.d.ts","sourceRoot":"","sources":["../../src/types/condition-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"condition-types.d.ts","sourceRoot":"","sources":["../../src/types/condition-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OA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B,GAAG;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,iBAAiB,CAAC;AAEtB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,iBAAiB,CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,iBAAiB,CAAC;AAEtB,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,GACP,WAAW,GACX,eAAe,GACf,MAAM,CAAC;AAEX,qDAAqD;AACrD,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;IAChD,KAAK,EAAE,IAAI,CAAC;CACb,GAAG,iBAAiB,CAAC;AAEtB,iDAAiD;AACjD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEnD,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { BindingType } from "../interfaces";
|
|
2
|
+
import type { Condition, ConditionSubType } from "../types/condition-types";
|
|
3
|
+
/**
|
|
4
|
+
* Turn a stored uid into something readable: `alpha_hero_centered` →
|
|
5
|
+
* "Alpha Hero Centered".
|
|
6
|
+
*
|
|
7
|
+
* Only ever applied to a **uid** — a block or content-type key the author named
|
|
8
|
+
* themselves in the CT builder. NEVER to a literal condition value: a literal is
|
|
9
|
+
* compared against real data, so prettifying `sale_ends` into "Sale Ends" would
|
|
10
|
+
* misstate what the condition actually matches.
|
|
11
|
+
*
|
|
12
|
+
* It is a guess even for a uid — Contentstack derives the uid from the name at
|
|
13
|
+
* creation and then locks it while the display name stays editable, so the two
|
|
14
|
+
* drift. A stored name (see {@link ConditionDisplay}) is always preferred; this
|
|
15
|
+
* is the floor for conditions that carry none.
|
|
16
|
+
*/
|
|
17
|
+
export declare function uidToDisplayName(uid: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Display names stamped on a condition block when its condition is authored,
|
|
20
|
+
* held on the node as `metadata.conditionDisplay`.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately kept OUT of `metadata.condition`: that object is the evaluation
|
|
23
|
+
* contract `evaluateCondition` consumes, and mixing presentation into it invites
|
|
24
|
+
* logic to key off a display string. Equally deliberately, only the two
|
|
25
|
+
* **uid-shaped** parts are stored — the field name and the block / content-type
|
|
26
|
+
* title. The operator and a literal value are derivable from the node, and
|
|
27
|
+
* storing a whole rendered sentence would freeze the grammar: later corrections
|
|
28
|
+
* would reach only conditions authored after them, and the label could fall out
|
|
29
|
+
* of step with the operator on its own node.
|
|
30
|
+
*/
|
|
31
|
+
export interface ConditionDisplay {
|
|
32
|
+
/** The condition subject's display name, e.g. `hero_sections` → "Hero Sections". */
|
|
33
|
+
subject?: string;
|
|
34
|
+
/** A block's or referenced content type's title, e.g. `alpha_hero` → "Hero — Alpha". */
|
|
35
|
+
value?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The short description of a condition block, used to tell one apart from its
|
|
39
|
+
* siblings. Rendered in the Layers row and in the block's drop well.
|
|
40
|
+
*
|
|
41
|
+
* `null` and `unsupported` are deliberately distinct. `null` means the block
|
|
42
|
+
* carries no condition at all — the surface should say so. `unsupported` means a
|
|
43
|
+
* condition IS configured but cannot be described; a surface must NOT then claim
|
|
44
|
+
* "no condition configured", which would be a plain lie about a configured block.
|
|
45
|
+
*/
|
|
46
|
+
export type ConditionHint = {
|
|
47
|
+
kind: "info";
|
|
48
|
+
prefix: string;
|
|
49
|
+
value: string;
|
|
50
|
+
rawValue: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "unsupported";
|
|
53
|
+
};
|
|
54
|
+
export type { ConditionSubType };
|
|
55
|
+
/**
|
|
56
|
+
* Derive the condition's sub-type from the condition alone — no schema.
|
|
57
|
+
*
|
|
58
|
+
* Ported from Studio's `conditionSubTypeConfig` so the Layers row and the canvas
|
|
59
|
+
* drop well cannot disagree with the Settings tab about what a condition is.
|
|
60
|
+
*
|
|
61
|
+
* Note `length` is used as the **catch-all else-branch** for `select`,
|
|
62
|
+
* `reference` and `modular_block`, not as a claim that the condition is about
|
|
63
|
+
* length. {@link subTypeLabel} guards against rendering it as one.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getConditionSubType(condition: Condition): ConditionSubType | null;
|
|
66
|
+
/**
|
|
67
|
+
* The field path a binding points at, as stored — `title`, `hero.file_size`,
|
|
68
|
+
* `hero_sections`. Exported so a Repeater's `items` binding and a condition's own
|
|
69
|
+
* binding are read by the same code: a condition block's subject can come from
|
|
70
|
+
* either, and the two must not disagree.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getBindingFieldPath(binding?: BindingType): string | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The field path a condition is evaluated against, as stored. Not de-uid-ified:
|
|
75
|
+
* this is a key, and prettifying a key produces something that reads as a display
|
|
76
|
+
* name and silently contradicts the real one whenever the two have drifted.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getConditionSubject(condition: Condition): string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* True when the condition's subject has collapsed into its own value and so
|
|
81
|
+
* identifies nothing.
|
|
82
|
+
*
|
|
83
|
+
* `useAddCondition` (and `createConditionBlockNode` on the auto path) rewrite a
|
|
84
|
+
* **repeater-scoped** identity binding's `path` to the condition value itself.
|
|
85
|
+
* The binding then points at the branch rather than at the field, so rendering
|
|
86
|
+
* subject + operator + value would read `block_1 == block_1`, or
|
|
87
|
+
* `_content_type_uid == author` where the subject just restates the operator.
|
|
88
|
+
*
|
|
89
|
+
* Value-only is also what the author needs there for an independent reason: every
|
|
90
|
+
* sibling branch inside one repeater is on the same field, so naming that field
|
|
91
|
+
* would distinguish nothing and would only cost width.
|
|
92
|
+
*
|
|
93
|
+
* NOT every identity condition is degenerate. A blocks-field condition bound
|
|
94
|
+
* through a template binding (only the repeater data source is `isNestedContext`,
|
|
95
|
+
* so only it triggers the rewrite) keeps a real subject and reads
|
|
96
|
+
* `hero_sections.Block Name == Alpha Hero Centered`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function isDegenerateSubject(condition: Condition): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Build the condition hint from the node's condition.
|
|
101
|
+
*
|
|
102
|
+
* The subject is taken from the first source that has one:
|
|
103
|
+
*
|
|
104
|
+
* 1. `display.subject` — a name stamped when the condition was authored
|
|
105
|
+
* 2. `selected_field` on the condition's own binding — set for section-scoped
|
|
106
|
+
* conditions, whose Repeater binds with an empty path
|
|
107
|
+
* 3. `fallback.subject` — a name the caller derived from context, which is how a
|
|
108
|
+
* collapsed page-scoped subject is recovered: the block's parent Repeater
|
|
109
|
+
* still names the field even though the condition's binding no longer does
|
|
110
|
+
* 4. the condition's own binding — unless that has collapsed into the value
|
|
111
|
+
*
|
|
112
|
+
* With a subject: When <subject>[.<SubType>] <op> <value>
|
|
113
|
+
* Without one: When <value>
|
|
114
|
+
*
|
|
115
|
+
* A collapsed subject is therefore no longer *dropped*, only *unavailable* — which
|
|
116
|
+
* it stops being as soon as a caller can name it. That is what lets the Layers row
|
|
117
|
+
* and the drop well read the same condition the Settings tab does, whose own
|
|
118
|
+
* resolver walks to the Repeater for exactly this reason.
|
|
119
|
+
*
|
|
120
|
+
* Returns `unsupported` when nothing describable is left — an array or object
|
|
121
|
+
* value, or a non-presence condition with no value and no subject.
|
|
122
|
+
*/
|
|
123
|
+
export declare function getConditionHint(condition?: Condition | null, display?: ConditionDisplay, fallback?: {
|
|
124
|
+
subject?: string;
|
|
125
|
+
}): ConditionHint | null;
|
|
126
|
+
//# sourceMappingURL=condition-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition-hint.d.ts","sourceRoot":"","sources":["../../src/utils/condition-hint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAwD5B,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,GACnB,gBAAgB,GAAG,IAAI,CAgCzB;AAwED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAa7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAI5E;AAyBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAMjE;AA4CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,EAC5B,OAAO,CAAC,EAAE,gBAAgB,EAC1B,QAAQ,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,aAAa,GAAG,IAAI,CAuCtB"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { CONDITION_OPERATORS } from '../constants/condition.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Turn a stored uid into something readable: `alpha_hero_centered` →
|
|
5
|
+
* "Alpha Hero Centered".
|
|
6
|
+
*
|
|
7
|
+
* Only ever applied to a **uid** — a block or content-type key the author named
|
|
8
|
+
* themselves in the CT builder. NEVER to a literal condition value: a literal is
|
|
9
|
+
* compared against real data, so prettifying `sale_ends` into "Sale Ends" would
|
|
10
|
+
* misstate what the condition actually matches.
|
|
11
|
+
*
|
|
12
|
+
* It is a guess even for a uid — Contentstack derives the uid from the name at
|
|
13
|
+
* creation and then locks it while the display name stays editable, so the two
|
|
14
|
+
* drift. A stored name (see {@link ConditionDisplay}) is always preferred; this
|
|
15
|
+
* is the floor for conditions that carry none.
|
|
16
|
+
*/
|
|
17
|
+
function uidToDisplayName(uid) {
|
|
18
|
+
return uid.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
19
|
+
}
|
|
20
|
+
/** A reference condition binds against this key rather than against a field. */
|
|
21
|
+
const CONTENT_TYPE_UID_KEY = "_content_type_uid";
|
|
22
|
+
const values = (list) => new Set(list.map((o) => o.value));
|
|
23
|
+
const PRESENCE_OPERATORS = values([
|
|
24
|
+
...CONDITION_OPERATORS.EXISTENCE_OPERATORS,
|
|
25
|
+
...CONDITION_OPERATORS.EMPTINESS_OPERATORS,
|
|
26
|
+
]);
|
|
27
|
+
/** Operators whose own symbol already reads "length …", so a Length label would double up. */
|
|
28
|
+
const ARRAY_OPERATORS = values(CONDITION_OPERATORS.ARRAY_OPERATORS);
|
|
29
|
+
const REF_CONTENT_TYPE_OPERATORS = new Set(["eq", "contentTypeIs"]);
|
|
30
|
+
const BLOCK_NAME_OPERATORS = new Set(["eq", "is"]);
|
|
31
|
+
const SELECT_OPTIONS_OPERATORS = new Set(["includes", "excludes"]);
|
|
32
|
+
/** Every operator, flattened, for symbol / label lookup by stored value. */
|
|
33
|
+
const OPERATOR_BY_VALUE = {};
|
|
34
|
+
for (const list of Object.values(CONDITION_OPERATORS)) {
|
|
35
|
+
for (const op of list) {
|
|
36
|
+
if (!OPERATOR_BY_VALUE[op.value]) {
|
|
37
|
+
OPERATOR_BY_VALUE[op.value] = { label: op.label, symbol: op.symbol };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether a condition's value is a number — including a numeric **string**.
|
|
43
|
+
*
|
|
44
|
+
* The string case is not defensive padding: `convertValueByDataType` only coerces
|
|
45
|
+
* for `boolean` and `number` FIELD data types, so a length check on a `blocks` or
|
|
46
|
+
* `reference` field persists `"3"` rather than `3`, even though its input is
|
|
47
|
+
* `type="number"`.
|
|
48
|
+
*
|
|
49
|
+
* This is the only signal separating a length check from an identity check.
|
|
50
|
+
* Neither the sub-type nor the field's data type is stored on the condition, so
|
|
51
|
+
* `Length == 3` and `Block Name == block_1` are otherwise identical:
|
|
52
|
+
* `{ type: "modular_block", operator: "eq" }`.
|
|
53
|
+
*/
|
|
54
|
+
function isNumericValue(value) {
|
|
55
|
+
if (typeof value === "number")
|
|
56
|
+
return Number.isFinite(value);
|
|
57
|
+
if (typeof value !== "string")
|
|
58
|
+
return false;
|
|
59
|
+
const trimmed = value.trim();
|
|
60
|
+
return trimmed !== "" && Number.isFinite(Number(trimmed));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Derive the condition's sub-type from the condition alone — no schema.
|
|
64
|
+
*
|
|
65
|
+
* Ported from Studio's `conditionSubTypeConfig` so the Layers row and the canvas
|
|
66
|
+
* drop well cannot disagree with the Settings tab about what a condition is.
|
|
67
|
+
*
|
|
68
|
+
* Note `length` is used as the **catch-all else-branch** for `select`,
|
|
69
|
+
* `reference` and `modular_block`, not as a claim that the condition is about
|
|
70
|
+
* length. {@link subTypeLabel} guards against rendering it as one.
|
|
71
|
+
*/
|
|
72
|
+
function getConditionSubType(condition) {
|
|
73
|
+
// Prefer what the author actually chose. Everything below is inference for
|
|
74
|
+
// conditions that predate `subType` — and for anything the CLI or the
|
|
75
|
+
// compositions API writes, which never records it. Guessing when the answer is
|
|
76
|
+
// on the node would keep the known-wrong cases wrong: a numeric block uid
|
|
77
|
+
// reading as a length check, and the `select` catch-all arm.
|
|
78
|
+
if (condition.subType)
|
|
79
|
+
return condition.subType;
|
|
80
|
+
const { type, operator } = condition;
|
|
81
|
+
// Presence is derived from the OPERATOR: a presence check persists the
|
|
82
|
+
// subject's own type, so a type-first derivation would miss it.
|
|
83
|
+
if (PRESENCE_OPERATORS.has(operator))
|
|
84
|
+
return "presence";
|
|
85
|
+
if (type === "image_extension")
|
|
86
|
+
return "image_extension";
|
|
87
|
+
if (type === "image_size")
|
|
88
|
+
return "image_size";
|
|
89
|
+
if (type === "array")
|
|
90
|
+
return "length";
|
|
91
|
+
if (type === "select")
|
|
92
|
+
return SELECT_OPTIONS_OPERATORS.has(operator) ? "select_options" : "length";
|
|
93
|
+
// `eq` is shared between an identity check and a length comparison, and the
|
|
94
|
+
// sub-type is not persisted — so an author who picked Length and typed 3 saved
|
|
95
|
+
// exactly what Block Name would have. Only the value tells them apart.
|
|
96
|
+
const numeric = isNumericValue(condition.value);
|
|
97
|
+
if (type === "reference") {
|
|
98
|
+
return REF_CONTENT_TYPE_OPERATORS.has(operator) && !numeric
|
|
99
|
+
? "ref_content_type"
|
|
100
|
+
: "length";
|
|
101
|
+
}
|
|
102
|
+
if (type === "modular_block") {
|
|
103
|
+
return BLOCK_NAME_OPERATORS.has(operator) && !numeric
|
|
104
|
+
? "block_name"
|
|
105
|
+
: "length";
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const SUB_TYPE_LABELS = {
|
|
110
|
+
block_name: "Block Name",
|
|
111
|
+
ref_content_type: "Content Type",
|
|
112
|
+
length: "Length",
|
|
113
|
+
image_size: "Size",
|
|
114
|
+
image_extension: "Extension",
|
|
115
|
+
select_options: "Selection",
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* The sub-type label to append to the subject, or `undefined` when the operator
|
|
119
|
+
* already implies it and appending would be noise or a contradiction.
|
|
120
|
+
*
|
|
121
|
+
* Skipped for:
|
|
122
|
+
* - `presence` — the operator says "exists" / "is empty"; "Hero.Presence Exists"
|
|
123
|
+
* reads as a doubling.
|
|
124
|
+
* - `select_options` — `includes` / `excludes` already say the subject is a set.
|
|
125
|
+
* - `length` with an ARRAY operator — its symbol is already `length >`.
|
|
126
|
+
* - `length` on any type other than `array` — there it is the catch-all arm, so a
|
|
127
|
+
* single-select `eq` would otherwise render `colors.Length == red`.
|
|
128
|
+
*/
|
|
129
|
+
function subTypeLabel(condition) {
|
|
130
|
+
const subType = getConditionSubType(condition);
|
|
131
|
+
if (!subType)
|
|
132
|
+
return undefined;
|
|
133
|
+
if (subType === "presence" || subType === "select_options")
|
|
134
|
+
return undefined;
|
|
135
|
+
if (subType === "length") {
|
|
136
|
+
// The operator's own symbol already reads "length >".
|
|
137
|
+
if (ARRAY_OPERATORS.has(condition.operator))
|
|
138
|
+
return undefined;
|
|
139
|
+
// A recorded sub-type is a fact, not a guess: trust it and skip the value
|
|
140
|
+
// test below. Suppressing the label here while the evaluator honours
|
|
141
|
+
// `subType === "length"` would put the two back out of step.
|
|
142
|
+
if (condition.subType === "length")
|
|
143
|
+
return SUB_TYPE_LABELS[subType];
|
|
144
|
+
// `length` is the catch-all else-branch of the `select` / `reference` /
|
|
145
|
+
// `modular_block` arms, so it is not by itself a claim about length. A length
|
|
146
|
+
// comparison is numeric — that is the signal. Without this, a single-select
|
|
147
|
+
// equality would render `colors.Length == "red"`.
|
|
148
|
+
if (!isNumericValue(condition.value))
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
return SUB_TYPE_LABELS[subType];
|
|
152
|
+
}
|
|
153
|
+
/** How the operator reads: its symbol where it has one, else its label lowercased. */
|
|
154
|
+
function operatorLabel(operator) {
|
|
155
|
+
const op = OPERATOR_BY_VALUE[operator];
|
|
156
|
+
if (!op)
|
|
157
|
+
return operator;
|
|
158
|
+
// Raw labels are title-cased for menu items ("Starts with", "Is Not"), which
|
|
159
|
+
// reads as a proper noun mid-string. Symbols stay as-is.
|
|
160
|
+
return op.symbol ?? op.label.toLowerCase();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Flatten a Contentstack-shaped binding path into dot notation:
|
|
164
|
+
* `{ hero: { file_size: {} } }` → `"hero.file_size"`.
|
|
165
|
+
*
|
|
166
|
+
* Reimplemented here rather than imported: `studio-registry` and `studio-client`
|
|
167
|
+
* each hold their own copy, but both sit downstream of this package, and this
|
|
168
|
+
* module must stay importable by a leaf. `BindingType` is defined here, so the
|
|
169
|
+
* walk arguably belongs here and the other two copies should collapse onto it —
|
|
170
|
+
* out of scope for this change.
|
|
171
|
+
*/
|
|
172
|
+
function flattenBindingPath(path) {
|
|
173
|
+
if (!path || typeof path !== "object")
|
|
174
|
+
return "";
|
|
175
|
+
const keys = Object.keys(path);
|
|
176
|
+
if (keys.length === 0)
|
|
177
|
+
return "";
|
|
178
|
+
const key = keys[0];
|
|
179
|
+
const rest = flattenBindingPath(path[key]);
|
|
180
|
+
return rest ? `${key}.${rest}` : key;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The field path a binding points at, as stored — `title`, `hero.file_size`,
|
|
184
|
+
* `hero_sections`. Exported so a Repeater's `items` binding and a condition's own
|
|
185
|
+
* binding are read by the same code: a condition block's subject can come from
|
|
186
|
+
* either, and the two must not disagree.
|
|
187
|
+
*/
|
|
188
|
+
function getBindingFieldPath(binding) {
|
|
189
|
+
if (!binding || typeof binding !== "object")
|
|
190
|
+
return undefined;
|
|
191
|
+
const value = binding.value;
|
|
192
|
+
// `component_props` and `static_value` bindings carry a plain string rather
|
|
193
|
+
// than a `path` object; the key is the string itself.
|
|
194
|
+
if (typeof value === "string")
|
|
195
|
+
return value.split(".").pop() || undefined;
|
|
196
|
+
const path = flattenBindingPath(value?.path);
|
|
197
|
+
return path || undefined;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The field path a condition is evaluated against, as stored. Not de-uid-ified:
|
|
201
|
+
* this is a key, and prettifying a key produces something that reads as a display
|
|
202
|
+
* name and silently contradicts the real one whenever the two have drifted.
|
|
203
|
+
*/
|
|
204
|
+
function getConditionSubject(condition) {
|
|
205
|
+
return getBindingFieldPath(condition.conditionBinding);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The field a **section-scoped** condition is bound within, de-uid-ified.
|
|
209
|
+
*
|
|
210
|
+
* `createConditionBlockNode` records `selected_field` on the condition's binding
|
|
211
|
+
* for section compositions, because a section's Repeater binds with an empty
|
|
212
|
+
* `path` and the field lives on the composition's linked schema instead. That
|
|
213
|
+
* makes this the one way to name the subject of a collapsed section-scoped
|
|
214
|
+
* condition without reaching into Studio's store — so the canvas and the Layers
|
|
215
|
+
* row can derive the same name.
|
|
216
|
+
*
|
|
217
|
+
* De-uid-ified, matching the Repeater row that renders the same field as
|
|
218
|
+
* "Iterates Hero Sections"; showing it raw here would make the two rows disagree.
|
|
219
|
+
*/
|
|
220
|
+
function getSectionScopeFieldName(condition) {
|
|
221
|
+
const value = condition
|
|
222
|
+
.conditionBinding?.value;
|
|
223
|
+
const selected = value
|
|
224
|
+
?.selected_field;
|
|
225
|
+
if (typeof selected !== "string" || !selected.trim())
|
|
226
|
+
return undefined;
|
|
227
|
+
const last = selected.split(".").pop() || selected;
|
|
228
|
+
return uidToDisplayName(last);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* True when the condition's subject has collapsed into its own value and so
|
|
232
|
+
* identifies nothing.
|
|
233
|
+
*
|
|
234
|
+
* `useAddCondition` (and `createConditionBlockNode` on the auto path) rewrite a
|
|
235
|
+
* **repeater-scoped** identity binding's `path` to the condition value itself.
|
|
236
|
+
* The binding then points at the branch rather than at the field, so rendering
|
|
237
|
+
* subject + operator + value would read `block_1 == block_1`, or
|
|
238
|
+
* `_content_type_uid == author` where the subject just restates the operator.
|
|
239
|
+
*
|
|
240
|
+
* Value-only is also what the author needs there for an independent reason: every
|
|
241
|
+
* sibling branch inside one repeater is on the same field, so naming that field
|
|
242
|
+
* would distinguish nothing and would only cost width.
|
|
243
|
+
*
|
|
244
|
+
* NOT every identity condition is degenerate. A blocks-field condition bound
|
|
245
|
+
* through a template binding (only the repeater data source is `isNestedContext`,
|
|
246
|
+
* so only it triggers the rewrite) keeps a real subject and reads
|
|
247
|
+
* `hero_sections.Block Name == Alpha Hero Centered`.
|
|
248
|
+
*/
|
|
249
|
+
function isDegenerateSubject(condition) {
|
|
250
|
+
const subject = getConditionSubject(condition);
|
|
251
|
+
if (!subject)
|
|
252
|
+
return false;
|
|
253
|
+
return (subject === CONTENT_TYPE_UID_KEY || subject === String(condition.value));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* True when the condition's value is a **uid** rather than a literal — a block
|
|
257
|
+
* uid or a content-type uid — and is therefore safe to render as a display name.
|
|
258
|
+
*
|
|
259
|
+
* Deliberately independent of {@link isDegenerateSubject}. Those answer different
|
|
260
|
+
* questions: whether the *subject* is worth showing, and whether the *value* is a
|
|
261
|
+
* uid. Tying de-uid-ification to degeneracy meant a blocks condition bound
|
|
262
|
+
* through a template binding printed the raw `alpha_hero_centered` instead of its
|
|
263
|
+
* name.
|
|
264
|
+
*/
|
|
265
|
+
function hasUidValue(condition) {
|
|
266
|
+
return ((condition.type === "modular_block" || condition.type === "reference") &&
|
|
267
|
+
typeof condition.value === "string" &&
|
|
268
|
+
condition.value.length > 0);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* How the value reads. `undefined` means the value must not be rendered at all
|
|
272
|
+
* (a presence check carries none) — distinct from a value that cannot be
|
|
273
|
+
* described, which makes the whole hint `unsupported`.
|
|
274
|
+
*/
|
|
275
|
+
function valueLabel(condition, display) {
|
|
276
|
+
const { value } = condition;
|
|
277
|
+
if (PRESENCE_OPERATORS.has(condition.operator))
|
|
278
|
+
return undefined;
|
|
279
|
+
if (hasUidValue(condition)) {
|
|
280
|
+
return display?.value || uidToDisplayName(value);
|
|
281
|
+
}
|
|
282
|
+
// Quotes are the only delimiter left once the subject is a raw key and the
|
|
283
|
+
// operator a symbol, and multi-word values are ordinary. Numbers and booleans
|
|
284
|
+
// stay bare — quoting them would suggest a string comparison.
|
|
285
|
+
if (typeof value === "string")
|
|
286
|
+
return `"${value}"`;
|
|
287
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
288
|
+
return String(value);
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Build the condition hint from the node's condition.
|
|
293
|
+
*
|
|
294
|
+
* The subject is taken from the first source that has one:
|
|
295
|
+
*
|
|
296
|
+
* 1. `display.subject` — a name stamped when the condition was authored
|
|
297
|
+
* 2. `selected_field` on the condition's own binding — set for section-scoped
|
|
298
|
+
* conditions, whose Repeater binds with an empty path
|
|
299
|
+
* 3. `fallback.subject` — a name the caller derived from context, which is how a
|
|
300
|
+
* collapsed page-scoped subject is recovered: the block's parent Repeater
|
|
301
|
+
* still names the field even though the condition's binding no longer does
|
|
302
|
+
* 4. the condition's own binding — unless that has collapsed into the value
|
|
303
|
+
*
|
|
304
|
+
* With a subject: When <subject>[.<SubType>] <op> <value>
|
|
305
|
+
* Without one: When <value>
|
|
306
|
+
*
|
|
307
|
+
* A collapsed subject is therefore no longer *dropped*, only *unavailable* — which
|
|
308
|
+
* it stops being as soon as a caller can name it. That is what lets the Layers row
|
|
309
|
+
* and the drop well read the same condition the Settings tab does, whose own
|
|
310
|
+
* resolver walks to the Repeater for exactly this reason.
|
|
311
|
+
*
|
|
312
|
+
* Returns `unsupported` when nothing describable is left — an array or object
|
|
313
|
+
* value, or a non-presence condition with no value and no subject.
|
|
314
|
+
*/
|
|
315
|
+
function getConditionHint(condition, display, fallback) {
|
|
316
|
+
if (!condition)
|
|
317
|
+
return null;
|
|
318
|
+
const rawValue = String(condition.value ?? "");
|
|
319
|
+
const isPresence = PRESENCE_OPERATORS.has(condition.operator);
|
|
320
|
+
const ownSubject = isDegenerateSubject(condition)
|
|
321
|
+
? undefined
|
|
322
|
+
: getConditionSubject(condition);
|
|
323
|
+
const subject = display?.subject ||
|
|
324
|
+
getSectionScopeFieldName(condition) ||
|
|
325
|
+
fallback?.subject ||
|
|
326
|
+
ownSubject;
|
|
327
|
+
const value = valueLabel(condition, display);
|
|
328
|
+
// Nothing to say: no subject to name and no value to compare.
|
|
329
|
+
if (!subject && value === undefined)
|
|
330
|
+
return { kind: "unsupported" };
|
|
331
|
+
// A value we cannot describe (array / object), on a condition that should have
|
|
332
|
+
// one. Naming the subject and operator without it would read as truncated.
|
|
333
|
+
if (!isPresence && value === undefined)
|
|
334
|
+
return { kind: "unsupported" };
|
|
335
|
+
// With no subject there is nothing for the operator to relate the value to, so
|
|
336
|
+
// a dangling `== "Sale"` would read as truncated. Show the value alone — which
|
|
337
|
+
// is also the collapsed-subject reading when no caller could name the field.
|
|
338
|
+
const parts = subject
|
|
339
|
+
? [
|
|
340
|
+
[subject, subTypeLabel(condition)].filter(Boolean).join("."),
|
|
341
|
+
operatorLabel(condition.operator),
|
|
342
|
+
value,
|
|
343
|
+
]
|
|
344
|
+
: [value];
|
|
345
|
+
const text = parts
|
|
346
|
+
.filter((part) => part !== undefined && part !== "")
|
|
347
|
+
.join(" ");
|
|
348
|
+
return { kind: "info", prefix: "When", value: text, rawValue };
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { getBindingFieldPath, getConditionHint, getConditionSubType, getConditionSubject, isDegenerateSubject, uidToDisplayName };
|
|
352
|
+
//# sourceMappingURL=condition-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition-hint.js","sources":["../../src/utils/condition-hint.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;AAaG;AACG,SAAU,gBAAgB,CAAC,GAAW,EAAA;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACxE;AAmCA;AACA,MAAM,oBAAoB,GAAG,mBAAmB;AAEhD,MAAM,MAAM,GAAG,CAAC,IAAkC,KAChD,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AAEnC,MAAM,kBAAkB,GAAG,MAAM,CAAC;IAChC,GAAG,mBAAmB,CAAC,mBAAmB;IAC1C,GAAG,mBAAmB,CAAC,mBAAmB;AAC3C,CAAA,CAAC;AACF;AACA,MAAM,eAAe,GAAG,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC;AACnE,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AACnE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAClD,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE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,KAAK,GAAG;AACZ,UAAE;AACE,YAAA,CAAC,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAC5D,YAAA,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC;YACjC,KAAK;AACN;AACH,UAAE,CAAC,KAAK,CAAC;IAEX,MAAM,IAAI,GAAG;AACV,SAAA,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;SAClD,IAAI,CAAC,GAAG,CAAC;AAEZ,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/studio-internal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "This is core package which is a flavour of slate js and consist of all editor functionality",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"homepage": "https://github.com/contentstack/composable-studio-sdk/tree/main/packages/studio-internal#readme",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"uuid": "^11.1.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@contentstack/common-config": "^1.2.
|
|
42
|
+
"@contentstack/common-config": "^1.2.4",
|
|
43
43
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
44
44
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
45
45
|
"@rollup/plugin-terser": "^1.0.0",
|
|
@@ -50,6 +50,5 @@
|
|
|
50
50
|
"rollup-plugin-dts": "^6.2.1",
|
|
51
51
|
"rollup-plugin-node-externals": "^8.0.1",
|
|
52
52
|
"rollup-plugin-preserve-directives": "^0.4.0"
|
|
53
|
-
}
|
|
54
|
-
"gitHead": "0a4e62965622cd47c743978ebdcda4f74515fc6e"
|
|
53
|
+
}
|
|
55
54
|
}
|