Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

onemapsg

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onemapsg - npm Package Compare versions

Comparing version 1.2.1 to 1.3.1

42

dist/services/Auth.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -23,23 +14,20 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

}
getToken() {
var _a, _b, _c, _d, _e, _f;
return __awaiter(this, void 0, void 0, function* () {
if (!((_a = this.onemap.options) === null || _a === void 0 ? void 0 : _a.credential)) {
throw new Error('No credential provided.');
}
if (!((_c = (_b = this.onemap.options) === null || _b === void 0 ? void 0 : _b.credential) === null || _c === void 0 ? void 0 : _c.email) || !((_e = (_d = this.onemap.options) === null || _d === void 0 ? void 0 : _d.credential) === null || _e === void 0 ? void 0 : _e.password)) {
throw new Error('Incomplete credential provided.');
}
const response = yield (0, axios_1.default)(`${OneMap_1.OneMap.BASE_URL}/privateapi/auth/post/getToken`, {
proxy: (_f = this.onemap.options) === null || _f === void 0 ? void 0 : _f.proxy,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
data: this.onemap.options.credential
});
return response.data;
async getToken() {
if (!this.onemap.options?.credential) {
throw new Error('No credential provided.');
}
if (!this.onemap.options?.credential?.email || !this.onemap.options?.credential?.password) {
throw new Error('Incomplete credential provided.');
}
const response = await (0, axios_1.default)(`${OneMap_1.OneMap.BASE_URL}/privateapi/auth/post/getToken`, {
proxy: this.onemap.options?.proxy,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
data: this.onemap.options.credential
});
return response.data;
}
}
exports.Auth = Auth;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,17 +9,13 @@ exports.Common = void 0;

}
revgeocodexy(req) {
return __awaiter(this, void 0, void 0, function* () {
const newReq = req;
newReq.location = newReq.location.join(',');
return this.privateapi('revgeocodexy', newReq);
});
async revgeocodexy(req) {
const newReq = req;
newReq.location = newReq.location.join(',');
return this.privateapi('revgeocodexy', newReq);
}
revgeocode(req) {
return __awaiter(this, void 0, void 0, function* () {
const newReq = req;
newReq.location = newReq.location.join(',');
return this.privateapi('revgeocode', newReq);
});
async revgeocode(req) {
const newReq = req;
newReq.location = newReq.location.join(',');
return this.privateapi('revgeocode', newReq);
}
}
exports.Common = Common;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,33 +9,21 @@ exports.Convert = void 0;

}
_4326to3857(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('4326to3857', req);
});
async _4326to3857(req) {
return this.commonapi('4326to3857', req);
}
_4326to3414(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('4326to3414', req);
});
async _4326to3414(req) {
return this.commonapi('4326to3414', req);
}
_3414to3857(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('3414to3857', req);
});
async _3414to3857(req) {
return this.commonapi('3414to3857', req);
}
_3414to4326(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('3414to4326', req);
});
async _3414to4326(req) {
return this.commonapi('3414to4326', req);
}
_3857to3414(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('3857to3414', req);
});
async _3857to3414(req) {
return this.commonapi('3857to3414', req);
}
_3857to4326(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('3857to4326', req);
});
async _3857to4326(req) {
return this.commonapi('3857to4326', req);
}
}
exports.Convert = Convert;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,18 +9,12 @@ exports.Planning = void 0;

}
getAllPlanningarea(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getAllPlanningarea', req);
});
async getAllPlanningarea(req) {
return this.privateapi('getAllPlanningarea', req);
}
getPlanningareaNames(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getPlanningareaNames', req);
});
async getPlanningareaNames(req) {
return this.privateapi('getPlanningareaNames', req);
}
getPlanningarea(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getPlanningarea', req);
});
async getPlanningarea(req) {
return this.privateapi('getPlanningarea', req);
}
}
exports.Planning = Planning;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,98 +9,60 @@ exports.Population = void 0;

}
getEconomicStatus(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getEconomicStatus', req);
});
async getEconomicStatus(req) {
return this.privateapi('getEconomicStatus', req);
}
getEducationAttending(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getEducationAttending', req);
});
async getEducationAttending(req) {
return this.privateapi('getEducationAttending', req);
}
getEthnicGroup(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getEthnicGroup', req);
});
async getEthnicGroup(req) {
return this.privateapi('getEthnicGroup', req);
}
getHouseholdMonthlyIncomeWork(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getHouseholdMonthlyIncomeWork', req);
});
async getHouseholdMonthlyIncomeWork(req) {
return this.privateapi('getHouseholdMonthlyIncomeWork', req);
}
getHouseholdSize(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getHouseholdSize', req);
});
async getHouseholdSize(req) {
return this.privateapi('getHouseholdSize', req);
}
getHouseholdStructure(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getHouseholdStructure', req);
});
async getHouseholdStructure(req) {
return this.privateapi('getHouseholdStructure', req);
}
getIncomeFromWork(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getIncomeFromWork', req);
});
async getIncomeFromWork(req) {
return this.privateapi('getIncomeFromWork', req);
}
getIndustry(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getIndustry', req);
});
async getIndustry(req) {
return this.privateapi('getIndustry', req);
}
getLanguageLiterate(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getLanguageLiterate', req);
});
async getLanguageLiterate(req) {
return this.privateapi('getLanguageLiterate', req);
}
getMaritalStatus(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getMaritalStatus', req);
});
async getMaritalStatus(req) {
return this.privateapi('getMaritalStatus', req);
}
getModeOfTransportSchool(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getModeOfTransportSchool', req);
});
async getModeOfTransportSchool(req) {
return this.privateapi('getModeOfTransportSchool', req);
}
getModeOfTransportWork(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getModeOfTransportWork', req);
});
async getModeOfTransportWork(req) {
return this.privateapi('getModeOfTransportWork', req);
}
getOccupation(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getOccupation', req);
});
async getOccupation(req) {
return this.privateapi('getOccupation', req);
}
getPopulationAgeGroup(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getPopulationAgeGroup', req);
});
async getPopulationAgeGroup(req) {
return this.privateapi('getPopulationAgeGroup', req);
}
getReligion(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getReligion', req);
});
async getReligion(req) {
return this.privateapi('getReligion', req);
}
getSpokenAtHome(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getSpokenAtHome', req);
});
async getSpokenAtHome(req) {
return this.privateapi('getSpokenAtHome', req);
}
getTenancy(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getTenancy', req);
});
async getTenancy(req) {
return this.privateapi('getTenancy', req);
}
getTypeOfDwellingHousehold(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getTypeOfDwellingHousehold', req);
});
async getTypeOfDwellingHousehold(req) {
return this.privateapi('getTypeOfDwellingHousehold', req);
}
getTypeOfDwellingPop(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getTypeOfDwellingPop', req);
});
async getTypeOfDwellingPop(req) {
return this.privateapi('getTypeOfDwellingPop', req);
}
}
exports.Population = Population;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,11 +9,9 @@ exports.Route = void 0;

}
route(req) {
return __awaiter(this, void 0, void 0, function* () {
const newReq = req;
newReq.start = newReq.start.join(',');
newReq.end = newReq.end.join(',');
return this.privateapi('route', newReq);
});
async route(req) {
const newReq = req;
newReq.start = newReq.start.join(',');
newReq.end = newReq.end.join(',');
return this.privateapi('route', newReq);
}
}
exports.Route = Route;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,8 +9,6 @@ exports.Search = void 0;

}
search(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.commonapi('', req);
});
async search(req) {
return this.commonapi('', req);
}
}
exports.Search = Search;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

@@ -38,18 +29,14 @@ if (kind === "m") throw new TypeError("Private method is not writable");

}
commonapi(endpoint, query) {
return __awaiter(this, void 0, void 0, function* () {
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_fetch).call(this, 'commonapi', endpoint, query);
});
async commonapi(endpoint, query) {
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_fetch).call(this, 'commonapi', endpoint, query);
}
privateapi(endpoint, query) {
return __awaiter(this, void 0, void 0, function* () {
const auth = yield this.onemap.auth.getToken();
if (query) {
query.token = auth.access_token;
}
else {
query = { token: auth.access_token };
}
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_fetch).call(this, 'privateapi', endpoint, query);
});
async privateapi(endpoint, query) {
const auth = await this.onemap.auth.getToken();
if (query) {
query.token = auth.access_token;
}
else {
query = { token: auth.access_token };
}
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_fetch).call(this, 'privateapi', endpoint, query);
}

@@ -71,12 +58,9 @@ getCommonApiUri(endpoint, query) {

return `${OneMap_1.OneMap.BASE_URL}/${type}/${__classPrivateFieldGet(this, _Service_serviceName, "f")}/${endpoint}`;
}, _Service_fetch = function _Service_fetch(type, endpoint, query) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const uri = __classPrivateFieldGet(this, _Service_instances, "m", _Service_getUri).call(this, type, endpoint, query);
const response = yield (0, axios_1.default)(uri, {
proxy: (_a = this.onemap.options) === null || _a === void 0 ? void 0 : _a.proxy,
method: 'GET'
});
return response.data;
}, _Service_fetch = async function _Service_fetch(type, endpoint, query) {
const uri = __classPrivateFieldGet(this, _Service_instances, "m", _Service_getUri).call(this, type, endpoint, query);
const response = await (0, axios_1.default)(uri, {
proxy: this.onemap.options?.proxy,
method: 'GET'
});
return response.data;
};
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -22,31 +13,23 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

}
checkThemeStatus(req) {
return __awaiter(this, void 0, void 0, function* () {
const newReq = req;
newReq.dateTime = (0, dayjs_1.default)(req.dateTime).format('YYYY-MM-DD[T]HH:mm:ss[:000Z]');
return this.privateapi('checkThemeStatus', newReq);
});
async checkThemeStatus(req) {
const newReq = req;
newReq.dateTime = (0, dayjs_1.default)(req.dateTime).format('YYYY-MM-DD[T]HH:mm:ss[:000Z]');
return this.privateapi('checkThemeStatus', newReq);
}
getThemeInfo(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getThemeInfo', req);
});
async getThemeInfo(req) {
return this.privateapi('getThemeInfo', req);
}
getAllThemesInfo(req) {
return __awaiter(this, void 0, void 0, function* () {
return this.privateapi('getAllThemesInfo', req);
});
async getAllThemesInfo(req) {
return this.privateapi('getAllThemesInfo', req);
}
retrieveTheme(req) {
return __awaiter(this, void 0, void 0, function* () {
const extents = [];
for (const coord of req.extents) {
extents.push(...coord);
}
const newReq = req;
newReq.extents = extents.join(',');
return this.privateapi('retrieveTheme', req);
});
async retrieveTheme(req) {
const extents = [];
for (const coord of req.extents) {
extents.push(...coord);
}
const newReq = req;
newReq.extents = extents.join(',');
return this.privateapi('retrieveTheme', req);
}
}
exports.Theme = Theme;

@@ -1,3 +0,3 @@

export declare type Coordinates = [number, number];
export declare type Color = [number, number, number];
export type Coordinates = [number, number];
export type Color = [number, number, number];
export interface ApiRes {

@@ -4,0 +4,0 @@ error: string;

{
"name": "onemapsg",
"version": "1.2.1",
"version": "1.3.1",
"author": "Chang Zhe Jiet",

@@ -32,18 +32,18 @@ "description": "Helper library for using OneMap APIs.",

"dependencies": {
"axios": "^0.26.1",
"dayjs": "^1.11.0"
"axios": "^1.2.2",
"dayjs": "^1.11.7"
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"del-cli": "^3.0.1",
"eslint": "^8.12.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-security": "^1.4.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.3"
"@types/jest": "^29.2.5",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"del-cli": "^4.0.1",
"eslint": "^8.32.0",
"eslint-plugin-import": "^2.27.4",
"eslint-plugin-security": "^1.6.0",
"jest": "^29.3.1",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc