diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7ca9435..d92c523 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,3 @@ jobs: - run: npm run publish env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} - - run: npm run publish-gpr - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/ReadMe.md b/ReadMe.md index c85b8f7..0457c08 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,7 @@ # Sisyphus for JavaScript/TypeScript +[![](https://img.shields.io/npm/v/@sisyphus.js/core)](https://www.npmjs.com/package/@sisyphus.js/core) ![](https://img.shields.io/librariesio/release/npm/@sisyphus.js/core) + Sisyphus.JS is the way how we connect with our Sisyphus backend services. It uses [HTTP and gRPC Transcoding](https://aip.bybutter.com/127) to call gRPC APIs. ## 🚀 Quick Start diff --git a/lerna.json b/lerna.json index da39f4b..97e950f 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/*" ], - "version": "0.0.1-alpha.9" + "version": "0.0.1-alpha.10" } diff --git a/package.json b/package.json index f3bdd05..204adc2 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ }, "scripts": { "prepare": "lerna bootstrap --hoist && lerna run build", - "publish": "lerna publish from-package --yes", - "publish-gpr": "lerna publish from-package --yes --registry https://npm.pkg.github.com/" + "publish": "lerna publish from-package --yes" } } diff --git a/packages/sisyphus-cli/package-lock.json b/packages/sisyphus-cli/package-lock.json index 10478ae..875819d 100644 --- a/packages/sisyphus-cli/package-lock.json +++ b/packages/sisyphus-cli/package-lock.json @@ -1,6 +1,6 @@ { "name": "@sisyphus.js/cli", - "version": "0.0.1-alpha.9", + "version": "0.0.1-alpha.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/sisyphus-cli/package.json b/packages/sisyphus-cli/package.json index 8de806f..73efa1d 100644 --- a/packages/sisyphus-cli/package.json +++ b/packages/sisyphus-cli/package.json @@ -1,6 +1,6 @@ { "name": "@sisyphus.js/cli", - "version": "0.0.1-alpha.9", + "version": "0.0.1-alpha.10", "description": "Protobuf generator cli for sisyphus project", "author": "Kanro ", "bugs": { @@ -24,7 +24,7 @@ "build": "tsc" }, "dependencies": { - "@sisyphus.js/generator": "^0.0.1-alpha.9", + "@sisyphus.js/generator": "^0.0.1-alpha.10", "commander": "^6.0.0" }, "devDependencies": { diff --git a/packages/sisyphus-core/package-lock.json b/packages/sisyphus-core/package-lock.json index 4104cf3..c628827 100644 --- a/packages/sisyphus-core/package-lock.json +++ b/packages/sisyphus-core/package-lock.json @@ -1,6 +1,6 @@ { "name": "@sisyphus.js/core", - "version": "0.0.1-alpha.9", + "version": "0.0.1-alpha.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/sisyphus-core/package.json b/packages/sisyphus-core/package.json index d17229a..a8705d1 100644 --- a/packages/sisyphus-core/package.json +++ b/packages/sisyphus-core/package.json @@ -1,6 +1,6 @@ { "name": "@sisyphus.js/core", - "version": "0.0.1-alpha.9", + "version": "0.0.1-alpha.10", "description": "Protobuf runtime for sisyphus project on js platform", "author": "Kanro ", "bugs": { diff --git a/packages/sisyphus-core/src/converter.ts b/packages/sisyphus-core/src/converter.ts index 14e5c2c..9ffe855 100644 --- a/packages/sisyphus-core/src/converter.ts +++ b/packages/sisyphus-core/src/converter.ts @@ -183,6 +183,9 @@ export function toJson(field: MapField | Field | Type | Enum | string, value: an case "sint64": case "fixed64": case "sfixed64": + if (long.isLong(value)) { + return value.toNumber() + } return value } } \ No newline at end of file diff --git a/packages/sisyphus-core/src/transcoding.ts b/packages/sisyphus-core/src/transcoding.ts index 311d216..df331cb 100644 --- a/packages/sisyphus-core/src/transcoding.ts +++ b/packages/sisyphus-core/src/transcoding.ts @@ -80,19 +80,21 @@ function getField(message: any, field: string | string[]): any { return message } -function getFieldInfo(type: Type, field: string | string[]): Type { +function getFieldInfo(type: Type, field: string | string[]): Type | null { if (typeof field === "string") { return getFieldInfo(type, field.split(".")) } for (let string of field) { type = type.fields[string].resolvedType + if (!type) return null } + return type } export function fillUrl(url: string, message: any): string { - return url.replace(/{([a-zA-Z0-9_]+)(?:=[^}]+)?}/g, (substring, g1) => `${getField(message, g1)}`) + return url.replace(/{([a-zA-Z0-9_.]+)(?:=[^}]+)?}/g, (substring, g1) => `${getField(message, g1)}`) } export function transcoding(http: IHttpImpl, config?: ITranscodingConfig): IRpcImpl { @@ -135,8 +137,9 @@ export function transcoding(http: IHttpImpl, config?: ITranscodingConfig): IRpcI break default: data = getField(message, rule.body) - if (data && data instanceof Message) { - messageCtor = getFieldInfo(desc.resolvedRequestType.messageCtor.$type, rule.body).messageCtor + let type = getFieldInfo(desc.resolvedRequestType.messageCtor.$type, rule.body) + if (data && type) { + messageCtor = type.messageCtor } break } diff --git a/packages/sisyphus-generator/package.json b/packages/sisyphus-generator/package.json index fce6924..1607aa1 100644 --- a/packages/sisyphus-generator/package.json +++ b/packages/sisyphus-generator/package.json @@ -1,6 +1,6 @@ { "name": "@sisyphus.js/generator", - "version": "0.0.1-alpha.9", + "version": "0.0.1-alpha.10", "description": "Protobuf generator for sisyphus project on js platform", "author": "Kanro ", "bugs": { @@ -21,7 +21,7 @@ "build": "tsc" }, "dependencies": { - "@sisyphus.js/core": "^0.0.1-alpha.9", + "@sisyphus.js/core": "^0.0.1-alpha.10", "change-case": "^4.1.1", "protobufjs": "^6.10.1" },