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.0.2 to 1.0.3

4

dist/services/Service.d.ts
import OneMap from '..';
export declare class Service {
#private;
readonly onemap: OneMap;
readonly serviceName: string;
protected constructor(onemap: OneMap, serviceName: string);

@@ -9,4 +9,2 @@ commonapi(endpoint: string, query?: any): Promise<any>;

getCommonApiUri(endpoint: string, query?: any): string;
private getUri;
private fetch;
}

@@ -11,5 +11,17 @@ "use strict";

};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _Service_instances, _Service_serviceName, _Service_getUri, _Service_fetch;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,8 +34,10 @@ exports.Service = void 0;

constructor(onemap, serviceName) {
_Service_instances.add(this);
_Service_serviceName.set(this, void 0);
this.onemap = onemap;
this.serviceName = serviceName;
__classPrivateFieldSet(this, _Service_serviceName, serviceName, "f");
}
commonapi(endpoint, query) {
return __awaiter(this, void 0, void 0, function* () {
return this.fetch('commonapi', endpoint, query);
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_fetch).call(this, 'commonapi', endpoint, query);
});

@@ -40,31 +54,30 @@ }

}
return this.fetch('privateapi', endpoint, query);
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_fetch).call(this, 'privateapi', endpoint, query);
});
}
getCommonApiUri(endpoint, query) {
return this.getUri('commonapi', endpoint, query);
return __classPrivateFieldGet(this, _Service_instances, "m", _Service_getUri).call(this, 'commonapi', endpoint, query);
}
getUri(type, endpoint, query) {
if (query) {
for (const key in query) {
if (typeof query[key] === 'boolean') {
query[key] = query[key] ? 'Y' : 'N';
}
}
exports.Service = Service;
_Service_serviceName = new WeakMap(), _Service_instances = new WeakSet(), _Service_getUri = function _Service_getUri(type, endpoint, query) {
if (query) {
for (const key in query) {
if (typeof query[key] === 'boolean') {
query[key] = query[key] ? 'Y' : 'N';
}
endpoint += `?${querystring_1.default.stringify(query)}`;
}
return `${__1.default.BASE_URL}/${type}/${this.serviceName}/${endpoint}`;
endpoint += `?${querystring_1.default.stringify(query)}`;
}
fetch(type, endpoint, query) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const uri = this.getUri(type, endpoint, query);
const response = yield axios_1.default(uri, {
proxy: (_a = this.onemap.options) === null || _a === void 0 ? void 0 : _a.proxy,
method: 'GET'
});
return response.data;
return `${__1.default.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 axios_1.default(uri, {
proxy: (_a = this.onemap.options) === null || _a === void 0 ? void 0 : _a.proxy,
method: 'GET'
});
}
}
exports.Service = Service;
return response.data;
});
};
{
"name": "onemapsg",
"version": "1.0.2",
"version": "1.0.3",
"author": "Chang Zhe Jiet",

@@ -5,0 +5,0 @@ "description": "Helper library for using OneMap APIs.",

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