Giter VIP home page Giter VIP logo

nakama-common's People

Contributors

4726 avatar bananu7 avatar emmrk avatar flaviofernandes004 avatar formatcvt avatar ftkg avatar lugehorsam avatar meneleus avatar mofirouz avatar noitabara avatar novabyte avatar pnarimani avatar punkle avatar sesposito avatar supernimbus-daithi avatar syhpoon avatar tomglenn avatar zyro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nakama-common's Issues

Typescript: Error create tournament?

I tried to create a simple default tournament but it didn't work. Then I have to take all codes from your example from docs but it turn into error too. It logged out nothing but error map[]

Untitled

Is there something wrong with your example, my code, or you guys hide some tricks behind the example? Or this is a bug then i have to wait? And by the way, other features are running fine.

[BUG] registerAfterDeleteNotifications

Hello, I am receiving this error after the registration.

initializer.registerAfterDeleteNotifications(afterDeleteNotifications);

nakama | {"level":"error","ts":"2022-05-06T08:02:23.102Z","caller":"server/runtime_javascript.go:1524","msg":"Failed to eval JavaScript modules.","error":"TypeError: Object has no member 'registerAfterDeleteNotifications'\n\tat InitModule (index.js:365:49(107))\n\tat native\n"}

Should i change the name or it should be remove from the project?

[TS] Feature request: allow the user to specify the state type for the Authoritative Multiplayer matches

Right now, the type for the state is:

    export interface MatchState {
        [key: string]: any;
    }

It would be great if this was customizable by the user. This would require adding making all the handlers generic accepting that type. It should be easy to make sure that a set of all handlers is coherent, because they're all passed together to registerMatch, which could simply fill in that type when typechecking.

To maintain backwards compatibility, I think it could be possible to leave this type in and make it the default value for the generic.

[TS] Problem with base64UrlDecode (wrong length)

hi,
First of all: I've built the current source code, so I have the latest changes regarding Base64.

I have string I wish to base64 decode. "D-piPuEUcFN8I_ZlwW0BVChQvWG446bwmFTMlWXTZ44="
When I use TypeScript implementation result string has 31 chars length.
nk.base64UrlDecode(s).length==31
When I use (https://go.dev/play/) and type the same code as in nakama runtime, result string is 32 chars length
len(base64.URLEncoding.DecodeString(s))==32

[GO] fix some error messages

There are some errors:

error strings should not be capitalizedST1005
error strings should not end with punctuation or newlinesST1005

ErrStorageRejectedVersion    = errors.New("Storage write rejected - version check failed.")
ErrStorageRejectedPermission = errors.New("Storage write rejected - permission denied.")

error strings should not be capitalizedST1005

ErrInvalidChannelTarget = errors.New("Invalid channel target")
ErrInvalidChannelType   = errors.New("Invalid channel type")

[TS] base64UrlEncode vs base64Encode

I was checking the new release 3.13.1 with runtime 1.24.0 to see if #88 is now fixed.

My test code still is:

nk.base64UrlEncode(nk.hmacSha256Hash('testpayload', 'testsecret'), false)

I noticed two things:

  1. Only base64Encode now accepts a string | ArrayBuffer while base64UrlEncode still only accepts string.
  2. When looking at the implementation of base64encode and base64UrlEncode it looks like both use url-encoding internally.

Side note: it would be nice to have jwt verification built in (as we also do have jwtGenerate)

TypeScript: wrong field name in ValidatedPurchase

Looks like in "ValidatedPurchase" ts interface, "providerResponse" should be declared instead of "providerPayload", cause there is no such field in arriving object. Besides, go api contains reference to "providerResponse" field as well.

[TS] Nakama-Project-Template Typescript compile npx tsc fails On MatchSignal is missing in type...

i noticed a new commit here 143e8d8 adding MatchSignal. The template has not been updated to support this perhaps?

i do the recommended npm install and then npx tsc and get this now:

C:\Users\user\projects\nakama\server\nakama-project-template>npx tsc
main.ts:23:43 - error TS2345: Argument of type '{ matchInit: nkruntime.MatchInitFunction; matchJoinAttempt: nkruntime.MatchJoinAttemptFunction; matchJoin: nkruntime.MatchJoinFunction; matchLeave: nkruntime.MatchLeaveFunction; matchLoop: nkruntime.MatchLoopFunction; matchTerminate: nkruntime.MatchTerminateFunction; }' is not assignable to parameter of type 'MatchHandler'.
  Property 'matchSignal' is missing in type '{ matchInit: nkruntime.MatchInitFunction; matchJoinAttempt: nkruntime.MatchJoinAttemptFunction; matchJoin: nkruntime.MatchJoinFunction; matchLeave: nkruntime.MatchLeaveFunction; matchLoop: nkruntime.MatchLoopFunction; matchTerminate: nkruntime.MatchTerminateFunction; }' but required in type 'MatchHandler'.

 23     initializer.registerMatch(moduleName, {
                                              ~
 24         matchInit,
    ~~~~~~~~~~~~~~~~~~
...
 29         matchTerminate,
    ~~~~~~~~~~~~~~~~~~~~~~~
 30     });
    ~~~~~

  node_modules/nakama-runtime/index.d.ts:804:9
    804         matchSignal: MatchSignalFunction;
                ~~~~~~~~~~~
    'matchSignal' is declared here.


Found 1 error.

[TS] hmacSha256Hash base64Url encoding issue

In Typescript

nk.base64UrlEncode(nk.hmacSha256Hash('testpayload', 'testsecret'), false)

generates
77-977-9XV5277-9Zm7vv71S77-9C--_ve-_vXMuIO-_vX3vv73vv73vv70WD--_vRjvv70QdCEDFg.

Using Go directly

	mac := hmac.New(sha256.New, []byte("testsecret"))
	_, err := mac.Write([]byte("testpayload"))
	log.Print(base64.RawURLEncoding.EncodeToString(mac.Sum(nil)))

generate a different string (which seems to be the correct one):

lJJdXnaVZm7GUuwL-KRzLiCRfbT7kBYPtxjCEHQhAxY.

Do I use the API in a wrong way or is there some encoding issue going on?

My dependencies:
nakama-runtime: "github:heroiclabs/nakama-common#v1.23.0"
docker image: registry.heroiclabs.com/heroiclabs/nakama:3.12.0

Add missing function declarations to Typescript

There are some functions that exist but are not declared in Typescript.

Here's a list of those I encountered so far, but there could be more. They are all methods of the nkruntime.Nakama object.

  • localcacheGet()
  • localcachePut()
  • localcacheDelete()
  • cronNext()

Please add the missing definitions to the .d.ts file.

Wasm

.lua, .so, and .js Are the current runtime authoring options.

Wazero runs wasm with no cgo and is V1 now. The no cgo is great be Ayse builds are easy.

it will allow devs to write their logic in any language that compiles to wasm . Rust, go. Typescript, python, c, c#, and many more.

index.d.ts: MatchInitFunction params wrong type + documentation update required

In index.d.ts, MatchInitFunction, params has wrong type:
current: params: {[key: string]: string})
should be: params: {[key: string]: any})
because it is not string, it returns an object. Maybe you forgot to align it.

Also, please update documentation:
https://heroiclabs.com/docs/nakama/server-framework/typescript-runtime/function-reference/match-handler/

By the way, in Go documentation it is set correctly:
params map[string]interface{}

Thanks in advance!

[TS] Using type only imports to use types "normally"?

The typescript setup guide tells the user to add "typeRoots": ["./node_modules"] to the tsconfig.json. This seems a little dangerous to me and from my PoV this could also be solved by using Type-Only imports from Typescript 3.8.
I went ahead and changed declare namespace nkruntime (see https://github.com/heroiclabs/nakama-common/blob/master/index.d.ts#L15) to export namespace nkruntime and then a corresponding import { nkruntime } from "nakama-runtime"; in my typescript file.

For me this works fine and nicely streamlines the development to be less "unusual".

[GO] fix the response result for the WalletUpdate function

I think this line should be changed.

WalletUpdate(ctx context.Context, userID string, changeset map[string]int64, metadata map[string]interface{}, updateLedger bool) (updated map[string]int64, previous map[string]int64, err error)

WalletUpdate(ctx context.Context, userID string, changeset map[string]int64, metadata map[string]interface{}, updateLedger bool) (updated map[string]int64, previous map[string]int64, err error)

to

WalletUpdate(ctx context.Context, userID string, changeset map[string]int64, metadata map[string]interface{}, updateLedger bool) (*WalletUpdateResult, error)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.