Package Tree REST Interface
The service endpoint of the package tree interface of the JS Registry is http://<server>:<port>/<contextname>/resources/jsregistry/root
.
This REST interface is an implementation of a CommonJS Compliant Package Registry . This is the main interface used by the map.apps JavaScript API to locate and load bundles.
Browse Packages
List all available package names
Requesting the root URL returns the list of all package names registered in the registry. Each entry links to the package root inside the registry.
GET /resources/jsregistry/root
{
"aceeditor": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/aceeditor",
"esri": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/esri",
"map": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/map",
"xstyle": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/xstyle"
}
List all versions of a package
To list all version of a concrete package the package name is added to the root URL.
The response lists all available versions of the package.
The dist-tags
section shows the latest version.
GET /resources/jsregistry/root/{name}
//GET /resources/jsregistry/root/map
{
"name": "map",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/map\/3.1.0-SNAPSHOT",
"3.0.9": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/map\/3.0.9"
}
}
Show metadata of an exact version of a package (package.json)
The metadata of a package can be accessed by adding its name and version to the root URL of the registry.
The response is the package.json
of the very package.
GET /resources/jsregistry/root/{name}/{version}
//GET /resources/jsregistry/root/map/3.1.0-SNAPSHOT
{
"name": "map",
"version": "3.1.0-SNAPSHOT",
"title": "Map",
"description": "The Map bundle manages the main map and all map content information...",
"vendor": "con terra GmbH",
"Config-Bundle-Location": "/config",
"startLevel": 40,
"layer": "module",
"main": "main",
"i18n": ["bundle"],
"optionalDependencies": {
"coordinatetransformer": ">=3.1.0-SNAPSHOT"
},
"components": [...],
// two special properties
"_id": "map@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/map"
}
The The |
Access a package resource
It is possible to access all files inside a package by adding the file path to the exact package path.
GET /resources/jsregistry/root/{name}/{version}/{file}
//GET /resources/jsregistry/root/map/3.1.0-SNAPSHOT/module.js
<<Binary data of the file requested>>
Advanced Package Queries
Search for packages
The root endpoint provides a filter
parameter, which can be used to query for packages inside the registry.
GET /resources/jsregistry/root?filter=name%20like%20"a*"
{
"aceeditor": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/aceeditor",
"addthis": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/addthis",
"agolauthn": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/agolauthn",
"agolmapfinder": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/agolmapfinder",
"agsprinting": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/agsprinting"
}
Name | Default | Description |
---|---|---|
|
A filter query expression that allows to search for packages with special properties. |
Simple Query:
Simple Queries can be combined using
|
Inline package versions
The root endpoint provides a versions parameter, which can be used to include versions in the packages response.
GET /resources/jsregistry/root?filter=name%20like%20"a*"&versions=true
{
"aceeditor": {
"name": "aceeditor",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/aceeditor\/3.1.0-SNAPSHOT",
"3.0.9": "http:\/\/localhost:8080\/resources\/jsregistry\/root\/aceeditor\/3.0.9"
}
},
...
}
Name | Default | Description |
---|---|---|
|
|
Enables including versions |
Inline package info
The root endpoint provides a inline parameter, which can be used to embed version and packages info in the packages response.
GET /resources/jsregistry/root?filter=name%20like%20"a*"&inline=true
{
"aceeditor": {
"name": "aceeditor",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
"name": "aceeditor",
"ACE-VERSION": "1.1.1",
"version": "3.1.0-SNAPSHOT",
"title": "ACE Editor",
"description": "The ACE Editor provides a code editor.",
"keywords": ["code"],
"url": "http://ace.c9.io/",
"layer": "module",
"main": "main",
"i18n": ["bundle"],
"components": [...],
"_id": "aceeditor@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/base\/aceeditor"
},
"3.0.9" : {
...
}
}
},
...
}
Name | Default | Description |
---|---|---|
|
|
Enables inlining package info |
Required Packages Resolution
The following clause describes different options of fetching package information if required by an application.
Consider that all requests being described result in a package list with exactly one version per package. The calculated versions are the best matching ones for the requirements previously being declared.
Fetch packages info from packages.json
This endpoint is provided to fetch the meta information required to register packages in an AMD loader. The response can be directly used to configure the Dojo AMD loader.
GET /resources/jsregistry/root/packages.json?requires=system@3.1.0-SNAPSHOT,map@3.1.0-SNAPSHOT
[{
"name": "ct",
"version": "3.1.0-SNAPSHOT",
"main": "main",
"location": "http:\/\/localhost:8080\/js\/ct"
},
{
"name": "map",
"version": "3.1.0-SNAPSHOT",
"main": "main",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/map"
},
{
"name": "system",
"version": "3.1.0-SNAPSHOT",
"main": "main",
"location": "http:\/\/localhost:8080\/js\/bundles\/base\/system"
},
...
]
Name | Default | Description |
---|---|---|
|
List of required package names. The syntax is
A version range expression can be a concrete version or a range like defined in the dependencies section of a |
|
|
List of required dependencies to be skipped, same syntax like |
|
|
|
If enabled, transitive resolved dependencies are included in the response. |
Fetch packages info from root
The registry root can directly be requested for required packages.
GET /resources/jsregistry/root?requires=map@3.1.0-SNAPSHOT&inline=true
{
"coordinatetransformer": {
"name": "coordinatetransformer",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
...
"_id": "coordinatetransformer@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/coordinatetransformer"
}
}
},
"geometryservice": {
"name": "geometryservice",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
...
"_id": "geometryservice@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/geometryservice"
}
}
},
"map": {
"name": "map",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
...
"_id": "map@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/map"
}
}
}
}
Name | Default | Description |
---|---|---|
|
List of required package names. The syntax is
A version range expression can be a concrete version or a range like defined in the dependencies section of a |
|
|
List of required dependencies to be skipped, same syntax like |
|
|
|
If enabled, transitive resolved dependencies are included in the response. |
|
|
If |
Fetch packages info from bundles.json
This endpoint is semantically equal to fetching the packages info directly from the root. However, it provides some additional query parameters to preserve compatibility with map.apps releases earlier than 3.1.0.
GET /resources/jsregistry/root/bundles.json?needed=map@3.1.0-SNAPSHOT
{
"coordinatetransformer": {
"name": "coordinatetransformer",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
...
"_id": "coordinatetransformer@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/coordinatetransformer"
}
}
},
"geometryservice": {
"name": "geometryservice",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
...
"_id": "geometryservice@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/geometryservice"
}
}
},
"map": {
"name": "map",
"dist-tags": {
"latest": "3.1.0-SNAPSHOT"
},
"versions": {
"3.1.0-SNAPSHOT": {
...
"_id": "map@3.1.0-SNAPSHOT",
"location": "http:\/\/localhost:8080\/js\/bundles\/mapcore\/map"
}
}
}
}
Name | Default | Description |
---|---|---|
|
|
List of required package names. The syntax is
A version range expression can be a concrete version or a range like defined in the dependencies section of a |
|
List of required dependencies to be skipped, same syntax like |
The response of a bundles.json endpoint matches the query /resources/jsregistry/root?requires=<needed>&requires_skip=<skipped>&transitive=true&inline=true
|
JavaScript Layer File Generation
A JavaScript layer file is a file containing a number of other JavaScript files. This helps to minimize HTTP requests required to fetch the files requested by an application. A layer file has the following AMD loader compatible format:
require({
cache:{
"<module identifier>":function(){
//filebody
},
...
}
});
<module identifier>
is the ID of the file used by the amd loader, for example system/module
or dojo/async
.
<file body>
is the content of the original JavaScript file.
This format ensures that the body of an embedded JavaScript file is only evaluated if required by the AMD loader.
The registry allows to dynamically generate JavaScript layer files.
A prerequisite is an existing dependencies.json
file provided by the installed packages.
This file describes the dependencies between files located in this very package and files located in other packages.
A dependencies.json
file can be generated with the jsregistry-maven-plugin
.
Fetch layer file from layer.js
This is the recommended endpoint to generate layer files.
This is an HTTP version of the buildLayers goal of the jsregistry-maven-plugin .
This means that the special syntax defined for includes and excludes is working with this endpoint.
|
GET /resources/jsregistry/root/layer.js?requires=system@3.1.0-SNAPSHOT/module&requires_skip=dojo/*,ct/*
require({
cache: {
"system/module": function(){ ... },
...
}
});
Name | Default | Description |
---|---|---|
|
List of required dependencies. The syntax is The syntax of a
A version range expression can be a concrete version or a range like defined in the dependencies section of a
The Special Syntax Elements:
|
|
|
List of dependencies to be skipped.
This is the same syntax like Special Syntax Elements:
|
|
|
|
Flag if the package resolution is transitive.
If |
|
A comma separated list of locales, for example |
|
|
Same as |
|
|
|
This switches the output of the request to a list of included filenames. This is useful to check the correct behavior. |
Sample of a response with printIncluded=true
:
GET /resources/jsregistry/root/layer.js?requires=system@3.1.0-SNAPSHOT/main&requires_skip=dojo/*,ct/*&locale=de&printIncluded=true
define([
"system/main",
"system/nls/bundle",
"system/nls/de/bundle"
]);
Fetch layer file from bundles.js
This endpoint is provided to preserver compatibility to the current map.apps Launcher. It has the same functionality as the layer.js endpoint but some parameters have different names.
GET /resources/jsregistry/root/bundles.js?mids=system@3.1.0-SNAPSHOT/module&skip=dojo/*,ct/*
require({
cache: {
"system/module": function(){ ... },
...
}
});
Name | Default | Description |
---|---|---|
|
Exactly defined like the requires parameter of the layer.js endpoint. |
|
|
Exactly defined like the requires_skip parameter of the layer.js endpoint. |
|
|
|
See the layer.js endpoint. |
|
See the layer.js endpoint. |
|
|
See the layer.js endpoint. |
|
|
|
See the layer.js endpoint. |