@ms-cloudpack/common-types
Advanced tools
Comparing version 0.5.4 to 0.6.0
@@ -21,5 +21,6 @@ export { allFeatures } from './allFeatures.js'; | ||
export type { PackageSettings } from './PackageSettings.js'; | ||
export type { Route } from './Route.js'; | ||
export type { Route, RenderedRoute, BootstrapRoute, StaticRoute } from './Route.js'; | ||
export { isBootstrapRoute, isRenderedRoute, isStaticRoute } from './Route.js'; | ||
export type { TelemetryConfig } from './TelemetryConfig.js'; | ||
export type { AppConfig } from './AppConfig.js'; | ||
//# sourceMappingURL=index.d.ts.map |
export { allFeatures } from './allFeatures.js'; | ||
export { isBootstrapRoute, isRenderedRoute, isStaticRoute } from './Route.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export interface Route { | ||
export interface SharedRouteOptions { | ||
/** | ||
@@ -7,8 +7,8 @@ * The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also | ||
match: string; | ||
} | ||
/** | ||
* A server-rendered route. The route is rendered by a custom server script in Cloudpack. | ||
*/ | ||
export interface RenderedRoute extends SharedRouteOptions { | ||
/** | ||
* The path relative to the app root to static assets. If this is provided, renderScript/exportEntry | ||
* will be ignored. | ||
*/ | ||
staticPath?: string; | ||
/** | ||
* Path to a .js or .html file used for rendering the route. If a script is provided, it must | ||
@@ -24,2 +24,32 @@ * export a default function implementing `RenderRouteFunction` defined in `@ms-cloudpack/app-server`. | ||
} | ||
/** | ||
* A route with a staticPath property serves static files from the specified path. | ||
*/ | ||
export interface StaticRoute extends SharedRouteOptions { | ||
/** | ||
* The path relative to the app root to static assets. | ||
*/ | ||
staticPath: string; | ||
} | ||
/** | ||
* A route that serves a bootstrap script. | ||
*/ | ||
export interface BootstrapRoute extends SharedRouteOptions { | ||
type: 'bootstrap'; | ||
/** | ||
* The key in the exports map which represents the entry point app script for this route. | ||
* Default is '.', meaning the main package export key. | ||
*/ | ||
exportEntry?: string; | ||
} | ||
export type Route = RenderedRoute | StaticRoute | BootstrapRoute; | ||
/** | ||
* User defined type guard to check if a route is a static route. | ||
*/ | ||
export declare function isStaticRoute(route: Route): route is StaticRoute; | ||
/** | ||
* User defined type guard to check if a route is a bootstrap route. | ||
*/ | ||
export declare function isBootstrapRoute(route: Route): route is BootstrapRoute; | ||
export declare function isRenderedRoute(route: Route): route is RenderedRoute; | ||
//# sourceMappingURL=Route.d.ts.map |
@@ -1,2 +0,19 @@ | ||
export {}; | ||
/** | ||
* User defined type guard to check if a route is a static route. | ||
*/ | ||
export function isStaticRoute(route) { | ||
return 'staticPath' in route; | ||
} | ||
/** | ||
* User defined type guard to check if a route is a bootstrap route. | ||
*/ | ||
export function isBootstrapRoute(route) { | ||
return 'type' in route && route.type === 'bootstrap'; | ||
} | ||
/* | ||
* User defined type guard to check if a route is a rendered route. | ||
*/ | ||
export function isRenderedRoute(route) { | ||
return !isStaticRoute(route) && !isBootstrapRoute(route); | ||
} | ||
//# sourceMappingURL=Route.js.map |
{ | ||
"name": "@ms-cloudpack/common-types", | ||
"version": "0.5.4", | ||
"version": "0.6.0", | ||
"description": "Common types for Cloudpack.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -434,2 +434,15 @@ { | ||
"Route": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/RenderedRoute" | ||
}, | ||
{ | ||
"$ref": "#/definitions/StaticRoute" | ||
}, | ||
{ | ||
"$ref": "#/definitions/BootstrapRoute" | ||
} | ||
] | ||
}, | ||
"RenderedRoute": { | ||
"type": "object", | ||
@@ -441,6 +454,2 @@ "properties": { | ||
}, | ||
"staticPath": { | ||
"type": "string", | ||
"description": "The path relative to the app root to static assets. If this is provided, renderScript/exportEntry will be ignored." | ||
}, | ||
"renderScript": { | ||
@@ -455,7 +464,50 @@ "type": "string", | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"match" | ||
], | ||
"additionalProperties": false | ||
"description": "A server-rendered route. The route is rendered by a custom server script in Cloudpack." | ||
}, | ||
"StaticRoute": { | ||
"type": "object", | ||
"properties": { | ||
"match": { | ||
"type": "string", | ||
"description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`." | ||
}, | ||
"staticPath": { | ||
"type": "string", | ||
"description": "The path relative to the app root to static assets." | ||
} | ||
}, | ||
"required": [ | ||
"match", | ||
"staticPath" | ||
], | ||
"additionalProperties": false, | ||
"description": "A route with a staticPath property serves static files from the specified path." | ||
}, | ||
"BootstrapRoute": { | ||
"type": "object", | ||
"properties": { | ||
"match": { | ||
"type": "string", | ||
"description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`." | ||
}, | ||
"type": { | ||
"type": "string", | ||
"const": "bootstrap" | ||
}, | ||
"exportEntry": { | ||
"type": "string", | ||
"description": "The key in the exports map which represents the entry point app script for this route. Default is '.', meaning the main package export key." | ||
} | ||
}, | ||
"required": [ | ||
"match", | ||
"type" | ||
], | ||
"additionalProperties": false, | ||
"description": "A route that serves a bootstrap script." | ||
}, | ||
"TelemetryConfig": { | ||
@@ -462,0 +514,0 @@ "type": "object", |
@@ -435,2 +435,15 @@ { | ||
"Route": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/RenderedRoute" | ||
}, | ||
{ | ||
"$ref": "#/definitions/StaticRoute" | ||
}, | ||
{ | ||
"$ref": "#/definitions/BootstrapRoute" | ||
} | ||
] | ||
}, | ||
"RenderedRoute": { | ||
"type": "object", | ||
@@ -442,6 +455,2 @@ "properties": { | ||
}, | ||
"staticPath": { | ||
"type": "string", | ||
"description": "The path relative to the app root to static assets. If this is provided, renderScript/exportEntry will be ignored." | ||
}, | ||
"renderScript": { | ||
@@ -456,7 +465,50 @@ "type": "string", | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"match" | ||
], | ||
"additionalProperties": false | ||
"description": "A server-rendered route. The route is rendered by a custom server script in Cloudpack." | ||
}, | ||
"StaticRoute": { | ||
"type": "object", | ||
"properties": { | ||
"match": { | ||
"type": "string", | ||
"description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`." | ||
}, | ||
"staticPath": { | ||
"type": "string", | ||
"description": "The path relative to the app root to static assets." | ||
} | ||
}, | ||
"required": [ | ||
"match", | ||
"staticPath" | ||
], | ||
"additionalProperties": false, | ||
"description": "A route with a staticPath property serves static files from the specified path." | ||
}, | ||
"BootstrapRoute": { | ||
"type": "object", | ||
"properties": { | ||
"match": { | ||
"type": "string", | ||
"description": "The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`." | ||
}, | ||
"type": { | ||
"type": "string", | ||
"const": "bootstrap" | ||
}, | ||
"exportEntry": { | ||
"type": "string", | ||
"description": "The key in the exports map which represents the entry point app script for this route. Default is '.', meaning the main package export key." | ||
} | ||
}, | ||
"required": [ | ||
"match", | ||
"type" | ||
], | ||
"additionalProperties": false, | ||
"description": "A route that serves a bootstrap script." | ||
}, | ||
"TelemetryConfig": { | ||
@@ -463,0 +515,0 @@ "type": "object", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174550
3006