@rtsdk/topia 0.0.3

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.
@@ -0,0 +1,16 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getWorldDetails } from ".";
11
+ describe("getWorldDetails", () => {
12
+ it("should return details of a world", () => __awaiter(void 0, void 0, void 0, function* () {
13
+ const result = yield getWorldDetails("lina");
14
+ expect(result).toBeDefined();
15
+ }));
16
+ });
@@ -0,0 +1,23 @@
1
+ module.exports = {
2
+ clearMocks: true,
3
+ collectCoverageFrom: ["./src/**"],
4
+ coverageThreshold: {
5
+ global: {
6
+ statements: 1,
7
+ branches: 1,
8
+ functions: 1,
9
+ lines: 1,
10
+ },
11
+ },
12
+ moduleFileExtensions: ["ts", "js"],
13
+ moduleNameMapper: {
14
+ "~/(.*)": "<rootDir>/src/$1",
15
+ },
16
+ testEnvironment: "node",
17
+ testPathIgnorePatterns: ["./node_modules/", "./build/"],
18
+ testRegex: "(/tests/.*|(\\.|/)(test|spec))\\.(js?|ts?)$",
19
+ transform: {
20
+ "^.+.(ts|js)$": "ts-jest",
21
+ },
22
+ transformIgnorePatterns: ["<rootDir>/node_modules/(?!@foo)"],
23
+ };
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "author": "Topia",
3
+ "bugs": {
4
+ "url": "https://github.com/metaversecloud-com/mc-sdk-js/issues"
5
+ },
6
+ "description": "MC Javascript SDK - Topia Client Library",
7
+ "devDependencies": {
8
+ "@rollup/plugin-commonjs": "^23.0.2",
9
+ "@rollup/plugin-json": "^5.0.1",
10
+ "@rollup/plugin-node-resolve": "^15.0.1",
11
+ "@types/jest": "^29.2.3",
12
+ "@typescript-eslint/eslint-plugin": "^5.43.0",
13
+ "@typescript-eslint/parser": "^5.43.0",
14
+ "axios": "^1.1.3",
15
+ "eslint": "^8.28.0",
16
+ "eslint-config-prettier": "^8.5.0",
17
+ "eslint-plugin-prettier": "^4.2.1",
18
+ "jest": "^29.3.1",
19
+ "prettier": "^2.7.1",
20
+ "rollup": "^3.4.0",
21
+ "rollup-plugin-typescript2": "^0.34.1",
22
+ "ts-jest": "^29.0.3",
23
+ "typescript": "^4.9.3"
24
+ },
25
+ "gitHead": "46900311a04fc1667af9ae9b4cced53b7a7e0507",
26
+ "homepage": "https://github.com/metaversecloud-com/mc-sdk-js#readme",
27
+ "license": "ISC",
28
+ "keywords": [],
29
+ "name": "@rtsdk/topia",
30
+ "main": "dist/index.js",
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
35
+ "repository": {
36
+ "directory": "clients/client-topia",
37
+ "type": "git",
38
+ "url": "git+https://github.com/metaversecloud-com/mc-sdk-js.git"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc && rollup -c",
42
+ "test": "ENV=testing jest --watchAll=false",
43
+ "lint": "eslint \"src/**\"",
44
+ "publish": "npm publish"
45
+ },
46
+ "type": "module",
47
+ "version": "0.0.3"
48
+ }
@@ -0,0 +1,25 @@
1
+ import commonjs from "@rollup/plugin-commonjs";
2
+ import json from "@rollup/plugin-json";
3
+ import resolve, { nodeResolve } from "@rollup/plugin-node-resolve";
4
+ import typescript from "rollup-plugin-typescript2";
5
+
6
+ export default {
7
+ input: ["src/index.ts"],
8
+ output: [
9
+ {
10
+ dir: "dist",
11
+ entryFileNames: "[name].js",
12
+ format: "cjs",
13
+ exports: "named",
14
+ },
15
+ ],
16
+ plugins: [
17
+ commonjs({
18
+ exclude: "node_modules",
19
+ }),
20
+ nodeResolve({ preferBuiltins: true, extensions: [".svg", ".js", ".ts"] }),
21
+ json(),
22
+ resolve(),
23
+ typescript(),
24
+ ],
25
+ };
@@ -0,0 +1,8 @@
1
+ import { getWorldDetails } from ".";
2
+
3
+ describe("getWorldDetails", () => {
4
+ it("should return details of a world", async () => {
5
+ const result = await getWorldDetails("lina");
6
+ expect(result).toBeDefined();
7
+ });
8
+ });
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ import axios from "axios";
2
+
3
+ export function getWorldDetails(urlSlug: string): Promise<object> {
4
+ return new Promise((resolve, reject) => {
5
+ axios
6
+ .get(`https://api.topia.io/api/world/${urlSlug}/world-details`, {
7
+ headers: { Authorization: process.env.API_KEY },
8
+ })
9
+ .then((response: any) => {
10
+ resolve(response.data);
11
+ })
12
+ .catch(reject);
13
+ });
14
+ }
15
+ export default { getWorldDetails };
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "baseUrl": ".",
5
+ "esModuleInterop": true,
6
+ "forceConsistentCasingInFileNames": true,
7
+ "module": "esnext",
8
+ "moduleResolution": "node",
9
+ "outDir": "./dist",
10
+ "skipLibCheck": true,
11
+ "strict": true,
12
+ "target": "es2016"
13
+ },
14
+ "include": ["src/**/*"],
15
+ "exclude": ["node_modules", "dist"]
16
+ }