Skip to content
Open
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
7 changes: 0 additions & 7 deletions .changeset/proxy-use-stored-packagename.md

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @\_linked/server-utils

## 1.0.5

### Patch Changes

- [`6965162`](https://github.com/linked-cm/server-utils/commit/696516211de3a2a8b5b1f863f118b467c18330ee) - `LincdServerProxy.parseShape`: prefer the `packageName` stored on the shape constructor (set by `@_linked/core` during `linkedPackage()` registration) instead of extracting it from the URI. The URI form passes through `URI.sanitize` which is lossy (`@_linked/server` → `-_linked-server`), so the sanitized segment can't round-trip as a Node module specifier. Falls back to URI parsing for shapes predating the `packageName` property.

Also: restore previously-deleted `src/types.d.ts` (CSS module declarations) needed by tsconfig.

## 1.0.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "git",
"url": ""
},
"version": "1.0.4",
"version": "1.0.5",
"linkedPackage": true,
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
Expand Down
10 changes: 10 additions & 0 deletions src/backend.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import './utils/BackendProvider.js';
import './utils/ShapeProvider.js';
import './utils/Upload.js';
import { BackendProvider } from './utils/BackendProvider.js';
import { UpdateMessage } from './utils/LinkedLiveUpdates.js';
export declare class LincdServerUtilsBackendProvider extends BackendProvider {
setupBeforeControllers(): void;
setupLiveUpdatesMulticore(): void;
getUpdatesSince(timestamp: number, limit?: number): UpdateMessage[];
}
14 changes: 14 additions & 0 deletions src/components/AppContext.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
export declare const AppContext: React.Context<AppContextProps>;
export declare const useAppContext: () => AppContextProps;
export type AppContextProps = {
assets?: any;
isNativeApp?: boolean;
requestLD?: any;
requestObject?: any;
expressRequest?: any;
expressResponse?: any;
preloadScripts?: string[];
preloadStyles?: string[];
};
export declare function AppContextProvider({ assets, isNativeApp, requestLD, requestObject, expressRequest, expressResponse, preloadScripts, preloadStyles, children, }: AppContextProps & React.PropsWithChildren): React.JSX.Element;
6 changes: 6 additions & 0 deletions src/components/AppRoot.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
export declare const AppRoot: React.NamedExoticComponent<{
style?: any;
} & {
children?: React.ReactNode | undefined;
}>;
10 changes: 10 additions & 0 deletions src/components/Body.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
export declare const useCurrentPath: (appRoutes: any) => any;
export declare const Body: React.NamedExoticComponent<{
children: any;
pageStyles?: any;
className?: any;
routes?: any;
style?: any;
loadingSpinner?: React.ReactNode;
}>;
2 changes: 2 additions & 0 deletions src/components/Head.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import React from 'react';
export declare const Head: ({ children }: React.PropsWithChildren) => React.JSX.Element;
8 changes: 8 additions & 0 deletions src/components/Html.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
interface HtmlProps extends React.PropsWithChildren {
title: string;
customHead: any;
style?: React.CSSProperties;
}
export declare const Html: React.NamedExoticComponent<HtmlProps>;
export {};
9 changes: 9 additions & 0 deletions src/components/Spinner.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
interface SpinnerProps {
active?: boolean;
size?: 'small' | 'medium' | 'large';
color?: string;
className?: string;
}
export declare function Spinner({ active, size, color, className, }: SpinnerProps): React.JSX.Element;
export default Spinner;
21 changes: 21 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import './shapes/Lincd_API_Client.js';
import './utils/Frontend.js';
import './utils/JSONParser.js';
import './utils/JSONWriter.js';
import './utils/LincdServerProxy.js';
import './utils/RequestData.js';
import './utils/Server.js';
import './utils/ImageResize.js';
import './utils/ServerPaths.js';
import './utils/LinkedEmail.js';
import './utils/Backup.js';
import './utils/LinkedLiveUpdates.js';
import './components/Head.js';
import './components/Body.js';
import './components/AppRoot.js';
import './components/Html.js';
import './components/AppContext.js';
import './components/Spinner.js';
import './utils/ShapeIndex.js';
export type { ShapeDetails, PropertyDetails, } from './types/ShapeDetails.js';
export type { RouteConfig, RoutesConfig, RoutesModule, } from './types/RouteConfig.js';
33 changes: 33 additions & 0 deletions src/ontologies/lincd-server-utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Load the data of this ontology into memory, thus adding the properties of the entities of this ontology to the local graph.
*/
export declare var loadData: () => Promise<{
"@context": {
dc: string;
owl: string;
rdf: string;
rdfs: string;
"lincd-server-utils": string;
};
"@graph": {
"@id": string;
"@type": string;
"rdfs:comment": string;
"rdfs:isDefinedBy": {
"@id": string;
};
"rdfs:label": string;
}[];
}>;
/**
* The namespace of this ontology, which can be used to create NamedNodes with URI's not listed in this file
*/
export declare var ns: (term: string) => import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
/**
* The NamedNode of the ontology itself
*/
export declare var _self: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
export declare var Lincd_API_Client: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
export declare const lincdServerUtils: {
Lincd_API_Client: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
};
4 changes: 4 additions & 0 deletions src/package.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare const linkedShape: {
<T extends typeof import("@_linked/core/shapes/Shape").Shape>(constructor: T): void;
<T extends typeof import("@_linked/core/shapes/Shape").Shape>(config?: import("@_linked/core/utils/Package").ShapeConfig): (constructor: T) => void;
}, linkedUtil: (constructor: any) => any, linkedOntology: (allFileExports: any, nameSpace: (term: string) => import("@_linked/core/utils/NodeReference").NodeReferenceValue, suggestedPrefixAndFileName: string, loadDataFunction?: () => Promise<any>, dataSource?: string | string[]) => void, registerPackageExport: (exportedObject: any) => void, packageExports: any, packageName: string;
11 changes: 11 additions & 0 deletions src/shapes/Lincd_API_Client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Shape } from '@_linked/core/shapes/Shape';
export declare class Lincd_API_Client extends Shape {
static targetClass: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
static getFromURI(uri: string): Lincd_API_Client;
selectQuery<ResultType>(query: unknown): Promise<ResultType>;
updateQuery<ResultType>(query: unknown): Promise<ResultType>;
createQuery<ResultType>(query: unknown): Promise<ResultType>;
deleteQuery<ResultType>(query: unknown): Promise<ResultType>;
selectRaw<ResultType>(query: string): Promise<ResultType>;
private call;
}
56 changes: 56 additions & 0 deletions src/types/RouteConfig.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
/**
* Configuration for a single route in the application
*/
export interface RouteConfig {
/**
* The URL path pattern for this route (e.g. "/signin", "/data/:id")
* Supports React Router path syntax including params (:id) and wildcards (*)
*/
path: string;
/**
* Component for this route (can be lazy-loaded or eager)
* For lazy loading, use React.lazy(() => import('./Component')) with webpackChunkName comment
* For eager loading, import the component directly
*/
component?: React.LazyExoticComponent<() => JSX.Element> | React.ComponentType<any>;
/**
* Custom render function for the route (alternative to component)
*/
render?: () => JSX.Element;
/**
* Whether this route requires authentication
* @default false
*/
requireAuth?: boolean;
/**
* Whether to exclude this route from navigation menus
* @default false
*/
excludeFromMenu?: boolean;
/**
* Display label for this route in navigation/menus
*/
label?: string;
/**
* Webpack chunk names to preload for this route (for SSR optimization)
* These should match the webpackChunkName comments in lazy imports
* @example ['signin', 'common-components']
*/
preloadChunks?: string[];
}
/**
* Collection of all routes in the application
* Key is the route identifier, value is the route configuration
*/
export type RoutesConfig = Record<string, RouteConfig>;
/**
* Module shape expected when loading routes dynamically
* Routes can be exported as ROUTES or as default export
*/
export interface RoutesModule {
ROUTES?: RoutesConfig;
default?: {
ROUTES?: RoutesConfig;
} | RoutesConfig;
}
53 changes: 53 additions & 0 deletions src/types/ShapeDetails.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Shape metadata types for CMS UI.
* These types describe shape structure for frontend display — no graph-runtime dependency.
*/
export type PropertyDetails = {
id: string;
label: string;
path: {
id: string;
} | {
id: string;
}[];
valueShape?: {
id: string;
};
datatype?: {
id: string;
};
description: string;
maxCount?: number;
minCount?: number;
nodeKind?: {
id: string;
};
name?: string;
pattern?: string;
minLength?: number;
maxLength?: number;
minInclusive?: number;
maxInclusive?: number;
minExclusive?: number;
maxExclusive?: number;
inValues?: {
id: string;
label: string;
}[];
};
export type ShapeDetails = {
id: string;
label: string;
description: string;
targetClass?: {
id: string;
};
type?: {
id: string;
};
extends?: {
id: string;
};
properties: PropertyDetails[];
numInstances?: number;
};
19 changes: 19 additions & 0 deletions src/utils/BackendProvider.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export declare class BackendProvider {
server: any;
lincdServer: any;
request: any;
response: any;
constructor(server: any, lincdServer: any);
/**
* Each request, all providers are given the opportunity to provide data for the request.
* For example, a provider that handles logins, may return data about the current user
* This data will then be available on the frontend right upon initialisation
*/
supplyDataForRequest(request: any, response: any, data: Record<string, any>): Promise<void> | void;
initRequest(request: any, response: any): Promise<void> | void;
setupBeforeControllers(): void;
setupBeforeCatchAllControllers(): void;
setupAfterControllers(): void;
protected assignEnvPathToField(envKey: any, field: any): Promise<void>;
protected callOtherProvider<S extends BackendProvider>(provider: typeof BackendProvider): S;
}
8 changes: 8 additions & 0 deletions src/utils/Backup.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export declare class Backup {
static keepBackup(date: Date, now?: Date, keepConfig?: {
hourlyThreshold: number;
sixHoursThreshold: number;
weeklyThreshold: number;
monthlyThreshold: number;
}): boolean;
}
1 change: 1 addition & 0 deletions src/utils/Frontend.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function initFrontend(): void;
1 change: 1 addition & 0 deletions src/utils/ImageResize.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function getResizedImagePath(fullImagePath: string, width?: number, height?: number): string;
18 changes: 18 additions & 0 deletions src/utils/JSONParser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export declare class JSONParser {
/**
* Parse a JSON string back into typed objects.
*/
static parse<T>(json: string): T;
/**
* Convert a plain JS object back into typed objects.
* Recognizes markers (__s, __sc, __dt, __type) and reconstructs
* the corresponding Shape/collection instances.
*/
static parseObject<T>(object: any): T;
private static parseInternal;
private static createShape;
private static createShapeClass;
private static createShapeSet;
private static createCoreSet;
private static createCoreMap;
}
16 changes: 16 additions & 0 deletions src/utils/JSONWriter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export declare class JSONWriter {
/**
* Convert any object to a JSON string.
* The result is meant to be consumed by JSONParser.
*/
static stringify(object: any): string;
/**
* Convert any object to a plain JS object suitable for JSON.stringify.
* Recursively converts Shape instances, Shape classes, Dates, and collections.
*/
static toJsObject(object: any): any;
private static convertShape;
private static convertShapeClass;
private static convertCoreSet;
private static convertCoreMap;
}
Loading