@webiny/website-builder-sdk 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9
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.js +29 -36
- package/BindingsApi.js.map +1 -1
- package/BindingsProcessor.js +34 -43
- package/BindingsProcessor.js.map +1 -1
- package/BindingsProcessor.test.js +82 -78
- package/BindingsProcessor.test.js.map +1 -1
- package/BindingsResolver.js +92 -122
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +399 -363
- package/BindingsResolver.test.js.map +1 -1
- package/ComponentInputTraverser.js +28 -49
- package/ComponentInputTraverser.js.map +1 -1
- package/ComponentManifestToAstConverter.js +20 -21
- package/ComponentManifestToAstConverter.js.map +1 -1
- package/ComponentRegistry.js +33 -22
- package/ComponentRegistry.js.map +1 -1
- package/ComponentResolver.js +25 -29
- package/ComponentResolver.js.map +1 -1
- package/ConstraintEvaluator.d.ts +36 -0
- package/ConstraintEvaluator.js +288 -0
- package/ConstraintEvaluator.js.map +1 -0
- package/ConstraintEvaluator.test.d.ts +1 -0
- package/ConstraintEvaluator.test.js +1634 -0
- package/ConstraintEvaluator.test.js.map +1 -0
- package/ContentSdk.d.ts +3 -3
- package/ContentSdk.js +83 -90
- package/ContentSdk.js.map +1 -1
- package/DocumentStore.js +47 -59
- package/DocumentStore.js.map +1 -1
- package/DocumentStoreManager.js +17 -16
- package/DocumentStoreManager.js.map +1 -1
- package/EditingSdk.d.ts +2 -2
- package/EditingSdk.js +87 -121
- package/EditingSdk.js.map +1 -1
- package/ElementFactory.d.ts +2 -3
- package/ElementFactory.js +125 -164
- package/ElementFactory.js.map +1 -1
- package/ElementFactory.test.d.ts +1 -0
- package/ElementFactory.test.js +251 -0
- package/ElementFactory.test.js.map +1 -0
- package/Environment.js +18 -19
- package/Environment.js.map +1 -1
- package/FunctionConverter.js +8 -7
- package/FunctionConverter.js.map +1 -1
- package/HashObject.js +11 -12
- package/HashObject.js.map +1 -1
- package/HotkeyManager.js +41 -48
- package/HotkeyManager.js.map +1 -1
- package/IBindingsUpdater.js +0 -3
- package/IRedirects.js +0 -3
- package/InheritanceProcessor.js +99 -139
- package/InheritanceProcessor.js.map +1 -1
- package/InheritanceProcessor.test.js +178 -179
- package/InheritanceProcessor.test.js.map +1 -1
- package/InheritedValueResolver.js +15 -20
- package/InheritedValueResolver.js.map +1 -1
- package/InputBindingsProcessor.js +187 -289
- package/InputBindingsProcessor.js.map +1 -1
- package/InputsBindingsProcessor.test.js +334 -314
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.d.ts +1 -1
- package/InputsUpdater.js +23 -26
- package/InputsUpdater.js.map +1 -1
- package/LiveSdk.d.ts +2 -2
- package/LiveSdk.js +12 -13
- package/LiveSdk.js.map +1 -1
- package/Logger.js +9 -8
- package/Logger.js.map +1 -1
- package/MouseTracker.js +77 -83
- package/MouseTracker.js.map +1 -1
- package/NullSdk.d.ts +4 -3
- package/NullSdk.js +22 -14
- package/NullSdk.js.map +1 -1
- package/PreviewDocument.js +27 -30
- package/PreviewDocument.js.map +1 -1
- package/PreviewSdk.d.ts +2 -2
- package/PreviewSdk.js +16 -17
- package/PreviewSdk.js.map +1 -1
- package/PreviewViewport.js +51 -63
- package/PreviewViewport.js.map +1 -1
- package/ResizeObserver.js +24 -31
- package/ResizeObserver.js.map +1 -1
- package/StylesBindingsProcessor.js +40 -79
- package/StylesBindingsProcessor.js.map +1 -1
- package/StylesUpdater.d.ts +1 -1
- package/StylesUpdater.js +20 -25
- package/StylesUpdater.js.map +1 -1
- package/Theme.js +29 -25
- package/Theme.js.map +1 -1
- package/ViewportManager.js +89 -101
- package/ViewportManager.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +7 -5
- package/constants.js.map +1 -1
- package/createElement.js +5 -6
- package/createElement.js.map +1 -1
- package/createInput.js +85 -143
- package/createInput.js.map +1 -1
- package/createTheme.js +2 -3
- package/createTheme.js.map +1 -1
- package/dataProviders/ApiClient.js +40 -49
- package/dataProviders/ApiClient.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +2 -2
- package/dataProviders/DefaultDataProvider.js +55 -44
- package/dataProviders/DefaultDataProvider.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +3 -1
- 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 +3 -1
- 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 +16 -5
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
- package/dataProviders/NullDataProvider.d.ts +12 -4
- package/dataProviders/NullDataProvider.js +21 -13
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/dataProviders/RedirectsProvider.js +24 -27
- package/dataProviders/RedirectsProvider.js.map +1 -1
- package/defaultBreakpoints.js +23 -22
- package/defaultBreakpoints.js.map +1 -1
- package/documentOperations/$addElementReferenceToParent.d.ts +1 -1
- package/documentOperations/$addElementReferenceToParent.js +30 -26
- package/documentOperations/$addElementReferenceToParent.js.map +1 -1
- package/documentOperations/AddElement.js +8 -7
- package/documentOperations/AddElement.js.map +1 -1
- package/documentOperations/AddToParent.d.ts +2 -2
- package/documentOperations/AddToParent.js +14 -13
- package/documentOperations/AddToParent.js.map +1 -1
- package/documentOperations/IDocumentOperation.js +0 -3
- package/documentOperations/RemoveElement.js +10 -7
- package/documentOperations/RemoveElement.js.map +1 -1
- package/documentOperations/SetGlobalInputBinding.js +23 -22
- package/documentOperations/SetGlobalInputBinding.js.map +1 -1
- package/documentOperations/SetGlobalStyleBinding.js +23 -23
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
- package/documentOperations/SetInputBindingOverride.js +30 -29
- package/documentOperations/SetInputBindingOverride.js.map +1 -1
- package/documentOperations/SetStyleBindingOverride.js +30 -31
- package/documentOperations/SetStyleBindingOverride.js.map +1 -1
- package/documentOperations/index.js +9 -8
- package/documentOperations/index.js.map +1 -1
- package/findMatchingAstNode.js +11 -13
- package/findMatchingAstNode.js.map +1 -1
- package/generateElementId.js +2 -2
- package/generateElementId.js.map +1 -1
- package/headersProvider.js +4 -3
- package/headersProvider.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -2
- package/jsonPatch.js +5 -9
- package/jsonPatch.js.map +1 -1
- package/messages.js +12 -11
- package/messages.js.map +1 -1
- package/messenger/MessageOrigin.js +12 -11
- package/messenger/MessageOrigin.js.map +1 -1
- package/messenger/Messenger.js +58 -71
- package/messenger/Messenger.js.map +1 -1
- package/messenger/index.js +0 -2
- package/package.json +16 -16
- package/registerComponentGroup.js +5 -6
- package/registerComponentGroup.js.map +1 -1
- package/types/ShorthandCssProperties.js +0 -3
- package/types/WebsiteBuilderTheme.d.ts +7 -0
- package/types/WebsiteBuilderTheme.js +0 -3
- package/types.d.ts +173 -11
- package/types.js +0 -3
- package/IBindingsUpdater.js.map +0 -1
- package/IRedirects.js.map +0 -1
- package/documentOperations/IDocumentOperation.js.map +0 -1
- package/index.js.map +0 -1
- package/messenger/index.js.map +0 -1
- package/types/ShorthandCssProperties.js.map +0 -1
- package/types/WebsiteBuilderTheme.js.map +0 -1
- package/types.js.map +0 -1
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","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":"AAgBA,SAASA,iBAAiB;;AAiB1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,SAASC,eAAeA,CAAuBC,KAAU,EAA+B;EAC3F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE,cAAc;IACxB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASI,mBAAmBA,CAC/BJ,KAAU,EACqB;EAC/B,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,iBAAiB;IAC3B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASK,iBAAiBA,CAAuBL,KAAU,EAAiC;EAC/F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASM,kBAAkBA,CAC9BN,KAAU,EACoB;EAC9B,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,SAAS;IACfC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASO,gBAAgBA,CAAuBP,KAAU,EAAgC;EAC7F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE,oBAAoB;IAC9B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASQ,eAAeA,CAAuBR,KAAU,EAA+B;EAC3F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE,oBAAoB;IAC9B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASS,eAAeA,CAAuBT,KAAU,EAAmC;EAC/F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,iBAAiB;IAC3B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASU,kBAAkBA,CAC9BV,KAAU,EACoB;EAC9B,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,SAAS;IACfC,QAAQ,EAAE,gBAAgB;IAC1B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASW,iBAAiBA,CAAuBX,KAAU,EAAiC;EAC/F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASY,gBAAgBA,CAAuBZ,KAAU,EAAgC;EAC7F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE,mBAAmB;IAC7B,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASa,iBAAiBA,CAAuBb,KAAU,EAAiC;EAC/F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE,eAAe;IACzB,GAAGH;EACP,CAAC,CAAC;AACN;;AAEA;;AAOA,OAAO,SAASc,eAAeA,CAAuBd,KAAU,EAA+B;EAC3F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZa,IAAI,EAAE,IAAI;IACVZ,QAAQ,EAAE,aAAa;IACvB,GAAGH;EACP,CAAC,CAAC;AACN;AAQA,OAAO,SAASgB,eAAeA,CAAuBhB,KAAU,EAA+B;EAC3F,OAAOC,WAAW,CAAC;IACfC,IAAI,EAAE,MAAM;IACZa,IAAI,EAAE,IAAI;IACVZ,QAAQ,EAAE,aAAa;IACvBc,YAAY,EAAE,EAAE;IAChB,GAAGjB;EACP,CAAC,CAAC;AACN;;AAEA;AACA,OAAO,SAASC,WAAWA,CAACD,KAAqB,EAAkB;EAC/D,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":[]}
|
|
1
|
+
{"version":3,"file":"createInput.js","sources":["../src/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"],"names":["createTextInput","input","createInput","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","createSlotInput","functionConverter"],"mappings":";AA0DO,SAASA,gBAAsCC,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASE,oBACZF,KAAU;IAEV,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASG,kBAAwCH,KAAU;IAC9D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASI,mBACZJ,KAAU;IAEV,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASK,iBAAuCL,KAAU;IAC7D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASM,gBAAsCN,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASO,gBAAsCP,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASQ,mBACZR,KAAU;IAEV,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASS,kBAAwCT,KAAU;IAC9D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASU,iBAAuCV,KAAU;IAC7D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASW,kBAAwCX,KAAU;IAC9D,OAAOC,YAAY;QACf,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AASO,SAASY,gBAAsCZ,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,MAAM;QACN,UAAU;QACV,GAAGD,KAAK;IACZ;AACJ;AAQO,SAASa,gBAAsCb,KAAU;IAC5D,OAAOC,YAAY;QACf,MAAM;QACN,MAAM;QACN,UAAU;QACV,cAAc,EAAE;QAChB,GAAGD,KAAK;IACZ;AACJ;AAGO,SAASC,YAAYD,KAAqB;IAC7C,IAAIA,MAAM,QAAQ,EAEdA,MAAM,QAAQ,GAAGc,kBAAkB,SAAS,CAACd,MAAM,QAAQ;IAE/D,OAAOA;AACX"}
|
package/createTheme.js
CHANGED
package/createTheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"createTheme.js","sources":["../src/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"],"names":["createTheme","theme"],"mappings":"AAIO,MAAMA,cAAc,CAACC,QACjBA"}
|
|
@@ -1,54 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
}
|
|
23
|
-
async query({
|
|
24
|
-
query,
|
|
25
|
-
variables,
|
|
26
|
-
preview
|
|
27
|
-
}) {
|
|
28
|
-
const fetchOptions = {
|
|
29
|
-
next: {
|
|
30
|
-
revalidate: preview ? 0 : 60
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const request = {
|
|
34
|
-
...fetchOptions,
|
|
35
|
-
path: "/graphql",
|
|
36
|
-
method: "POST",
|
|
37
|
-
body: JSON.stringify({
|
|
38
|
-
query,
|
|
39
|
-
variables
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
|
-
const json = await this.fetch(request);
|
|
43
|
-
if (json.message) {
|
|
44
|
-
throw new Error(json.message);
|
|
1
|
+
class ApiClient {
|
|
2
|
+
constructor(apiHost, apiKey, apiTenant){
|
|
3
|
+
this.apiTenant = apiTenant;
|
|
4
|
+
this.apiHost = apiHost;
|
|
5
|
+
this.apiKey = apiKey;
|
|
45
6
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
7
|
+
async fetch({ headers, path, ...params }) {
|
|
8
|
+
return fetch(`${this.apiHost}${path}`, {
|
|
9
|
+
method: "GET",
|
|
10
|
+
headers: {
|
|
11
|
+
"Content-Type": "application/json",
|
|
12
|
+
"X-Tenant": this.apiTenant,
|
|
13
|
+
Authorization: "Bearer " + this.apiKey,
|
|
14
|
+
...headers
|
|
15
|
+
},
|
|
16
|
+
...params
|
|
17
|
+
}).then((res)=>res.json());
|
|
18
|
+
}
|
|
19
|
+
async query({ query, variables, preview }) {
|
|
20
|
+
const fetchOptions = {
|
|
21
|
+
next: {
|
|
22
|
+
revalidate: preview ? 0 : 60
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const request = {
|
|
26
|
+
...fetchOptions,
|
|
27
|
+
path: "/graphql",
|
|
28
|
+
method: "POST",
|
|
29
|
+
body: JSON.stringify({
|
|
30
|
+
query,
|
|
31
|
+
variables
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
const json = await this.fetch(request);
|
|
35
|
+
if (json.message) throw new Error(json.message);
|
|
36
|
+
if (json.errors) {
|
|
37
|
+
console.error(json.errors);
|
|
38
|
+
throw new Error("Failed to fetch API");
|
|
39
|
+
}
|
|
40
|
+
return json.data;
|
|
49
41
|
}
|
|
50
|
-
return json.data;
|
|
51
|
-
}
|
|
52
42
|
}
|
|
43
|
+
export { ApiClient };
|
|
53
44
|
|
|
54
45
|
//# sourceMappingURL=ApiClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/ApiClient.js","sources":["../../src/dataProviders/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"],"names":["ApiClient","apiHost","apiKey","apiTenant","headers","path","params","fetch","res","query","variables","preview","fetchOptions","request","JSON","json","Error","console"],"mappings":"AAWO,MAAMA;IAKT,YAAYC,OAAe,EAAEC,MAAc,EAAEC,SAAiB,CAAE;QAC5D,IAAI,CAAC,SAAS,GAAGA;QACjB,IAAI,CAAC,OAAO,GAAGF;QACf,IAAI,CAAC,MAAM,GAAGC;IAClB;IAEA,MAAM,MAAM,EAAEE,OAAO,EAAEC,IAAI,EAAE,GAAGC,QAA+B,EAAgB;QAC3E,OAAOC,MAAM,GAAG,IAAI,CAAC,OAAO,GAAGF,MAAM,EAAE;YACnC,QAAQ;YACR,SAAS;gBACL,gBAAgB;gBAChB,YAAY,IAAI,CAAC,SAAS;gBAC1B,eAAe,YAAY,IAAI,CAAC,MAAM;gBACtC,GAAGD,OAAO;YACd;YACA,GAAGE,MAAM;QACb,GAAG,IAAI,CAACE,CAAAA,MAAOA,IAAI,IAAI;IAC3B;IAEA,MAAM,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,OAAO,EAAe,EAAE;QACpD,MAAMC,eAAe;YACjB,MAAM;gBACF,YAAYD,UAAU,IAAI;YAC9B;QACJ;QAEA,MAAME,UAAiC;YACnC,GAAGD,YAAY;YACf,MAAM;YACN,QAAQ;YACR,MAAME,KAAK,SAAS,CAAC;gBACjBL;gBACAC;YACJ;QACJ;QAEA,MAAMK,OAAO,MAAM,IAAI,CAAC,KAAK,CAACF;QAE9B,IAAIE,KAAK,OAAO,EACZ,MAAM,IAAIC,MAAMD,KAAK,OAAO;QAGhC,IAAIA,KAAK,MAAM,EAAE;YACbE,QAAQ,KAAK,CAACF,KAAK,MAAM;YACzB,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOD,KAAK,IAAI;IACpB;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IDataProvider, PublicPage } from "../types.js";
|
|
1
|
+
import type { IDataProvider, ListPagesOptions, ListPagesResult, PublicPage } from "../types.js";
|
|
2
2
|
import type { ApiClient } from "../dataProviders/ApiClient.js";
|
|
3
3
|
interface DefaultDataProviderConfig {
|
|
4
4
|
apiClient: ApiClient;
|
|
@@ -8,7 +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
12
|
private checkForErrors;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,52 +1,63 @@
|
|
|
1
1
|
import { GET_PAGE_BY_PATH } from "./GET_PAGE_BY_PATH.js";
|
|
2
2
|
import { GET_PAGE_BY_ID } from "./GET_PAGE_BY_ID.js";
|
|
3
3
|
import { LIST_PUBLISHED_PAGES } from "./LIST_PUBLISHED_PAGES.js";
|
|
4
|
-
const ignoreActions = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
where
|
|
34
|
-
|
|
4
|
+
const ignoreActions = [
|
|
5
|
+
".well-known",
|
|
6
|
+
"_next"
|
|
7
|
+
];
|
|
8
|
+
class DefaultDataProvider {
|
|
9
|
+
constructor(config){
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async getPageByPath(path) {
|
|
13
|
+
const result = await this.config.apiClient.query({
|
|
14
|
+
query: GET_PAGE_BY_PATH,
|
|
15
|
+
variables: {
|
|
16
|
+
path
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
this.checkForErrors(`getPageByPath:${path}`, result.websiteBuilder.getPageByPath);
|
|
20
|
+
return result.websiteBuilder.getPageByPath.data;
|
|
21
|
+
}
|
|
22
|
+
async getPageById(id) {
|
|
23
|
+
const result = await this.config.apiClient.query({
|
|
24
|
+
query: GET_PAGE_BY_ID,
|
|
25
|
+
variables: {
|
|
26
|
+
id
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.checkForErrors("getPageById", result.websiteBuilder.getPageById);
|
|
30
|
+
return result.websiteBuilder.getPageById.data;
|
|
31
|
+
}
|
|
32
|
+
async listPages(options) {
|
|
33
|
+
const { where, ...rest } = options ?? {};
|
|
34
|
+
const result = await this.config.apiClient.query({
|
|
35
|
+
query: LIST_PUBLISHED_PAGES,
|
|
36
|
+
variables: {
|
|
37
|
+
where: {
|
|
38
|
+
...where,
|
|
39
|
+
published: true
|
|
40
|
+
},
|
|
41
|
+
...rest
|
|
42
|
+
}
|
|
43
|
+
});
|
|
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
|
+
if (ignoreActions.some((item)=>action.includes(item))) return;
|
|
57
|
+
console.error(`Could not execute "${action}". Reason: ${data.error.message}`);
|
|
35
58
|
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
this.checkForErrors("listPages", result.websiteBuilder.listPages);
|
|
39
|
-
return result.websiteBuilder.listPages.data ?? [];
|
|
40
|
-
}
|
|
41
|
-
checkForErrors(action, data) {
|
|
42
|
-
if (data.error) {
|
|
43
|
-
// TODO: investigate how these ignored actions make their way to the SDK.
|
|
44
|
-
if (ignoreActions.some(item => action.includes(item))) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
console.error(`Could not execute "${action}". Reason: ${data.error.message}`);
|
|
48
59
|
}
|
|
49
|
-
}
|
|
50
60
|
}
|
|
61
|
+
export { DefaultDataProvider };
|
|
51
62
|
|
|
52
63
|
//# sourceMappingURL=DefaultDataProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/DefaultDataProvider.js","sources":["../../src/dataProviders/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"],"names":["ignoreActions","DefaultDataProvider","config","path","result","GET_PAGE_BY_PATH","id","GET_PAGE_BY_ID","options","where","rest","LIST_PUBLISHED_PAGES","action","data","item","console"],"mappings":";;;AAUA,MAAMA,gBAAgB;IAAC;IAAe;CAAQ;AAEvC,MAAMC;IAGT,YAAYC,MAAiC,CAAE;QAC3C,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,MAAa,cAAcC,IAAY,EAA8B;QACjE,MAAMC,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YAC7C,OAAOC;YACP,WAAW;gBACPF;YACJ;QACJ;QAEA,IAAI,CAAC,cAAc,CAAC,CAAC,cAAc,EAAEA,MAAM,EAAEC,OAAO,cAAc,CAAC,aAAa;QAEhF,OAAOA,OAAO,cAAc,CAAC,aAAa,CAAC,IAAI;IACnD;IAEA,MAAa,YAAYE,EAAU,EAA8B;QAC7D,MAAMF,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YAC7C,OAAOG;YACP,WAAW;gBACPD;YACJ;QACJ;QAEA,IAAI,CAAC,cAAc,CAAC,eAAeF,OAAO,cAAc,CAAC,WAAW;QAEpE,OAAOA,OAAO,cAAc,CAAC,WAAW,CAAC,IAAI;IACjD;IAEA,MAAa,UAAUI,OAA0B,EAA4B;QACzE,MAAM,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGF,WAAW,CAAC;QAEvC,MAAMJ,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YAC7C,OAAOO;YACP,WAAW;gBACP,OAAO;oBACH,GAAGF,KAAK;oBACR,WAAW;gBACf;gBACA,GAAGC,IAAI;YACX;QACJ;QAEA,IAAI,CAAC,cAAc,CAAC,aAAaN,OAAO,cAAc,CAAC,SAAS;QAEhE,OAAO;YACH,MAAMA,OAAO,cAAc,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE;YAChD,MAAMA,OAAO,cAAc,CAAC,SAAS,CAAC,IAAI,IAAI;gBAC1C,cAAc;gBACd,YAAY;gBACZ,QAAQ;YACZ;QACJ;IACJ;IAEQ,eAAeQ,MAAc,EAAEC,IAAS,EAAE;QAC9C,IAAIA,KAAK,KAAK,EAAE;YAEZ,IAAIb,cAAc,IAAI,CAACc,CAAAA,OAAQF,OAAO,QAAQ,CAACE,QAC3C;YAEJC,QAAQ,KAAK,CAAC,CAAC,mBAAmB,EAAEH,OAAO,WAAW,EAAEC,KAAK,KAAK,CAAC,OAAO,EAAE;QAChF;IACJ;AACJ"}
|
|
@@ -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 extensions\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,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const GET_PAGE_BY_ID = `
|
|
2
2
|
query GetPageById($id: ID!) {
|
|
3
3
|
websiteBuilder {
|
|
4
4
|
getPageById(id: $id) {
|
|
@@ -8,6 +8,7 @@ export const GET_PAGE_BY_ID = /* GraphQL*/`
|
|
|
8
8
|
elements
|
|
9
9
|
bindings
|
|
10
10
|
extensions
|
|
11
|
+
languagePaths
|
|
11
12
|
}
|
|
12
13
|
error {
|
|
13
14
|
code
|
|
@@ -18,5 +19,6 @@ export const GET_PAGE_BY_ID = /* GraphQL*/`
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
`;
|
|
22
|
+
export { GET_PAGE_BY_ID };
|
|
21
23
|
|
|
22
24
|
//# sourceMappingURL=GET_PAGE_BY_ID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/GET_PAGE_BY_ID.js","sources":["../../src/dataProviders/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"],"names":["GET_PAGE_BY_ID"],"mappings":"AAAO,MAAMA,iBAA8B,CAAC;;;;;;;;;;;;;;;;;;;;AAoB5C,CAAC"}
|
|
@@ -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 extensions\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,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const GET_PAGE_BY_PATH = `
|
|
2
2
|
query GetPageByPath($path: String!) {
|
|
3
3
|
websiteBuilder {
|
|
4
4
|
getPageByPath(path: $path) {
|
|
@@ -8,6 +8,7 @@ export const GET_PAGE_BY_PATH = /* GraphQL*/`
|
|
|
8
8
|
elements
|
|
9
9
|
bindings
|
|
10
10
|
extensions
|
|
11
|
+
languagePaths
|
|
11
12
|
}
|
|
12
13
|
error {
|
|
13
14
|
code
|
|
@@ -18,5 +19,6 @@ export const GET_PAGE_BY_PATH = /* GraphQL*/`
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
`;
|
|
22
|
+
export { GET_PAGE_BY_PATH };
|
|
21
23
|
|
|
22
24
|
//# sourceMappingURL=GET_PAGE_BY_PATH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/GET_PAGE_BY_PATH.js","sources":["../../src/dataProviders/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"],"names":["GET_PAGE_BY_PATH"],"mappings":"AAAO,MAAMA,mBAAgC,CAAC;;;;;;;;;;;;;;;;;;;;AAoB9C,CAAC"}
|
|
@@ -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,14 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
query ListPublishedPages(
|
|
1
|
+
const LIST_PUBLISHED_PAGES = `
|
|
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
|
-
bindings
|
|
14
|
+
metadata
|
|
10
15
|
extensions
|
|
11
16
|
}
|
|
17
|
+
meta {
|
|
18
|
+
hasMoreItems
|
|
19
|
+
totalCount
|
|
20
|
+
cursor
|
|
21
|
+
}
|
|
12
22
|
error {
|
|
13
23
|
code
|
|
14
24
|
message
|
|
@@ -18,5 +28,6 @@ export const LIST_PUBLISHED_PAGES = /* GraphQL*/`
|
|
|
18
28
|
}
|
|
19
29
|
}
|
|
20
30
|
`;
|
|
31
|
+
export { LIST_PUBLISHED_PAGES };
|
|
21
32
|
|
|
22
33
|
//# sourceMappingURL=LIST_PUBLISHED_PAGES.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/LIST_PUBLISHED_PAGES.js","sources":["../../src/dataProviders/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"],"names":["LIST_PUBLISHED_PAGES"],"mappings":"AAAO,MAAMA,uBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BlD,CAAC"}
|
|
@@ -1,7 +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
|
+
}>;
|
|
6
14
|
listRedirects(): Promise<PublicRedirect[]>;
|
|
7
15
|
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
class NullDataProvider {
|
|
2
|
+
getPageById() {
|
|
3
|
+
return Promise.resolve(null);
|
|
4
|
+
}
|
|
5
|
+
getPageByPath() {
|
|
6
|
+
return Promise.resolve(null);
|
|
7
|
+
}
|
|
8
|
+
async listPages() {
|
|
9
|
+
return {
|
|
10
|
+
data: [],
|
|
11
|
+
meta: {
|
|
12
|
+
hasMoreItems: false,
|
|
13
|
+
totalCount: 0,
|
|
14
|
+
cursor: null
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
listRedirects() {
|
|
19
|
+
return Promise.resolve([]);
|
|
20
|
+
}
|
|
14
21
|
}
|
|
22
|
+
export { NullDataProvider };
|
|
15
23
|
|
|
16
24
|
//# sourceMappingURL=NullDataProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/NullDataProvider.js","sources":["../../src/dataProviders/NullDataProvider.ts"],"sourcesContent":["import type { IDataProvider, PublicRedirect } from \"~/types.js\";\nimport type { PublicPage } from \"~/types.js\";\n\nexport class NullDataProvider implements IDataProvider {\n getPageById(): Promise<PublicPage | null> {\n return Promise.resolve(null);\n }\n\n getPageByPath(): Promise<PublicPage | null> {\n return Promise.resolve(null);\n }\n\n public async listPages() {\n return { data: [], meta: { hasMoreItems: false, totalCount: 0, cursor: null } };\n }\n\n listRedirects(): Promise<PublicRedirect[]> {\n return Promise.resolve([]);\n }\n}\n"],"names":["NullDataProvider","Promise"],"mappings":"AAGO,MAAMA;IACT,cAA0C;QACtC,OAAOC,QAAQ,OAAO,CAAC;IAC3B;IAEA,gBAA4C;QACxC,OAAOA,QAAQ,OAAO,CAAC;IAC3B;IAEA,MAAa,YAAY;QACrB,OAAO;YAAE,MAAM,EAAE;YAAE,MAAM;gBAAE,cAAc;gBAAO,YAAY;gBAAG,QAAQ;YAAK;QAAE;IAClF;IAEA,gBAA2C;QACvC,OAAOA,QAAQ,OAAO,CAAC,EAAE;IAC7B;AACJ"}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
async getRedirectByPath(path) {
|
|
7
|
-
await this.populateCache();
|
|
8
|
-
if (!this.redirectsCache) {
|
|
9
|
-
return undefined;
|
|
1
|
+
class RedirectsProvider {
|
|
2
|
+
constructor(apiClient){
|
|
3
|
+
this.redirectsCache = void 0;
|
|
4
|
+
this.apiClient = apiClient;
|
|
10
5
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
async getRedirectByPath(path) {
|
|
7
|
+
await this.populateCache();
|
|
8
|
+
if (!this.redirectsCache) return;
|
|
9
|
+
return this.redirectsCache.get(path);
|
|
10
|
+
}
|
|
11
|
+
async getAllRedirects() {
|
|
12
|
+
await this.populateCache();
|
|
13
|
+
return this.redirectsCache ?? new Map();
|
|
14
|
+
}
|
|
15
|
+
async populateCache() {
|
|
16
|
+
const redirects = await this.apiClient.fetch({
|
|
17
|
+
path: "/wb/redirects",
|
|
18
|
+
cache: "no-cache",
|
|
19
|
+
next: {
|
|
20
|
+
revalidate: 0
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
this.redirectsCache = new Map();
|
|
24
|
+
for (const redirect of redirects)this.redirectsCache.set(redirect.from, redirect);
|
|
28
25
|
}
|
|
29
|
-
}
|
|
30
26
|
}
|
|
27
|
+
export { RedirectsProvider };
|
|
31
28
|
|
|
32
29
|
//# sourceMappingURL=RedirectsProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dataProviders/RedirectsProvider.js","sources":["../../src/dataProviders/RedirectsProvider.ts"],"sourcesContent":["import type { ApiClient } from \"./ApiClient.js\";\nimport type { IRedirects } from \"~/IRedirects.js\";\nimport type { PublicRedirect } from \"~/types.js\";\n\nexport class RedirectsProvider implements IRedirects {\n private redirectsCache: Map<string, PublicRedirect> | undefined = undefined;\n private apiClient: ApiClient;\n\n constructor(apiClient: ApiClient) {\n this.apiClient = apiClient;\n }\n\n async getRedirectByPath(path: string): Promise<PublicRedirect | undefined> {\n await this.populateCache();\n\n if (!this.redirectsCache) {\n return undefined;\n }\n\n return this.redirectsCache.get(path);\n }\n\n async getAllRedirects(): Promise<Map<string, PublicRedirect>> {\n await this.populateCache();\n return this.redirectsCache ?? new Map();\n }\n\n private async populateCache() {\n const redirects: PublicRedirect[] = await this.apiClient.fetch({\n path: \"/wb/redirects\",\n cache: \"no-cache\",\n next: {\n revalidate: 0\n }\n });\n\n this.redirectsCache = new Map();\n for (const redirect of redirects) {\n this.redirectsCache.set(redirect.from, redirect);\n }\n }\n}\n"],"names":["RedirectsProvider","apiClient","undefined","path","Map","redirects","redirect"],"mappings":"AAIO,MAAMA;IAIT,YAAYC,SAAoB,CAAE;aAH1B,cAAc,GAA4CC;QAI9D,IAAI,CAAC,SAAS,GAAGD;IACrB;IAEA,MAAM,kBAAkBE,IAAY,EAAuC;QACvE,MAAM,IAAI,CAAC,aAAa;QAExB,IAAI,CAAC,IAAI,CAAC,cAAc,EACpB;QAGJ,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAACA;IACnC;IAEA,MAAM,kBAAwD;QAC1D,MAAM,IAAI,CAAC,aAAa;QACxB,OAAO,IAAI,CAAC,cAAc,IAAI,IAAIC;IACtC;IAEA,MAAc,gBAAgB;QAC1B,MAAMC,YAA8B,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAC3D,MAAM;YACN,OAAO;YACP,MAAM;gBACF,YAAY;YAChB;QACJ;QAEA,IAAI,CAAC,cAAc,GAAG,IAAID;QAC1B,KAAK,MAAME,YAAYD,UACnB,IAAI,CAAC,cAAc,CAAC,GAAG,CAACC,SAAS,IAAI,EAAEA;IAE/C;AACJ"}
|