update deps
This commit is contained in:
parent
5af203f541
commit
e7a6dcf601
@ -1,26 +1,26 @@
|
||||
"use strict";
|
||||
// tslint:disable
|
||||
/**
|
||||
* Magento Community
|
||||
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||
*
|
||||
* OpenAPI spec version: 2.4
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Configuration = void 0;
|
||||
class Configuration {
|
||||
constructor(param = {}) {
|
||||
this.apiKey = param.apiKey;
|
||||
this.username = param.username;
|
||||
this.password = param.password;
|
||||
this.accessToken = param.accessToken;
|
||||
this.basePath = param.basePath;
|
||||
}
|
||||
}
|
||||
exports.Configuration = Configuration;
|
||||
"use strict";
|
||||
// tslint:disable
|
||||
/**
|
||||
* Magento Community
|
||||
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||
*
|
||||
* OpenAPI spec version: 2.4
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Configuration = void 0;
|
||||
class Configuration {
|
||||
constructor(param = {}) {
|
||||
this.apiKey = param.apiKey;
|
||||
this.username = param.username;
|
||||
this.password = param.password;
|
||||
this.accessToken = param.accessToken;
|
||||
this.basePath = param.basePath;
|
||||
}
|
||||
}
|
||||
exports.Configuration = Configuration;
|
||||
//# sourceMappingURL=configuration.js.map
|
||||
137
index.js
137
index.js
@ -1,74 +1,65 @@
|
||||
"use strict";
|
||||
/*
|
||||
export * from './paths';
|
||||
export * from './format';
|
||||
export * from './log';
|
||||
export * from './types';
|
||||
export * from './formatter';
|
||||
export * from './main';
|
||||
export * from './test';
|
||||
*/
|
||||
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 });
|
||||
exports.test = exports.Magento = exports.getToken = void 0;
|
||||
const configuration = require("./configuration");
|
||||
const os_1 = require("os");
|
||||
const read_1 = require("@plastichub/fs/read");
|
||||
const path = require("path");
|
||||
const api_1 = require("./api");
|
||||
exports.getToken = (url, user, password) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const api = new api_1.IntegrationAdminTokenServiceV1Api({
|
||||
basePath: url
|
||||
});
|
||||
return api.integrationAdminTokenServiceV1CreateAdminAccessTokenPost({
|
||||
username: user,
|
||||
password: password
|
||||
});
|
||||
});
|
||||
class Magento {
|
||||
}
|
||||
exports.Magento = Magento;
|
||||
Magento.token = null;
|
||||
Magento.apiConfig = null;
|
||||
Magento.init = (baseUrl, username, password) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const token = yield exports.getToken(baseUrl, username, password);
|
||||
api_1.setAuth({
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
Magento.token = token;
|
||||
Magento.apiConfig = new configuration.Configuration({
|
||||
basePath: baseUrl,
|
||||
accessToken: token
|
||||
});
|
||||
return Magento.token;
|
||||
});
|
||||
Magento.initWithProfile = (profilePath, baseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (profilePath[0] === '~') {
|
||||
profilePath = path.join(os_1.homedir(), profilePath.slice(1));
|
||||
}
|
||||
const profile = read_1.sync(path.resolve(profilePath), 'json') || {};
|
||||
return Magento.init(baseUrl || profile.baseUrl, profile.username, profile.password);
|
||||
});
|
||||
exports.test = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
process.on('unhandledRejection', (reason) => {
|
||||
console.error('Unhandled rejection, reason: ', reason);
|
||||
});
|
||||
yield Magento.initWithProfile('~/.magento.json', 'https://shop.plastic-hub.com/rest/all');
|
||||
// await Magento.init('https://shop.plastic-hub.com/rest/all', 'admin', '');
|
||||
console.log('Magento API Config', Magento.apiConfig);
|
||||
const storeApi = new api_1.StoreStoreRepositoryV1Api(Magento.apiConfig);
|
||||
const stores = yield storeApi.storeStoreRepositoryV1GetListGet({});
|
||||
console.log('stores', stores);
|
||||
});
|
||||
exports.API = require("./api");
|
||||
"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 });
|
||||
exports.test = exports.Magento = exports.getToken = void 0;
|
||||
const configuration = require("./configuration");
|
||||
const os_1 = require("os");
|
||||
const read_1 = require("@plastichub/fs/read");
|
||||
const path = require("path");
|
||||
const api_1 = require("./api");
|
||||
exports.getToken = (url, user, password) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const api = new api_1.IntegrationAdminTokenServiceV1Api({
|
||||
basePath: url
|
||||
});
|
||||
return api.integrationAdminTokenServiceV1CreateAdminAccessTokenPost({
|
||||
username: user,
|
||||
password: password
|
||||
});
|
||||
});
|
||||
class Magento {
|
||||
}
|
||||
exports.Magento = Magento;
|
||||
Magento.token = null;
|
||||
Magento.apiConfig = null;
|
||||
Magento.init = (baseUrl, username, password) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const token = yield exports.getToken(baseUrl, username, password);
|
||||
api_1.setAuth({
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
Magento.token = token;
|
||||
Magento.apiConfig = new configuration.Configuration({
|
||||
basePath: baseUrl,
|
||||
accessToken: token
|
||||
});
|
||||
return Magento.token;
|
||||
});
|
||||
Magento.initWithProfile = (profilePath, baseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (profilePath[0] === '~') {
|
||||
profilePath = path.join(os_1.homedir(), profilePath.slice(1));
|
||||
}
|
||||
const profile = read_1.sync(path.resolve(profilePath), 'json') || {};
|
||||
return Magento.init(baseUrl || profile.baseUrl, profile.username, profile.password);
|
||||
});
|
||||
exports.test = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
process.on('unhandledRejection', (reason) => {
|
||||
console.error('Unhandled rejection, reason: ', reason);
|
||||
});
|
||||
yield Magento.initWithProfile('~/.magento.json', 'https://shop.plastic-hub.com/rest/all');
|
||||
// await Magento.init('https://shop.plastic-hub.com/rest/all', 'admin', '');
|
||||
console.log('Magento API Config', Magento.apiConfig);
|
||||
const storeApi = new api_1.StoreStoreRepositoryV1Api(Magento.apiConfig);
|
||||
const stores = yield storeApi.storeStoreRepositoryV1GetListGet({});
|
||||
console.log('stores', stores);
|
||||
});
|
||||
exports.API = require("./api");
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;EAQE;;;;;;;;;;;;AAEF,iDAAiD;AAEjD,2BAA6B;AAC7B,8CAAmD;AACnD,6BAA6B;AAE7B,+BAGc;AAGD,QAAA,QAAQ,GAAG,CAAO,GAAG,EAAE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C;IAC1F,4EAA4E;IAC5E,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,IAAI,+BAAyB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,gCAAgC,CAAC,EAAE,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC,CAAA,CAAA;AAED,+BAA6B"}
|
||||
@ -2,7 +2,6 @@
|
||||
"name": "@plastichub/magento",
|
||||
"version": "1.0.15",
|
||||
"description": "",
|
||||
"main": "./main.js",
|
||||
"types": "./index.d.ts",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@ -19,9 +18,7 @@
|
||||
"url": "git+https://git.osr-plastic.org/osr-plastic/magento-ts-client.git"
|
||||
},
|
||||
"author": "",
|
||||
"bin": {
|
||||
"magento-client": "build/main.js"
|
||||
},
|
||||
"bin": {},
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://git.osr-plastic.org/osr-plastic/magento-ts-client/issues"
|
||||
@ -37,7 +34,7 @@
|
||||
"ora": "^2.1.0",
|
||||
"portable-fetch": "^3.0.0",
|
||||
"readline": "^1.3.0",
|
||||
"typescript": "^3.7.4",
|
||||
"typescript": "^3.9.10",
|
||||
"yargs": "^15.0.2",
|
||||
"yarn": "^1.22.10"
|
||||
},
|
||||
@ -49,4 +46,4 @@
|
||||
"@types/ora": "^1.3.4",
|
||||
"@types/yargs": "^13.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,3 @@
|
||||
/*
|
||||
export * from './paths';
|
||||
export * from './format';
|
||||
export * from './log';
|
||||
export * from './types';
|
||||
export * from './formatter';
|
||||
export * from './main';
|
||||
export * from './test';
|
||||
*/
|
||||
|
||||
import * as configuration from './configuration';
|
||||
import * as debug from '@plastichub/core/debug';
|
||||
|
||||
Reference in New Issue
Block a user