@webiny/website-builder-sdk 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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/BindingsApi.d.ts +4 -4
- package/BindingsApi.js +3 -3
- package/BindingsApi.js.map +1 -1
- package/BindingsProcessor.d.ts +1 -1
- package/BindingsProcessor.js.map +1 -1
- package/BindingsProcessor.test.js +2 -1
- package/BindingsProcessor.test.js.map +1 -1
- package/BindingsResolver.d.ts +2 -2
- package/BindingsResolver.js +3 -6
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +4 -3
- package/BindingsResolver.test.js.map +1 -1
- package/ComponentInputTraverser.d.ts +1 -1
- package/ComponentInputTraverser.js.map +1 -1
- package/ComponentManifestToAstConverter.d.ts +1 -1
- package/ComponentManifestToAstConverter.js.map +1 -1
- package/ComponentRegistry.js +30 -0
- package/ComponentRegistry.js.map +1 -1
- package/ComponentResolver.d.ts +2 -2
- package/ComponentResolver.js +3 -3
- package/ComponentResolver.js.map +1 -1
- package/ConstraintEvaluator.d.ts +36 -0
- package/ConstraintEvaluator.js +395 -0
- package/ConstraintEvaluator.js.map +1 -0
- package/ConstraintEvaluator.test.d.ts +1 -0
- package/ConstraintEvaluator.test.js +1456 -0
- package/ConstraintEvaluator.test.js.map +1 -0
- package/ContentSdk.d.ts +13 -7
- package/ContentSdk.js +26 -10
- package/ContentSdk.js.map +1 -1
- package/DocumentStore.d.ts +3 -3
- package/DocumentStore.js +1 -1
- package/DocumentStore.js.map +1 -1
- package/DocumentStoreManager.d.ts +2 -2
- package/DocumentStoreManager.js +1 -1
- package/DocumentStoreManager.js.map +1 -1
- package/EditingSdk.d.ts +4 -4
- package/EditingSdk.js +12 -15
- package/EditingSdk.js.map +1 -1
- package/ElementFactory.d.ts +5 -6
- package/ElementFactory.js +25 -16
- package/ElementFactory.js.map +1 -1
- package/ElementFactory.test.d.ts +1 -0
- package/ElementFactory.test.js +280 -0
- package/ElementFactory.test.js.map +1 -0
- package/HashObject.js +14 -0
- package/HashObject.js.map +1 -1
- package/HotkeyManager.js +1 -1
- package/HotkeyManager.js.map +1 -1
- package/IBindingsUpdater.d.ts +2 -2
- package/IBindingsUpdater.js.map +1 -1
- package/IRedirects.d.ts +5 -0
- package/IRedirects.js +3 -0
- package/IRedirects.js.map +1 -0
- package/InheritanceProcessor.d.ts +4 -4
- package/InheritanceProcessor.js.map +1 -1
- package/InheritanceProcessor.test.js +2 -1
- package/InheritanceProcessor.test.js.map +1 -1
- package/InheritedValueResolver.d.ts +1 -1
- package/InheritedValueResolver.js.map +1 -1
- package/InputBindingsProcessor.d.ts +4 -4
- package/InputBindingsProcessor.js +29 -11
- package/InputBindingsProcessor.js.map +1 -1
- package/InputsBindingsProcessor.test.js +4 -2
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.d.ts +5 -5
- package/InputsUpdater.js +2 -2
- package/InputsUpdater.js.map +1 -1
- package/LiveSdk.d.ts +2 -2
- package/LiveSdk.js +1 -1
- package/LiveSdk.js.map +1 -1
- package/Logger.d.ts +2 -1
- package/Logger.js +7 -4
- package/Logger.js.map +1 -1
- package/NullSdk.d.ts +5 -3
- package/NullSdk.js +10 -0
- package/NullSdk.js.map +1 -1
- package/PreviewDocument.js +1 -1
- package/PreviewDocument.js.map +1 -1
- package/PreviewSdk.d.ts +2 -2
- package/PreviewSdk.js +3 -3
- package/PreviewSdk.js.map +1 -1
- package/PreviewViewport.d.ts +1 -2
- package/PreviewViewport.js +1 -21
- package/PreviewViewport.js.map +1 -1
- package/README.md +10 -2
- package/StylesBindingsProcessor.d.ts +2 -2
- package/StylesBindingsProcessor.js +4 -4
- package/StylesBindingsProcessor.js.map +1 -1
- package/StylesUpdater.d.ts +4 -4
- package/StylesUpdater.js +2 -2
- package/StylesUpdater.js.map +1 -1
- package/Theme.d.ts +1 -1
- package/Theme.js +6 -11
- package/Theme.js.map +1 -1
- package/ViewportManager.d.ts +3 -1
- package/ViewportManager.js +8 -1
- package/ViewportManager.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -1
- package/constants.js.map +1 -1
- package/createElement.d.ts +1 -1
- package/createElement.js.map +1 -1
- package/createInput.d.ts +124 -16
- package/createInput.js +33 -1
- package/createInput.js.map +1 -1
- package/createTheme.d.ts +2 -1
- package/createTheme.js.map +1 -1
- package/dataProviders/ApiClient.d.ts +6 -1
- package/dataProviders/ApiClient.js +19 -8
- package/dataProviders/ApiClient.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +4 -3
- package/dataProviders/DefaultDataProvider.js +32 -6
- package/dataProviders/DefaultDataProvider.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +2 -0
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.js +2 -0
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.js +15 -4
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
- package/dataProviders/NullDataProvider.d.ts +13 -4
- package/dataProviders/NullDataProvider.js +11 -1
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/dataProviders/RedirectsProvider.d.ts +11 -0
- package/dataProviders/RedirectsProvider.js +32 -0
- package/dataProviders/RedirectsProvider.js.map +1 -0
- package/defaultBreakpoints.d.ts +1 -1
- package/defaultBreakpoints.js.map +1 -1
- package/documentOperations/$addElementReferenceToParent.d.ts +1 -1
- package/documentOperations/$addElementReferenceToParent.js +9 -2
- package/documentOperations/$addElementReferenceToParent.js.map +1 -1
- package/documentOperations/AddElement.d.ts +1 -1
- package/documentOperations/AddElement.js.map +1 -1
- package/documentOperations/AddToParent.d.ts +3 -3
- package/documentOperations/AddToParent.js.map +1 -1
- package/documentOperations/RemoveElement.d.ts +1 -1
- package/documentOperations/RemoveElement.js +9 -0
- package/documentOperations/RemoveElement.js.map +1 -1
- package/documentOperations/SetGlobalInputBinding.d.ts +1 -1
- package/documentOperations/SetGlobalInputBinding.js.map +1 -1
- package/documentOperations/SetGlobalStyleBinding.d.ts +1 -1
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
- package/documentOperations/SetInputBindingOverride.d.ts +1 -1
- package/documentOperations/SetInputBindingOverride.js.map +1 -1
- package/documentOperations/SetStyleBindingOverride.d.ts +1 -1
- package/documentOperations/SetStyleBindingOverride.js.map +1 -1
- package/documentOperations/index.d.ts +8 -8
- package/documentOperations/index.js +7 -7
- package/documentOperations/index.js.map +1 -1
- package/findMatchingAstNode.d.ts +1 -1
- package/findMatchingAstNode.js.map +1 -1
- package/generateElementId.d.ts +1 -1
- package/generateElementId.js +0 -1
- package/generateElementId.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +2 -3
- package/index.js.map +1 -1
- package/jsonPatch.d.ts +1 -1
- package/messenger/Messenger.js +6 -6
- package/messenger/Messenger.js.map +1 -1
- package/package.json +14 -20
- package/registerComponentGroup.d.ts +1 -1
- package/registerComponentGroup.js +1 -1
- package/registerComponentGroup.js.map +1 -1
- package/types/WebsiteBuilderTheme.d.ts +52 -42
- package/types/WebsiteBuilderTheme.js.map +1 -1
- package/types.d.ts +207 -20
- package/types.js.map +1 -1
- package/lexical/createDefaultLexicalTheme.d.ts +0 -2
- package/lexical/createDefaultLexicalTheme.js +0 -84
- package/lexical/createDefaultLexicalTheme.js.map +0 -1
- package/lexical/createLexicalTheme.d.ts +0 -2
- package/lexical/createLexicalTheme.js +0 -7
- package/lexical/createLexicalTheme.js.map +0 -1
- package/lexical/deepMerge.d.ts +0 -1
- package/lexical/deepMerge.js +0 -23
- package/lexical/deepMerge.js.map +0 -1
- package/types/LexicalEditorTheme.d.ts +0 -2
- package/types/LexicalEditorTheme.js +0 -3
- package/types/LexicalEditorTheme.js.map +0 -1
package/createInput.d.ts
CHANGED
|
@@ -1,17 +1,125 @@
|
|
|
1
|
-
import type { TextInput, LongTextInput, NumberInput, BooleanInput, ColorInput, FileInput, LexicalInput, SelectInput, RadioInput, ObjectInput, DateTimeInput, ComponentInput, TagsInput, SlotInput } from "./types";
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import type { TextInput, LongTextInput, NumberInput, BooleanInput, ColorInput, FileInput, LexicalInput, SelectInput, RadioInput, ObjectInput, DateTimeInput, ComponentInput, TagsInput, SlotInput } from "./types.js";
|
|
2
|
+
export type InputFactory<Name extends string> = ReturnType<typeof createTextInput<Name>> | ReturnType<typeof createLongTextInput<Name>> | ReturnType<typeof createNumberInput<Name>> | ReturnType<typeof createBooleanInput<Name>> | ReturnType<typeof createColorInput<Name>> | ReturnType<typeof createFileInput<Name>> | ReturnType<typeof createDateInput<Name>> | ReturnType<typeof createLexicalInput<Name>> | ReturnType<typeof createSelectInput<Name>> | ReturnType<typeof createRadioInput<Name>> | ReturnType<typeof createObjectInput<Name>> | ReturnType<typeof createTagsInput<Name>> | ReturnType<typeof createSlotInput<Name>>;
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript Overload Resolution and Input Factory Design
|
|
5
|
+
*
|
|
6
|
+
* Each input factory (e.g., createTextInput) is defined with two TypeScript overload signatures:
|
|
7
|
+
* 1. One overload requires a `name` property in the input (used for array-based APIs, where inference is needed).
|
|
8
|
+
* 2. The other overload omits the `name` property (used for object-based APIs, where the key provides the name).
|
|
9
|
+
*
|
|
10
|
+
* TypeScript resolves overloads by scanning from top to bottom and picking the first matching signature.
|
|
11
|
+
* The implementation signature uses `any` for the argument, and the return type is unified to match all overloads.
|
|
12
|
+
*
|
|
13
|
+
* In array mode, the `name` must be explicitly provided in the input object, so inference for `TName` works.
|
|
14
|
+
* In object mode, the input does not require a `name` property; instead, the key in the object (e.g., `{ foo: createTextInput({ ... }) }`)
|
|
15
|
+
* provides the name via contextual typing from the consuming function (such as `createComponent`). TypeScript uses this context
|
|
16
|
+
* to resolve the correct type for `TName` even when `name` is omitted from the input.
|
|
17
|
+
*
|
|
18
|
+
* This pattern ensures that all returned input objects are typed as `{ name: TName }`, whether `name` is provided explicitly or inferred,
|
|
19
|
+
* so consumers of these factories do not need to worry about the presence of the `name` property in the result.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createTextInput<TName extends string>(input: {
|
|
22
|
+
name: TName;
|
|
23
|
+
} & Omit<TextInput, "type" | "name">): TextInput & {
|
|
24
|
+
name: TName;
|
|
25
|
+
};
|
|
26
|
+
export declare function createTextInput<TName extends string>(input: Omit<TextInput, "type" | "name">): TextInput & {
|
|
27
|
+
name: TName;
|
|
28
|
+
};
|
|
29
|
+
export declare function createLongTextInput<TName extends string>(input: {
|
|
30
|
+
name: TName;
|
|
31
|
+
} & Omit<LongTextInput, "type" | "name">): LongTextInput & {
|
|
32
|
+
name: TName;
|
|
33
|
+
};
|
|
34
|
+
export declare function createLongTextInput<TName extends string>(input: Omit<LongTextInput, "type" | "name">): LongTextInput & {
|
|
35
|
+
name: TName;
|
|
36
|
+
};
|
|
37
|
+
export declare function createNumberInput<TName extends string>(input: {
|
|
38
|
+
name: TName;
|
|
39
|
+
} & Omit<NumberInput, "type" | "name">): NumberInput & {
|
|
40
|
+
name: TName;
|
|
41
|
+
};
|
|
42
|
+
export declare function createNumberInput<TName extends string>(input: Omit<NumberInput, "type" | "name">): NumberInput & {
|
|
43
|
+
name: TName;
|
|
44
|
+
};
|
|
45
|
+
export declare function createBooleanInput<TName extends string>(input: {
|
|
46
|
+
name: TName;
|
|
47
|
+
} & Omit<BooleanInput, "type" | "name">): BooleanInput & {
|
|
48
|
+
name: TName;
|
|
49
|
+
};
|
|
50
|
+
export declare function createBooleanInput<TName extends string>(input: Omit<BooleanInput, "type" | "name">): BooleanInput & {
|
|
51
|
+
name: TName;
|
|
52
|
+
};
|
|
53
|
+
export declare function createColorInput<TName extends string>(input: {
|
|
54
|
+
name: TName;
|
|
55
|
+
} & Omit<ColorInput, "type" | "name">): ColorInput & {
|
|
56
|
+
name: TName;
|
|
57
|
+
};
|
|
58
|
+
export declare function createColorInput<TName extends string>(input: Omit<ColorInput, "type" | "name">): ColorInput & {
|
|
59
|
+
name: TName;
|
|
60
|
+
};
|
|
61
|
+
export declare function createFileInput<TName extends string>(input: {
|
|
62
|
+
name: TName;
|
|
63
|
+
} & Omit<FileInput, "type" | "name">): FileInput & {
|
|
64
|
+
name: TName;
|
|
65
|
+
};
|
|
66
|
+
export declare function createFileInput<TName extends string>(input: Omit<FileInput, "type" | "name">): FileInput & {
|
|
67
|
+
name: TName;
|
|
68
|
+
};
|
|
69
|
+
export declare function createDateInput<TName extends string>(input: {
|
|
70
|
+
name: TName;
|
|
71
|
+
} & Omit<DateTimeInput, "type" | "name">): DateTimeInput & {
|
|
72
|
+
name: TName;
|
|
73
|
+
};
|
|
74
|
+
export declare function createDateInput<TName extends string>(input: Omit<DateTimeInput, "type" | "name">): DateTimeInput & {
|
|
75
|
+
name: TName;
|
|
76
|
+
};
|
|
77
|
+
export declare function createLexicalInput<TName extends string>(input: {
|
|
78
|
+
name: TName;
|
|
79
|
+
} & Omit<LexicalInput, "type" | "name">): LexicalInput & {
|
|
80
|
+
name: TName;
|
|
81
|
+
};
|
|
82
|
+
export declare function createLexicalInput<TName extends string>(input: Omit<LexicalInput, "type" | "name">): LexicalInput & {
|
|
83
|
+
name: TName;
|
|
84
|
+
};
|
|
85
|
+
export declare function createSelectInput<TName extends string>(input: {
|
|
86
|
+
name: TName;
|
|
87
|
+
} & Omit<SelectInput, "type" | "name">): SelectInput & {
|
|
88
|
+
name: TName;
|
|
89
|
+
};
|
|
90
|
+
export declare function createSelectInput<TName extends string>(input: Omit<SelectInput, "type" | "name">): SelectInput & {
|
|
91
|
+
name: TName;
|
|
92
|
+
};
|
|
93
|
+
export declare function createRadioInput<TName extends string>(input: {
|
|
94
|
+
name: TName;
|
|
95
|
+
} & Omit<RadioInput, "type" | "name">): RadioInput & {
|
|
96
|
+
name: TName;
|
|
97
|
+
};
|
|
98
|
+
export declare function createRadioInput<TName extends string>(input: Omit<RadioInput, "type" | "name">): RadioInput & {
|
|
99
|
+
name: TName;
|
|
100
|
+
};
|
|
101
|
+
export declare function createObjectInput<TName extends string>(input: {
|
|
102
|
+
name: TName;
|
|
103
|
+
} & Omit<ObjectInput, "type" | "name">): ObjectInput & {
|
|
104
|
+
name: TName;
|
|
105
|
+
};
|
|
106
|
+
export declare function createObjectInput<TName extends string>(input: Omit<ObjectInput, "type" | "name">): ObjectInput & {
|
|
107
|
+
name: TName;
|
|
108
|
+
};
|
|
109
|
+
export declare function createTagsInput<TName extends string>(input: {
|
|
110
|
+
name: TName;
|
|
111
|
+
} & Omit<TagsInput, "type" | "name">): TagsInput & {
|
|
112
|
+
name: TName;
|
|
113
|
+
};
|
|
114
|
+
export declare function createTagsInput<TName extends string>(input: Omit<TagsInput, "type" | "name">): TagsInput & {
|
|
115
|
+
name: TName;
|
|
116
|
+
};
|
|
117
|
+
export declare function createSlotInput<TName extends string>(input: {
|
|
118
|
+
name: TName;
|
|
119
|
+
} & Omit<SlotInput, "type" | "name">): SlotInput & {
|
|
120
|
+
name: TName;
|
|
121
|
+
};
|
|
122
|
+
export declare function createSlotInput<TName extends string>(input: Omit<SlotInput, "type" | "name">): SlotInput & {
|
|
123
|
+
name: TName;
|
|
124
|
+
};
|
|
16
125
|
export declare function createInput(input: ComponentInput): ComponentInput;
|
|
17
|
-
export {};
|
package/createInput.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
import { functionConverter } from "./FunctionConverter";
|
|
1
|
+
import { functionConverter } from "./FunctionConverter.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript Overload Resolution and Input Factory Design
|
|
5
|
+
*
|
|
6
|
+
* Each input factory (e.g., createTextInput) is defined with two TypeScript overload signatures:
|
|
7
|
+
* 1. One overload requires a `name` property in the input (used for array-based APIs, where inference is needed).
|
|
8
|
+
* 2. The other overload omits the `name` property (used for object-based APIs, where the key provides the name).
|
|
9
|
+
*
|
|
10
|
+
* TypeScript resolves overloads by scanning from top to bottom and picking the first matching signature.
|
|
11
|
+
* The implementation signature uses `any` for the argument, and the return type is unified to match all overloads.
|
|
12
|
+
*
|
|
13
|
+
* In array mode, the `name` must be explicitly provided in the input object, so inference for `TName` works.
|
|
14
|
+
* In object mode, the input does not require a `name` property; instead, the key in the object (e.g., `{ foo: createTextInput({ ... }) }`)
|
|
15
|
+
* provides the name via contextual typing from the consuming function (such as `createComponent`). TypeScript uses this context
|
|
16
|
+
* to resolve the correct type for `TName` even when `name` is omitted from the input.
|
|
17
|
+
*
|
|
18
|
+
* This pattern ensures that all returned input objects are typed as `{ name: TName }`, whether `name` is provided explicitly or inferred,
|
|
19
|
+
* so consumers of these factories do not need to worry about the presence of the `name` property in the result.
|
|
20
|
+
*/
|
|
2
21
|
// Text
|
|
22
|
+
|
|
3
23
|
export function createTextInput(input) {
|
|
4
24
|
return createInput({
|
|
5
25
|
type: "text",
|
|
@@ -9,6 +29,7 @@ export function createTextInput(input) {
|
|
|
9
29
|
}
|
|
10
30
|
|
|
11
31
|
// Long Text
|
|
32
|
+
|
|
12
33
|
export function createLongTextInput(input) {
|
|
13
34
|
return createInput({
|
|
14
35
|
type: "longText",
|
|
@@ -18,6 +39,7 @@ export function createLongTextInput(input) {
|
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
// Number
|
|
42
|
+
|
|
21
43
|
export function createNumberInput(input) {
|
|
22
44
|
return createInput({
|
|
23
45
|
type: "number",
|
|
@@ -27,6 +49,7 @@ export function createNumberInput(input) {
|
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
// Boolean
|
|
52
|
+
|
|
30
53
|
export function createBooleanInput(input) {
|
|
31
54
|
return createInput({
|
|
32
55
|
type: "boolean",
|
|
@@ -36,6 +59,7 @@ export function createBooleanInput(input) {
|
|
|
36
59
|
}
|
|
37
60
|
|
|
38
61
|
// Color
|
|
62
|
+
|
|
39
63
|
export function createColorInput(input) {
|
|
40
64
|
return createInput({
|
|
41
65
|
type: "color",
|
|
@@ -45,6 +69,7 @@ export function createColorInput(input) {
|
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
// File
|
|
72
|
+
|
|
48
73
|
export function createFileInput(input) {
|
|
49
74
|
return createInput({
|
|
50
75
|
type: "file",
|
|
@@ -54,6 +79,7 @@ export function createFileInput(input) {
|
|
|
54
79
|
}
|
|
55
80
|
|
|
56
81
|
// Date
|
|
82
|
+
|
|
57
83
|
export function createDateInput(input) {
|
|
58
84
|
return createInput({
|
|
59
85
|
type: "datetime",
|
|
@@ -63,6 +89,7 @@ export function createDateInput(input) {
|
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
// Rich Text
|
|
92
|
+
|
|
66
93
|
export function createLexicalInput(input) {
|
|
67
94
|
return createInput({
|
|
68
95
|
type: "lexical",
|
|
@@ -72,6 +99,7 @@ export function createLexicalInput(input) {
|
|
|
72
99
|
}
|
|
73
100
|
|
|
74
101
|
// Select
|
|
102
|
+
|
|
75
103
|
export function createSelectInput(input) {
|
|
76
104
|
return createInput({
|
|
77
105
|
type: "select",
|
|
@@ -81,6 +109,7 @@ export function createSelectInput(input) {
|
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
// Radio
|
|
112
|
+
|
|
84
113
|
export function createRadioInput(input) {
|
|
85
114
|
return createInput({
|
|
86
115
|
type: "radio",
|
|
@@ -90,6 +119,7 @@ export function createRadioInput(input) {
|
|
|
90
119
|
}
|
|
91
120
|
|
|
92
121
|
// Object
|
|
122
|
+
|
|
93
123
|
export function createObjectInput(input) {
|
|
94
124
|
return createInput({
|
|
95
125
|
type: "object",
|
|
@@ -99,6 +129,7 @@ export function createObjectInput(input) {
|
|
|
99
129
|
}
|
|
100
130
|
|
|
101
131
|
// Tags
|
|
132
|
+
|
|
102
133
|
export function createTagsInput(input) {
|
|
103
134
|
return createInput({
|
|
104
135
|
type: "text",
|
|
@@ -112,6 +143,7 @@ export function createSlotInput(input) {
|
|
|
112
143
|
type: "slot",
|
|
113
144
|
list: true,
|
|
114
145
|
renderer: "Webiny/Slot",
|
|
146
|
+
defaultValue: [],
|
|
115
147
|
...input
|
|
116
148
|
});
|
|
117
149
|
}
|
package/createInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["functionConverter","createTextInput","input","createInput","type","renderer","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","list","createSlotInput","onChange","serialize"],"sources":["createInput.ts"],"sourcesContent":["import type {\n TextInput,\n LongTextInput,\n NumberInput,\n BooleanInput,\n ColorInput,\n FileInput,\n LexicalInput,\n SelectInput,\n RadioInput,\n ObjectInput,\n DateTimeInput,\n ComponentInput,\n TagsInput,\n SlotInput\n} from \"./types\";\nimport { functionConverter } from \"~/FunctionConverter\";\n\ntype OmitType<T> = Omit<T, \"type\">;\n\n// Text\nexport function createTextInput(input: OmitType<TextInput>) {\n return createInput({\n type: \"text\",\n renderer: \"Webiny/Input\",\n ...input\n }) as TextInput;\n}\n\n// Long Text\nexport function createLongTextInput(input: OmitType<LongTextInput>) {\n return createInput({\n type: \"longText\",\n renderer: \"Webiny/Textarea\",\n ...input\n });\n}\n\n// Number\nexport function createNumberInput(input: OmitType<NumberInput>) {\n return createInput({\n type: \"number\",\n renderer: \"Webiny/Number\",\n ...input\n }) as NumberInput;\n}\n\n// Boolean\nexport function createBooleanInput(input: OmitType<BooleanInput>) {\n return createInput({\n type: \"boolean\",\n renderer: \"Webiny/Switch\",\n ...input\n }) as BooleanInput;\n}\n\n// Color\nexport function createColorInput(input: OmitType<ColorInput>) {\n return createInput({\n type: \"color\",\n renderer: \"Webiny/ColorPicker\",\n ...input\n }) as ColorInput;\n}\n\n// File\nexport function createFileInput(input: OmitType<FileInput>) {\n return createInput({\n type: \"file\",\n renderer: \"Webiny/FileManager\",\n ...input\n }) as FileInput;\n}\n\n// Date\nexport function createDateInput(input: OmitType<DateTimeInput>) {\n return createInput({\n type: \"datetime\",\n renderer: \"Webiny/DateTime\",\n ...input\n }) as DateTimeInput;\n}\n\n// Rich Text\nexport function createLexicalInput(input: OmitType<LexicalInput>) {\n return createInput({\n type: \"lexical\",\n renderer: \"Webiny/Lexical\",\n ...input\n }) as LexicalInput;\n}\n\n// Select\nexport function createSelectInput(input: OmitType<SelectInput>) {\n return createInput({\n type: \"select\",\n renderer: \"Webiny/Select\",\n ...input\n }) as SelectInput;\n}\n\n// Radio\nexport function createRadioInput(input: OmitType<RadioInput>) {\n return createInput({\n type: \"radio\",\n renderer: \"Webiny/RadioGroup\",\n ...input\n }) as RadioInput;\n}\n\n// Object\nexport function createObjectInput(input: OmitType<ObjectInput>) {\n return createInput({\n type: \"object\",\n renderer: \"Webiny/Object\",\n ...input\n }) as ObjectInput;\n}\n\n// Tags\nexport function createTagsInput(input: OmitType<TagsInput>) {\n return createInput({\n type: \"text\",\n list: true,\n renderer: \"Webiny/Tags\",\n ...input\n }) as TagsInput;\n}\n\nexport function createSlotInput(input: OmitType<SlotInput>) {\n return createInput({\n type: \"slot\",\n list: true,\n renderer: \"Webiny/Slot\",\n ...input\n }) as SlotInput;\n}\n\n// Implementation\nexport function createInput(input: ComponentInput): ComponentInput {\n if (input.onChange) {\n // @ts-expect-error We don't use this function on the frontend, so this is ok.\n input.onChange = functionConverter.serialize(input.onChange!);\n }\n return input;\n}\n"],"mappings":"AAgBA,SAASA,iBAAiB;AAI1B;AACA,OAAO,SAASC,eAAeA,CAACC,KAA0B,EAAE;EACxD,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZC,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O,SAASW,iBAAiBA,CAACX,KAA4B,EAAE;EAC5D,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;AACA,OAAO,SAASY,gBAAgBA,CAACZ,KAA2B,EAAE;EAC1D,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE,mBAAmB;IAC7B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;AACA,OAAO,SAASa,iBAAiBA,CAACb,KAA4B,EAAE;EAC5D,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;AACA,OAAO,SAASc,eAAeA,CAACd,KAA0B,EAAE;EACxD,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZa,IAAI,EAAE,IAAI;IACVZ,QAAQ,EAAE,aAAa;IACvB,GAAGH;EACP,CAAC,CAAC;AACN;AAEA,OAAO,SAASgB,eAAeA,CAAChB,KAA0B,EAAE;EACxD,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZa,IAAI,EAAE,IAAI;IACVZ,QAAQ,EAAE,aAAa;IACvB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;AACA,OAAO,SAASC,WAAWA,CAACD,KAAqB,EAAkB;EAC/D,IAAIA,KAAK,CAACiB,QAAQ,EAAE;IAChB;IACAjB,KAAK,CAACiB,QAAQ,GAAGnB,iBAAiB,CAACoB,SAAS,CAAClB,KAAK,CAACiB,QAAS,CAAC;EACjE;EACA,OAAOjB,KAAK;AAChB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["functionConverter","createTextInput","input","createInput","type","renderer","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","list","createSlotInput","defaultValue","onChange","serialize"],"sources":["createInput.ts"],"sourcesContent":["import type {\n TextInput,\n LongTextInput,\n NumberInput,\n BooleanInput,\n ColorInput,\n FileInput,\n LexicalInput,\n SelectInput,\n RadioInput,\n ObjectInput,\n DateTimeInput,\n ComponentInput,\n TagsInput,\n SlotInput\n} from \"./types.js\";\nimport { functionConverter } from \"~/FunctionConverter.js\";\n\nexport type InputFactory<Name extends string> =\n | ReturnType<typeof createTextInput<Name>>\n | ReturnType<typeof createLongTextInput<Name>>\n | ReturnType<typeof createNumberInput<Name>>\n | ReturnType<typeof createBooleanInput<Name>>\n | ReturnType<typeof createColorInput<Name>>\n | ReturnType<typeof createFileInput<Name>>\n | ReturnType<typeof createDateInput<Name>>\n | ReturnType<typeof createLexicalInput<Name>>\n | ReturnType<typeof createSelectInput<Name>>\n | ReturnType<typeof createRadioInput<Name>>\n | ReturnType<typeof createObjectInput<Name>>\n | ReturnType<typeof createTagsInput<Name>>\n | ReturnType<typeof createSlotInput<Name>>;\n\n/**\n * TypeScript Overload Resolution and Input Factory Design\n *\n * Each input factory (e.g., createTextInput) is defined with two TypeScript overload signatures:\n * 1. One overload requires a `name` property in the input (used for array-based APIs, where inference is needed).\n * 2. The other overload omits the `name` property (used for object-based APIs, where the key provides the name).\n *\n * TypeScript resolves overloads by scanning from top to bottom and picking the first matching signature.\n * The implementation signature uses `any` for the argument, and the return type is unified to match all overloads.\n *\n * In array mode, the `name` must be explicitly provided in the input object, so inference for `TName` works.\n * In object mode, the input does not require a `name` property; instead, the key in the object (e.g., `{ foo: createTextInput({ ... }) }`)\n * provides the name via contextual typing from the consuming function (such as `createComponent`). TypeScript uses this context\n * to resolve the correct type for `TName` even when `name` is omitted from the input.\n *\n * This pattern ensures that all returned input objects are typed as `{ name: TName }`, whether `name` is provided explicitly or inferred,\n * so consumers of these factories do not need to worry about the presence of the `name` property in the result.\n */\n// Text\nexport function createTextInput<TName extends string>(\n input: { name: TName } & Omit<TextInput, \"type\" | \"name\">\n): TextInput & { name: TName };\nexport function createTextInput<TName extends string>(\n input: Omit<TextInput, \"type\" | \"name\">\n): TextInput & { name: TName };\nexport function createTextInput<TName extends string>(input: any): TextInput & { name: TName } {\n return createInput({\n type: \"text\",\n renderer: \"Webiny/Input\",\n ...input\n }) as TextInput & { name: TName };\n}\n\n// Long Text\nexport function createLongTextInput<TName extends string>(\n input: { name: TName } & Omit<LongTextInput, \"type\" | \"name\">\n): LongTextInput & { name: TName };\nexport function createLongTextInput<TName extends string>(\n input: Omit<LongTextInput, \"type\" | \"name\">\n): LongTextInput & { name: TName };\nexport function createLongTextInput<TName extends string>(\n input: any\n): LongTextInput & { name: TName } {\n return createInput({\n type: \"longText\",\n renderer: \"Webiny/Textarea\",\n ...input\n }) as LongTextInput & { name: TName };\n}\n\n// Number\nexport function createNumberInput<TName extends string>(\n input: { name: TName } & Omit<NumberInput, \"type\" | \"name\">\n): NumberInput & { name: TName };\nexport function createNumberInput<TName extends string>(\n input: Omit<NumberInput, \"type\" | \"name\">\n): NumberInput & { name: TName };\nexport function createNumberInput<TName extends string>(input: any): NumberInput & { name: TName } {\n return createInput({\n type: \"number\",\n renderer: \"Webiny/Number\",\n ...input\n }) as NumberInput & { name: TName };\n}\n\n// Boolean\nexport function createBooleanInput<TName extends string>(\n input: { name: TName } & Omit<BooleanInput, \"type\" | \"name\">\n): BooleanInput & { name: TName };\nexport function createBooleanInput<TName extends string>(\n input: Omit<BooleanInput, \"type\" | \"name\">\n): BooleanInput & { name: TName };\nexport function createBooleanInput<TName extends string>(\n input: any\n): BooleanInput & { name: TName } {\n return createInput({\n type: \"boolean\",\n renderer: \"Webiny/Switch\",\n ...input\n }) as BooleanInput & { name: TName };\n}\n\n// Color\nexport function createColorInput<TName extends string>(\n input: { name: TName } & Omit<ColorInput, \"type\" | \"name\">\n): ColorInput & { name: TName };\nexport function createColorInput<TName extends string>(\n input: Omit<ColorInput, \"type\" | \"name\">\n): ColorInput & { name: TName };\nexport function createColorInput<TName extends string>(input: any): ColorInput & { name: TName } {\n return createInput({\n type: \"color\",\n renderer: \"Webiny/ColorPicker\",\n ...input\n }) as ColorInput & { name: TName };\n}\n\n// File\nexport function createFileInput<TName extends string>(\n input: { name: TName } & Omit<FileInput, \"type\" | \"name\">\n): FileInput & { name: TName };\nexport function createFileInput<TName extends string>(\n input: Omit<FileInput, \"type\" | \"name\">\n): FileInput & { name: TName };\nexport function createFileInput<TName extends string>(input: any): FileInput & { name: TName } {\n return createInput({\n type: \"file\",\n renderer: \"Webiny/FileManager\",\n ...input\n }) as FileInput & { name: TName };\n}\n\n// Date\nexport function createDateInput<TName extends string>(\n input: { name: TName } & Omit<DateTimeInput, \"type\" | \"name\">\n): DateTimeInput & { name: TName };\nexport function createDateInput<TName extends string>(\n input: Omit<DateTimeInput, \"type\" | \"name\">\n): DateTimeInput & { name: TName };\nexport function createDateInput<TName extends string>(input: any): DateTimeInput & { name: TName } {\n return createInput({\n type: \"datetime\",\n renderer: \"Webiny/DateTime\",\n ...input\n }) as DateTimeInput & { name: TName };\n}\n\n// Rich Text\nexport function createLexicalInput<TName extends string>(\n input: { name: TName } & Omit<LexicalInput, \"type\" | \"name\">\n): LexicalInput & { name: TName };\nexport function createLexicalInput<TName extends string>(\n input: Omit<LexicalInput, \"type\" | \"name\">\n): LexicalInput & { name: TName };\nexport function createLexicalInput<TName extends string>(\n input: any\n): LexicalInput & { name: TName } {\n return createInput({\n type: \"lexical\",\n renderer: \"Webiny/Lexical\",\n ...input\n }) as LexicalInput & { name: TName };\n}\n\n// Select\nexport function createSelectInput<TName extends string>(\n input: { name: TName } & Omit<SelectInput, \"type\" | \"name\">\n): SelectInput & { name: TName };\nexport function createSelectInput<TName extends string>(\n input: Omit<SelectInput, \"type\" | \"name\">\n): SelectInput & { name: TName };\nexport function createSelectInput<TName extends string>(input: any): SelectInput & { name: TName } {\n return createInput({\n type: \"select\",\n renderer: \"Webiny/Select\",\n ...input\n }) as SelectInput & { name: TName };\n}\n\n// Radio\nexport function createRadioInput<TName extends string>(\n input: { name: TName } & Omit<RadioInput, \"type\" | \"name\">\n): RadioInput & { name: TName };\nexport function createRadioInput<TName extends string>(\n input: Omit<RadioInput, \"type\" | \"name\">\n): RadioInput & { name: TName };\nexport function createRadioInput<TName extends string>(input: any): RadioInput & { name: TName } {\n return createInput({\n type: \"radio\",\n renderer: \"Webiny/RadioGroup\",\n ...input\n }) as RadioInput & { name: TName };\n}\n\n// Object\nexport function createObjectInput<TName extends string>(\n input: { name: TName } & Omit<ObjectInput, \"type\" | \"name\">\n): ObjectInput & { name: TName };\nexport function createObjectInput<TName extends string>(\n input: Omit<ObjectInput, \"type\" | \"name\">\n): ObjectInput & { name: TName };\nexport function createObjectInput<TName extends string>(input: any): ObjectInput & { name: TName } {\n return createInput({\n type: \"object\",\n renderer: \"Webiny/Object\",\n ...input\n }) as ObjectInput & { name: TName };\n}\n\n// Tags\nexport function createTagsInput<TName extends string>(\n input: { name: TName } & Omit<TagsInput, \"type\" | \"name\">\n): TagsInput & { name: TName };\nexport function createTagsInput<TName extends string>(\n input: Omit<TagsInput, \"type\" | \"name\">\n): TagsInput & { name: TName };\nexport function createTagsInput<TName extends string>(input: any): TagsInput & { name: TName } {\n return createInput({\n type: \"text\",\n list: true,\n renderer: \"Webiny/Tags\",\n ...input\n }) as TagsInput & { name: TName };\n}\n\nexport function createSlotInput<TName extends string>(\n input: { name: TName } & Omit<SlotInput, \"type\" | \"name\">\n): SlotInput & { name: TName };\nexport function createSlotInput<TName extends string>(\n input: Omit<SlotInput, \"type\" | \"name\">\n): SlotInput & { name: TName };\nexport function createSlotInput<TName extends string>(input: any): SlotInput & { name: TName } {\n return createInput({\n type: \"slot\",\n list: true,\n renderer: \"Webiny/Slot\",\n defaultValue: [],\n ...input\n }) as SlotInput & { name: TName };\n}\n\n// Implementation\nexport function createInput(input: ComponentInput): ComponentInput {\n if (input.onChange) {\n // @ts-expect-error We don't use this function on the frontend, so this is ok.\n input.onChange = functionConverter.serialize(input.onChange!);\n }\n return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IAAIA,KAAK,CAACkB,QAAQ,EAAE;IAChB;IACAlB,KAAK,CAACkB,QAAQ,GAAGpB,iBAAiB,CAACqB,SAAS,CAACnB,KAAK,CAACkB,QAAS,CAAC;EACjE;EACA,OAAOlB,KAAK;AAChB","ignoreList":[]}
|
package/createTheme.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { WebsiteBuilderThemeInput } from "./types/WebsiteBuilderTheme";
|
|
1
|
+
import type { WebsiteBuilderThemeInput } from "./types/WebsiteBuilderTheme.js";
|
|
2
|
+
export type { WebsiteBuilderThemeInput };
|
|
2
3
|
export declare const createTheme: (theme: WebsiteBuilderThemeInput) => WebsiteBuilderThemeInput;
|
package/createTheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createTheme","theme"],"sources":["createTheme.ts"],"sourcesContent":["import type { WebsiteBuilderThemeInput } from \"~/types/WebsiteBuilderTheme\";\n\nexport const createTheme = (theme: WebsiteBuilderThemeInput) => {\n return theme;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createTheme","theme"],"sources":["createTheme.ts"],"sourcesContent":["import type { WebsiteBuilderThemeInput } from \"~/types/WebsiteBuilderTheme.js\";\n\nexport type { WebsiteBuilderThemeInput };\n\nexport const createTheme = (theme: WebsiteBuilderThemeInput) => {\n return theme;\n};\n"],"mappings":"AAIA,OAAO,MAAMA,WAAW,GAAIC,KAA+B,IAAK;EAC5D,OAAOA,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -3,11 +3,16 @@ interface QueryParams {
|
|
|
3
3
|
variables: Record<string, any>;
|
|
4
4
|
preview?: boolean;
|
|
5
5
|
}
|
|
6
|
+
type WithPath<T> = T & {
|
|
7
|
+
path?: string;
|
|
8
|
+
next?: Record<string, any>;
|
|
9
|
+
};
|
|
6
10
|
export declare class ApiClient {
|
|
7
|
-
private readonly
|
|
11
|
+
private readonly apiHost;
|
|
8
12
|
private readonly apiKey;
|
|
9
13
|
private readonly apiTenant;
|
|
10
14
|
constructor(apiHost: string, apiKey: string, apiTenant: string);
|
|
15
|
+
fetch({ headers, path, ...params }: WithPath<RequestInit>): Promise<any>;
|
|
11
16
|
query({ query, variables, preview }: QueryParams): Promise<any>;
|
|
12
17
|
}
|
|
13
18
|
export {};
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
export class ApiClient {
|
|
2
2
|
constructor(apiHost, apiKey, apiTenant) {
|
|
3
3
|
this.apiTenant = apiTenant;
|
|
4
|
-
this.
|
|
4
|
+
this.apiHost = apiHost;
|
|
5
5
|
this.apiKey = apiKey;
|
|
6
6
|
}
|
|
7
|
+
async fetch({
|
|
8
|
+
headers,
|
|
9
|
+
path,
|
|
10
|
+
...params
|
|
11
|
+
}) {
|
|
12
|
+
return fetch(`${this.apiHost}${path}`, {
|
|
13
|
+
method: "GET",
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
"X-Tenant": this.apiTenant,
|
|
17
|
+
Authorization: "Bearer " + this.apiKey,
|
|
18
|
+
...headers
|
|
19
|
+
},
|
|
20
|
+
...params
|
|
21
|
+
}).then(res => res.json());
|
|
22
|
+
}
|
|
7
23
|
async query({
|
|
8
24
|
query,
|
|
9
25
|
variables,
|
|
@@ -16,19 +32,14 @@ export class ApiClient {
|
|
|
16
32
|
};
|
|
17
33
|
const request = {
|
|
18
34
|
...fetchOptions,
|
|
35
|
+
path: "/graphql",
|
|
19
36
|
method: "POST",
|
|
20
|
-
headers: {
|
|
21
|
-
"Content-Type": "application/json",
|
|
22
|
-
"X-Tenant": this.apiTenant,
|
|
23
|
-
Authorization: "Bearer " + this.apiKey
|
|
24
|
-
},
|
|
25
37
|
body: JSON.stringify({
|
|
26
38
|
query,
|
|
27
39
|
variables
|
|
28
40
|
})
|
|
29
41
|
};
|
|
30
|
-
const
|
|
31
|
-
const json = await res.json();
|
|
42
|
+
const json = await this.fetch(request);
|
|
32
43
|
if (json.message) {
|
|
33
44
|
throw new Error(json.message);
|
|
34
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ApiClient","constructor","apiHost","apiKey","apiTenant","
|
|
1
|
+
{"version":3,"names":["ApiClient","constructor","apiHost","apiKey","apiTenant","fetch","headers","path","params","method","Authorization","then","res","json","query","variables","preview","fetchOptions","next","revalidate","request","body","JSON","stringify","message","Error","errors","console","error","data"],"sources":["ApiClient.ts"],"sourcesContent":["interface QueryParams {\n query: string;\n variables: Record<string, any>;\n preview?: boolean;\n}\n\ntype WithPath<T> = T & {\n path?: string;\n next?: Record<string, any>;\n};\n\nexport class ApiClient {\n private readonly apiHost: string;\n private readonly apiKey: string;\n private readonly apiTenant: string;\n\n constructor(apiHost: string, apiKey: string, apiTenant: string) {\n this.apiTenant = apiTenant;\n this.apiHost = apiHost;\n this.apiKey = apiKey;\n }\n\n async fetch({ headers, path, ...params }: WithPath<RequestInit>): Promise<any> {\n return fetch(`${this.apiHost}${path}`, {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Tenant\": this.apiTenant,\n Authorization: \"Bearer \" + this.apiKey,\n ...headers\n },\n ...params\n }).then(res => res.json());\n }\n\n async query({ query, variables, preview }: QueryParams) {\n const fetchOptions = {\n next: {\n revalidate: preview ? 0 : 60\n }\n };\n\n const request: WithPath<RequestInit> = {\n ...fetchOptions,\n path: \"/graphql\",\n method: \"POST\",\n body: JSON.stringify({\n query,\n variables\n })\n };\n\n const json = await this.fetch(request);\n\n if (json.message) {\n throw new Error(json.message);\n }\n\n if (json.errors) {\n console.error(json.errors);\n throw new Error(\"Failed to fetch API\");\n }\n\n return json.data;\n }\n}\n"],"mappings":"AAWA,OAAO,MAAMA,SAAS,CAAC;EAKnBC,WAAWA,CAACC,OAAe,EAAEC,MAAc,EAAEC,SAAiB,EAAE;IAC5D,IAAI,CAACA,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACF,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,M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
1
|
-
import type { IDataProvider, PublicPage } from "../types.js";
|
|
2
|
-
import type { ApiClient } from "
|
|
1
|
+
import type { IDataProvider, ListPagesOptions, ListPagesResult, PublicPage } from "../types.js";
|
|
2
|
+
import type { ApiClient } from "../dataProviders/ApiClient.js";
|
|
3
3
|
interface DefaultDataProviderConfig {
|
|
4
4
|
apiClient: ApiClient;
|
|
5
5
|
}
|
|
@@ -8,6 +8,7 @@ export declare class DefaultDataProvider implements IDataProvider {
|
|
|
8
8
|
constructor(config: DefaultDataProviderConfig);
|
|
9
9
|
getPageByPath(path: string): Promise<PublicPage | null>;
|
|
10
10
|
getPageById(id: string): Promise<PublicPage | null>;
|
|
11
|
-
listPages(): Promise<
|
|
11
|
+
listPages(options?: ListPagesOptions): Promise<ListPagesResult>;
|
|
12
|
+
private checkForErrors;
|
|
12
13
|
}
|
|
13
14
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { GET_PAGE_BY_PATH } from "./GET_PAGE_BY_PATH";
|
|
2
|
-
import { GET_PAGE_BY_ID } from "./GET_PAGE_BY_ID";
|
|
3
|
-
import { LIST_PUBLISHED_PAGES } from "./LIST_PUBLISHED_PAGES";
|
|
1
|
+
import { GET_PAGE_BY_PATH } from "./GET_PAGE_BY_PATH.js";
|
|
2
|
+
import { GET_PAGE_BY_ID } from "./GET_PAGE_BY_ID.js";
|
|
3
|
+
import { LIST_PUBLISHED_PAGES } from "./LIST_PUBLISHED_PAGES.js";
|
|
4
|
+
const ignoreActions = [".well-known", "_next"];
|
|
4
5
|
export class DefaultDataProvider {
|
|
5
6
|
constructor(config) {
|
|
6
7
|
this.config = config;
|
|
@@ -12,6 +13,7 @@ export class DefaultDataProvider {
|
|
|
12
13
|
path
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
this.checkForErrors(`getPageByPath:${path}`, result.websiteBuilder.getPageByPath);
|
|
15
17
|
return result.websiteBuilder.getPageByPath.data;
|
|
16
18
|
}
|
|
17
19
|
async getPageById(id) {
|
|
@@ -21,18 +23,42 @@ export class DefaultDataProvider {
|
|
|
21
23
|
id
|
|
22
24
|
}
|
|
23
25
|
});
|
|
26
|
+
this.checkForErrors("getPageById", result.websiteBuilder.getPageById);
|
|
24
27
|
return result.websiteBuilder.getPageById.data;
|
|
25
28
|
}
|
|
26
|
-
async listPages() {
|
|
29
|
+
async listPages(options) {
|
|
30
|
+
const {
|
|
31
|
+
where,
|
|
32
|
+
...rest
|
|
33
|
+
} = options ?? {};
|
|
27
34
|
const result = await this.config.apiClient.query({
|
|
28
35
|
query: LIST_PUBLISHED_PAGES,
|
|
29
36
|
variables: {
|
|
30
37
|
where: {
|
|
38
|
+
...where,
|
|
31
39
|
published: true
|
|
32
|
-
}
|
|
40
|
+
},
|
|
41
|
+
...rest
|
|
33
42
|
}
|
|
34
43
|
});
|
|
35
|
-
|
|
44
|
+
this.checkForErrors("listPages", result.websiteBuilder.listPages);
|
|
45
|
+
return {
|
|
46
|
+
data: result.websiteBuilder.listPages.data ?? [],
|
|
47
|
+
meta: result.websiteBuilder.listPages.meta ?? {
|
|
48
|
+
hasMoreItems: false,
|
|
49
|
+
totalCount: 0,
|
|
50
|
+
cursor: null
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
checkForErrors(action, data) {
|
|
55
|
+
if (data.error) {
|
|
56
|
+
// TODO: investigate how these ignored actions make their way to the SDK.
|
|
57
|
+
if (ignoreActions.some(item => action.includes(item))) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
console.error(`Could not execute "${action}". Reason: ${data.error.message}`);
|
|
61
|
+
}
|
|
36
62
|
}
|
|
37
63
|
}
|
|
38
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_PATH","GET_PAGE_BY_ID","LIST_PUBLISHED_PAGES","DefaultDataProvider","constructor","config","getPageByPath","path","result","apiClient","query","variables","websiteBuilder","data","getPageById","id","listPages","where","published"],"sources":["DefaultDataProvider.ts"],"sourcesContent":["import type { IDataProvider, PublicPage } from \"~/types.js\";\nimport type { ApiClient } from \"~/dataProviders/ApiClient\";\nimport { GET_PAGE_BY_PATH } from \"./GET_PAGE_BY_PATH\";\nimport { GET_PAGE_BY_ID } from \"./GET_PAGE_BY_ID\";\nimport { LIST_PUBLISHED_PAGES } from \"./LIST_PUBLISHED_PAGES\";\n\ninterface DefaultDataProviderConfig {\n apiClient: ApiClient;\n}\n\nexport class DefaultDataProvider implements IDataProvider {\n private config: DefaultDataProviderConfig;\n\n constructor(config: DefaultDataProviderConfig) {\n this.config = config;\n }\n\n public async getPageByPath(path: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_PATH,\n variables: {\n path\n }\n });\n\n return result.websiteBuilder.getPageByPath.data;\n }\n\n public async getPageById(id: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_ID,\n variables: {\n id\n }\n });\n\n return result.websiteBuilder.getPageById.data;\n }\n\n public async listPages() {\n const result = await this.config.apiClient.query({\n query: LIST_PUBLISHED_PAGES,\n variables: {\n where: {\n published: true\n }\n }\n });\n\n return result.websiteBuilder.listPages.data ?? [];\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAM7B,OAAO,MAAMC,mBAAmB,CAA0B;EAGtDC,WAAWA,CAACC,MAAiC,EAAE;IAC3C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,aAAaA,CAACC,IAAY,EAA8B;IACjE,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_PATH","GET_PAGE_BY_ID","LIST_PUBLISHED_PAGES","ignoreActions","DefaultDataProvider","constructor","config","getPageByPath","path","result","apiClient","query","variables","checkForErrors","websiteBuilder","data","getPageById","id","listPages","options","where","rest","published","meta","hasMoreItems","totalCount","cursor","action","error","some","item","includes","console","message"],"sources":["DefaultDataProvider.ts"],"sourcesContent":["import type { IDataProvider, ListPagesOptions, ListPagesResult, PublicPage } from \"~/types.js\";\nimport type { ApiClient } from \"~/dataProviders/ApiClient.js\";\nimport { GET_PAGE_BY_PATH } from \"./GET_PAGE_BY_PATH.js\";\nimport { GET_PAGE_BY_ID } from \"./GET_PAGE_BY_ID.js\";\nimport { LIST_PUBLISHED_PAGES } from \"./LIST_PUBLISHED_PAGES.js\";\n\ninterface DefaultDataProviderConfig {\n apiClient: ApiClient;\n}\n\nconst ignoreActions = [\".well-known\", \"_next\"];\n\nexport class DefaultDataProvider implements IDataProvider {\n private config: DefaultDataProviderConfig;\n\n constructor(config: DefaultDataProviderConfig) {\n this.config = config;\n }\n\n public async getPageByPath(path: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_PATH,\n variables: {\n path\n }\n });\n\n this.checkForErrors(`getPageByPath:${path}`, result.websiteBuilder.getPageByPath);\n\n return result.websiteBuilder.getPageByPath.data;\n }\n\n public async getPageById(id: string): Promise<PublicPage | null> {\n const result = await this.config.apiClient.query({\n query: GET_PAGE_BY_ID,\n variables: {\n id\n }\n });\n\n this.checkForErrors(\"getPageById\", result.websiteBuilder.getPageById);\n\n return result.websiteBuilder.getPageById.data;\n }\n\n public async listPages(options?: ListPagesOptions): Promise<ListPagesResult> {\n const { where, ...rest } = options ?? {};\n\n const result = await this.config.apiClient.query({\n query: LIST_PUBLISHED_PAGES,\n variables: {\n where: {\n ...where,\n published: true\n },\n ...rest\n }\n });\n\n this.checkForErrors(\"listPages\", result.websiteBuilder.listPages);\n\n return {\n data: result.websiteBuilder.listPages.data ?? [],\n meta: result.websiteBuilder.listPages.meta ?? {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null\n }\n };\n }\n\n private checkForErrors(action: string, data: any) {\n if (data.error) {\n // TODO: investigate how these ignored actions make their way to the SDK.\n if (ignoreActions.some(item => action.includes(item))) {\n return;\n }\n console.error(`Could not execute \"${action}\". Reason: ${data.error.message}`);\n }\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAM7B,MAAMC,aAAa,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;AAE9C,OAAO,MAAMC,mBAAmB,CAA0B;EAGtDC,WAAWA,CAACC,MAAiC,EAAE;IAC3C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,aAAaA,CAACC,IAAY,EAA8B;IACjE,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAEX,gBAAgB;MACvBY,SAAS,EAAE;QACPJ;MACJ;IACJ,CAAC,CAAC;IAEF,IAAI,CAACK,cAAc,CAAC,iBAAiBL,IAAI,EAAE,EAAEC,MAAM,CAACK,cAAc,CAACP,aAAa,CAAC;IAEjF,OAAOE,MAAM,CAACK,cAAc,CAACP,aAAa,CAACQ,IAAI;EACnD;EAEA,MAAaC,WAAWA,CAACC,EAAU,EAA8B;IAC7D,MAAMR,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAEV,cAAc;MACrBW,SAAS,EAAE;QACPK;MACJ;IACJ,CAAC,CAAC;IAEF,IAAI,CAACJ,cAAc,CAAC,aAAa,EAAEJ,MAAM,CAACK,cAAc,CAACE,WAAW,CAAC;IAErE,OAAOP,MAAM,CAACK,cAAc,CAACE,WAAW,CAACD,IAAI;EACjD;EAEA,MAAaG,SAASA,CAACC,OAA0B,EAA4B;IACzE,MAAM;MAAEC,KAAK;MAAE,GAAGC;IAAK,CAAC,GAAGF,OAAO,IAAI,CAAC,CAAC;IAExC,MAAMV,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAET,oBAAoB;MAC3BU,SAAS,EAAE;QACPQ,KAAK,EAAE;UACH,GAAGA,KAAK;UACRE,SAAS,EAAE;QACf,CAAC;QACD,GAAGD;MACP;IACJ,CAAC,CAAC;IAEF,IAAI,CAACR,cAAc,CAAC,WAAW,EAAEJ,MAAM,CAACK,cAAc,CAACI,SAAS,CAAC;IAEjE,OAAO;MACHH,IAAI,EAAEN,MAAM,CAACK,cAAc,CAACI,SAAS,CAACH,IAAI,IAAI,EAAE;MAChDQ,IAAI,EAAEd,MAAM,CAACK,cAAc,CAACI,SAAS,CAACK,IAAI,IAAI;QAC1CC,YAAY,EAAE,KAAK;QACnBC,UAAU,EAAE,CAAC;QACbC,MAAM,EAAE;MACZ;IACJ,CAAC;EACL;EAEQb,cAAcA,CAACc,MAAc,EAAEZ,IAAS,EAAE;IAC9C,IAAIA,IAAI,CAACa,KAAK,EAAE;MACZ;MACA,IAAIzB,aAAa,CAAC0B,IAAI,CAACC,IAAI,IAAIH,MAAM,CAACI,QAAQ,CAACD,IAAI,CAAC,CAAC,EAAE;QACnD;MACJ;MACAE,OAAO,CAACJ,KAAK,CAAC,sBAAsBD,MAAM,cAAcZ,IAAI,CAACa,KAAK,CAACK,OAAO,EAAE,CAAC;IACjF;EACJ;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_ID"],"sources":["GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,YAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_ID"],"sources":["GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,YAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_PATH"],"sources":["GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,YAAa;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_PATH"],"sources":["GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,YAAa;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIST_PUBLISHED_PAGES = "\n query ListPublishedPages($where: WbPagesListWhereInput) {\n websiteBuilder {\n listPages(where: $where) {\n data {\n id\n properties\n
|
|
1
|
+
export declare const LIST_PUBLISHED_PAGES = "\n query ListPublishedPages(\n $where: WbPagesListWhereInput\n $limit: Int\n $after: String\n $sort: [WbPageListSorter]\n $search: String\n ) {\n websiteBuilder {\n listPages(where: $where, limit: $limit, after: $after, sort: $sort, search: $search) {\n data {\n id\n properties\n metadata\n extensions\n }\n meta {\n hasMoreItems\n totalCount\n cursor\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
export const LIST_PUBLISHED_PAGES = /* GraphQL*/`
|
|
2
|
-
query ListPublishedPages(
|
|
2
|
+
query ListPublishedPages(
|
|
3
|
+
$where: WbPagesListWhereInput
|
|
4
|
+
$limit: Int
|
|
5
|
+
$after: String
|
|
6
|
+
$sort: [WbPageListSorter]
|
|
7
|
+
$search: String
|
|
8
|
+
) {
|
|
3
9
|
websiteBuilder {
|
|
4
|
-
listPages(where: $where) {
|
|
10
|
+
listPages(where: $where, limit: $limit, after: $after, sort: $sort, search: $search) {
|
|
5
11
|
data {
|
|
6
12
|
id
|
|
7
13
|
properties
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
metadata
|
|
15
|
+
extensions
|
|
16
|
+
}
|
|
17
|
+
meta {
|
|
18
|
+
hasMoreItems
|
|
19
|
+
totalCount
|
|
20
|
+
cursor
|
|
10
21
|
}
|
|
11
22
|
error {
|
|
12
23
|
code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LIST_PUBLISHED_PAGES"],"sources":["LIST_PUBLISHED_PAGES.ts"],"sourcesContent":["export const LIST_PUBLISHED_PAGES = /* GraphQL*/ `\n query ListPublishedPages($where: WbPagesListWhereInput) {\n websiteBuilder {\n listPages(where: $where) {\n data {\n id\n properties\n
|
|
1
|
+
{"version":3,"names":["LIST_PUBLISHED_PAGES"],"sources":["LIST_PUBLISHED_PAGES.ts"],"sourcesContent":["export const LIST_PUBLISHED_PAGES = /* GraphQL*/ `\n query ListPublishedPages(\n $where: WbPagesListWhereInput\n $limit: Int\n $after: String\n $sort: [WbPageListSorter]\n $search: String\n ) {\n websiteBuilder {\n listPages(where: $where, limit: $limit, after: $after, sort: $sort, search: $search) {\n data {\n id\n properties\n metadata\n extensions\n }\n meta {\n hasMoreItems\n totalCount\n cursor\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG,YAAa;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import type { IDataProvider,
|
|
1
|
+
import type { IDataProvider, PublicRedirect } from "../types.js";
|
|
2
|
+
import type { PublicPage } from "../types.js";
|
|
2
3
|
export declare class NullDataProvider implements IDataProvider {
|
|
3
|
-
getPageById(): Promise<
|
|
4
|
-
getPageByPath(): Promise<
|
|
5
|
-
listPages(): Promise<
|
|
4
|
+
getPageById(): Promise<PublicPage | null>;
|
|
5
|
+
getPageByPath(): Promise<PublicPage | null>;
|
|
6
|
+
listPages(): Promise<{
|
|
7
|
+
data: never[];
|
|
8
|
+
meta: {
|
|
9
|
+
hasMoreItems: boolean;
|
|
10
|
+
totalCount: number;
|
|
11
|
+
cursor: null;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
listRedirects(): Promise<PublicRedirect[]>;
|
|
6
15
|
}
|