Skip to content

Commit

Permalink
Merge branch 'release-2.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
lowzonenose committed Apr 14, 2021
2 parents 6d7ba41 + 8d96d0c commit 8b313d4
Show file tree
Hide file tree
Showing 27 changed files with 125 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build project ...
name: Build

on:
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ jobs:
with:
repository: IGNF/geoportal-access-lib-samples
ref: master
token : ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}

- name: Get the version
id: get_version
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ FIXME*
CONTRIBUTING.md
CONTRIBUTORS.md
COMPILE.md
TEAM_DEV_WORKFLOW.md
DRAFT_CHANGELOG.md
HISTORY.md
History.md
jsdoc.json
Expand Down
10 changes: 5 additions & 5 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Liste des targets disponibles :
target : (clean), build,
test, sample, (doc)
test:serve, sample:serve, doc:serve
option : --env.production, --env.development, --env.clean
option : --mode=production, --mode=development, --env.clean

### Installation des dépendances

Expand All @@ -87,8 +87,8 @@ la target suivante :
**ouvrir une console :**

npm run build
npm run build -- --env.production
npm run build -- --env.development
npm run build -- --mode=production
npm run build -- --mode=development

ou

Expand Down Expand Up @@ -142,8 +142,8 @@ Les exemples sont générées lors du build dans le répertoire *samples*.
**ouvrir une console :**

npm run sample
npm run sample -- --env.production
npm run sample -- --env.development
npm run sample -- --mode=production
npm run sample -- --mode=development

ou

Expand Down
15 changes: 9 additions & 6 deletions DRAFT_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# Bibliothèque d'accès aux services Géoportail, version 2.1.7
# Bibliothèque d'accès aux services Géoportail, version 2.1.8

**12/02/2021 : 2.1.7**
**14/04/2021 : 2.1.8**

> release of geoportal access library
## Summary

* Modifications sur les processus de dev et de déploiement
* correctif sur la jsdoc
* suppression de la dependance dépréciée *request*

## Changelog

* [Added]

- déploiement git/npm via github actions (568f8f44e4d7d20058918c40b48f55317b291cdd)
- ajout de tests E2E, avec rapports de tests, et exemples automatiques (6b4e47cb6773d0f68e3539fd24f3a2bd8e74fe01)
- ajout des badges DeepScan et de build dans le README

* [Changed]

- dockerisation des exemples de dev (6cddae1e520980af11269404131c4fee864937f7)
- remplacement de la dépendance *request* (depréciée) par *node-fetch* pour une meilleure utilisation sous nodeJS

* [Removed]

* [Fixed]

- correctif sur la jsdoc / tutorial : optimize-getconfig
- correctif header UMD des bundles sous webpack 4

* [Deprecated]

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Bibliothèque d'accès aux ressources du Géoportail

[![Build Status](https://travis-ci.org/IGNF/geoportal-access-lib.png?branch=master)](https://travis-ci.org/IGNF/geoportal-access-lib)
[![Build](https://github.com/IGNF/geoportal-access-lib/actions/workflows/build.yml/badge.svg)](https://github.com/IGNF/geoportal-access-lib/actions/workflows/build.yml)
[![GitHub release](https://img.shields.io/github/release/IGNF/geoportal-access-lib.svg)](https://github.com/IGNF/geoportal-access-lib)
[![DeepScan grade](https://deepscan.io/api/teams/12425/projects/15468/branches/309615/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=12425&pid=15468&bid=309615)

La bibliothèque d’accès aux ressources de la plateforme Géoportail est une bibliothèque de fonctions javascript permettant d'accéder aux ressources délivrées par les services web du Géoportail.

Expand Down
10 changes: 6 additions & 4 deletions TEAM_DEV_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ git merge release-X.Y.Z
5 - On recommence autant de fois que necessaire les etapes 3 et 4

6 - Quand on estime que tout est ok, on prépare la future publication npm en construisant les binaires :
* cd build/script/release
* vérifier date et version dans les package.json
* ./build-pack.sh
* commiter
```bash
$> ./build.sh
$> npm pack
```

Puis, commiter...

6 - Quand on estime que la release est OK, on merge la branche sans fast-forward sur **develop**

Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ printTo "BEGIN"

function production() {
printTo "####### production !"
doCmd "npm run build -- --env.production"
doCmd "npm run build:prod"
}

function map() {
printTo "####### sourcemap !"
doCmd "npm run build -- --env.development"
doCmd "npm run build:dev"
}

function sources() {
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/optimize-getconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Click the "Get Config File" button.
<input type="button" onclick="doIt()" id="key-button" value="Get Config File" class="key-button" ></input></p>
<script type="text/javascript" src="./../dist/GpServices.js"></script>
<script type="text/javascript">

function doIt() {
var kelem = document.getElementById("apiKey") ;
if (!kelem.value || kelem.value.trim().length == 0) {
Expand Down
Binary file removed geoportal-access-lib-2.1.6.tgz
Binary file not shown.
Binary file added geoportal-access-lib-2.1.8.tgz
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "geoportal-access-lib",
"version": "2.1.7",
"date": "12/02/2021",
"version": "2.1.8",
"date": "14/04/2021",
"description": "French Geoportal resources access library",
"module": "src/Gp.js",
"main": "dist/GpServices-src.js",
Expand Down Expand Up @@ -47,7 +47,7 @@
"license": "CECILL-B",
"dependencies": {
"es6-promise": "^4.2.4",
"request": "^2.87.0",
"node-fetch": "^2.6.1",
"xmldom": "^0.1.27"
},
"devDependencies": {
Expand Down
9 changes: 1 addition & 8 deletions src/Formats/XLS/LocationUtilityService/model/Address.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,9 @@ function Address (options) {
};

// param obligatoire
if (!options.location) {
if (!this.options.location || Object.keys(this.options.location).length === 0) {
throw new Error("l'option 'location' n'est pas renseignée !");
}

// et on ajoute les options en paramètre aux options par défaut
for (var opt in options) {
if (options.hasOwnProperty(opt)) {
this.options[opt] = options[opt];
}
}
}

/**
Expand Down
9 changes: 1 addition & 8 deletions src/Formats/XLS/LocationUtilityService/model/Position.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,9 @@ function Position (options) {
this.options = options || {};

// param obligatoire
if (!options.position) {
if (!this.options.position) {
throw new Error("l'option 'position' n'est pas renseignée !");
}

// et on ajoute les options en paramètre aux options par défaut
for (var opt in options) {
if (options.hasOwnProperty(opt)) {
this.options[opt] = options[opt];
}
}
}

/**
Expand Down
11 changes: 2 additions & 9 deletions src/Formats/XLS/RouteService/model/RoutePlan.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,13 @@ function RoutePlan (options) {
this.options = options || {};

// param obligatoire
if (!options.startPoint) {
if (!this.options.startPoint) {
throw new Error("l'option 'startPoint' n'est pas renseignée !");
}

if (!options.endPoint) {
if (!this.options.endPoint) {
throw new Error("l'option 'endPoint' n'est pas renseignée !");
}

// et on ajoute les options en paramètre aux options par défaut
for (var opt in options) {
if (options.hasOwnProperty(opt)) {
this.options[opt] = options[opt];
}
}
}

RoutePlan.prototype = {
Expand Down
2 changes: 1 addition & 1 deletion src/Protocols/Protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var Protocol = {
settings.wrap = true;
}

settings.callback = (options.protocol === "JSONP") ? null : null; // FIXME non géré !?
settings.callback = null; // FIXME non géré !?
settings.output = settings.wrap ? "json" : null;

// on encapsule les reponses dans un objet JSON
Expand Down
48 changes: 33 additions & 15 deletions src/Protocols/XHR.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,44 @@ var XHR = {

// test on env. nodejs or browser
if (typeof window === "undefined") {
// Utilisation du module :
// cf. http://blog.modulus.io/node.js-tutorial-how-to-use-request-module
var nodefetch = require("node-fetch");

var req = require("request");// __request
var opts = {
headers : {
Referer : "https://localhost"
}
};

// mapping data avec body param. pour le mode POST ou PUT (?)
if (options.data && typeof options.data === "string" && corps) {
options.body = options.data;
opts = {
method : options.method,
body : options.data,
headers : {
"Content-Type" : options.content,
Referer : "https://localhost"
}
};
}

// FIXME ERROR : self signed certificate in certificate chain
options.rejectUnauthorized = false;

req(options, function (error, response, body) {
if (!error && response.statusCode === 200 && body) {
resolve(body);
} else {
reject("Errors Occured on Http Request (nodejs) : " + error);
}
});
return nodefetch(options.url, opts)
.then(function (response) {
if (response.ok) { // res.status >= 200 && res.status < 300
resolve(response.text());
} else {
var message = "Errors Occured on Http Request (status : '" + response.statusText + "' | url : '" + response.url + "')";
var status = response.status;
reject({
message : message,
status : status
});
}
})
.catch(function (e) {
reject({
message : e,
status : -1
});
});
} else {
if (window.XMLHttpRequest) {
logger.trace("XMLHttpRequest");
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Alti/Request/AltiRequestFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ var AltiRequestFactory = {
settings.param.zonly = options.zonly;

// gestion des callback
var bOnError = !!((options.onError !== null && typeof options.onError === "function"));
var bOnSuccess = !!((options.onSuccess !== null && typeof options.onSuccess === "function"));
var bOnError = !!(options.onError !== null && typeof options.onError === "function"); // cast variable to boolean
var bOnSuccess = !!(options.onSuccess !== null && typeof options.onSuccess === "function");

var message = null;
switch (options.api) {
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Alti/Response/AltiResponseFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ var AltiResponseFactory = {
logger.trace("analyze response : json");
logger.trace("analyze response : ", typeof options.response);

var JSONResponse;
var JSONResponse = null;
if (typeof options.response === "string") {
JSONResponse = JSON.parse(options.response);
} else {
JSONResponse = options.response;
}

// le service renvoie t il une erreur ?
if (JSONResponse.error) {
if (JSONResponse && JSONResponse.error) {
// ex. {"error": {"code": "BAD_PARAMETER","description": "The values () cannot be parsed as a valid longitude (double value such as -180 < lat < 180)."}}
options.onError.call(options.scope, new ErrorService({
message : MRes.getMessage("SERVICE_RESPONSE_EXCEPTION", JSONResponse.error.description),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var AutoCompleteResponseFactory = {
logger.trace("analyze response : raw");
data = options.response;
} else {
var JSONResponse;
var JSONResponse = null;
if (typeof options.response === "string") {
JSONResponse = JSON.parse(options.response);
} else {
Expand All @@ -69,17 +69,17 @@ var AutoCompleteResponseFactory = {

// boucle sur les résultats de l'autocomplétion
if (JSONResponse.results && Array.isArray(JSONResponse.results)) {
var suggestedLocation;
var suggestedLocation = null;

for (var i = 0; i < JSONResponse.results.length; i++) {
var result = JSONResponse.results[i];
suggestedLocation = new SuggestedLocation();

if (suggestedLocation) {
if (result && result.country === "StreetAddress") {
if (result) {
if (result.country === "StreetAddress") {
suggestedLocation.street = result.street;
suggestedLocation.type = "StreetAddress";
} else if (result && result.country === "PositionOfInterest") {
} else if (result.country === "PositionOfInterest") {
suggestedLocation.poi = result.street;
suggestedLocation.kind = result.kind;
suggestedLocation.type = "PositionOfInterest";
Expand Down
2 changes: 1 addition & 1 deletion src/Services/AutoConf/Formats/AutoConfResponseReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ AutoConfResponseReader.READERS = {
}
}
// si aucune metadata n'a été ajoutée, on crée le tableau vide
if (!lyr.metadata && !Array.isArray(lyr.metadata)) {
if (!lyr.metadata) {
lyr.metadata = [];
}
lyr.metadata.push(m);
Expand Down
4 changes: 2 additions & 2 deletions src/Services/CommonService.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function CommonService (options) {
}

// gestion du callback onSuccess
var bOnSuccess = !!((this.options.onSuccess !== null && typeof this.options.onSuccess === "function"));
var bOnSuccess = !!(this.options.onSuccess !== null && typeof this.options.onSuccess === "function");
if (!bOnSuccess) {
throw new Error(_.getMessage("PARAM_MISSING", "onSuccess()"));
}
Expand Down Expand Up @@ -363,7 +363,7 @@ CommonService.prototype = {

// a t on mis en place un proxy ?
// la proxyfication est valable uniquement en mode XHR !
var bUrlProxified = !!((this.options.proxyURL && this.options.protocol === "XHR"));
var bUrlProxified = !!(this.options.proxyURL && this.options.protocol === "XHR");

// rajout de l'option gpbibaccess
// INFO : acces au numero de version de package.conf aprés compilation !
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var ReverseGeocodeReponseFactory = {
if (options.scope && options.scope.options && options.scope.options.srs && options.scope.options.srs !== "EPSG:4326") {
var location;
var pos;
if (data || data.locations || data.locations.length) {
if (data.locations) {
for (var i = 0; i < data.locations.length; i++) {
location = data.locations[i];
if (location) {
Expand Down
Loading

0 comments on commit 8b313d4

Please sign in to comment.