@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.
Files changed (183) hide show
  1. package/BindingsApi.d.ts +4 -4
  2. package/BindingsApi.js +3 -3
  3. package/BindingsApi.js.map +1 -1
  4. package/BindingsProcessor.d.ts +1 -1
  5. package/BindingsProcessor.js.map +1 -1
  6. package/BindingsProcessor.test.js +2 -1
  7. package/BindingsProcessor.test.js.map +1 -1
  8. package/BindingsResolver.d.ts +2 -2
  9. package/BindingsResolver.js +3 -6
  10. package/BindingsResolver.js.map +1 -1
  11. package/BindingsResolver.test.js +4 -3
  12. package/BindingsResolver.test.js.map +1 -1
  13. package/ComponentInputTraverser.d.ts +1 -1
  14. package/ComponentInputTraverser.js.map +1 -1
  15. package/ComponentManifestToAstConverter.d.ts +1 -1
  16. package/ComponentManifestToAstConverter.js.map +1 -1
  17. package/ComponentRegistry.js +30 -0
  18. package/ComponentRegistry.js.map +1 -1
  19. package/ComponentResolver.d.ts +2 -2
  20. package/ComponentResolver.js +3 -3
  21. package/ComponentResolver.js.map +1 -1
  22. package/ConstraintEvaluator.d.ts +36 -0
  23. package/ConstraintEvaluator.js +395 -0
  24. package/ConstraintEvaluator.js.map +1 -0
  25. package/ConstraintEvaluator.test.d.ts +1 -0
  26. package/ConstraintEvaluator.test.js +1456 -0
  27. package/ConstraintEvaluator.test.js.map +1 -0
  28. package/ContentSdk.d.ts +13 -7
  29. package/ContentSdk.js +26 -10
  30. package/ContentSdk.js.map +1 -1
  31. package/DocumentStore.d.ts +3 -3
  32. package/DocumentStore.js +1 -1
  33. package/DocumentStore.js.map +1 -1
  34. package/DocumentStoreManager.d.ts +2 -2
  35. package/DocumentStoreManager.js +1 -1
  36. package/DocumentStoreManager.js.map +1 -1
  37. package/EditingSdk.d.ts +4 -4
  38. package/EditingSdk.js +12 -15
  39. package/EditingSdk.js.map +1 -1
  40. package/ElementFactory.d.ts +5 -6
  41. package/ElementFactory.js +25 -16
  42. package/ElementFactory.js.map +1 -1
  43. package/ElementFactory.test.d.ts +1 -0
  44. package/ElementFactory.test.js +280 -0
  45. package/ElementFactory.test.js.map +1 -0
  46. package/HashObject.js +14 -0
  47. package/HashObject.js.map +1 -1
  48. package/HotkeyManager.js +1 -1
  49. package/HotkeyManager.js.map +1 -1
  50. package/IBindingsUpdater.d.ts +2 -2
  51. package/IBindingsUpdater.js.map +1 -1
  52. package/IRedirects.d.ts +5 -0
  53. package/IRedirects.js +3 -0
  54. package/IRedirects.js.map +1 -0
  55. package/InheritanceProcessor.d.ts +4 -4
  56. package/InheritanceProcessor.js.map +1 -1
  57. package/InheritanceProcessor.test.js +2 -1
  58. package/InheritanceProcessor.test.js.map +1 -1
  59. package/InheritedValueResolver.d.ts +1 -1
  60. package/InheritedValueResolver.js.map +1 -1
  61. package/InputBindingsProcessor.d.ts +4 -4
  62. package/InputBindingsProcessor.js +29 -11
  63. package/InputBindingsProcessor.js.map +1 -1
  64. package/InputsBindingsProcessor.test.js +4 -2
  65. package/InputsBindingsProcessor.test.js.map +1 -1
  66. package/InputsUpdater.d.ts +5 -5
  67. package/InputsUpdater.js +2 -2
  68. package/InputsUpdater.js.map +1 -1
  69. package/LiveSdk.d.ts +2 -2
  70. package/LiveSdk.js +1 -1
  71. package/LiveSdk.js.map +1 -1
  72. package/Logger.d.ts +2 -1
  73. package/Logger.js +7 -4
  74. package/Logger.js.map +1 -1
  75. package/NullSdk.d.ts +5 -3
  76. package/NullSdk.js +10 -0
  77. package/NullSdk.js.map +1 -1
  78. package/PreviewDocument.js +1 -1
  79. package/PreviewDocument.js.map +1 -1
  80. package/PreviewSdk.d.ts +2 -2
  81. package/PreviewSdk.js +3 -3
  82. package/PreviewSdk.js.map +1 -1
  83. package/PreviewViewport.d.ts +1 -2
  84. package/PreviewViewport.js +1 -21
  85. package/PreviewViewport.js.map +1 -1
  86. package/README.md +10 -2
  87. package/StylesBindingsProcessor.d.ts +2 -2
  88. package/StylesBindingsProcessor.js +4 -4
  89. package/StylesBindingsProcessor.js.map +1 -1
  90. package/StylesUpdater.d.ts +4 -4
  91. package/StylesUpdater.js +2 -2
  92. package/StylesUpdater.js.map +1 -1
  93. package/Theme.d.ts +1 -1
  94. package/Theme.js +6 -11
  95. package/Theme.js.map +1 -1
  96. package/ViewportManager.d.ts +3 -1
  97. package/ViewportManager.js +8 -1
  98. package/ViewportManager.js.map +1 -1
  99. package/constants.d.ts +1 -0
  100. package/constants.js +2 -1
  101. package/constants.js.map +1 -1
  102. package/createElement.d.ts +1 -1
  103. package/createElement.js.map +1 -1
  104. package/createInput.d.ts +124 -16
  105. package/createInput.js +33 -1
  106. package/createInput.js.map +1 -1
  107. package/createTheme.d.ts +2 -1
  108. package/createTheme.js.map +1 -1
  109. package/dataProviders/ApiClient.d.ts +6 -1
  110. package/dataProviders/ApiClient.js +19 -8
  111. package/dataProviders/ApiClient.js.map +1 -1
  112. package/dataProviders/DefaultDataProvider.d.ts +4 -3
  113. package/dataProviders/DefaultDataProvider.js +32 -6
  114. package/dataProviders/DefaultDataProvider.js.map +1 -1
  115. package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
  116. package/dataProviders/GET_PAGE_BY_ID.js +2 -0
  117. package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
  118. package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
  119. package/dataProviders/GET_PAGE_BY_PATH.js +2 -0
  120. package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
  121. package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -1
  122. package/dataProviders/LIST_PUBLISHED_PAGES.js +15 -4
  123. package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
  124. package/dataProviders/NullDataProvider.d.ts +13 -4
  125. package/dataProviders/NullDataProvider.js +11 -1
  126. package/dataProviders/NullDataProvider.js.map +1 -1
  127. package/dataProviders/RedirectsProvider.d.ts +11 -0
  128. package/dataProviders/RedirectsProvider.js +32 -0
  129. package/dataProviders/RedirectsProvider.js.map +1 -0
  130. package/defaultBreakpoints.d.ts +1 -1
  131. package/defaultBreakpoints.js.map +1 -1
  132. package/documentOperations/$addElementReferenceToParent.d.ts +1 -1
  133. package/documentOperations/$addElementReferenceToParent.js +9 -2
  134. package/documentOperations/$addElementReferenceToParent.js.map +1 -1
  135. package/documentOperations/AddElement.d.ts +1 -1
  136. package/documentOperations/AddElement.js.map +1 -1
  137. package/documentOperations/AddToParent.d.ts +3 -3
  138. package/documentOperations/AddToParent.js.map +1 -1
  139. package/documentOperations/RemoveElement.d.ts +1 -1
  140. package/documentOperations/RemoveElement.js +9 -0
  141. package/documentOperations/RemoveElement.js.map +1 -1
  142. package/documentOperations/SetGlobalInputBinding.d.ts +1 -1
  143. package/documentOperations/SetGlobalInputBinding.js.map +1 -1
  144. package/documentOperations/SetGlobalStyleBinding.d.ts +1 -1
  145. package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
  146. package/documentOperations/SetInputBindingOverride.d.ts +1 -1
  147. package/documentOperations/SetInputBindingOverride.js.map +1 -1
  148. package/documentOperations/SetStyleBindingOverride.d.ts +1 -1
  149. package/documentOperations/SetStyleBindingOverride.js.map +1 -1
  150. package/documentOperations/index.d.ts +8 -8
  151. package/documentOperations/index.js +7 -7
  152. package/documentOperations/index.js.map +1 -1
  153. package/findMatchingAstNode.d.ts +1 -1
  154. package/findMatchingAstNode.js.map +1 -1
  155. package/generateElementId.d.ts +1 -1
  156. package/generateElementId.js +0 -1
  157. package/generateElementId.js.map +1 -1
  158. package/index.d.ts +3 -3
  159. package/index.js +2 -3
  160. package/index.js.map +1 -1
  161. package/jsonPatch.d.ts +1 -1
  162. package/messenger/Messenger.js +6 -6
  163. package/messenger/Messenger.js.map +1 -1
  164. package/package.json +14 -20
  165. package/registerComponentGroup.d.ts +1 -1
  166. package/registerComponentGroup.js +1 -1
  167. package/registerComponentGroup.js.map +1 -1
  168. package/types/WebsiteBuilderTheme.d.ts +52 -42
  169. package/types/WebsiteBuilderTheme.js.map +1 -1
  170. package/types.d.ts +207 -20
  171. package/types.js.map +1 -1
  172. package/lexical/createDefaultLexicalTheme.d.ts +0 -2
  173. package/lexical/createDefaultLexicalTheme.js +0 -84
  174. package/lexical/createDefaultLexicalTheme.js.map +0 -1
  175. package/lexical/createLexicalTheme.d.ts +0 -2
  176. package/lexical/createLexicalTheme.js +0 -7
  177. package/lexical/createLexicalTheme.js.map +0 -1
  178. package/lexical/deepMerge.d.ts +0 -1
  179. package/lexical/deepMerge.js +0 -23
  180. package/lexical/deepMerge.js.map +0 -1
  181. package/types/LexicalEditorTheme.d.ts +0 -2
  182. package/types/LexicalEditorTheme.js +0 -3
  183. 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 OmitType<T> = Omit<T, "type">;
3
- export declare function createTextInput(input: OmitType<TextInput>): TextInput;
4
- export declare function createLongTextInput(input: OmitType<LongTextInput>): ComponentInput;
5
- export declare function createNumberInput(input: OmitType<NumberInput>): NumberInput;
6
- export declare function createBooleanInput(input: OmitType<BooleanInput>): BooleanInput;
7
- export declare function createColorInput(input: OmitType<ColorInput>): ColorInput;
8
- export declare function createFileInput(input: OmitType<FileInput>): FileInput;
9
- export declare function createDateInput(input: OmitType<DateTimeInput>): DateTimeInput;
10
- export declare function createLexicalInput(input: OmitType<LexicalInput>): LexicalInput;
11
- export declare function createSelectInput(input: OmitType<SelectInput>): SelectInput;
12
- export declare function createRadioInput(input: OmitType<RadioInput>): RadioInput;
13
- export declare function createObjectInput(input: OmitType<ObjectInput>): ObjectInput;
14
- export declare function createTagsInput(input: OmitType<TagsInput>): TagsInput;
15
- export declare function createSlotInput(input: OmitType<SlotInput>): SlotInput;
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
  }
@@ -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":"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","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 input;\n}\n"],"mappings":"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","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;
@@ -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":"AAEA,OAAO,MAAMA,WAAW,GAAIC,KAA+B,IAAK;EAC5D,OAAOA,KAAK;AAChB,CAAC","ignoreList":[]}
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 apiEndpoint;
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.apiEndpoint = apiHost + "/graphql";
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 res = await fetch(this.apiEndpoint, request);
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","apiEndpoint","query","variables","preview","fetchOptions","next","revalidate","request","method","headers","Authorization","body","JSON","stringify","res","fetch","json","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\nexport class ApiClient {\n private readonly apiEndpoint: 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.apiEndpoint = apiHost + \"/graphql\";\n this.apiKey = apiKey;\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 = {\n ...fetchOptions,\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Tenant\": this.apiTenant,\n Authorization: \"Bearer \" + this.apiKey\n },\n body: JSON.stringify({\n query,\n variables\n })\n };\n\n const res = await fetch(this.apiEndpoint, request);\n const json = await res.json();\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":"AAMA,OAAO,MAAMA,SAAS,CAAC;EAKnBC,WAAWA,CAACC,OAAe,EAAEC,MAAc,EAAEC,SAAiB,EAAE;IAC5D,IAAI,CAACA,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,WAAW,GAAGH,OAAO,GAAG,UAAU;IACvC,IAAI,CAACC,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAMG,KAAKA,CAAC;IAAEA,KAAK;IAAEC,SAAS;IAAEC;EAAqB,CAAC,EAAE;IACpD,MAAMC,YAAY,GAAG;MACjBC,IAAI,EAAE;QACFC,UAAU,EAAEH,OAAO,GAAG,CAAC,GAAG;MAC9B;IACJ,CAAC;IAED,MAAMI,OAAO,GAAG;MACZ,GAAGH,YAAY;MACfI,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACL,cAAc,EAAE,kBAAkB;QAClC,UAAU,EAAE,IAAI,CAACV,SAAS;QAC1BW,aAAa,EAAE,SAAS,GAAG,IAAI,CAACZ;MACpC,CAAC;MACDa,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACjBZ,KAAK;QACLC;MACJ,CAAC;IACL,CAAC;IAED,MAAMY,GAAG,GAAG,MAAMC,KAAK,CAAC,IAAI,CAACf,WAAW,EAAEO,OAAO,CAAC;IAClD,MAAMS,IAAI,GAAG,MAAMF,GAAG,CAACE,IAAI,CAAC,CAAC;IAE7B,IAAIA,IAAI,CAACC,OAAO,EAAE;MACd,MAAM,IAAIC,KAAK,CAACF,IAAI,CAACC,OAAO,CAAC;IACjC;IAEA,IAAID,IAAI,CAACG,MAAM,EAAE;MACbC,OAAO,CAACC,KAAK,CAACL,IAAI,CAACG,MAAM,CAAC;MAC1B,MAAM,IAAID,KAAK,CAAC,qBAAqB,CAAC;IAC1C;IAEA,OAAOF,IAAI,CAACM,IAAI;EACpB;AACJ","ignoreList":[]}
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,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAME,KAAKA,CAAC;IAAEC,OAAO;IAAEC,IAAI;IAAE,GAAGC;EAA8B,CAAC,EAAgB;IAC3E,OAAOH,KAAK,CAAC,GAAG,IAAI,CAACH,OAAO,GAAGK,IAAI,EAAE,EAAE;MACnCE,MAAM,EAAE,KAAK;MACbH,OAAO,EAAE;QACL,cAAc,EAAE,kBAAkB;QAClC,UAAU,EAAE,IAAI,CAACF,SAAS;QAC1BM,aAAa,EAAE,SAAS,GAAG,IAAI,CAACP,MAAM;QACtC,GAAGG;MACP,CAAC;MACD,GAAGE;IACP,CAAC,CAAC,CAACG,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;EAC9B;EAEA,MAAMC,KAAKA,CAAC;IAAEA,KAAK;IAAEC,SAAS;IAAEC;EAAqB,CAAC,EAAE;IACpD,MAAMC,YAAY,GAAG;MACjBC,IAAI,EAAE;QACFC,UAAU,EAAEH,OAAO,GAAG,CAAC,GAAG;MAC9B;IACJ,CAAC;IAED,MAAMI,OAA8B,GAAG;MACnC,GAAGH,YAAY;MACfV,IAAI,EAAE,UAAU;MAChBE,MAAM,EAAE,MAAM;MACdY,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACjBT,KAAK;QACLC;MACJ,CAAC;IACL,CAAC;IAED,MAAMF,IAAI,GAAG,MAAM,IAAI,CAACR,KAAK,CAACe,OAAO,CAAC;IAEtC,IAAIP,IAAI,CAACW,OAAO,EAAE;MACd,MAAM,IAAIC,KAAK,CAACZ,IAAI,CAACW,OAAO,CAAC;IACjC;IAEA,IAAIX,IAAI,CAACa,MAAM,EAAE;MACbC,OAAO,CAACC,KAAK,CAACf,IAAI,CAACa,MAAM,CAAC;MAC1B,MAAM,IAAID,KAAK,CAAC,qBAAqB,CAAC;IAC1C;IAEA,OAAOZ,IAAI,CAACgB,IAAI;EACpB;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { IDataProvider, PublicPage } from "../types.js";
2
- import type { ApiClient } from "./ApiClient";
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<any>;
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
- return result.websiteBuilder.listPages.data ?? [];
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,EAAEV,gBAAgB;MACvBW,SAAS,EAAE;QACPJ;MACJ;IACJ,CAAC,CAAC;IAEF,OAAOC,MAAM,CAACI,cAAc,CAACN,aAAa,CAACO,IAAI;EACnD;EAEA,MAAaC,WAAWA,CAACC,EAAU,EAA8B;IAC7D,MAAMP,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAET,cAAc;MACrBU,SAAS,EAAE;QACPI;MACJ;IACJ,CAAC,CAAC;IAEF,OAAOP,MAAM,CAACI,cAAc,CAACE,WAAW,CAACD,IAAI;EACjD;EAEA,MAAaG,SAASA,CAAA,EAAG;IACrB,MAAMR,MAAM,GAAG,MAAM,IAAI,CAACH,MAAM,CAACI,SAAS,CAACC,KAAK,CAAC;MAC7CA,KAAK,EAAER,oBAAoB;MAC3BS,SAAS,EAAE;QACPM,KAAK,EAAE;UACHC,SAAS,EAAE;QACf;MACJ;IACJ,CAAC,CAAC;IAEF,OAAOV,MAAM,CAACI,cAAc,CAACI,SAAS,CAACH,IAAI,IAAI,EAAE;EACrD;AACJ","ignoreList":[]}
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";
@@ -7,6 +7,8 @@ export const GET_PAGE_BY_ID = /* GraphQL*/`
7
7
  properties
8
8
  elements
9
9
  bindings
10
+ extensions
11
+ languagePaths
10
12
  }
11
13
  error {
12
14
  code
@@ -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";
@@ -7,6 +7,8 @@ export const GET_PAGE_BY_PATH = /* GraphQL*/`
7
7
  properties
8
8
  elements
9
9
  bindings
10
+ extensions
11
+ languagePaths
10
12
  }
11
13
  error {
12
14
  code
@@ -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 elements\n bindings\n }\n error {\n code\n message\n data\n }\n }\n }\n }\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($where: WbPagesListWhereInput) {
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
- elements
9
- bindings
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 elements\n bindings\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,CAAC","ignoreList":[]}
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, Page } from "../types.js";
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<Page | null>;
4
- getPageByPath(): Promise<Page | null>;
5
- listPages(): Promise<never[]>;
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
  }