Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="Umbraco.Cms" Version="17.3.0" />
<PackageVersion Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
<PackageVersion Include="Umbraco.Cms.DevelopmentMode.Backoffice" Version="17.3.0" />
<PackageVersion Include="Clean.Core" Version="7.0.5" />
</ItemGroup>
<!-- umbraco libraries for packages -->
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
...defaultPlugins,
{
name: '@hey-api/client-fetch',
runtimeConfigPath: '../hey-api',
exportFromIndex: true,
throwOnError: true,
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"homepage": "https://jumoo.co.uk/uSync",
"license": "MPL-2.0",
"type": "module",
"version": "17.1.0",
"version": "17.3.0",
"main": "./dist/usync.js",
"types": "./dist/index.d.ts",
"module": "./dist/usync.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts

import { createClientConfig } from '../hey-api';

import { type ClientOptions, type Config, createClient, createConfig } from './client';
import type { ClientOptions as ClientOptions2 } from './types.gen';

Expand All @@ -13,4 +15,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
*/
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;

export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:16903', throwOnError: true }));
export const client = createClient(createClientConfig(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:16903', throwOnError: true })));
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

export { client, type CreateClientConfig } from './client.gen';
export { ActionsService, FoldersService, MigrationsService, type Options, SettingsService } from './sdk.gen';
export { type Assembly, type AssemblyWritable, CallingConventions, ChangeDetailType, ChangeType, type CheckLegacyData, type CheckLegacyErrors, type CheckLegacyResponse, type CheckLegacyResponses, type ClientOptions, type ConstructorInfo, type ConstructorInfoWritable, type CopyLegacyData, type CopyLegacyErrors, type CopyLegacyResponse, type CopyLegacyResponses, type CustomAttributeData, type CustomAttributeDataWritable, type CustomAttributeNamedArgument, type CustomAttributeNamedArgumentWritable, type CustomAttributeTypedArgument, type CustomAttributeTypedArgumentWritable, type DownloadData, type DownloadErrors, type DownloadResponse, type DownloadResponses, EventAttributes, type EventInfo, type EventInfoWritable, EventMessageTypeModel, type Exception, type ExceptionWritable, FieldAttributes, type FieldInfo, type FieldInfoWritable, GenericParameterAttributes, type GetActionsBySetData, type GetActionsBySetErrors, type GetActionsBySetResponse, type GetActionsBySetResponses, type GetActionsData, type GetActionsErrors, type GetActionsResponse, type GetActionsResponses, type GetAddOnsData, type GetAddOnsErrors, type GetAddonSplashData, type GetAddonSplashErrors, type GetAddonSplashResponse, type GetAddonSplashResponses, type GetAddOnsResponse, type GetAddOnsResponses, type GetHandlerSetSettingsData, type GetHandlerSetSettingsErrors, type GetHandlerSetSettingsResponse, type GetHandlerSetSettingsResponses, type GetSetsData, type GetSetsErrors, type GetSetsResponse, type GetSetsResponses, type GetSettingsData, type GetSettingsErrors, type GetSettingsResponse, type GetSettingsResponses, type HandlerSettings, HandlerStatus, type ICustomAttributeProvider, type IgnoreLegacyData, type IgnoreLegacyErrors, type IgnoreLegacyResponse, type IgnoreLegacyResponses, type ImportSingleData, type ImportSingleErrors, type ImportSingleResponse, type ImportSingleResponses, type IntPtr, LayoutKind, type MemberInfo, type MemberInfoWritable, MemberTypes, type MergeExportFolderData, type MergeExportFolderErrors, type MergeExportFolderResponse, type MergeExportFolderResponses, MethodAttributes, type MethodBase, type MethodBaseWritable, MethodImplAttributes, type MethodInfo, type MethodInfoWritable, type Module, type ModuleHandle, type ModuleWritable, type NotificationHeaderModel, ParameterAttributes, type ParameterInfo, type ParameterInfoWritable, type PerformActionData, type PerformActionErrors, type PerformActionRequest, type PerformActionResponse, type PerformActionResponse2, type PerformActionResponses, type ProcessUploadData, type ProcessUploadErrors, type ProcessUploadResponse, type ProcessUploadResponses, PropertyAttributes, type PropertyInfo, type PropertyInfoWritable, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type StructLayoutAttributeWritable, type SyncActionButton, type SyncActionGroup, SyncFolderMode, type SyncHandlerSummary, type SyncLegacyCheckResponse, SyncProcessingMode, type SyncSelectableSet, type Type, TypeAttributes, type TypeInfo, type TypeInfoWritable, type TypeWritable, type UploadImportResult, type USyncAction, type USyncActionView, type USyncActionWritable, type USyncAddonInfo, type USyncAddonSplash, type USyncChange, type USyncHandlerSetSettings, type USyncOptions, type USyncSettings } from './types.gen';
export { type Assembly, type AssemblyWritable, CallingConventions, ChangeDetailType, ChangeType, type CheckLegacyData, type CheckLegacyErrors, type CheckLegacyResponse, type CheckLegacyResponses, type ClientOptions, type ConstructorInfo, type ConstructorInfoWritable, type CopyLegacyData, type CopyLegacyErrors, type CopyLegacyResponse, type CopyLegacyResponses, type CustomAttributeData, type CustomAttributeDataWritable, type CustomAttributeNamedArgument, type CustomAttributeNamedArgumentWritable, type CustomAttributeTypedArgument, type CustomAttributeTypedArgumentWritable, type DownloadData, type DownloadErrors, type DownloadResponse, type DownloadResponses, EventAttributes, type EventInfo, type EventInfoWritable, type Exception, type ExceptionWritable, FieldAttributes, type FieldInfo, type FieldInfoWritable, GenericParameterAttributes, type GetActionsBySetData, type GetActionsBySetErrors, type GetActionsBySetResponse, type GetActionsBySetResponses, type GetActionsData, type GetActionsErrors, type GetActionsResponse, type GetActionsResponses, type GetAddOnsData, type GetAddOnsErrors, type GetAddonSplashData, type GetAddonSplashErrors, type GetAddonSplashResponse, type GetAddonSplashResponses, type GetAddOnsResponse, type GetAddOnsResponses, type GetHandlerSetSettingsData, type GetHandlerSetSettingsErrors, type GetHandlerSetSettingsResponse, type GetHandlerSetSettingsResponses, type GetSetsData, type GetSetsErrors, type GetSetsResponse, type GetSetsResponses, type GetSettingsData, type GetSettingsErrors, type GetSettingsResponse, type GetSettingsResponses, type HandlerSettings, HandlerStatus, type ICustomAttributeProvider, type IgnoreLegacyData, type IgnoreLegacyErrors, type IgnoreLegacyResponse, type IgnoreLegacyResponses, type ImportSingleData, type ImportSingleErrors, type ImportSingleResponse, type ImportSingleResponses, type IntPtr, LayoutKind, type MemberInfo, type MemberInfoWritable, MemberTypes, type MergeExportFolderData, type MergeExportFolderErrors, type MergeExportFolderResponse, type MergeExportFolderResponses, MethodAttributes, type MethodBase, type MethodBaseWritable, MethodImplAttributes, type MethodInfo, type MethodInfoWritable, type Module, type ModuleHandle, type ModuleWritable, ParameterAttributes, type ParameterInfo, type ParameterInfoWritable, type PerformActionData, type PerformActionErrors, type PerformActionRequest, type PerformActionResponse, type PerformActionResponse2, type PerformActionResponses, type ProcessUploadData, type ProcessUploadErrors, type ProcessUploadResponse, type ProcessUploadResponses, PropertyAttributes, type PropertyInfo, type PropertyInfoWritable, type RuntimeFieldHandle, type RuntimeMethodHandle, type RuntimeTypeHandle, SecurityRuleSet, type StructLayoutAttribute, type StructLayoutAttributeWritable, type SyncActionButton, type SyncActionGroup, SyncFolderMode, type SyncHandlerSummary, type SyncLegacyCheckResponse, SyncProcessingMode, type SyncSelectableSet, type Type, TypeAttributes, type TypeInfo, type TypeInfoWritable, type TypeWritable, type UploadImportResult, type USyncAction, type USyncActionView, type USyncActionWritable, type USyncAddonInfo, type USyncAddonSplash, type USyncChange, type USyncHandlerSetSettings, type USyncOptions, type USyncSettings } from './types.gen';
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ export type EventInfo = {
eventHandlerType?: Type | null;
};

export enum EventMessageTypeModel {
DEFAULT = 'Default',
INFO = 'Info',
ERROR = 'Error',
SUCCESS = 'Success',
WARNING = 'Warning'
}

export type Exception = {
targetSite?: MethodBase | null;
readonly message: string;
Expand Down Expand Up @@ -431,12 +423,6 @@ export type ModuleHandle = {
readonly mdStreamVersion: number;
};

export type NotificationHeaderModel = {
message: string;
category: string;
type: EventMessageTypeModel;
};

export enum ParameterAttributes {
NONE = 'None',
IN = 'In',
Expand Down
16 changes: 16 additions & 0 deletions uSync.Backoffice.Management.Client/usync-assets/src/hey-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { CreateClientConfig } from './api/client.gen';
import { umbHttpClient } from '@umbraco-cms/backoffice/http-client';

/**
* Pre-configure the generated client by copying the Umbraco HTTP client's config.
*
* Called automatically by the generated client during initialization (via runtimeConfigPath).
* Inherits baseUrl, credentials, auth, and headers from umbHttpClient — which is already
* configured by the backoffice before extensions load.
*
* @see https://heyapi.dev/openapi-ts/clients/fetch#configuration
*/
export const createClientConfig: CreateClientConfig = (config) => ({
...config,
...umbHttpClient.getConfig(),
});
20 changes: 0 additions & 20 deletions uSync.Backoffice.Management.Client/usync-assets/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api';
import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth';

import './components/index.js';
import './dialogs/index.js';
Expand All @@ -11,27 +10,8 @@ import './api/index.js';
export * from './exports.js';

import { manifests } from './manifests.js';
import { client } from './api/client.gen.js';

export const onInit: UmbEntryPointOnInit = (_host, extensionRegistry) => {
// register the manifests
extensionRegistry.registerMany(manifests);

_host.consumeContext(UMB_AUTH_CONTEXT, (_auth) => {
if (!_auth) return;

var config = _auth.getOpenApiConfiguration();

client.setConfig({
auth: config.token,
baseUrl: config.base,
credentials: config.credentials,
});

client.interceptors.request.use(async (request, _options) => {
const token = await _auth.getLatestToken();
request.headers.set('Authorization', `Bearer ${token}`);
return request;
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
USyncSettings,
} from '@jumoo/uSync';

export * from './components/usyncSettingItem.element.ts';
export * from './components/usyncSettingItem.element';

@customElement('usync-settings-view')
export class USyncSettingsViewElement extends UmbElementMixin(LitElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"emitDeclarationOnly": true,
"emitDeclarationOnly": false,
"useDefineForClassFields": false,
"moduleDetection": "force",
"allowJs": true,
"noEmit": false,
"composite": true,
"sourceMap": false,
"declaration": true,
"allowArbitraryExtensions": false
"allowArbitraryExtensions": false,
"allowImportingTsExtensions": false
},
"include": ["src/**/*.ts", "src/**/*.js"]
}
2 changes: 1 addition & 1 deletion uSync.History/Controllers/uSyncHistoryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace uSync.History.Controllers
[ApiController]
[uSyncVersionedRoute("history")]
[Authorize(Policy = SyncAuthorizationPolicies.TreeAccessuSync)]
[MapToApi("uSync.History")]
[MapToApi(SyncHistoryConstants.ApiName)]
[DisableBrowserCache]
[JsonOptionsName(Constants.JsonOptionsNames.BackOffice)]
[ApiVersion("1.0")]
Expand Down
4 changes: 2 additions & 2 deletions uSync.History/history-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion uSync.History/history-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "usync-history-client",
"version": "17.1.0",
"version": "17.3.0",
"licence": "Custom",
"description": "uSync history function",
"type": "module",
Expand Down
1 change: 1 addition & 0 deletions uSync.History/history-client/scripts/generate-openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ fetch(swaggerUrl).then(async (response) => {
...defaultPlugins,
{
name: '@hey-api/client-fetch',
runtimeConfigPath: '../hey-api',
exportFromIndex: true,
throwOnError: true,
},
Expand Down
12 changes: 8 additions & 4 deletions uSync.History/history-client/src/api/client.gen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts

import { createClientConfig } from "../hey-api";

import {
type ClientOptions,
type Config,
Expand All @@ -21,8 +23,10 @@ export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
) => Config<Required<ClientOptions> & T>;

export const client = createClient(
createConfig<ClientOptions2>({
baseUrl: "https://localhost:44398",
throwOnError: true,
}),
createClientConfig(
createConfig<ClientOptions2>({
baseUrl: "https://localhost:44398",
throwOnError: true,
}),
),
);
3 changes: 3 additions & 0 deletions uSync.History/history-client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ export {
ChangeDetailType,
ChangeType,
type ClearHistoryData,
type ClearHistoryErrors,
type ClearHistoryResponses,
type ClientOptions,
type GetHistoryData,
type GetHistoryErrors,
type GetHistoryResponse,
type GetHistoryResponses,
type HistoryInfo,
type HistoryIsEnabledData,
type HistoryIsEnabledErrors,
type HistoryIsEnabledResponse,
type HistoryIsEnabledResponses,
type USyncActionView,
Expand Down
27 changes: 21 additions & 6 deletions uSync.History/history-client/src/api/sdk.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import type { Client, Options as Options2, TDataShape } from "./client";
import { client } from "./client.gen";
import type {
ClearHistoryData,
ClearHistoryErrors,
ClearHistoryResponses,
GetHistoryData,
GetHistoryErrors,
GetHistoryResponses,
HistoryIsEnabledData,
HistoryIsEnabledErrors,
HistoryIsEnabledResponses,
} from "./types.gen";

Expand Down Expand Up @@ -35,28 +38,40 @@ export class History {
) {
return (options?.client ?? client).get<
ClearHistoryResponses,
unknown,
ClearHistoryErrors,
ThrowOnError
>({ url: "/umbraco/usync/api/v1/history/ClearHistory", ...options });
>({
security: [{ scheme: "bearer", type: "http" }],
url: "/umbraco/usync/api/v1/history/ClearHistory",
...options,
});
}

public static getHistory<ThrowOnError extends boolean = true>(
options?: Options<GetHistoryData, ThrowOnError>,
) {
return (options?.client ?? client).get<
GetHistoryResponses,
unknown,
GetHistoryErrors,
ThrowOnError
>({ url: "/umbraco/usync/api/v1/history/GetHistory", ...options });
>({
security: [{ scheme: "bearer", type: "http" }],
url: "/umbraco/usync/api/v1/history/GetHistory",
...options,
});
}

public static historyIsEnabled<ThrowOnError extends boolean = true>(
options?: Options<HistoryIsEnabledData, ThrowOnError>,
) {
return (options?.client ?? client).get<
HistoryIsEnabledResponses,
unknown,
HistoryIsEnabledErrors,
ThrowOnError
>({ url: "/umbraco/usync/api/v1/history/HistoryIsEnabled", ...options });
>({
security: [{ scheme: "bearer", type: "http" }],
url: "/umbraco/usync/api/v1/history/HistoryIsEnabled",
...options,
});
}
}
21 changes: 21 additions & 0 deletions uSync.History/history-client/src/api/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export type ClearHistoryData = {
url: "/umbraco/usync/api/v1/history/ClearHistory";
};

export type ClearHistoryErrors = {
/**
* The resource is protected and requires an authentication token
*/
401: unknown;
};

export type ClearHistoryResponses = {
/**
* OK
Expand All @@ -83,6 +90,13 @@ export type GetHistoryData = {
url: "/umbraco/usync/api/v1/history/GetHistory";
};

export type GetHistoryErrors = {
/**
* The resource is protected and requires an authentication token
*/
401: unknown;
};

export type GetHistoryResponses = {
/**
* OK
Expand All @@ -99,6 +113,13 @@ export type HistoryIsEnabledData = {
url: "/umbraco/usync/api/v1/history/HistoryIsEnabled";
};

export type HistoryIsEnabledErrors = {
/**
* The resource is protected and requires an authentication token
*/
401: unknown;
};

export type HistoryIsEnabledResponses = {
/**
* OK
Expand Down
16 changes: 16 additions & 0 deletions uSync.History/history-client/src/hey-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { CreateClientConfig } from './api/client.gen';
import { umbHttpClient } from '@umbraco-cms/backoffice/http-client';

/**
* Pre-configure the generated client by copying the Umbraco HTTP client's config.
*
* Called automatically by the generated client during initialization (via runtimeConfigPath).
* Inherits baseUrl, credentials, auth, and headers from umbHttpClient — which is already
* configured by the backoffice before extensions load.
*
* @see https://heyapi.dev/openapi-ts/clients/fetch#configuration
*/
export const createClientConfig: CreateClientConfig = (config) => ({
...config,
...umbHttpClient.getConfig(),
});
20 changes: 0 additions & 20 deletions uSync.History/history-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { UmbEntryPointOnInit } from "@umbraco-cms/backoffice/extension-api";
import { UMB_AUTH_CONTEXT } from "@umbraco-cms/backoffice/auth";
import { client } from "./api/client.gen.js";

import { manifests as localizations } from "./lang/manifest.js";
import { manifests as views } from "./views/manifest.js";
Expand All @@ -14,22 +12,4 @@ export const onInit: UmbEntryPointOnInit = (_host, extensionRegistry) => {
...modals,
...conditions,
]);

_host.consumeContext(UMB_AUTH_CONTEXT, (_auth) => {
if (!_auth) return;

var config = _auth.getOpenApiConfiguration();

client.setConfig({
auth: config.token,
baseUrl: config.base,
credentials: config.credentials,
});

client.interceptors.request.use(async (request, _options) => {
const token = await _auth.getLatestToken();
request.headers.set("Authorization", `Bearer ${token}`);
return request;
});
});
};
Loading
Loading