feat: release toolbox portal 0.1.0
This commit is contained in:
61
src/test/fixtures.ts
Normal file
61
src/test/fixtures.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type {
|
||||
ToolboxAppManifest,
|
||||
ToolboxCatalog,
|
||||
} from '@add-ideas/toolbox-contract';
|
||||
|
||||
export const pdfManifest: ToolboxAppManifest = {
|
||||
schemaVersion: 1,
|
||||
id: 'de.add-ideas.pdf-tools',
|
||||
name: 'PDF Workbench',
|
||||
version: '0.3.4',
|
||||
description: 'Page-level PDF operations performed locally in the browser.',
|
||||
entry: './',
|
||||
icon: './favicon.svg',
|
||||
categories: ['documents', 'pdf'],
|
||||
tags: ['merge', 'split'],
|
||||
integration: {
|
||||
contextVersion: 1,
|
||||
launchModes: ['navigate', 'new-tab'],
|
||||
embedding: 'unsupported',
|
||||
},
|
||||
requirements: {
|
||||
secureContext: true,
|
||||
workers: true,
|
||||
indexedDb: true,
|
||||
crossOriginIsolated: false,
|
||||
},
|
||||
privacy: {
|
||||
processing: 'local',
|
||||
fileUploads: false,
|
||||
telemetry: false,
|
||||
},
|
||||
source: {
|
||||
repository: 'https://git.add-ideas.de/zemion/pdf-tools',
|
||||
license: 'AGPL-3.0-only',
|
||||
},
|
||||
};
|
||||
|
||||
export const catalogue: ToolboxCatalog = {
|
||||
schemaVersion: 1,
|
||||
id: 'de.add-ideas.toolbox',
|
||||
name: 'add·ideas Toolbox',
|
||||
home: './',
|
||||
theme: { mode: 'system', brand: 'add·ideas' },
|
||||
apps: [{ manifest: './apps/pdf/toolbox-app.json', enabled: true }],
|
||||
};
|
||||
|
||||
export function catalogueFetch(overrides: Record<string, Response> = {}) {
|
||||
return async (input: string | URL | Request): Promise<Response> => {
|
||||
const url = new URL(
|
||||
input instanceof Request ? input.url : String(input),
|
||||
document.baseURI
|
||||
);
|
||||
const custom = overrides[url.pathname];
|
||||
if (custom) return custom.clone();
|
||||
if (url.pathname.endsWith('/toolbox.catalog.json'))
|
||||
return Response.json(catalogue);
|
||||
if (url.pathname.endsWith('/apps/pdf/toolbox-app.json'))
|
||||
return Response.json(pdfManifest);
|
||||
return new Response('Not found', { status: 404 });
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user