[ENG-725] Read-only SchemaBlockGroupRenderer

Ticket: []
Feature flag: n/a

Purpose
To update the SchemaBlockGroupRenderer to include read-only components for the submission review page.
Summary of Changes

Add read-only components
Update handbook

Side Effects
N/A
QA Notes
N/A

Pull Request Test Coverage Report for Build 3469

18 of 24 (75.0%)  changed or added relevant lines in 4 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage decreased (-0.04%) to 75.465%

Changes Missing Coverage
Covered Lines
Changed/Added Lines
%

lib/osf-components/addon/components/registries/schema-block-renderer/read-only/base/component.ts
8
14
57.14%

Totals

Change from base Build 3465:
-0.04%

Covered Lines:
7878

Relevant Lines:
9163

💛  - Coveralls

@aaxelb The name for the parameter was blockStrategy at first, but then we thought it was confusing so we change it to mapper. I am okay with strategy as long as everybody knows what it means.

Yeah, the ultimate goal of a name is for all of us to know what it means -- I think "mapper" feels clear to us now because we've been saying it a lot recently, but I worry it might be confusing when we come back to it a year from now, or for someone new to the codebase. (I'm open to disagreement, ofc)
I agree blockStrategy was confusing -- would renderingStrategy be better?

What about renderWith or renderUsing?
<SchemaBlockGroupRenderer
    @renderWith={{component '.../read-only' responses=@responses}}
>

<SchemaBlockGroupRenderer
    @renderUsing={{component '.../editable' changeset=@changeset}}
>

Also, I second the idea of passing @responses and @changeset (and probably @node) to the "mapper". This didn't make as much sense when the mapper was invoked inside SchemaBlockGroupRenderer, but does now that it's invoked outside and passed in and each mapper has different needs.

What about renderWith or renderUsing?
<SchemaBlockGroupRenderer
    @renderWith={{component '.../read-only' responses=@responses}}
>

<SchemaBlockGroupRenderer
    @renderUsing={{component '.../editable' changeset=@changeset}}
>

How about renderingStrategy or renderStrategy?

I like how renderWith sounds, it's probably my favorite non-strategy name. If we're ok with strategy, though, I like renderStrategy.


merge from template-arlac77-github

package.json

chore(deps): add ^23.0.3 remove ^23.0.2 (devDependencies.semantic-release)

Pull Request Test Coverage Report for Build<PHONE_NUMBER>
Details

0 of 0   changed or added relevant lines in 0 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage remained the same at 98.141%

Totals

Change from base Build<PHONE_NUMBER>:
0.0%

Covered Lines:
405

Relevant Lines:
413

💛  - Coveralls


ES6 import don't work with additional sorts

While this works:
import Tablesort from 'tablesort'

I don't know how to import the additional sorts (example: number, date). Could you please document this?

+1 to this issue.
I think src/sorts/ should be marked as exportable modules

+1

I believe this library is no longer maintained :(

Pull requests happily accepted!

Importing the sort files directly does not work, as inside of them Tablesort is not defined.
This here is working (at least for webpack):
https://github.com/contradictioned/tablesort/commit/c00ff8271828d06e3dbca4af27f7d993a25c438a
Problem is, that this import probably does not work with a plain-old-javascript setup.


[Organizations] Review existing notifications for organizations

Determine when to send to DL vs. Admins vs. All members
We also need to update existing notifications for orgs. Proposing the following:

Notifications to only org admins:

Email confirmation link for changing email
Email confirmation links for package owner requests
Email notifications for package owner added/removed/rejected
Email for contact owners
Email for delete account

Notifications to all org members:

Package push notifications
Email change notifications
Emails for contact support (from address)

Also need to update existing notifications for API keys. See #5321.


[Bug] Editor dispose erroring in async.ts

Reproducible in vscode.dev or in VS Code Desktop?

[X] Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

[ ] Not reproducible in the monaco editor playground

Monaco Editor Playground Code
// The Monaco Editor can be easily created, given an
// empty container and an options literal.
// Two members of the literal are "value" and "language".
// The editor takes the full size of its container.

const mon = monaco.editor.create(document.getElementById('container'),  {
                autoClosingBrackets: "never",
                autoClosingQuotes: "never",
                automaticLayout: true, // severe performance impact, but avoiding CSS for now
                language: 'csharp',
                lineNumbers: "off",
                minimap: {
                    enabled: false,
                },
                renderValidationDecorations: "off",
                scrollbar: {
                    alwaysConsumeMouseWheel: false,
                },
                suggest: {
                    showStatusBar: true,
                    showWords: false, // There is a weird interaction between editors without this being set to false.
                    snippetsPreventQuickSuggestions: false,
                },
                theme: "vs",
                value: "22",
            });

mon.dispose();

Reproduction Steps
Paste the code on the playground
Open a console and put a breakpoint in async.ts line 274 in the cancel() method:
cancel(): void {
  this.cancelTimeout();

  if (this.completionPromise) {
	  if (this.doReject) {
		  this.doReject(new CancellationError());  // HERE
	  }
	  this.completionPromise = null;
  }
}

Press the Run button
It should hit the breakpoint
Actual (Problematic) Behavior
The actual problem is that it would cause a memory leak, which we could see when testing
Expected Behavior
The async dispose should happen correctly, not reject.
Additional Context
No response

Can you elaborate why you think this causes a memory leak?

Hi,
We use Monaco editor as part of one of our components written in AngularJS.
For every of our components, we add a tag onto the scope so that we can detect if anything is left over after destroying the scope.
Part as part of our destroy, we dispose of the monaco editor, however, when we run our tests, we find tags left over, with a promise help for async.js.  We then search for tag, and find leftover tags.

I hope this helps.
Louis

Can you provide steps of how to reproduce the memory leak in the playground?

I will spend some time on it and try to get the leak on the playground.
It might take some time hehe.


Triangle 2

Rapid Left and Right Jittering Movement Fix (with too many enemies on screen)
Sometimes the Goombas will start jittering in place upon colliding with one another or the obstacles. The jittering movement may be caused by the randomness of the Goomba collisions, so probably change this part of the Goomba.js code:
// Player action on collisions
    collisionAction() {
        if (this.collisionData.touchPoints.other.id === "tube") {
            if (this.collisionData.touchPoints.other.left || this.collisionData.touchPoints.other.right) {
                this.speed = -this.speed;
            }
        }
}

     if (this.collisionData.touchPoints.other.id === "goomba") {
            if (GameEnv.difficulty !== "impossible" && (this.collisionData.touchPoints.other.left || this.collisionData.touchPoints.other.right)) {
                this.speed = -this.speed;
            }
        }
        if (this.collisionData.touchPoints.other.id === "jumpPlatform") {
            if (this.collisionData.touchPoints.other.left || this.collisionData.touchPoints.other.right) {
                this.speed = -this.speed;
            }
        }

(I'm still not sure how to fix this issue but maybe we can have collision action happen only between the Goombas and the obstacles and not between Goombas to reduce the possible randomness of the collision movements (although this would make the enemy movement less interesting))
FlyingGoomba Not Doing Damage Fix
The player can essentially pass through the FlyingGoomba without it doing any damage to the player. This could be an error within the collision action part of the FlyingGoomba.js code and could be a result of it missing parts of the animation/action that would happen following collision detection with player. Comparing it to the Goomba.js collision code:
 if (this.collisionData.touchPoints.other.id === "player") {
            // Collision: Top of Goomba with Bottom of Player
            //console.log(this.collisionData.touchPoints.other.bottom + 'bottom')
            //console.log(this.collisionData.touchPoints.other.top + "top")
            //console.log(this.collisionData.touchPoints.other.right + "right")
            //console.log(this.collisionData.touchPoints.other.left + "left")
            if (this.collisionData.touchPoints.other.bottom && this.immune == 0) {
                GameEnv.invincible = true;
                GameEnv.goombaBounce = true;
                this.canvas.style.transition = "transform 1.5s, opacity 1s";
                this.canvas.style.transition = "transform 2s, opacity 1s";
                this.canvas.style.transformOrigin = "bottom"; // Set the transform origin to the bottom
                this.canvas.style.transform = "scaleY(0)"; // Make the Goomba flat
                this.speed = 0;
                GameEnv.playSound("goombaDeath");

                setTimeout((function() {
                    GameEnv.invincible = false;
                    this.destroy();
                }).bind(this), 1500);

                // Set a timeout to make GameEnv.invincible false after 2000 milliseconds (2 seconds)
                setTimeout(function () {
                this.destroy();
                GameEnv.invincible = false;
                }, 2000);
            }
        }

and the FlyingGoomba.js collision code:
    if (this.collisionData.touchPoints.other.id === "player") {
            this.speed = 0;
            // Collision: Top of Goomba with Bottom of Player
            console.log(this.collisionData.touchPoints.other.bottom + 'bottom')
            console.log(this.collisionData.touchPoints.other.top + "top")
            console.log(this.collisionData.touchPoints.other.right + "right")
            console.log(this.collisionData.touchPoints.other.left + "left")

            if (this.collisionData.touchPoints.other.bottom && this.immune == 0) {
                GameEnv.invincible = true;
                this.speed = 0;
                GameEnv.playSound("goombaDeath");
                setTimeout((function() {
                    GameEnv.invincible = false;
                    this.destroy();
                }).bind(this), 1500);

            }
        }

it seems to be missing the transforming animation (but this could be on purpose. Also not sure if this solves the collision detection part of the code though because it could just be a bug resulting from the FlyingGoomba animation. Maybe instead create the animation code after implementing Goomba doing damage code <- according to Xavier)
Less/More Enemies Per Level
Make Regular Goomba Do Damage for All Levels

Make Regular Goomba Do Damage for All Levels

Normal Goomba will not kill you on easy & hard

The original code included a single if statement for Goomba collision on levels normal and imposable.
 if (GameEnv.difficulty === "normal | | imposable") {

It used ( | | ) which returns the boolean value true if either or both operands is true and returns false otherwise. In other words its an OR operator. Assuming this method worked we could fix the code simply by including the other levels seperated by the same OR operator...
 if (GameEnv.difficulty === "normal | | imposable | | hard") {

The reason we don't include easy is because Goombas are not supposed to kill you on that difficulty level

Unfortunately after trying such fix I realized this would not work due to the fact that all variables (game levels) are within the same quotations making the the tree separate variables read as one. The fix for such code would be simple...
 if (GameEnv.difficulty === "normal" | | "imposable" | | "hard") {

With that said the fix I decided to go with was creating 3 separate if statements, one for each level. This allows us to toggle with each level individually as we progress with our changes.
        if (this.timer === false) {
            this.timer = true;
            if (GameEnv.difficulty === "normal") {
                this.canvas.style.transition = "transform 0.5s";
                this.canvas.style.transform = "rotate(-90deg) translate(-26px, 0%)";
                GameEnv.playSound("PlayerDeath");

                if (this.isDying == false) {
                    this.isDying = true;
                    setTimeout(async() => {
                        await GameControl.transitionToLevel(GameEnv.levels[GameEnv.levels.indexOf(GameEnv.currentLevel)]);
                        console.log("level restart")
                        this.isDying = false;
                    }, 900);
                }
            }
            if (GameEnv.difficulty === "hard") {
                this.canvas.style.transition = "transform 0.5s";
                this.canvas.style.transform = "rotate(-90deg) translate(-26px, 0%)";
                GameEnv.playSound("PlayerDeath");

                if (this.isDying == false) {
                    this.isDying = true;
                    setTimeout(async() => {
                        await GameControl.transitionToLevel(GameEnv.levels[GameEnv.levels.indexOf(GameEnv.currentLevel)]);
                        console.log("level restart")
                        this.isDying = false;
                    }, 900);
                }
            }
            if (GameEnv.difficulty === "impossible") {
                this.canvas.style.transition = "transform 0.5s";
                this.canvas.style.transform = "rotate(-90deg) translate(-26px, 0%)";
                GameEnv.playSound("PlayerDeath");

                if (this.isDying == false) {
                    this.isDying = true;
                    setTimeout(async() => {
                        await GameControl.transitionToLevel(GameEnv.levels[GameEnv.levels.indexOf(GameEnv.currentLevel)]);
                        console.log("level restart")
                        this.isDying = false;
                    }, 900);
                }
            }
            else if (GameEnv.difficulty === "easy") {
                this.x += 10;
            }
        }
    }

Less or More Enemies Per Level
The original code does not specify the number of enemies spawned per level. For example, hillsGameObjects is just an array containing all the game objects, which applies for all difficulties:
const hillsGameObjects = [
        // GameObject(s), the order is important to z-index...
        { name: 'mountains', id: 'background', class: BackgroundMountains,  data: this.assets.backgrounds.mountains },
        { name: 'clouds', id: 'background', class: BackgroundClouds, data: this.assets.backgrounds.clouds },
        { name: 'hills', id: 'background', class: BackgroundHills, data: this.assets.backgrounds.hills },
        { name: 'grass', id: 'platform', class: Platform, data: this.assets.platforms.grass },
        { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2, yPercentage: 0.85 },
        { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2368, yPercentage: 0.85 },
        { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2736, yPercentage: 0.85 },
        { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.6, yPercentage: 1 },
        { name: 'itemBlock', id: 'jumpPlatform', class: JumpPlatform, data: this.assets.platforms.itemBlock, xPercentage: 0.4, yPercentage: 0.65 }, //item block is a platform
        { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.3, yPercentage: 1, minPosition: 0.05},
        { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.5, yPercentage: 1, minPosition: 0.3 },
        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.49},
        { name: 'goombaSpecial', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.75, yPercentage: 1, minPosition: 0.5 }, //this special name is used for random event 2 to make sure that only one of the Goombas ends the random event
        { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.1908, yPercentage: 0.75 },
        { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2242, yPercentage: 0.75 },
        { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2575, yPercentage: 0.75 },
        { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.5898, yPercentage: 0.900 },
        { name: 'mario', id: 'player', class: Player, data: this.assets.players.mario },
        { name: 'tube', id: 'tube', class: Tube, data: this.assets.obstacles.tube },
        { name: 'loading', id: 'background', class: BackgroundTransitions,  data: this.assets.backgrounds.loading },
        ];

To make this different for each difficulty, create a switch statement that will execute the case that applies to the difficulty (also leave the hillsGameObjects array empty):
// Hills Game Level defintion...
        const hillsGameObjects = [];

        switch(localStorage.getItem("difficulty"))
        {
          // change number of each type of goomba for each difficulty
          case "easy":
            //run code that should happen in easy
            hillsGameObjects.push(
              { name: 'mountains', id: 'background', class: BackgroundMountains,  data: this.assets.backgrounds.mountains },
              { name: 'clouds', id: 'background', class: BackgroundClouds, data: this.assets.backgrounds.clouds },
              { name: 'hills', id: 'background', class: BackgroundHills, data: this.assets.backgrounds.hills },
              { name: 'grass', id: 'platform', class: Platform, data: this.assets.platforms.grass },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2, yPercentage: 0.85 },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2368, yPercentage: 0.85 },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2736, yPercentage: 0.85 },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.6, yPercentage: 1 },
              { name: 'itemBlock', id: 'jumpPlatform', class: JumpPlatform, data: this.assets.platforms.itemBlock, xPercentage: 0.4, yPercentage: 0.65 }, //item block is a platform
              { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.3, yPercentage: 1, minPosition: 0.05},
              { name: 'goombaSpecial', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.75, yPercentage: 1, minPosition: 0.5 }, //this special name is used for random event 2 to make sure that only one of the Goombas ends the random event
              { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.49},
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.1908, yPercentage: 0.75 },
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2242, yPercentage: 0.75 },
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2575, yPercentage: 0.75 },
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.5898, yPercentage: 0.900 },
              { name: 'mario', id: 'player', class: Player, data: this.assets.players.mario },
              { name: 'tube', id: 'tube', class: Tube, data: this.assets.obstacles.tube },
              { name: 'loading', id: 'background', class: BackgroundTransitions,  data: this.assets.backgrounds.loading },
              )
          break;

          case "normal":
            hillsGameObjects.push(
              { name: 'mountains', id: 'background', class: BackgroundMountains,  data: this.assets.backgrounds.mountains },
              { name: 'clouds', id: 'background', class: BackgroundClouds, data: this.assets.backgrounds.clouds },
              { name: 'hills', id: 'background', class: BackgroundHills, data: this.assets.backgrounds.hills },
              { name: 'grass', id: 'platform', class: Platform, data: this.assets.platforms.grass },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2, yPercentage: 0.85 },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2368, yPercentage: 0.85 },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2736, yPercentage: 0.85 },
              { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.6, yPercentage: 1 },
              { name: 'itemBlock', id: 'jumpPlatform', class: JumpPlatform, data: this.assets.platforms.itemBlock, xPercentage: 0.4, yPercentage: 0.65 }, //item block is a platform
              { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.3, yPercentage: 1, minPosition: 0.05},
              { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.4, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
              { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.5, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
              { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.6, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
              { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.49},
              { name: 'goombaSpecial', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.75, yPercentage: 1, minPosition: 0.5 }, //this special name is used for random event 2 to make sure that only one of the Goombas ends the random event
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.1908, yPercentage: 0.75 },
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2242, yPercentage: 0.75 },
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2575, yPercentage: 0.75 },
              { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.5898, yPercentage: 0.900 },
              { name: 'mario', id: 'player', class: Player, data: this.assets.players.mario },
              { name: 'tube', id: 'tube', class: Tube, data: this.assets.obstacles.tube },
              { name: 'loading', id: 'background', class: BackgroundTransitions,  data: this.assets.backgrounds.loading },
              )
          break;
              case "hard":
                hillsGameObjects.push(
                  { name: 'mountains', id: 'background', class: BackgroundMountains,  data: this.assets.backgrounds.mountains },
                  { name: 'clouds', id: 'background', class: BackgroundClouds, data: this.assets.backgrounds.clouds },
                  { name: 'hills', id: 'background', class: BackgroundHills, data: this.assets.backgrounds.hills },
                  { name: 'grass', id: 'platform', class: Platform, data: this.assets.platforms.grass },
                  { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2, yPercentage: 0.85 },
                  { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2368, yPercentage: 0.85 },
                  { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2736, yPercentage: 0.85 },
                  { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.6, yPercentage: 1 },
                  { name: 'itemBlock', id: 'jumpPlatform', class: JumpPlatform, data: this.assets.platforms.itemBlock, xPercentage: 0.4, yPercentage: 0.65 }, //item block is a platform
                  { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.3, yPercentage: 1, minPosition: 0.05},
                  { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.4, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                  { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.5, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                  { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.6, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                  { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.49},
                  { name: 'goombaSpecial', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.75, minPosition: 0.5 }, //this special name is used for random event 2 to make sure that only one of the Goombas ends the random event
                  { name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.5, minPosition:  0.05},
                  { name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.9, minPosition: 0.5},
                  { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.1908, yPercentage: 0.75 },
                  { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2242, yPercentage: 0.75 },
                  { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2575, yPercentage: 0.75 },
                  { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.5898, yPercentage: 0.900 },
                  { name: 'mario', id: 'player', class: Player, data: this.assets.players.mario },
                  { name: 'tube', id: 'tube', class: Tube, data: this.assets.obstacles.tube },
                  { name: 'loading', id: 'background', class: BackgroundTransitions,  data: this.assets.backgrounds.loading },
                  )
          break;
              case "impossible":
                    hillsGameObjects.push(
                      { name: 'mountains', id: 'background', class: BackgroundMountains,  data: this.assets.backgrounds.mountains },
                      { name: 'clouds', id: 'background', class: BackgroundClouds, data: this.assets.backgrounds.clouds },
                      { name: 'hills', id: 'background', class: BackgroundHills, data: this.assets.backgrounds.hills },
                      { name: 'grass', id: 'platform', class: Platform, data: this.assets.platforms.grass },
                      { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2, yPercentage: 0.85 },
                      { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2368, yPercentage: 0.85 },
                      { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.2736, yPercentage: 0.85 },
                      { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.block, xPercentage: 0.6, yPercentage: 1 },
                      { name: 'itemBlock', id: 'jumpPlatform', class: JumpPlatform, data: this.assets.platforms.itemBlock, xPercentage: 0.4, yPercentage: 0.65 }, //item block is a platform
                      { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.3, yPercentage: 1, minPosition: 0.05},
                      { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.4, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                      { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.5, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                      { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.6, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                      { name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.7, yPercentage: 1, minPosition: 0.05},        { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.09},
                      { name: 'mushroom', id: 'mushroom', class: Mushroom, data: this.assets.enemies.mushroom, xPercentage: 0.49},
                      { name: 'goombaSpecial', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.75, minPosition: 0.5 }, //this special name is used for random event 2 to make sure that only one of the Goombas ends the random event
                      { name: 'goombaSpecial', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage:  0.80, minPosition: 0.5 }, //this special name is used for random event 2 to make sure that only one of the Goombas ends the random event
                      { name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.5, minPosition:  0.05},
                      { name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.3, minPosition:  0.05},
                      { name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.2, minPosition: 0.5},
                      { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.1908, yPercentage: 0.75 },
                      { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2242, yPercentage: 0.75 },
                      { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.2575, yPercentage: 0.75 },
                      { name: 'coin', id: 'coin', class: Coin, data: this.assets.obstacles.coin, xPercentage: 0.5898, yPercentage: 0.900 },
                      { name: 'mario', id: 'player', class: Player, data: this.assets.players.mario },
                      { name: 'tube', id: 'tube', class: Tube, data: this.assets.obstacles.tube },
                      { name: 'loading', id: 'background', class: BackgroundTransitions,  data: this.assets.backgrounds.loading },
                      )
          //default:
            //default cases run whena all conditions fail: it's the else{} block of switch()
          break;
        }

I also changed the xPercentage to spawn the goombas at different places

FlyingGoomba Not Doing Damage Fix

Flying Goomba wont kill you on contact

The original code included a single if statement for Goomba collisions and FlyingGoomba collisions separated by ( | | ) which returns the Boolean value true if either or both operands is true and returns false otherwise. In other words its an OR operator that unfortunately did not work.
        if (this.collisionData.touchPoints.other.id === "goomba" || this.collisionData.touchPoints.other.id === "flyingGoomba") {
            if (GameEnv.invincible === false) {
                GameEnv.goombaInvincible = true;
                // Collision with the left side of the Enemy
                if (this.collisionData.touchPoints.other.left && !this.collisionData.touchPoints.other.bottom && !this.collisionData.touchPoints.other.top && GameEnv.invincible === false && this.timer === false) {
                    setTimeout(this.goombaCollision.bind(this), 50);
                } else if (this.collisionData.touchPoints.other.right && !this.collisionData.touchPoints.other.bottom && !this.collisionData.touchPoints.other.top && GameEnv.invincible === false && this.timer === false) {
                    setTimeout(this.goombaCollision.bind(this), 50);
                }

                // Collision with the right side of the Enemy
            }
        }

The code can be fixed simply by separating the operation into two separate if statements...
        if (this.collisionData.touchPoints.other.id === "goomba") {
            if (GameEnv.invincible === false) {
                GameEnv.goombaInvincible = true;
                // Collision with the left side of the Enemy
                if (this.collisionData.touchPoints.other.left && !this.collisionData.touchPoints.other.bottom && !this.collisionData.touchPoints.other.top && GameEnv.invincible === false && this.timer === false) {
                    setTimeout(this.goombaCollision.bind(this), 50);
                } else if (this.collisionData.touchPoints.other.right && !this.collisionData.touchPoints.other.bottom && !this.collisionData.touchPoints.other.top && GameEnv.invincible === false && this.timer === false) {
                    setTimeout(this.goombaCollision.bind(this), 50);
                }

                // Collision with the right side of the Enemy
            }
        }
        if ( this.collisionData.touchPoints.other.id === "flyingGoomba") {
            if (GameEnv.invincible === false) {
                GameEnv.goombaInvincible = true;
                // Collision with the left side of the Enemy
                if (this.collisionData.touchPoints.other.left && !this.collisionData.touchPoints.other.bottom && !this.collisionData.touchPoints.other.top && GameEnv.invincible === false && this.timer === false) {
                    setTimeout(this.goombaCollision.bind(this), 50);
                } else if (this.collisionData.touchPoints.other.right && !this.collisionData.touchPoints.other.bottom && !this.collisionData.touchPoints.other.top && GameEnv.invincible === false && this.timer === false) {
                    setTimeout(this.goombaCollision.bind(this), 50);
                }

                // Collision with the right side of the Enemy
            }
        }

Rapid Left and Right Jittering Movement Fix (with too many enemies on screen)
Sometimes the Goombas will start jittering in place upon colliding with one another or the obstacles. The jittering movement may be caused by the overlapping of Goombas' hitboxes(sometimes frequent changes of direction in obstacle-heavy maps can cause if-statement conflicts, which can accidentally allow hitboxes to overlap, therefore causing both Goombas repeatedly change direction and cause both Goombas to start jittering):
     if (this.collisionData.touchPoints.other.id === "goomba") {
            if (GameEnv.difficulty !== "impossible" && (this.collisionData.touchPoints.other.left || this.collisionData.touchPoints.other.right)) {
                this.speed = -this.speed;
            }
        }

So, instead of deleting the entire Goombas collision, we can make the collisions less frequent by adding a boolean and if-statement (adding limit to Goombas collision.
    constructor(canvas, image, data, xPercentage, yPercentage, name, minPosition){
        super(canvas, image, data, 0.0, 0.2);
...
        this.collisionYes = false;  //new line added, boolean to determine if a Goomba is allowed to change direction.
...
    }

        if(this.collisionYes){
            setTimeout(() => {
                this.collisionYes = false; //turn the boolean to false to allow the if-statement below to run again.
            }, 10000); // 10000 milliseconds = 10 seconds //everytime when a Goomba change direction, it need to wait for 10 second to change direction again
        }

        if (this.collisionData.touchPoints.other.id === "goomba") {
            if (GameEnv.difficulty !== "impossible" && (this.collisionData.touchPoints.other.left || this.collisionData.touchPoints.other.right) && !this.collisionYes) {
                this.collisionYes = true; //set the boolean to true(if the boolean is true, this if-statement won't run again)
                this.speed = -this.speed;
            }
        }


Modifier -> SwiftUI -> Modal presentations: alert(_:isPresented:presenting:actions:message:)

Doc:
https://developer.apple.com/documentation/swiftui/view/alert(_:ispresented:presenting:actions:message:)-29bp4

[ ] Swift implementation
[ ] Elixir implementation

https://developer.apple.com/documentation/swiftui/view/alert(_:ispresented:presenting:actions:message:)-3md6l

[ ] Swift implementation
[ ] Elixir implementation

https://developer.apple.com/documentation/swiftui/view/alert(_:ispresented:presenting:actions:message:)-8584l

[ ] Swift implementation
[ ] Elixir implementation

#636 for all alert modifiers. Rejecting


[Event Request] - Report Calculate Inventory - function CalcPhysInvQtyAndInsertItemJnlLine

local procedure CalcPhysInvQtyAndInsertItemJnlLine()
    begin
        with QuantityOnHandBuffer do begin
            Reset;
            //new Event
            OnCalcPhysInvQtyAndInsertItemJnlLineOnBeforeFindset(QuantityOnHandBuffer);
            //New Event
            if FindSet then begin
                repeat
                    PosQty := 0;
                    NegQty := 0;

                    GetLocation("Location Code");
                    if Location."Directed Put-away and Pick" then
                        CalcWhseQty(Location."Adjustment Bin Code", PosQty, NegQty);

                    if (NegQty - Quantity <> Quantity - PosQty) or ItemTrackingSplit then begin

  [IntegrationEvent(false, false)]
    local procedure OnCalcPhysInvQtyAndInsertItemJnlLineOnBeforeFindset(var InventoryBuffer: Record "Inventory Buffer")
    begin
    end;

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.


Add CI and run clang-format

Adds CI that runs clang-format and our unit tests. Also cleans up the code using clang-format to ensure it passes CI.
CC: @shankari  @AssemblyJohn

@christopher-davis-afs I think that some additional context would be helpful here. I checked the "checks" and they are not related to this PR in any way. The only two checks are from "codacy static code analysis" and "DCO", neither of which is related to build or test (see below).
How do you even know that this works?

Those are the checks that are already in the repository. I believe someone with write access to the repo needs to allow the GitHub Actions workflow to run.

How do you even know that this works?

Prior to making this PR, I had the workflow set to run on every push. When I pushed changes to our fork, our fork ran the GitHub Actions and I was able to verify that they complete.

@christopher-davis-afs

Those are the checks that are already in the repository. I believe someone with write access to the repo needs to allow the GitHub Actions workflow to run.

The workflow actions have been run (see the message around "All checks have passed"). It looks like somebody has already approved this action. But the new "build and test" workflow has not been run.

@christopher-davis-afs This PR is still pending the discussion around why the test is not being executed.
I believe we had discussed creating test PRs in repos that both have the action tab and don't have the action tab, so we can figure out the root case, and then ask the EVerest maintainers to reconcile the settings between the correctly configured and incorrectly configured repos.

There are PRs that fulfill those criteria:
A repo without the actions tab: https://github.com/EVerest/liblog/pull/16
A repo with: https://github.com/EVerest/libtimer/pull/8
Neither has the added actions running, and neither mentions a workflow requiring an approval.
Who should we reach out to from EVerest to help figure out where the issue is?

Due to the lack of incremental commits, I am not sure what changed here. Clearly the schedule was removed, but apparently there were also some changes in install_and_test.sh but I am not sure what they were.
The file is not very complex, and appears to be correct and consistent with the other repos, so I am approving this for now but would like to see the changes for easier incremental reviews in the future.

When the pull request is ready for merging, please mark me as a reviewer.

Could you provide a link to a successful run of this workflow in your fork?

https://github.com/US-JOET/libfsm/actions/runs/7265028354

Unfortunately not - I can only do that if I change the workflow to run on every push instead of just on PR, which would then need to be dropped before merging.

In this case, we merge and test afterwards :)

It works :)
https://github.com/PionixInternal/octt-everest-testing-instance/pull/5


Allow passing first_name and last_name in the auth url params when using custom signup

Prerequisites

[X] I have searched the repository’s issues, Kinde community and public roadmap to ensure my feature request isn’t a duplicate
[X] I have read the contributing guidelines
[X] I agree to the terms within the code of conduct

What is the problem you’re trying to solve?
Currently there's no way to assign first_name and last_name to a new user during custom signup process.
register({
	authUrlParams: {
		connection_id: import.meta.env.VITE_KINDE_EMAIL_PASSWORD_CONNECTION_ID,
		login_hint: email,
	},
});

The created user object only contains the id and email,
{
    "id": "kp_userid",
    "email"<EMAIL_ADDRESS>    "family_name": undefined,
    "given_name": undefined,
    "picture": undefined,
}

What solution would you like to see?
the authUrlParams should allow passing the first_name and last_name as parameters.
register({
	authUrlParams: {
		connection_id: import.meta.env.VITE_KINDE_EMAIL_PASSWORD_CONNECTION_ID,
		login_hint: email,
		first_name: firstName,
		last_name: lastName
	},
});

After custom signup, the user object should look like this:
{
    "id": "kp_userid",
    "email"<EMAIL_ADDRESS>    "family_name": firstName,
    "given_name": lastName,
    "picture": undefined,
}

Additional information
No response

Hi,
Thanks for this, we have been discussing internally, currently the Kinde auth platform doesn't support passing these properties over.  I will see if I can get updates on when we could get these added.


User attributes

Had issue with Travis CI - "Could not authorize build request for uoa-ems-research/JEMSS.jl"
Have now selected the free plan for the uoa-ems-research organisation on Travis CI, so hopefully re-requesting a pull will initiate a build.

Builds on Travis are now failing with error:
"The command "julia --color=yes -e "if VERSION < v"0.7.0-DEV.5183"; cd(Pkg.dir("${JL_PKG}")); else using Pkg; end; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())"" exited with 1."
I will remove use of Coveralls for now and see if that removes the error.


Add RATA Run Data

As an ECMPS user (logged-in), I want to add RATA Run data so that I can add information to a test
Acceptance Criteria:
Given the user has selected Relative Accuracy from the Test Type Group dropdown
When the user clicks on 'Add' for Run
Then the system displays a modal
and the user can add new data for:
Run Number (Text)
Begin Date (Text+Datepicker)
Begin Hour (Dropdown)
Begin Minute (Dropdown)
End Date (Text+Datepicker)
End Hour (Dropdown)
End Minute Dropdown)
CEM Value (Text)
RATA Reference Value (Text)
Gross Unit Load (Text)
Run Status Code (Dropdown)
Given the user has added RATA Run data
When the user chooses to save and close
Then the data is saved
And the modal closes
And the user is returned to the Landing screen for RATA Run data
And the Run Record is reflected on the UI
Given the user has added new 'Run Records' (RATA Summary)
When the user chooses to Cancel
Then the user is returned to the Landing screen for RATA
And no updates are saved
Reference Invision:
https://projects.invisionapp.com/freehand/document/SrHrFhGQ3?zoomToItems=Y2w0eWhoZjZ5MDE3OTNiNnlqNHF4d21vYQ%3D%3D
https://projects.invisionapp.com/freehand/document/SrHrFhGQ3?zoomToItems=Y2w0eWd4NmthMDFldTNiN2diaThybG9uaQ%3D%3D
Testing
Test Cases:
View TC907
Tester:  @mosesdeeCVP

Test Passed


Extraction function for Chinese

This PR adds an extraction function for Chinese that targets Mandarin pronunciations. It also filters the Mandarin data we collect by removing everything that is not part of the Han Unicode script leaving us with a TSV chi_hani_phonemic.tsv that contains 117991 entries. 'hani' is used in order to follow the ISO 15924 conventions we observe when naming TSVs that have been split, but since we are only filtering out Latin entries (and some emojis) and aren't splitting the Mandarin data into multiple TSVs perhaps it would make more sense to leave it as chi_phonemic.tsv?
The method used for filtering the Mandarin data could be applied to other languages, like Korean, that we want to remove Latin entries from.
This PR also fixes a problem in merge.py and some previously identified problems with the requirements.txt for the scraping scripts.
I think this resolves #72 although there is some other Chinese language data to be grabbed from scrapping chi like Min Nan and Cantonese transcriptions as mentioned in #57 .

I made the changes requested. When we go to write a Cantonese extraction function we may need to modify extract/__init__.py in some way (or modify and rename cmn.py to handle Mandarin and Cantonese). We want both cmn and yue to target the "Chinese" Wiktionary language and extract/__init__.py will not be able to assign a different extraction function to yue if it has the key as cmn.


ffjson 2x slower for unmarshal than encoding/json

I'm experimenting with ffjson for a struct we use very heavily in our advertising platform. I was surprised to get a 2x slowdown in unmarshal performance when compared to encoding/json:
BenchmarkUnmarshalRequestStdlib	   20000	     68320 ns/op	    5953 B/op	     142 allocs/op
BenchmarkUnmarshalRequestFfjson	   10000	    119168 ns/op	   17420 B/op	     376 allocs/op

I think I am using ffjson correctly, but perhaps I've made a mistake
However, it may be that struct I'm unmarshalling is not a good fit for ffjson and so it might be of interest to the authors. The struct is quite complex with several sub structs, but it's main feature is that nearly every field is optional and is expressed as a pointer.
Benchmark code is here https://github.com/avct/openrtb/blob/ffjson/benchmark_test.go (ffjson branch of https://github.com/avct/openrtb). Struct being unmarshalled is at https://github.com/avct/openrtb/blob/ffjson/request.go

Looking at https://github.com/avct/openrtb/blob/ffjson/request_ffjson.go - it seems a lot are falling back to json.Unmarshal
If you added ffjson files for openrtb.Impression,openrtb.Site, openrtb.App, openrtb.Device, openrtb.User, openrtb.Regulations,openrtb.Extensions and openrtb.Pmp types, ffjson will be able to encode these fields directly, and not have to go through the json library.
@pquerna: I don't know much about the decoder, maybe you have something to add.

i'm  seeing 2x penalty slow down as well for decoding. decoding a million records takes 1m8s without ffjson and 2m34s.
Looking at a cpu profile (smaller set 100k) it looks like most time is spent in fflib. I believe scanblock is from excessive garbage generation.

(pprof) top10
7660ms of 15740ms total (48.67%)
Dropped 105 nodes (cum <= 78.70ms)
Showing top 10 nodes out of 94 (cum >= 350ms)
      flat  flat%   sum%        cum   cum%
    2290ms 14.55% 14.55%     2290ms 14.55%  scanblock
    1060ms  6.73% 21.28%     1110ms  7.05%  encoding/json.stateInString
     980ms  6.23% 27.51%     1340ms  8.51%  runtime.mallocgc
     640ms  4.07% 31.58%     1350ms  8.58%  encoding/json.(*Decoder).readValue
     600ms  3.81% 35.39%     1730ms 10.99%  encoding/json.nextValue
     490ms  3.11% 38.50%      490ms  3.11%  runtime.memmove
     470ms  2.99% 41.49%     1080ms  6.86%  encoding/json.checkValid
     400ms  2.54% 44.03%      400ms  2.54%  runtime.MSpan_Sweep
     380ms  2.41% 46.44%     5320ms 33.80%  github.com/pquerna/ffjson/fflib/v1.(*FFLexer).Scan
     350ms  2.22% 48.67%      350ms  2.22%  github.com/pquerna/ffjson/fflib/v1.scanString

most of these slowdowns are due to when we fallback on the decoder, we have to scan out the whole sub-field in the JSON, and then copy it over to the encoding/json decoder, which does its own scan of the JSON.
I'll try to dive into @iand's case today though, should be doing better for sure.

Maybe we should have a look at possibly inlining "foreign" structs like the encoder does with anonymous members.

Thanks for taking a look at this. @klauspost I tried your suggestion and generated ffjson unmarshallers for all structs in the package. Unfortunately the benchmarks are worse so there's clearly something quite strange going on.
BenchmarkUnmarshalRequest	   10000	    150823 ns/op	   23196 B/op	     482 allocs/op
Same benchmark as before but in a new ffjson-all branch: https://github.com/avct/openrtb/blob/ffjson-all/benchmark_test.go

Yeah, the allocs-per-operation are crazy high.

I had a short look. These things stand out so far:
1 - Bug in unmarshalFasterType
First of all, a bug: The unmarshalFasterType is not detected, since handleFieldAddr should test a pointer to the type, and not the type itself. This works:
func handleFieldAddr(ic *Inception, name string, takeAddr bool, typ reflect.Type, ptr bool) string {
	out := ""
	out += fmt.Sprintf("/* handler: %s type=%v kind=%v */\n", name, typ, typ.Kind())

	// typ changed to reflect.PtrTo(typ) here:
	umlx := reflect.PtrTo(typ).Implements(unmarshalFasterType) || typeInInception(ic, typ, shared.MustDecoder)
[...]

This change cuts allocations in half, and brings performance close to encoding/json.
2 Slice decoding
Slices are falling back to "json.Unmarshal". The Request has 5 slices, and all of them have the field captured and Unmarshalled. This is an obvious place to optimize.
3 Lexer -> WriteJsonString
When the lexer calls WriteJsonString can be made leaner:
This was mainly a hotspot because of the issues above, but getting a string from the capture buffer and sending it to WriteJsonString caused many allocations. I tried sending a buffer instead, and it shaved of a few allocations. Something like:
// Function to keep compatibility
func WriteJsonString(buf JsonStringWriter, s string) {
	WriteJsonStringB(buf,[]byte(s))
}

/**
 * Function ported from encoding/json: func (e *encodeState) string(s string) (int, error)
 */
func WriteJsonStringB(buf JsonStringWriter, s []byte) {

// (exchange buf.WriteString(s[start:i]) -> buf.Write(s[start:i]))

The Lexer has two calls to WriteJsonString, and they can be adjusted easily to send a buffer.
4 Scratch buffer
There are a few places where a var buf Buffer is used. If you put that as a member of the Lexer, so it can be re-used.
5 Re-encoding strings when capturing?
It seems strange to decode and afterwards encode json strings when capturing. Surely there must be a way to just copy the original.
@iand: Use ffjson.Unmarshal
As per the readme, use the ffjson library for your Unmarshal calls. That will also help. Compare:
import "github.com/pquerna/ffjson/ffjson"

func BenchmarkUnmarshalRequestFF(b *testing.B) {
	for i := 0; i < b.N; i++ {
		req := &Request{}
		ffjson.Unmarshal(requests[i%len(requests)], req)
	}
}

I have quickly hacked together 1, 3 and 4, which gives me:
FFJSON: 20000             64353 ns/op            6702 B/op        143 allocs/op
JSON:   20000             74354 ns/op            5288B/op        142 allocs/op

Fallbacks to json.Unmarshal (probably because of 2) is responsible for about half the allocations, so if we can handle slices of structs without falling back we should have a significant edge.

Added PR #126 (fixes issue 1) and PR #127 (fixes 3 +4)

Added PR #128 (fixes 2)

The fixes have landed. Your benchmark now looks like this:
ffjson:
BenchmarkUnmarshalRequestFF        30000             45569 ns/op            5721 B/op        123 allocs/op

No ffjson:
BenchmarkUnmarshalRequestFF        20000             76204 ns/op            5288 B/op        142 allocs/op

Now ffjson takes ~59% of the time of encoding/json.
There are fallbacks in case there are "Extensions" because they are map[string]interface{}, but fixing them will be a longer process. There are also fallback for "Publisher"/"Producer" types since they are aliases, which currently isn't resolved.
The benchmark looks like this:
func BenchmarkUnmarshalRequestFF(b *testing.B) {
	for i := 0; i < b.N; i++ {
		req := &Request{}
		ffjson.Unmarshal(requests[i%len(requests)], req)
	}
}

Excellent, thank you for your work on this. Here are my benchmarks for comparison. You can see they are similar to yours and show a good speedup over just using vanilla encoding/json
Using ffjson generated unmarshalling code with encoding/json Unmarshal function:
BenchmarkUnmarshalRequest  	   20000	     62721 ns/op	    6597 B/op	     132 allocs/op

Using ffjson generated unmarshalling code with ffjson Unmarshal function:
BenchmarkUnmarshalRequestFF	   30000	     44494 ns/op	    6101 B/op	     123 allocs/op

Feel free to close this issue and thanks again.

Found a final optimization, in PR #131, which eliminates fallback for  "Publisher"/"Producer". Times are now:
BenchmarkUnmarshalRequestFF        30000             41802 ns/op            5477 B/op        121 allocs/op

Shaving off another 5%.


with this script I can listen my text from terminal?

go run my.go return me
2016/01/20 15:51:52 5844
2016/01/20 15:51:52 audio/mpeg
2016/01/20 15:51:52 4f0894f2-4ad3-4ca6-8872-daf7a53eab70

where is audio?..

You'd have to write Audio to a file.

Can you please provide code for writing audio to file?..

https://gobyexample.com/writing-files

Thank you!
ioutil.WriteFile("/home/vitaly/Desktop/audio.mp3", r.Audio, 0644)


Make 'RefreshState' public

Should fix #1157

change its good, what surprises me is that docs\oidc-client-ts.api.md has not changed... ?

Can you guido me how to get it updated? npm run build doesnt seem to do the trick

I guess you will need to add this type to the index.ts..

thanks for contributing


send_configs_from_file.py Plugin

Description
Adding plugin for send_configs_from_file as required to send commands from a text file.
Type of change
Please delete options that are not relevant.

[ ] New feature (non-breaking change which adds functionality/plugin)

How Has This Been Tested?
I have tested on Juniper devices(QFX5100 & EX4300) only.
Checklist:

[ ] My code follows the style guidelines of this project (no GitHub actions compalints! run make lint before
committing!)
[ ] I have commented my code, pydocstyle and darglint are happy, docstrings are in google docstring format, and all
docstrings include a summary, args, returns and raises fields (even if N/A)
[ ] I have added tests that prove my fix is effective or that my feature works
[ ] New and existing unit tests pass locally with my changes

@tejasmokashi1992 Nice! We should definitely get this added in!
I've somewhat abandoned the master branch of nornir_scrapli for now and have focused on develop branch in support of nornir3... unfortunately nornir3 still is only alpha release right now. This kinda sucks because I've got the develop branch cleaned up and looking pretty nice, with better testing and all that too...
So I think what we can do is just merge this to master now, and then I can make an updated version of this to fit in with the develop branch and can just deal with a merge conflict when merging develop->master whenever nornir3 is released.
Alternatively, if you are ok with using nornir3 alpha/installing nornir_scrapli from develop branch... we can repoint this PR -> develop and make the necessary updates to get it working in develop with the changes/improvements I've made there.
Let me know how you'd like to proceed!
Carl

@carlmontanari i am ok with the first option.

@tejasmokashi1992 made a minor change to your pr, but got it merged. I also updated develop w/ a send_configs_from_file task and tests. Thanks for the contribution!
Carl


504 Gateway Timeout only when using the HUD

Describe the bug
I am doing some testing on a Bug Bounty site. I have two domains to test; real.example.com and test.example.com. ZAP works perfectly on the test site but when attempting to load the real site I get a stacktrace (below) and a 504 Gateway Timeout Error in the history.

If I do not use the HUD it works fine, but I get a gateway timeout when using the HUD.
Things I have tried:

Just browsing from a non-proxied browser - This works just fine
Adjusting the User Agent - Does not fix the issue
Using other tools - Other proxy tools work just fine.
Increasing the Connection Timeout Time - I went up to 120 seconds with no change
Attempted both http and https - Only HTTPS works and only when NOT using the HUD.

Software versions

ZAP: 2.10.0
OS: Windows 10, also tried in Ubuntu 20.04 with no change.
Java: openjdk version 1.8.0_292
Browser: Tried with both embedded browsers (Chrome and Firefox)

Would you like to help fix this issue?
I would like to use the HUD but the program is obviously still useable without it so yes. I would like assistance if possible.

Does the site in question support HTTPS?
The HUD can only work over HTTPS as is uses modern technologies like WebSockets and Web Workers.
If a site doesnt support HTTPS then ZAP "upgrades" it to HTTPS internally (ie within ZAP).
This works for straightforward cases but it wouldnt surprise me if if failed for more unusual cases.
Unfortunately theres not enough info here for us to know whats going on.


Rfe 40 misc fixes

A bunch of updates in user guide and example.

Coverage remained the same at 44.512% when pulling 565dda7a8c1c9a574ee72dc2aba1749f19eec702 on yumaoka:rfe-40-misc-fixes into fe56c08ba833b6e2de4f8302f9f0b7d3197fc0fd on IBM-Bluemix:master.

Looks good. just a doubt , shouldn't gp-ant-task.md be changed to README.md?


General: Update Vulnerable Packages

Description
This updates patches vulnerable packages
How has this been tested?
no testing required
Types of changes

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

[ ] The related ClickUp task has been linked to this PR
[ ] The person creating the pull request is listed in "Assignees"
[ ] My code follows the code style of this project .
[ ] My change requires a change to the documentation.
[ ] I have updated the documentation accordingly.

Task linked: CU-2nna3k8 UI: Update Vulnerable Packages


Currency internal subscriptions not added with non-USD account currency

Expected Behavior
All required subscriptions should be added for conversions to account currency.
Actual Behavior
When using a non-USD account currency and adding a crypto pair which does not include the account currency, the required internal currency pair is not added automatically.
An exception similar to this is thrown:
During the algorithm initialization, the following exception has occurred:
In order to maintain cash in BTC you are required to add a subscription for Forex pair BTCETH or ETHBTC

Potential Solution
Add the missing ETHBTC pair (and others which might be needed in other cases) to Currencies.CryptoCurrencyPairs
Reproducing the Problem
This simple algorithm throws an exception:
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
        public override void Initialize()
        {
            SetAccountCurrency("ETH");

            SetStartDate(2018, 4, 4);
            SetEndDate(2018, 4, 4);

            SetCash(10);

            AddCrypto("BTCUSD");
        }
}

Checklist

[x] I have completely filled out this template
[x] I have confirmed that this issue exists on the current master branch
[x] I have confirmed that this is not a duplicate issue by searching issues
[x] I have provided detailed steps to reproduce the issue

Possible duplicate of https://github.com/QuantConnect/Lean/issues/2060? Which seems like the underlying issue here


Have co-pilot add links to vscode .json files when appropriate in answers

I would like co-pilot suggestions to include "links" when pointing to files to edit.
Here is my use-case example.
I asked co-pilot how to fix my test discovery.  The suggestions are generally good.  However, at step 3, it say to do something to my "settings.json" file.  Fine suggestion.  However, it doesn't tell me where to find the settings.json file in my .vscode directory.  Ideally, it would have made "settings.json" in the suggestion a link that would tell vscode to open that file for editing.  Then I could paste the suggestion in easily.  Now, I have to ask co-pilot how to edit the settings.json file.  An extra step.  An extra query.

The latest insiders builds of the extension create links for file paths
If you're still not seeing this working, please share an example workspace + question where you'd expect a llink

Thanks, I will try an insiders build.  Normally, i just use the stock
release, but I can look to see if this works like I hope, and presume that
it will eventually make it into the stock release.
On Tue, May 7, 2024 at 1:58 AM Matt Bierner @.***>
wrote:

The latest insiders builds of the extension create links for file paths
If you're still not seeing this working, please share an example workspace

question where you'd expect a llink

—
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-copilot-release/issues/1174#issuecomment-2097065223,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/A7IXB42NMLMMNP3Y53BNW7LZBADKLAVCNFSM6AAAAABHGYKGDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXGA3DKMRSGM
.
You are receiving this because you authored the thread.Message ID:
@.***>


Update fine-tuning-overview.md

added gpt-4

@eric-urban
IMPORTANT: When the changes are ready for publication, add a #sign-off comment to signal that the PR is ready for the review team to merge.
#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

#please-close


Please provide instructions for configuring network

In the instructions
"Note: Above assumes that you have configured Host-only network 'vboxnet0' with <IP_ADDRESS>/24 and NAT network 'NatNetwork' with DHCP enabled."
@cppforlife showed me this config has to be done in the Virtualbox UI. I would not have known what to do otherwise, and without this step it took 7min to contact the agent.
Please replace this text with step by step instructions.
Thank you!

doc page updated with links.


WIP: ubuntu and node releases using cloudbuild.yaml and build.sh

[ ] get feedback on appropriate release flow
[ ] add build triggers to launch the cloudbuild

Currently, the plan is to have 4 cloudbuild triggers based on tags.  The cloudbuild tags are:
ubuntu_16_0_4_release.*
ubuntu_16_0_4_build_release.*
node_8_5_0_ubuntu_release.*
node_8_5_0_ubuntu_build_release.*
so to release an image, someone uploads a tag:
ubuntu_16_0_4_release_v1.0.0
and the cloudbuild triggers creating the image:
gcr.io/gcp-runtimes/ubuntu_16_0_4:<COMMIT_SHA>

I have changed the cloudbuild triggers to run at every merge to master instead of using release tags

This should be ready now


save cert

hello
is there a way to save the cert afterthe first pairing and reuse later so I won't need to do the pairing process again?
I saw the method getCertificate() but it looks like it's used just to reconnect or something like that, it's not saving the cert into a .pem file.
thanks

Yes, you can use fs.writeFileSync (https://nodejs.org/api/fs.html) with cert and key. Save it by naming it cert.pem and key.pem

I'm trying to do something like:
    let cert = androidRemote.getCertificate();
    fs.writeFileSync("cert.pem", cert);

but since cert isn't in the correct format I'm getting this error:
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object
to what format should I convert he cert then?


fix: App doesn't crash on creating new events

Fixes #861
The app no longer crashes on creating new events.

You have a PMD violation
https://146-65606855-gh.circle-artifacts.com/0/outputs/pmd/pmd.html


Build libv86 with GitHub Actions

This closes #297. It automatically builds libv86 with Travis CI and publishes it to GitHub Pages.
I only added ACPI build, but normal build can also be added if needed. File, as well as sourcemap, will then be published to gh-pages branch.
However, compaling fails because of some error (at least on Travis CI on my repository):
java.lang.NullPointerException: No warning class for name: ambiguousFunctionDecl

	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:980)

	at com.google.javascript.jscomp.DiagnosticGroups.setWarningLevel(DiagnosticGroups.java:703)

	at com.google.javascript.jscomp.AbstractCommandLineRunner.setWarningGuardOptions(AbstractCommandLineRunner.java:327)

	at com.google.javascript.jscomp.AbstractCommandLineRunner.setRunOptions(AbstractCommandLineRunner.java:368)

	at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:1107)

	at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:546)

	at com.google.javascript.jscomp.CommandLineRunner.main(CommandLineRunner.java:2131)

It is interesting that even without any modifications to Makefile (in final version I did some modifications to include sourcemap), it fails. So it may be problem with newer version of Closure Compiler.

@copy Sorry for delay. I switched to GitHub Actions for building libv86 and then releasing it to GitHub Releases.

@filips123 Manually rebased and merged into master, thanks! Latest release is here: https://github.com/copy/v86/releases
Github Actions looks pretty solid, I think eventually we should also run tests there.

@copy Nice. Can you modify GitHub workflow to also release libv86.js.map file? I forgot to add it while I was creating that changes, but I think it would be quite useful to have it, especially if you are developing and debugging site that uses v86.
Workflow file probably just needs to be updated to include:
files: |
  build/*.js
  build/*.js.map

@filips123 Done.


Allow %%% in JVM projects

Can one of the admins verify this patch?

Hum, that's supposed to work already. Could you provide a reproduction, please? And file an issue, since it seems to a bug.

Created #2979

Superseded by #2980.


Unable to Select GLES3.0 Renderer When Starting A New Project (Hardware is Fine)

Godot version:
3.2.4 beta4 official
OS/device including version:
MacOS 10.15.7 Catalina
MacBook Pro (15-inch, 2018)
Processor: 2.2 GHz 6-Core Intel Core i7
Memory: 16 GB 2400 MHz DDR4
Graphics: Radeon Pro 555X 4 GB
Also occurring on my 2020 iMac:
MacOS 10.15.7 Catalina
Graphics: Radeon Pro 5300 GPU (4GB GDDR6)
Issue description:
When creating a new project, the option to select the GLES 3.0 renderer is disabled/greyed out, and "Not supported by your GPU drivers" is displayed.  This was not the case in Godot 3.2.3.  I can however switch to GLES3.0 in the editor once the project is created.
Steps to reproduce:
Idk if this is happening on all operating systems, but on macOS:

Open Godot Project Manager
click "New Project"
OpenGL ES 3.0 will be disabled

Minimal reproduction project:
NA

Fixed in beta5 and newer.


Finalized Admin managment

my code is able to hide the admin tab from non admin. It does however allow non admins to type in the url to find the admin tab, which I cant seem to stop. however all features are disabled for them so no damage can be done. the admin tab has the ability to change permissions and should work for any new user types we create.
ps. Last time i did the pull request was to help development elsewhere

You are merging into master. That's a nope. :-1: :shipit:


Add IHttpRequestPathFeature.CurrentExecutionFilePath

Closes #372
Since the Execute/Transfer is not supported yet. I don't add tests for CurrentExecutionFilePath.

Thanks @Clounea!


A lot of unused files from FLENS get installed by cmake (unused cmake lists, lapack bundle)

and other things.
We should prevent this either:

by removing them from the source tree
or by adding exclude pattern for the files type.

Fixed!


chore: remove all whitespace at end of line

Thanks for this @Hongarc , I'm just wondering if it's worth introducing a prettier rule/plugin that would carry this out automatically, rather than having to manually remove whitespace?

I use gulp to remove whitespace all file in the folder.

@Hongarc true, I hadn't considered prettier's ability to lint non-js files. Happy to merge this then while we look for automatic solutions for the future.


AI Assist Badge

Hi!
You can use this tool that helps users understand your open-source project with an AI agent trained on it. For example, https://app.commanddash.io/agent?github=https://github.com/datavorous/comandi
many projects mention it as a badge in their readme.

Seems good! Would you mind explaining how it might help?
P.S. - added it in the readme

thanks! The agent is indexed on the code + issues and can users understand how to use it and also the code of the repo. Anyone can ask questions like:
"How can I use COMANDI to convert natural language instructions into command-line commands?"
"How does the prompt templates work behind the scenes"
"What are the steps to contribute to the COMANDI project?"
and get custom AI generated answers for the repo :) hope this helps.


node: register ipsec metric once

Guard ipsec metric registration with sync.Once to avoid double registration seen in tests:
level=error msg="Invoke failed" ="cmd.glob..func3 (daemon_main.go:1574)" error="could not build arguments for function "github.com/cilium/cilium/daemon/cmd".glob..func3 (/home/runner/work/cilium/cilium/daemon/cmd/daemon_main.go:1574): failed to build promise.Promise[*github.com/cilium/cilium/daemon/cmd.Daemon]: could not build arguments for function "github.com/cilium/cilium/daemon/cmd".newDaemonPromise (/home/runner/work/cilium/cilium/daemon/cmd/daemon_main.go:1604): failed to build manager.NodeManager: received non-nil error from function "github.com/cilium/cilium/pkg/node/manager".newAllNodeManager (/home/runner/work/cilium/cilium/pkg/node/manager/cell.go:67): duplicate metrics collector registration attempted" subsys=hive
Note that the registration is never removed as we do not support disabling IPSec on a running agent anyway.

/test

test-1.26-net-next hit by a known flake (https://github.com/cilium/cilium/issues/15455), rerunning...

/test-1.26-net-next


Don't log errors using Console.WriteLine

Example: https://github.com/Flagsmith/flagsmith-dotnet-client/blob/3334c96192e66eb28ea8ad79e028a0d65ceb38bd/FlagsmithClient.cs#L75
There is no guarantee that the process has a console, and if it doesn't then an attempt to write to the non-existent console can bring down the entire application. Ideally you'd want to use a proper logging framework, but since the usage here is relatively limited you could implement a simple check before writing to the console: if (Console.WindowHeight > 0) { Console.WriteLine("Error"); }

Thanks for this - happy to take a PR if you are up for it?!

I pulled the latest source code and it seems like this is done already? Otherwise I would have taken a look at it, as we would need all our logging to land in Seq.

Thanks @MichaelHochriegl, I'll go ahead and close this issue.


encodeChatGenerator undefined?

encodeChat error TypeError: Cannot read properties of undefined (reading 'encodeChatGenerator')
at encodeChat
node_modules/.pnpm/gpt-tokenizer@2.1.1/node_modules/gpt-tokenizer/cjs/GptEncoding.js:141:25

Also facing this problem.
Maybe the author forgot to pack some external modules?
The error occurs when I execute the following code:
import { encodeChat } from "gpt-tokenizer";

const messages = [ /* Valid chat */ ];

console.log(encodeChat(messages, "gpt-3.5-turbo"));

Here's the full error:

Notice that I'm using WSL so the file directory might be a little bit weird.

file:///mnt/d/Documents/.project/Script/GPT-Tokenizer/node_modules/.pnpm/gpt-tokenizer@2.1.1/node_modules/gpt-tokenizer/esm/GptEncoding.js:138
        return [...this.encodeChatGenerator(chat, model)].flat();
                        ^

TypeError: Cannot read property 'encodeChatGenerator' of undefined
    at encodeChat (file:///mnt/d/Documents/.project/Script/GPT-Tokenizer/node_modules/.pnpm/gpt-tokenizer@2.1.1/node_modules/gpt-tokenizer/esm/GptEncoding.js:138:25)
    at file:///mnt/d/Documents/.project/Script/GPT-Tokenizer/index.js:83:13
    at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
    at async Loader.import (internal/modules/esm/loader.js:178:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)
    at async handleMainPromise (internal/modules/run_main.js:59:12)

I'm also facing the same issue.

Same issue.

@zz98 This problem is related to the way you're importing and using the encodeChat method from the gpt-tokenizer module.
When you use the following import statement:
import { encodeChat } from 'gpt-tokenizer'

You're importing encodeChat as a detached function from the original object (the module). Therefore, you won't have access to the context or properties of the original object.
However, when you use the import statement as follows:
import tokenizer from 'gpt-tokenizer'
tokenizer.encodeChat([{ ... }])

You're importing the entire original object. This allows you to access the properties and methods of the original object.
The error message you're seeing:
node_modules/gpt-tokenizer/src/GptEncoding.ts:246
    return [...this.encodeChatGenerator(chat, model)].flat()

suggests that this is undefined or not what's expected in this.encodeChatGenerator(chat, model). In JavaScript, when a method is called detached from its object, this becomes undefined (in strict mode). Hence, calling the detached encodeChat method results in an error.
However, when you call encodeChat in the form of tokenizer.encodeChat, the encodeChat method is bound to the tokenizer object. Therefore, this refers to the tokenizer object, and no error occurs.
To resolve this issue, you should import the whole tokenizer and call encodeChat as a method of tokenizer. This way, this will correctly refer to tokenizer, and the error should not occur. (this answer written and translate by gpt-4.)

@wgot Thanks for the explanation! I just had the same issue.
However, it seems the underlying problem is that class functions really shouldn't be exported like that. Even the author itself has mistaken the behavior of their own code, because the usage example in the main README.md itself would be incorrect, since it's using the unbound functions:
import {
  encode,
  encodeChat,
  decode,
  isWithinTokenLimit,
  encodeGenerator,
  decodeGenerator,
  decodeAsyncGenerator,
} from 'gpt-tokenizer'

Same issue. Documentation needs to be updated as well.

Still doesn't work:
const tokenizer = require('gpt-tokenizer')
const chatTokens = tokenizer.encodeChat(chat, 'gpt-3.5-turbo')
I get this error:
TypeError: Cannot read properties of undefined (reading 'get')
    at Object.encodeChatGenerator (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:99:57)
    at encodeChatGenerator.next (<anonymous>)
    at Object.encodeChat (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:141:25)
    at cleanup (xxx/scripts/cleanupTranscript.js:40:32)
    at Object.<anonymous> (xxx/scripts/cleanupTranscript.js:62:1)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)

Same issue
This code works in esm but doesn't work in cjs
const tokenizer = require('gpt-tokenizer')
const chatTokens = tokenizer.encodeChat(chat, 'gpt-3.5-turbo')
this.specialTokenMapping is undefined when the encodeChatGenerator function is called in cjs.
GptEncoding this =>  {   default: [Getter],   decode: [Getter],   decodeAsyncGenerator: [Getter],   decodeGenerator: [Getter],   encode: [Getter],   encodeChat: [Getter],   encodeChatGenerator: [Getter],   encodeGenerator: [Getter],   isWithinTokenLimit: [Getter],   EndOfText: [Getter],   FimPrefix: [Getter],   FimMiddle: [Getter],   FimSuffix: [Getter],   ImStart: [Getter],   ImEnd: [Getter],   ImSep: [Getter],   EndOfPrompt: [Getter] } this.specialTokenMapping=>  undefined
TypeError: Cannot read properties of undefined (reading 'get')     at Object.encodeChatGenerator (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:110:57)     at encodeChatGenerator.next (<anonymous>)     at Object.encodeChat (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:153:25)

Same issue This code works in esm but doesn't work in cjs
const tokenizer = require('gpt-tokenizer') const chatTokens = tokenizer.encodeChat(chat, 'gpt-3.5-turbo')
this.specialTokenMapping is undefined when the encodeChatGenerator function is called in cjs.
GptEncoding this => { default: [Getter], decode: [Getter], decodeAsyncGenerator: [Getter], decodeGenerator: [Getter], encode: [Getter], encodeChat: [Getter], encodeChatGenerator: [Getter], encodeGenerator: [Getter], isWithinTokenLimit: [Getter], EndOfText: [Getter], FimPrefix: [Getter], FimMiddle: [Getter], FimSuffix: [Getter], ImStart: [Getter], ImEnd: [Getter], ImSep: [Getter], EndOfPrompt: [Getter] } this.specialTokenMapping=> undefined
TypeError: Cannot read properties of undefined (reading 'get') at Object.encodeChatGenerator (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:110:57) at encodeChatGenerator.next (<anonymous>) at Object.encodeChat (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:153:25)

Solved like this for cjs
const tokenizer = require('gpt-tokenizer').default;

Same issue This code works in esm but doesn't work in cjs
const tokenizer = require('gpt-tokenizer') const chatTokens = tokenizer.encodeChat(chat, 'gpt-3.5-turbo')
this.specialTokenMapping is undefined when the encodeChatGenerator function is called in cjs.
GptEncoding this => { default: [Getter], decode: [Getter], decodeAsyncGenerator: [Getter], decodeGenerator: [Getter], encode: [Getter], encodeChat: [Getter], encodeChatGenerator: [Getter], encodeGenerator: [Getter], isWithinTokenLimit: [Getter], EndOfText: [Getter], FimPrefix: [Getter], FimMiddle: [Getter], FimSuffix: [Getter], ImStart: [Getter], ImEnd: [Getter], ImSep: [Getter], EndOfPrompt: [Getter] } this.specialTokenMapping=> undefined
TypeError: Cannot read properties of undefined (reading 'get') at Object.encodeChatGenerator (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:110:57) at encodeChatGenerator.next (<anonymous>) at Object.encodeChat (xxx/node_modules/gpt-tokenizer/cjs/GptEncoding.js:153:25)

Solved like this for cjs const tokenizer = require('gpt-tokenizer').default;

this fixed my issue! Thanks!

@wgot Thanks for the explanation! I just had the same issue.
However, it seems the underlying problem is that class functions really shouldn't be exported like that. Even the author itself has mistaken the behavior of their own code, because the usage example in the main README.md itself would be incorrect, since it's using the unbound functions:
import {
  encode,
  encodeChat,
  decode,
  isWithinTokenLimit,
  encodeGenerator,
  decodeGenerator,
  decodeAsyncGenerator,
} from 'gpt-tokenizer'

@niieani this is a valid point, please adjust the documentation for encodeChat usage.

Apologies folks, the documentation was written by ChatGPT and I've missed this. 😄
I'll make a fix soon.

Wasn't a documentation issue after all, just forgot to bind the functions. Should be fixed in next version.