@opensea/i18n-upload
Advanced tools
Comparing version 0.0.16 to 0.0.20
@@ -11,6 +11,7 @@ #!/usr/bin/env node | ||
// src/client.ts | ||
import fs from "fs"; | ||
// ../smartling-client/src/client.ts | ||
import ky from "ky"; | ||
import fs from "fs"; | ||
var BASE_URL = "https://api.smartling.com"; | ||
var SmartlingClient = class { | ||
var SmartlingClient = class _SmartlingClient { | ||
userSecret; | ||
@@ -22,2 +23,3 @@ userIdentifier; | ||
accessToken = ""; | ||
static BASE_URL = "https://api.smartling.com"; | ||
constructor({ userSecret, userIdentifier, ref, projectId }) { | ||
@@ -29,3 +31,3 @@ this.userSecret = userSecret; | ||
this.client = ky.create({ | ||
prefixUrl: BASE_URL, | ||
prefixUrl: _SmartlingClient.BASE_URL, | ||
hooks: { | ||
@@ -77,2 +79,21 @@ beforeRequest: [ | ||
} | ||
getProjectDetails = () => { | ||
return this.client.get(`projects-api/v2/projects/${this.projectId}`).json().then((response) => response.response.data); | ||
}; | ||
}; | ||
// src/client.ts | ||
var UploadClient = class extends SmartlingClient { | ||
async authenticate() { | ||
const response = await this.client.post("auth-api/v2/authenticate", { | ||
json: { userSecret: this.userSecret, userIdentifier: this.userIdentifier } | ||
}); | ||
const { | ||
response: { | ||
data: { accessToken } | ||
} | ||
} = await response.json(); | ||
this.accessToken = accessToken; | ||
return accessToken; | ||
} | ||
async createJob(jobName, targetLocaleIds) { | ||
@@ -129,5 +150,2 @@ jobName = this.prefix(jobName); | ||
} | ||
getProjectDetails = () => { | ||
return this.client.get(`projects-api/v2/projects/${this.projectId}`).json().then((response) => response.response.data); | ||
}; | ||
async startBatch(batch) { | ||
@@ -158,3 +176,3 @@ return await this.client.post( | ||
}) => { | ||
const client = new SmartlingClient({ | ||
const client = new UploadClient({ | ||
userSecret, | ||
@@ -161,0 +179,0 @@ userIdentifier, |
{ | ||
"name": "@opensea/i18n-upload", | ||
"version": "0.0.16", | ||
"version": "0.0.20", | ||
"description": "Package for i18n key upload", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"scripts": { | ||
"build": "tsup src/cli.ts --format esm", | ||
"build": "tsup", | ||
"lint": "concurrently \"npm run typecheck\" \"npm run prettier:package.json:check\"", | ||
@@ -28,2 +28,3 @@ "prettier:package.json:check": "prettier-package-json --list-different", | ||
"devDependencies": { | ||
"@opensea/smartling-client": "*", | ||
"@types/uuid": "9.0.2", | ||
@@ -30,0 +31,0 @@ "msw": "1.2.5", |
# upload | ||
## Install | ||
```sh | ||
npm install --save-dev @opensea/i18n-upload | ||
``` | ||
## Running tests | ||
@@ -4,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7459
217
14
5
3