diff --git a/Writerside/topics/Configuration.md b/Writerside/topics/Configuration.md index c86126e..c5fe430 100644 --- a/Writerside/topics/Configuration.md +++ b/Writerside/topics/Configuration.md @@ -1,6 +1,5 @@ # Configuration - -Start typing here... +This section of documentation is dedicated to configuration of providers. Each provider has it's own configuration options and this section will only shared configuration options between all providers. ## Configuration ### Json Options Schema ```json @@ -11,5 +10,10 @@ Start typing here... This flag is responsible by enabling / disabling adding logs to Umbraco Audit log. Default value is true. #### Preview Flag This flag is responsible by enabling / disabling refreshment of preview in cases when CDN is enabled on preview Urls(not recommended). Default value is false. +#### ReferencePurge +This flag is responsible by enabling / disabling refreshment of content referencing current page(not recommended). Default value is false. This is not recommended as it can cause performance issues. #### Development Mode Flag -This flag is responsible by enabling / disabling development mode for provider and logging more details to Umbraco log. Default value is false. \ No newline at end of file +This flag is responsible by enabling / disabling development mode for provider and should be use only when working with changes in UI as allows to bootstrap Vite compiler and do live reloads. Default value is false. + +## Umbraco Configuration +When using provider, it is highly recommend to use Culture and hostnames for each language. If you don't have hostnames for each language, languages will be send to provider based on umbraco url(https://github.com/umbraco/Umbraco-CMS/blob/2e61d6449ae8e0c837dafa1e93ac950eda36c4f2/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs#L68) and this will cause issues in load balancing scenarios. diff --git a/Writerside/topics/api-docs.md b/Writerside/topics/api-docs.md index 2b8de20..5fb4827 100644 --- a/Writerside/topics/api-docs.md +++ b/Writerside/topics/api-docs.md @@ -4,7 +4,7 @@ ## Introduction -This is document in progress +This project was started as there was lack of good CDN integration providers for umbraco. Previous providers were not working as expected or were not maintained anymore. ## What you can do using CDN integration provider for umbraco diff --git a/docs/webHelpADOC2-all.zip b/docs/webHelpADOC2-all.zip index 25b0386..945dfcb 100644 Binary files a/docs/webHelpADOC2-all.zip and b/docs/webHelpADOC2-all.zip differ diff --git a/src/bielu.Umbraco.Cdn.Core/Configuration/BieluCdnOptions.cs b/src/bielu.Umbraco.Cdn.Core/Configuration/BieluCdnOptions.cs index 93834ab..ce056e6 100644 --- a/src/bielu.Umbraco.Cdn.Core/Configuration/BieluCdnOptions.cs +++ b/src/bielu.Umbraco.Cdn.Core/Configuration/BieluCdnOptions.cs @@ -13,4 +13,6 @@ public class BieluCdnOptions [SchemaPrefix] [JsonIgnore] public static string SectionName { get; set; } = $"{CdnConstants.CdnConfigSectionName}"; + + public bool ReferencePurge { get; set; } = false; } \ No newline at end of file diff --git a/src/bielu.Umbraco.Cdn.Core/NotitificationHandlers/Content/ContentEventsNotificationNotificationHandler.cs b/src/bielu.Umbraco.Cdn.Core/NotitificationHandlers/Content/ContentEventsNotificationNotificationHandler.cs index a435738..a93717e 100644 --- a/src/bielu.Umbraco.Cdn.Core/NotitificationHandlers/Content/ContentEventsNotificationNotificationHandler.cs +++ b/src/bielu.Umbraco.Cdn.Core/NotitificationHandlers/Content/ContentEventsNotificationNotificationHandler.cs @@ -6,6 +6,7 @@ using bielu.Umbraco.Cdn.Core.Configuration; using bielu.Umbraco.Cdn.Core.Services; using bielu.Umbraco.Cdn.Services; +using Lucene.Net.Util; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -51,13 +52,7 @@ public async Task HandleAsync(ContentMovingNotification notification, Cancellati var currentUser = _accessor.BackOfficeSecurity.CurrentUser; foreach (var content in notification.MoveInfoCollection) { - if (_configuration.Auditing) - { - _auditService.Add(AuditType.Custom, currentUser.Id, content.Entity.Id, "CDN Refresh", - $"CDN cache was purged", $"CDN cache purged"); - } - - pages.AddRange(_umbracoUrlDeliveryService.GetUrlsById(content.Entity)); + pages.AddRange(GetPages(content.Entity)); } //todo: optimize as now we dont valide which domains is valid for either of cdns @@ -91,21 +86,31 @@ public async Task HandleAsync(ContentMovingNotification notification, Cancellati } } + private List GetPages(IContent content) + { + var currentUser = _accessor.BackOfficeSecurity.CurrentUser; + var pages = new List(); + if (_configuration.Auditing) + { + _auditService.Add(AuditType.Custom, currentUser.Id, content.Id, "CDN Refresh", + $"CDN cache was purged", $"CDN cache purged"); + } + pages.AddRange(_umbracoUrlDeliveryService.GetUrlsByIContent(content)); + if (_configuration.ReferencePurge) + { + pages.AddRange(_umbracoUrlDeliveryService.GetUrlsByReferences(content)); + } + + return pages; + } public async Task HandleAsync(ContentDeletingNotification notification, CancellationToken cancellationToken) { var pages = new List(); - var currentUser = _accessor.BackOfficeSecurity.CurrentUser; foreach (var content in notification.DeletedEntities) { - if (_configuration.Auditing) - { - _auditService.Add(AuditType.Custom, currentUser.Id, content.Id, "CDN Refresh", - $"CDN cache was purged", $"CDN cache purged"); - } - - pages.AddRange(_umbracoUrlDeliveryService.GetUrlsById(content)); + pages.AddRange(GetPages(content)); } //todo: optimize as now we dont valide which domains is valid for either of cdns @@ -208,13 +213,7 @@ public async Task HandleAsync(ContentPublishedNotification notification, Cancell var pages = new List(); foreach (var content in notification.PublishedEntities) { - if (_configuration.Auditing) - { - _auditService.Add(AuditType.Custom, currentUser.Id, content.Id, "CDN Refresh", - $"CDN cache was purged", $"CDN cache purged"); - } - - pages.AddRange(_umbracoUrlDeliveryService.GetUrlsById(content)); + pages.AddRange(GetPages(content)); } try @@ -259,19 +258,10 @@ public async Task HandleAsync(ContentPublishedNotification notification, Cancell public async Task HandleAsync(ContentUnpublishingNotification notification, CancellationToken cancellationToken) { - var currentUser = _accessor.BackOfficeSecurity.CurrentUser; var pages = new List(); - - foreach (var content in notification.UnpublishedEntities) { - if (_configuration.Auditing) - { - _auditService.Add(AuditType.Custom, currentUser.Id, content.Id, "CDN Refresh", - $"CDN cache was purged", $"CDN cache purged"); - } - - pages.AddRange(_umbracoUrlDeliveryService.GetUrlsById(content)); + pages.AddRange(GetPages(content)); } notification.State["purgedUrls"] = pages; @@ -289,10 +279,7 @@ public async Task HandleAsync(ContentPublishingNotification notification, Cancel { if (content.Published) { - _auditService.Add(AuditType.Custom, currentUser.Id, content.Id, "CDN Refresh", - $"Cloudflare cache was purged", $"Clouflare cache purged"); - - pages.AddRange(_umbracoUrlDeliveryService.GetUrlsById(content)); + pages.AddRange(GetPages(content)); } } @@ -320,13 +307,7 @@ public async Task HandleAsync(ContentSavedNotification notification, Cancellatio { if (content.Published) { - if (_configuration.Auditing) - { - _auditService.Add(AuditType.Custom, currentUser.Id, content.Id, "CDN Refresh", - $"CDN cache was purged", $"CDN cache purged"); - } - - pages.AddRange(_umbracoUrlDeliveryService.GetUrlsById(content)); + pages.AddRange(GetPages(content)); } } diff --git a/src/bielu.Umbraco.Cdn.Core/Services/IUmbracoUrlDeliveryService.cs b/src/bielu.Umbraco.Cdn.Core/Services/IUmbracoUrlDeliveryService.cs index b0ac76f..2be1e9b 100644 --- a/src/bielu.Umbraco.Cdn.Core/Services/IUmbracoUrlDeliveryService.cs +++ b/src/bielu.Umbraco.Cdn.Core/Services/IUmbracoUrlDeliveryService.cs @@ -5,6 +5,7 @@ namespace bielu.Umbraco.Cdn.Core.Services { public interface IUmbracoUrlDeliveryService { - public List GetUrlsById(IContent content, bool includeDescendants = false); + public List GetUrlsByIContent(IContent content, bool includeDescendants = false); + public List GetUrlsByReferences(IContent content, bool includeDescendants = false); } } \ No newline at end of file diff --git a/src/bielu.Umbraco.Cdn.Core/Services/UmbracoUrlDeliveryService.cs b/src/bielu.Umbraco.Cdn.Core/Services/UmbracoUrlDeliveryService.cs index 3d95bfe..e01f876 100644 --- a/src/bielu.Umbraco.Cdn.Core/Services/UmbracoUrlDeliveryService.cs +++ b/src/bielu.Umbraco.Cdn.Core/Services/UmbracoUrlDeliveryService.cs @@ -5,6 +5,7 @@ using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Web; +using Umbraco.Cms.Web.Common.AspNetCore; using Umbraco.Extensions; namespace bielu.Umbraco.Cdn.Core.Services @@ -13,38 +14,95 @@ public class UmbracoUrlDeliveryService : IUmbracoUrlDeliveryService { private readonly IDomainService _domainService; private readonly IUmbracoContextFactory _contextFactory; + private readonly ITrackedReferencesService _trackedReferencesService; + private readonly IRequestAccessor _requestAccessor; - public UmbracoUrlDeliveryService(IDomainService domainService, IUmbracoContextFactory contextFactory) + public UmbracoUrlDeliveryService(IDomainService domainService, IUmbracoContextFactory contextFactory, + ITrackedReferencesService trackedReferencesService,IRequestAccessor requestAccessor) { _domainService = domainService; _contextFactory = contextFactory; + _trackedReferencesService = trackedReferencesService; + _requestAccessor = requestAccessor; } - public List GetUrlsById(IContent content, bool includeDescendants = false) + public List GetUrlsByIContent(IContent content, bool includeDescendants = false) { List urls = new List(); if (content == null) { return urls; } + foreach (var url in GetUrl(content)) { urls.AddRange(BuildDomainUrls(new List() { url }, GetDomains(content))); + } + + return urls; + } + public List GetUrlsByReferences(IContent content, bool includeDescendants = false) + { + var urls = new List(); + var references = _trackedReferencesService.GetPagedItemsWithRelations(new[] { content.Id }, 0, 1000, false); + urls.AddRange(GetUrlFromReferencePage(references.Items)); + for (int i = 1; i < references.TotalPages; i++) + { + references = _trackedReferencesService.GetPagedItemsWithRelations(new[] { content.Id }, i, 1000, false); + urls.AddRange(GetUrlFromReferencePage(references.Items)); } + + return urls; + } + + private List GetUrlFromReferencePage(IEnumerable? referencesItems) + { + List urls = new List(); + using (var contextReference = _contextFactory.EnsureUmbracoContext()) + { + foreach (var relationItem in referencesItems) + { + IPublishedContent item = null; + switch (relationItem.NodeUdi.EntityType) + { + case global::Umbraco.Cms.Core.Constants.UdiEntityType.DocumentType: + item = contextReference.UmbracoContext.Content.GetById(relationItem.NodeId); + + break; + case global::Umbraco.Cms.Core.Constants.UdiEntityType.Media: + item = contextReference.UmbracoContext.Media.GetById(relationItem.NodeId); + + break; + } + + if (item == null) continue; + urls.AddRange(BuildDomainUrls(new List() { item.Url(mode: UrlMode.Absolute) }, + GetDomains(item))); + } + } + return urls; } private IEnumerable BuildDomainUrls(List urls, List assignedDomains) { var list = new List(); - if (urls == null || urls.All(x=>string.IsNullOrWhiteSpace(x))) return list; - if(assignedDomains == null || !assignedDomains.Any()) return list; - foreach (var url in urls. Where(x=>!string.IsNullOrWhiteSpace(x))) + if (urls == null || urls.All(x => string.IsNullOrWhiteSpace(x))) return list; + if (assignedDomains == null || !assignedDomains.Any()) + { + var domain = (_requestAccessor as AspNetCoreRequestAccessor).GetApplicationUrl().GetLeftPart(UriPartial.Authority); + foreach (var url in urls.Where(x => !string.IsNullOrWhiteSpace(x))) + { + + list.Add(CombinePaths(domain, url)); + } + } + foreach (var url in urls.Where(x => !string.IsNullOrWhiteSpace(x))) { foreach (var domain in assignedDomains) { - list.Add(CombinePaths(domain.DomainName,url.Replace(domain.RootContentId.ToString(),""))); + list.Add(CombinePaths(domain.DomainName, url.Replace(domain.RootContentId.ToString(), ""))); } } @@ -55,12 +113,22 @@ private List GetDomains(IContent content) { var list = new List(); //Termination case - if (content == null ) + if (content == null) { return list; } - foreach (var id in content.Path.Split(',')) + list.AddRange(GetDomainByPath(content.Path)); + + + return list; + } + + private List GetDomainByPath(string path) + { + var list = new List(); + + foreach (var id in path.Split(',')) { var numericId = int.Parse(id); if (numericId < 0) @@ -73,47 +141,68 @@ private List GetDomains(IContent content) list.AddRange(validDomain); } + + return list; + } + + private List GetDomains(IPublishedContent content) + { + var list = new List(); + //Termination case + if (content == null) + { + return list; + } + + list.AddRange(GetDomainByPath(content.Path)); + return list; } + private List GetUrl(IContent content) { using (var contextReference = _contextFactory.EnsureUmbracoContext()) { var urls = new List(); var route = contextReference.UmbracoContext.Content.GetRouteById(content.Id); - + if (!string.IsNullOrWhiteSpace(route)) { - urls.Add(route); + urls.Add(route); } + urls.Add(content.Id.ToString()); - IPublishedContent publishedContent = contextReference.UmbracoContext.Content.GetById(content.Id); - foreach (var culture in content.EditedCultures) - { - urls.Add(contextReference.UmbracoContext.Content.GetRouteById(false, content.Id, culture)); - } - return urls; + IPublishedContent publishedContent = contextReference.UmbracoContext.Content.GetById(content.Id); + foreach (var culture in content.EditedCultures) + { + urls.Add(contextReference.UmbracoContext.Content.GetRouteById(false, content.Id, culture)); + } + + return urls; } } + public string CombinePaths(string domain, string url) { if (url.Contains(domain)) { return url; } - if(domain.EndsWith("/") && url.StartsWith("/")) + + if (domain.EndsWith("/") && url.StartsWith("/")) { //strip the first / so they aren't doubled up when we combine them. domain = domain.TrimEnd('/'); } - else if(!domain.EndsWith("/") && !url.StartsWith("/")) + else if (!domain.EndsWith("/") && !url.StartsWith("/")) { //neight of them had a / so we have to add one. domain = domain + "/"; } + //on purpose we support only https - return (domain.Contains("https://")? "": "https://")+ domain + url; + return (domain.Contains("https://") ? "" : "https://") + domain + url; } } } \ No newline at end of file diff --git a/src/bielu.Umbraco.Cdn.Core/schema/appsettings-schema.BieluCdnOptions.json b/src/bielu.Umbraco.Cdn.Core/schema/appsettings-schema.BieluCdnOptions.json index 4504d9a..0b891ee 100644 --- a/src/bielu.Umbraco.Cdn.Core/schema/appsettings-schema.BieluCdnOptions.json +++ b/src/bielu.Umbraco.Cdn.Core/schema/appsettings-schema.BieluCdnOptions.json @@ -11,6 +11,9 @@ }, "Preview": { "type": "boolean" + }, + "ReferencePurge": { + "type": "boolean" } } } \ No newline at end of file diff --git a/src/bielu.Umbraco.TestProject/appsettings.json b/src/bielu.Umbraco.TestProject/appsettings.json index a92e35f..99350b2 100644 --- a/src/bielu.Umbraco.TestProject/appsettings.json +++ b/src/bielu.Umbraco.TestProject/appsettings.json @@ -16,7 +16,7 @@ }, "Bielu": { "Cdn": { - "DevMode": false, + "DevMode": true, "cloudflare": { "enabled": true, "token": "-- token - use secret.json --" diff --git a/src/bielu.Umbraco.TestProject/bielu.Umbraco.TestProject.csproj b/src/bielu.Umbraco.TestProject/bielu.Umbraco.TestProject.csproj index 70f8eb6..a6759fd 100644 --- a/src/bielu.Umbraco.TestProject/bielu.Umbraco.TestProject.csproj +++ b/src/bielu.Umbraco.TestProject/bielu.Umbraco.TestProject.csproj @@ -41,7 +41,9 @@ - + + diff --git a/src/bielu.cdn.ui/.gitignore b/src/bielu.cdn.ui/.gitignore index 89970dc..1c879b2 100644 --- a/src/bielu.cdn.ui/.gitignore +++ b/src/bielu.cdn.ui/.gitignore @@ -23,4 +23,5 @@ dist-ssr *.sln *.sw? /wwwroot/App_Plugins/bielu.cdn.ui/* -!/wwwroot/App_Plugins/bielu.cdn.ui/.gitkeep \ No newline at end of file +!/wwwroot/App_Plugins/bielu.cdn.ui/.gitkeep +/types/ diff --git a/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/RefreshNodeEditor.html b/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/RefreshNodeEditor.html index 2860eeb..4074582 100644 --- a/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/RefreshNodeEditor.html +++ b/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/RefreshNodeEditor.html @@ -1,10 +1,3 @@ -
diff --git a/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/bootstrapper.js b/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/bootstrapper.js index 674af40..37e22e1 100644 --- a/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/bootstrapper.js +++ b/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/bootstrapper.js @@ -1,4 +1,4 @@ -loadModuleMap(); +//loadModuleMap(); loadModule("/App_Plugins/bielu.cdn.ui/bielu.cdn.ui.js"); function loadModule(url) { diff --git a/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/cdnDashboard.html b/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/cdnDashboard.html index 31d492c..fdf3dd6 100644 --- a/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/cdnDashboard.html +++ b/src/bielu.cdn.ui/App_Plugins/bielu.cdn.ui/cdnDashboard.html @@ -1,8 +1 @@ - \ No newline at end of file diff --git a/src/bielu.cdn.ui/package-lock.json b/src/bielu.cdn.ui/package-lock.json index 858b1cc..d9f0885 100644 --- a/src/bielu.cdn.ui/package-lock.json +++ b/src/bielu.cdn.ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "bielu.cdn.ui", - "version": "0.0.0", + "version": "2.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bielu.cdn.ui", - "version": "0.0.0", + "version": "2.0.0", "dependencies": { "moment": "^2.29.4", "vue": "^3.3.9" diff --git a/src/bielu.cdn.ui/src/components/CdnDashboard.vue b/src/bielu.cdn.ui/src/components/CdnDashboard.vue index 7146a84..c94d709 100644 --- a/src/bielu.cdn.ui/src/components/CdnDashboard.vue +++ b/src/bielu.cdn.ui/src/components/CdnDashboard.vue @@ -31,6 +31,8 @@ export default defineComponent({ } }, setup(props) { +// named, returns classes for diff --git a/src/bielu.cdn.ui/types/Services/UmbracoClient.d.ts b/src/bielu.cdn.ui/types/Services/UmbracoClient.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/bielu.cdn.ui/types/Services/service-container.d.ts b/src/bielu.cdn.ui/types/Services/service-container.d.ts deleted file mode 100644 index 421071c..0000000 --- a/src/bielu.cdn.ui/types/Services/service-container.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ManagementClient } from "./umbraco/generated/api.generated.clients"; -export declare const serviceContainer: { - managmentApiClient: ManagementClient; -}; diff --git a/src/bielu.cdn.ui/types/Services/umbraco/generated/api.generated.clients.d.ts b/src/bielu.cdn.ui/types/Services/umbraco/generated/api.generated.clients.d.ts deleted file mode 100644 index 32ee09f..0000000 --- a/src/bielu.cdn.ui/types/Services/umbraco/generated/api.generated.clients.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -import * as moment from 'moment'; -export interface IManagementClient { - getAuditHistory(): Promise; - getProviders(id?: number | undefined): Promise; - refreshForNode(id: number, providerId?: string | undefined, domain?: string | undefined): Promise; -} -export declare class ManagementClient implements IManagementClient { - private http; - private baseUrl; - protected jsonParseReviver: ((key: string, value: any) => any) | undefined; - constructor(baseUrl?: string, http?: { - fetch(url: RequestInfo, init?: RequestInit): Promise; - }); - getAuditHistory(): Promise; - protected processGetAuditHistory(response: Response): Promise; - getProviders(id?: number | undefined): Promise; - protected processGetProviders(response: Response): Promise; - refreshForNode(id: number, providerId?: string | undefined, domain?: string | undefined): Promise; - protected processRefreshForNode(response: Response): Promise; -} -export declare class AuditRecord implements IAuditRecord { - name: string | null; - date: moment.Moment; - message: string | null; - details: string | null; - username: string | null; - constructor(data?: IAuditRecord); - init(_data?: any, _mappings?: any): void; - static fromJS(data: any, _mappings?: any): AuditRecord | null; - toJSON(data?: any): any; -} -export interface IAuditRecord { - name: string | null; - date: moment.Moment; - message: string | null; - details: string | null; - username: string | null; -} -export declare class Provider implements IProvider { - enabled: boolean; - id: string | null; - name: string | null; - supportedHostnames: string[] | null; - version: string; - constructor(data?: IProvider); - init(_data?: any, _mappings?: any): void; - static fromJS(data: any, _mappings?: any): Provider | null; - toJSON(data?: any): any; -} -export interface IProvider { - enabled: boolean; - id: string | null; - name: string | null; - supportedHostnames: string[] | null; - version: string; -} -export declare class Status implements IStatus { - success: boolean; - message: string | null; - details: string | null; - errors: Errors[] | null; - exception: Exception | null; - messageType: EventMessageType | null; - constructor(data?: IStatus); - init(_data?: any, _mappings?: any): void; - static fromJS(data: any, _mappings?: any): Status | null; - toJSON(data?: any): any; -} -export interface IStatus { - success: boolean; - message: string | null; - details: string | null; - errors: Errors[] | null; - exception: Exception | null; - messageType: EventMessageType | null; -} -export declare class Errors implements IErrors { - code: number; - message: string | null; - constructor(data?: IErrors); - init(_data?: any, _mappings?: any): void; - static fromJS(data: any, _mappings?: any): Errors | null; - toJSON(data?: any): any; -} -export interface IErrors { - code: number; - message: string | null; -} -export declare class Exception implements IException { - message: string; - innerException: Exception | null; - source: string | null; - stackTrace: string | null; - constructor(data?: IException); - init(_data?: any, _mappings?: any): void; - static fromJS(data: any, _mappings?: any): Exception | null; - toJSON(data?: any): any; -} -export interface IException { - message: string; - innerException: Exception | null; - source: string | null; - stackTrace: string | null; -} -export declare enum EventMessageType { - Default = 0, - Info = 1, - Error = 2, - Success = 3, - Warning = 4 -} -export declare class ApiException extends Error { - message: string; - status: number; - response: string; - headers: { - [key: string]: any; - }; - result: any; - constructor(message: string, status: number, response: string, headers: { - [key: string]: any; - }, result: any); - protected isApiException: boolean; - static isApiException(obj: any): obj is ApiException; -} diff --git a/src/bielu.cdn.ui/types/Types/CommonTypes.d.ts b/src/bielu.cdn.ui/types/Types/CommonTypes.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/bielu.cdn.ui/types/components/CdnDashboard.vue.d.ts b/src/bielu.cdn.ui/types/components/CdnDashboard.vue.d.ts deleted file mode 100644 index 9962fd1..0000000 --- a/src/bielu.cdn.ui/types/components/CdnDashboard.vue.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import '@umbraco-ui/uui-button'; -import '@umbraco-ui/uui-select'; -import '@umbraco-ui/uui-loader-bar'; -import { Provider } from "../Services/umbraco/generated/api.generated.clients"; -import { PropType } from 'vue'; -declare const _default: import("vue").DefineComponent<{ - message: StringConstructor; - providers: { - type: PropType; - required: true; - }; -}, void, { - loading: boolean; - message: string; - providers: Provider[]; - currentDomain: string; - currentProvider: string; -}, {}, { - refreshAllProviders(): Promise; - refreshProvider(provider: Provider): Promise; - refreshDomain(domain: string): Promise; - fetchData(): Promise; -}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly; - required: true; - }; -}>>, {}, {}>; -export default _default; diff --git a/src/bielu.cdn.ui/types/components/RefreshNode.vue.d.ts b/src/bielu.cdn.ui/types/components/RefreshNode.vue.d.ts deleted file mode 100644 index 0e5d550..0000000 --- a/src/bielu.cdn.ui/types/components/RefreshNode.vue.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -import '@umbraco-ui/uui-button'; -import '@umbraco-ui/uui-select'; -import '@umbraco-ui/uui-loader-bar'; -import { PropType } from 'vue'; -import { Status } from "../Services/umbraco/generated/api.generated.clients"; -declare const _default: import("vue").DefineComponent<{ - loading: { - type: BooleanConstructor; - default: boolean; - }; - nodeId: { - type: NumberConstructor; - default: number; - }; - message: StringConstructor; - providers: { - type: PropType; - default: () => Option[]; - }; - currentDomains: { - type: PropType; - default: () => Option[]; - }; - domains: { - type: PropType; - default: () => Option[]; - }; -}, void, { - loading: boolean; - message: string; - providers: any[]; - currentDomain: string; - currentProvider: string; -}, {}, { - selectProvider(object: any): Promise; - selectDomain(object: any): Promise; - sendData(): Promise; - fetchData(): Promise; -}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { - refrehsnodesubmit: (result: Status) => true; -}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly; - default: () => Option[]; - }; - currentDomains: { - type: PropType; - default: () => Option[]; - }; - domains: { - type: PropType; - default: () => Option[]; - }; -}>> & { - onRefrehsnodesubmit?: (result: Status) => any; -}, { - providers: Option[]; - loading: boolean; - nodeId: number; - currentDomains: Option[]; - domains: Option[]; -}, {}>; -export default _default; diff --git a/src/bielu.cdn.ui/types/main.d.ts b/src/bielu.cdn.ui/types/main.d.ts deleted file mode 100644 index 4d01025..0000000 --- a/src/bielu.cdn.ui/types/main.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import './style.css'; -import './style.css'; diff --git a/src/bielu.cdn.ui/types/stories/Dashboard.stories.d.ts b/src/bielu.cdn.ui/types/stories/Dashboard.stories.d.ts deleted file mode 100644 index 0618af3..0000000 --- a/src/bielu.cdn.ui/types/stories/Dashboard.stories.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { StoryObj } from '@storybook/vue3'; -declare const meta: { - title: string; - component: import("vue").DefineComponent<{ - message: StringConstructor; - providers: { - type: import("vue").PropType; - required: true; - }; - }, void, { - loading: boolean; - message: string; - providers: import("../Services/umbraco/generated/api.generated.clients").Provider[]; - currentDomain: string; - currentProvider: string; - }, {}, { - refreshAllProviders(): Promise; - refreshProvider(provider: import("../Services/umbraco/generated/api.generated.clients").Provider): Promise; - refreshDomain(domain: string): Promise; - fetchData(): Promise; - }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly; - required: true; - }; - }>>, {}, {}>; - render: () => { - components: { - CdnDashboard: import("vue").DefineComponent<{ - message: StringConstructor; - providers: { - type: import("vue").PropType; - required: true; - }; - }, void, { - loading: boolean; - message: string; - providers: import("../Services/umbraco/generated/api.generated.clients").Provider[]; - currentDomain: string; - currentProvider: string; - }, {}, { - refreshAllProviders(): Promise; - refreshProvider(provider: import("../Services/umbraco/generated/api.generated.clients").Provider): Promise; - refreshDomain(domain: string): Promise; - fetchData(): Promise; - }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly; - required: true; - }; - }>>, {}, {}>; - }; - template: string; - }; - parameters: { - layout: string; - }; - tags: string[]; -}; -export default meta; -type Story = StoryObj; -export declare const LoggedIn: Story; diff --git a/src/bielu.cdn.ui/types/stories/RefreshNode.stories.d.ts b/src/bielu.cdn.ui/types/stories/RefreshNode.stories.d.ts deleted file mode 100644 index 373443c..0000000 --- a/src/bielu.cdn.ui/types/stories/RefreshNode.stories.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { StoryObj } from '@storybook/vue3'; -import RefreshNode from "../components/RefreshNode.vue"; -declare const meta: { - title: string; - component: import("vue").DefineComponent<{ - loading: { - type: BooleanConstructor; - default: boolean; - }; - nodeId: { - type: NumberConstructor; - default: number; - }; - message: StringConstructor; - providers: { - type: import("vue").PropType; - default: () => Option[]; - }; - currentDomains: { - type: import("vue").PropType; - default: () => Option[]; - }; - domains: { - type: import("vue").PropType; - default: () => Option[]; - }; - }, void, { - loading: boolean; - message: string; - providers: any[]; - currentDomain: string; - currentProvider: string; - }, {}, { - selectProvider(object: any): Promise; - selectDomain(object: any): Promise; - sendData(): Promise; - fetchData(): Promise; - }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { - refrehsnodesubmit: (result: import("../Services/umbraco/generated/api.generated.clients").Status) => true; - }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly; - default: () => Option[]; - }; - currentDomains: { - type: import("vue").PropType; - default: () => Option[]; - }; - domains: { - type: import("vue").PropType; - default: () => Option[]; - }; - }>> & { - onRefrehsnodesubmit?: (result: import("../Services/umbraco/generated/api.generated.clients").Status) => any; - }, { - providers: Option[]; - loading: boolean; - nodeId: number; - currentDomains: Option[]; - domains: Option[]; - }, {}>; -}; -export default meta; -type Story = StoryObj; -export declare const Primary: Story; diff --git a/src/bielu.cdn.ui/vite.config.ts b/src/bielu.cdn.ui/vite.config.ts index 600a9f5..77348be 100644 --- a/src/bielu.cdn.ui/vite.config.ts +++ b/src/bielu.cdn.ui/vite.config.ts @@ -2,11 +2,12 @@ import {resolve} from "path"; import {defineConfig} from 'vite'; import vue from '@vitejs/plugin-vue'; import dts from "vite-plugin-dts"; +import type { PluginOption } from 'vite' // https://vitejs.dev/config/ import { cert, key } from "./build/certs" - +import { viteVueCE } from 'unplugin-vue-ce' export default defineConfig({ - plugins: [vue(), dts()], + plugins: [vue(), dts(), viteVueCE() as PluginOption,], build: { lib: { entry: resolve(__dirname, 'src/main.ts'), @@ -15,14 +16,7 @@ export default defineConfig({ }, outDir: './wwwroot/App_Plugins/bielu.Cdn.UI/', emptyOutDir: false, - rollupOptions: { - external: ["vue"], - output: { - globals: { - vue: "Vue" - } - } - } + }, define: { 'process.env': {}