@localess/js-client 0.0.4-next.20240527-202257.0 → 0.0.4-next.20240527-214345.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +135 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/models/content-asset.js +3 -0
- package/dist/cjs/models/content-asset.js.map +1 -0
- package/dist/cjs/models/content-data.js +3 -0
- package/dist/cjs/models/content-data.js.map +1 -0
- package/dist/cjs/models/content-metadata.js +3 -0
- package/dist/cjs/models/content-metadata.js.map +1 -0
- package/dist/cjs/models/content.js +3 -0
- package/dist/cjs/models/content.js.map +1 -0
- package/dist/cjs/models/index.js +23 -0
- package/dist/cjs/models/index.js.map +1 -0
- package/dist/cjs/models/links.js +3 -0
- package/dist/cjs/models/links.js.map +1 -0
- package/dist/cjs/models/translations.js +3 -0
- package/dist/cjs/models/translations.js.map +1 -0
- package/dist/cjs/utils.js +51 -0
- package/dist/cjs/utils.js.map +1 -0
- package/package.json +14 -6
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.localessClient = void 0;
|
|
21
|
+
const proxy_agent_1 = require("proxy-agent");
|
|
22
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
23
|
+
const utils_1 = require("./utils");
|
|
24
|
+
__exportStar(require("./models"), exports);
|
|
25
|
+
const LOG_GROUP = `${utils_1.FG_BLUE}[Localess]${utils_1.RESET}`;
|
|
26
|
+
function localessClient(options) {
|
|
27
|
+
if (options.debug) {
|
|
28
|
+
console.log(LOG_GROUP, 'Client Options :', options);
|
|
29
|
+
}
|
|
30
|
+
const fetchOptions = {
|
|
31
|
+
redirect: 'follow',
|
|
32
|
+
};
|
|
33
|
+
if ((0, utils_1.proxyURIFromEnv)()) {
|
|
34
|
+
fetchOptions.agent = new proxy_agent_1.ProxyAgent();
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
/**
|
|
38
|
+
* Get all links
|
|
39
|
+
* @returns {Promise<Links>}
|
|
40
|
+
*/
|
|
41
|
+
async getLinks() {
|
|
42
|
+
if (options.debug) {
|
|
43
|
+
console.log(LOG_GROUP, 'getLinks()');
|
|
44
|
+
}
|
|
45
|
+
let url = `${options.origin}/api/v1/spaces/${options.spaceId}/links?token=${options.token}`;
|
|
46
|
+
if (options.debug) {
|
|
47
|
+
console.log(LOG_GROUP, 'getLinks url :', url);
|
|
48
|
+
}
|
|
49
|
+
const response = await (0, node_fetch_1.default)(url, fetchOptions);
|
|
50
|
+
if (options.debug) {
|
|
51
|
+
console.log(LOG_GROUP, 'getLinks status :', response.status);
|
|
52
|
+
}
|
|
53
|
+
const data = await response.json();
|
|
54
|
+
return data;
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Get content by SLUG
|
|
58
|
+
* @param slug{string} - Content SLUG
|
|
59
|
+
* @param params{ContentFetchParams} - Fetch parameters
|
|
60
|
+
* @returns {Promise<Content>}
|
|
61
|
+
*/
|
|
62
|
+
async getContentBySlug(slug, params) {
|
|
63
|
+
if (options.debug) {
|
|
64
|
+
console.log(LOG_GROUP, 'getContentBySlug() slug :', slug);
|
|
65
|
+
}
|
|
66
|
+
const version = params?.version == 'draft' ? `&version=${params.version}` : '';
|
|
67
|
+
const locale = params?.locale ? `&locale=${params.locale}` : '';
|
|
68
|
+
let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}`;
|
|
69
|
+
if (options.debug) {
|
|
70
|
+
console.log(LOG_GROUP, 'getContentBySlug url :', url);
|
|
71
|
+
}
|
|
72
|
+
const response = await (0, node_fetch_1.default)(url, fetchOptions);
|
|
73
|
+
if (options.debug) {
|
|
74
|
+
console.log(LOG_GROUP, 'getContentBySlug status :', response.status);
|
|
75
|
+
}
|
|
76
|
+
const data = await response.json();
|
|
77
|
+
return data;
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Get content by ID
|
|
81
|
+
* @param id{string} - Content ID
|
|
82
|
+
* @param params{ContentFetchParams} - Fetch parameters
|
|
83
|
+
* @returns {Promise<Content>}
|
|
84
|
+
*/
|
|
85
|
+
async getContentById(id, params) {
|
|
86
|
+
if (options.debug) {
|
|
87
|
+
console.log(LOG_GROUP, 'getContentById() id :', id);
|
|
88
|
+
}
|
|
89
|
+
const version = params?.version == 'draft' ? `&version=${params.version}` : '';
|
|
90
|
+
const locale = params?.locale ? `&locale=${params.locale}` : '';
|
|
91
|
+
let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}`;
|
|
92
|
+
if (options.debug) {
|
|
93
|
+
console.log(LOG_GROUP, 'getContentById url :', url);
|
|
94
|
+
}
|
|
95
|
+
const response = await (0, node_fetch_1.default)(url, fetchOptions);
|
|
96
|
+
if (options.debug) {
|
|
97
|
+
console.log(LOG_GROUP, 'getContentById status :', response.status);
|
|
98
|
+
}
|
|
99
|
+
const data = await response.json();
|
|
100
|
+
return data;
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Get translations for the given locale
|
|
104
|
+
* @param locale{string} - Locale identifier (ISO 639-1)
|
|
105
|
+
*/
|
|
106
|
+
async getTranslations(locale) {
|
|
107
|
+
if (options.debug) {
|
|
108
|
+
console.log(LOG_GROUP, 'getTranslations()');
|
|
109
|
+
}
|
|
110
|
+
let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
|
|
111
|
+
if (options.debug) {
|
|
112
|
+
console.log(LOG_GROUP, 'getTranslations url :', url);
|
|
113
|
+
}
|
|
114
|
+
const response = await (0, node_fetch_1.default)(url, fetchOptions);
|
|
115
|
+
if (options.debug) {
|
|
116
|
+
console.log(LOG_GROUP, 'getTranslations status :', response.status);
|
|
117
|
+
}
|
|
118
|
+
const data = await response.json();
|
|
119
|
+
return data;
|
|
120
|
+
},
|
|
121
|
+
syncScriptUrl() {
|
|
122
|
+
return `${options.origin}/scripts/sync-v1.js`;
|
|
123
|
+
},
|
|
124
|
+
assetLink(asset) {
|
|
125
|
+
if (typeof asset === 'string') {
|
|
126
|
+
return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
exports.localessClient = localessClient;
|
|
135
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AACvC,4DAA8C;AAE9C,mCAAwD;AAExD,2CAAyB;AAoCzB,MAAM,SAAS,GAAG,GAAG,eAAO,aAAa,aAAK,EAAE,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O,CAAC,GAAG,CAAC,SAAS,EAAE,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACtE,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAoB,CAAC;QAC9B,CAAC;QAED,aAAa;YACX,OAAO,GAAG,OAAO,CAAC,MAAM,qBAAqB,CAAA;QAC/C,CAAC;QAED,SAAS,CAAC,KAA4B;YACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,GAAG,OAAO,CAAC,MAAM,kBAAkB,OAAO,CAAC,OAAO,WAAW,KAAK,EAAE,CAAC;YAC9E,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,OAAO,CAAC,MAAM,kBAAkB,OAAO,CAAC,OAAO,WAAW,KAAK,CAAC,GAAG,EAAE,CAAC;YAClF,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAjHD,wCAiHC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-asset.js","sourceRoot":"","sources":["../../../src/models/content-asset.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-data.js","sourceRoot":"","sources":["../../../src/models/content-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-metadata.js","sourceRoot":"","sources":["../../../src/models/content-metadata.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/models/content.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./content"), exports);
|
|
18
|
+
__exportStar(require("./content-asset"), exports);
|
|
19
|
+
__exportStar(require("./content-data"), exports);
|
|
20
|
+
__exportStar(require("./content-metadata"), exports);
|
|
21
|
+
__exportStar(require("./links"), exports);
|
|
22
|
+
__exportStar(require("./translations"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC;AACnC,0CAAwB;AACxB,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../../src/models/links.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.js","sourceRoot":"","sources":["../../../src/models/translations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BG_BRIGHT_WHITE = exports.BG_BRIGHT_CYAN = exports.BG_BRIGHT_MAGENTA = exports.BG_BRIGHT_BLUE = exports.BG_BRIGHT_YELLOW = exports.BG_BRIGHT_GREEN = exports.BG_BRIGHT_RED = exports.BG_GRAY = exports.BG_WHITE = exports.BG_CYAN = exports.BG_MAGENTA = exports.BG_BLUE = exports.BG_YELLOW = exports.BG_GREEN = exports.BG_RED = exports.BG_BLACK = exports.FG_BRIGHT_WHITE = exports.FG_BRIGHT_CYAN = exports.FG_BRIGHT_MAGENTA = exports.FG_BRIGHT_BLUE = exports.FG_BRIGHT_YELLOW = exports.FG_BRIGHT_GREEN = exports.FG_BRIGHT_RED = exports.FG_GRAY = exports.FG_WHITE = exports.FG_CYAN = exports.FG_MAGENTA = exports.FG_BLUE = exports.FG_YELLOW = exports.FG_GREEN = exports.FG_RED = exports.FG_BLACK = exports.HIDDEN = exports.REVERSE = exports.BLINK = exports.UNDERSCORE = exports.DIM = exports.BRIGHT = exports.RESET = exports.proxyURIFromEnv = void 0;
|
|
4
|
+
function proxyURIFromEnv() {
|
|
5
|
+
return (process.env.HTTPS_PROXY ||
|
|
6
|
+
process.env.https_proxy ||
|
|
7
|
+
process.env.HTTP_PROXY ||
|
|
8
|
+
process.env.http_proxy ||
|
|
9
|
+
undefined);
|
|
10
|
+
}
|
|
11
|
+
exports.proxyURIFromEnv = proxyURIFromEnv;
|
|
12
|
+
exports.RESET = "\x1b[0m";
|
|
13
|
+
exports.BRIGHT = "\x1b[1m";
|
|
14
|
+
exports.DIM = "\x1b[2m";
|
|
15
|
+
exports.UNDERSCORE = "\x1b[4m";
|
|
16
|
+
exports.BLINK = "\x1b[5m";
|
|
17
|
+
exports.REVERSE = "\x1b[7m";
|
|
18
|
+
exports.HIDDEN = "\x1b[8m";
|
|
19
|
+
exports.FG_BLACK = "\x1b[30m";
|
|
20
|
+
exports.FG_RED = "\x1b[31m";
|
|
21
|
+
exports.FG_GREEN = "\x1b[32m";
|
|
22
|
+
exports.FG_YELLOW = "\x1b[33m";
|
|
23
|
+
exports.FG_BLUE = "\x1b[34m";
|
|
24
|
+
exports.FG_MAGENTA = "\x1b[35m";
|
|
25
|
+
exports.FG_CYAN = "\x1b[36m";
|
|
26
|
+
exports.FG_WHITE = "\x1b[37m";
|
|
27
|
+
exports.FG_GRAY = "\x1b[90m";
|
|
28
|
+
exports.FG_BRIGHT_RED = "\x1b[91m";
|
|
29
|
+
exports.FG_BRIGHT_GREEN = "\x1b[92m";
|
|
30
|
+
exports.FG_BRIGHT_YELLOW = "\x1b[93m";
|
|
31
|
+
exports.FG_BRIGHT_BLUE = "\x1b[94m";
|
|
32
|
+
exports.FG_BRIGHT_MAGENTA = "\x1b[95m";
|
|
33
|
+
exports.FG_BRIGHT_CYAN = "\x1b[96m";
|
|
34
|
+
exports.FG_BRIGHT_WHITE = "\x1b[97m";
|
|
35
|
+
exports.BG_BLACK = "\x1b[40m";
|
|
36
|
+
exports.BG_RED = "\x1b[41m";
|
|
37
|
+
exports.BG_GREEN = "\x1b[42m";
|
|
38
|
+
exports.BG_YELLOW = "\x1b[43m";
|
|
39
|
+
exports.BG_BLUE = "\x1b[44m";
|
|
40
|
+
exports.BG_MAGENTA = "\x1b[45m";
|
|
41
|
+
exports.BG_CYAN = "\x1b[46m";
|
|
42
|
+
exports.BG_WHITE = "\x1b[47m";
|
|
43
|
+
exports.BG_GRAY = "\x1b[100m";
|
|
44
|
+
exports.BG_BRIGHT_RED = "\x1b[101m";
|
|
45
|
+
exports.BG_BRIGHT_GREEN = "\x1b[102m";
|
|
46
|
+
exports.BG_BRIGHT_YELLOW = "\x1b[103m";
|
|
47
|
+
exports.BG_BRIGHT_BLUE = "\x1b[104m";
|
|
48
|
+
exports.BG_BRIGHT_MAGENTA = "\x1b[105m";
|
|
49
|
+
exports.BG_BRIGHT_CYAN = "\x1b[106m";
|
|
50
|
+
exports.BG_BRIGHT_WHITE = "\x1b[107m";
|
|
51
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/ut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CAAA;AACtB,QAAA,OAAO,GAAG,UAAU,CAAA;AACpB,QAAA,UAAU,GAAG,UAAU,CAAA;AACvB,QAAA,OAAO,GAAG,UAAU,CAAA;AACpB,QAAA,QAAQ,GAAG,UAAU,CAAA;AACrB,QAAA,OAAO,GAAG,WAAW,CAAA;AAErB,QAAA,aAAa,GAAG,WAAW,CAAA;AAC3B,QAAA,eAAe,GAAG,WAAW,CAAA;AAC7B,QAAA,gBAAgB,GAAG,WAAW,CAAA;AAC9B,QAAA,cAAc,GAAG,WAAW,CAAA;AAC5B,QAAA,iBAAiB,GAAG,WAAW,CAAA;AAC/B,QAAA,cAAc,GAAG,WAAW,CAAA;AAC5B,QAAA,eAAe,GAAG,WAAW,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localess/js-client",
|
|
3
|
-
"version": "0.0.4-next.20240527-
|
|
3
|
+
"version": "0.0.4-next.20240527-214345.0",
|
|
4
4
|
"description": "Universal JavaScript/TypeScript SDK for Localess's API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"localess",
|
|
@@ -13,11 +13,18 @@
|
|
|
13
13
|
"author": "Lessify",
|
|
14
14
|
"homepage": "https://localess.org",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"main": "./dist/index.js",
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
16
|
"files": [
|
|
19
17
|
"dist"
|
|
20
18
|
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/cjs/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js",
|
|
25
|
+
"node": "./dist/cjs/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
21
28
|
"repository": {
|
|
22
29
|
"type": "git",
|
|
23
30
|
"url": "git+https://github.com/Lessify/localess-js-client.git"
|
|
@@ -26,8 +33,9 @@
|
|
|
26
33
|
"url": "https://github.com/Lessify/localess-js-client/issues"
|
|
27
34
|
},
|
|
28
35
|
"scripts": {
|
|
29
|
-
"build": "tsc
|
|
36
|
+
"build": "npm run build:tsc && npm run build:cjs",
|
|
30
37
|
"build:tsc": "tsc -p tsconfig.json",
|
|
38
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
31
39
|
"build:tsup": "tsup-node --env.NODE_ENV production"
|
|
32
40
|
},
|
|
33
41
|
"license": "MIT",
|
|
@@ -37,8 +45,8 @@
|
|
|
37
45
|
},
|
|
38
46
|
"devDependencies": {
|
|
39
47
|
"@types/node": "^20.12.12",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
48
|
+
"tsup": "^8.0.2",
|
|
49
|
+
"typescript": "^5.0.0"
|
|
42
50
|
},
|
|
43
51
|
"engines": {
|
|
44
52
|
"node": ">= 18.0.0"
|