Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bscotch/gcdata

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bscotch/gcdata - npm Package Compare versions

Comparing version 0.16.0 to 0.17.0

10

dist/cl2.quest.parse.js

@@ -5,3 +5,3 @@ import { assert } from './assert.js';

import { bsArrayToArray, changedPosition, createBsArrayKey, updateBsArrayOrder, } from './helpers.js';
import { parsedItemToWords } from './util.js';
import { checkWords } from './util.js';
export function parseStringifiedQuest(text, packed, options = {}) {

@@ -64,9 +64,5 @@ const motes = getMoteLists(packed.working);

const checkSpelling = (item) => {
if (!item || !options.checkSpelling)
if (!item || !options.checkSpelling || !packed.glossary)
return;
// Parse out the word positions so they can be used as ranges to check cursor position
const words = parsedItemToWords(item);
for (const word of words) {
result.words.push(packed.spellChecker.checkWord(word));
}
result.words.push(...checkWords(item, packed.glossary));
};

@@ -73,0 +69,0 @@ /** The MoteId for the last speaker we saw. Used to figure out who to assign stuff to */

import { assert } from './assert.js';
import { arrayTagPattern, getStorylineMote, getStorylineSchema, lineIsArrayItem, linePatterns, parseIfMatch, storylineSchemaId, } from './cl2.storyline.types.js';
import { bsArrayToArray, createBsArrayKey, updateBsArrayOrder, } from './helpers.js';
import { parsedItemToWords } from './util.js';
import { checkWords } from './util.js';
export function parseStringifiedStoryline(text, packed, options = {}) {

@@ -19,7 +19,3 @@ const result = {

return;
// Parse out the word positions so they can be used as ranges to check cursor position
const words = parsedItemToWords(item);
for (const word of words) {
result.words.push(packed.spellChecker.checkWord(word));
}
result.words.push(...checkWords(item, packed.glossary));
};

@@ -26,0 +22,0 @@ const lines = text.split(/(\r?\n)/g);

@@ -12,2 +12,7 @@ import type { Range } from './types.editor.js';

}
export type ParsedWord = Range & {
value: string;
suggestions?: string[];
valid: boolean;
};
export interface ParserResult {

@@ -25,9 +30,5 @@ diagnostics: (Range & {

completions: Range[];
words: (Range & {
value: string;
suggestions?: string[];
valid: boolean;
})[];
words: ParsedWord[];
parsed: ParsedBase;
}
//# sourceMappingURL=cl2.types.editor.d.ts.map

@@ -0,3 +1,3 @@

import { Glossary } from '@bscotch/cl2-string-server-shared';
import { Pathy } from '@bscotch/pathy';
import { SpellChecker } from './SpellChecker.js';
import { GameChangerRumpusMetadata } from './types.cl2.rumpus.js';

@@ -46,3 +46,2 @@ import { Bschema, ChangeType, Changes, type Mote, type MoteId, type PackedData, type SchemaId } from './types.js';

export declare class GameChanger {
#private;
readonly projectName: string;

@@ -52,4 +51,4 @@ base: Gcdata;

protected changes: Changes;
glossary?: Glossary;
protected constructor(projectName: string);
get spellChecker(): SpellChecker;
protected get workingData(): PackedData;

@@ -72,2 +71,7 @@ protected get baseData(): PackedData;

load(): Promise<void>;
loadGlossary(access: {
host: string;
username: string;
password: string;
}): Promise<Glossary>;
/**

@@ -74,0 +78,0 @@ * @param path Either the path to a .yyp file (to get the included packed file) or the direct path to a GameChanger snapshot (e.g. a packed file or a base file).

@@ -0,4 +1,5 @@

import { Client, Glossary } from '@bscotch/cl2-string-server-shared';
import { pathy } from '@bscotch/pathy';
import fetch from 'node-fetch';
import { gameChangerEvents } from './GameChanger.events.js';
import { SpellChecker } from './SpellChecker.js';
import { GcdataError, assert } from './assert.js';

@@ -134,11 +135,6 @@ import { gameChangerRumpusMetadataSchema, } from './types.cl2.rumpus.js';

changes;
#spellChecker;
glossary;
constructor(projectName) {
this.projectName = projectName;
}
get spellChecker() {
// Lazy-load the spell checker to save some compute
this.#spellChecker ||= new SpellChecker(this);
return this.#spellChecker;
}
get workingData() {

@@ -444,2 +440,13 @@ return this.working.data;

}
async loadGlossary(access) {
const client = new Client({
baseUrl: access.host,
password: access.password,
user: access.username,
// @ts-expect-error A type mismatch, but this is the correct thing!
fetch,
});
this.glossary = await Glossary.create(client);
return this.glossary;
}
/**

@@ -446,0 +453,0 @@ * @param path Either the path to a .yyp file (to get the included packed file) or the direct path to a GameChanger snapshot (e.g. a packed file or a base file).

@@ -0,3 +1,5 @@

import type { Glossary } from '@bscotch/cl2-string-server-shared';
import type { Gcdata } from './GameChanger.js';
import { ParsedLineItem } from './cl2.quest.types.js';
import { ParsedWord } from './cl2.types.editor.js';
import { type Bschema, type Mote } from './types.js';

@@ -42,2 +44,3 @@ export declare function objectToMap<T>(obj: T): Map<keyof T, T[keyof T]>;

export declare function parsedItemToWords(item: ParsedLineItem): ParsedLineItem[];
export declare function checkWords(item: ParsedLineItem<any> | undefined, glossary?: Glossary): ParsedWord[];
//# sourceMappingURL=util.d.ts.map

@@ -272,2 +272,24 @@ import { assert } from './assert.js';

}
export function checkWords(item, glossary) {
const result = [];
if (!item || !glossary)
return result;
// Parse out the word positions so they can be used as ranges to check cursor position
const words = glossary.parse(item.value);
for (const word of words) {
const checked = glossary.checkWord(word);
const asGcWord = {
valid: checked.valid,
value: checked.substr,
start: { ...item.start },
end: { ...item.start },
};
asGcWord.start.character += checked.start;
asGcWord.start.index += checked.start;
asGcWord.end.character = asGcWord.start.character + checked.substr.length;
asGcWord.end.index = asGcWord.start.index + checked.substr.length;
result.push(asGcWord);
}
return result;
}
//# sourceMappingURL=util.js.map
{
"name": "@bscotch/gcdata",
"version": "0.16.0",
"version": "0.17.0",
"license": "MIT",

@@ -8,4 +8,6 @@ "type": "module",

"dependencies": {
"@bscotch/cl2-string-server-shared": "0.5.2",
"@bscotch/emitter": "0.2.1",
"@bscotch/pathy": "^2.12.0",
"node-fetch": "^3.3.2",
"nspell": "2.1.5",

@@ -12,0 +14,0 @@ "zod": "3.22.4"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc