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

@bscotch/cl2-string-server-shared

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bscotch/cl2-string-server-shared - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

241

dist/types.d.ts

@@ -146,14 +146,51 @@ import { z } from 'zod';

}>;
export declare const stringContextSchema: z.ZodObject<{
projectId: z.ZodString;
export type GameChangerString = z.infer<typeof gameChangerStringSchema>;
export declare const gameChangerStringSchema: z.ZodObject<{
stringId: z.ZodEffects<z.ZodString, string, unknown>;
note: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, unknown>>>;
sortKey: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
immutable: z.ZodOptional<z.ZodBoolean>;
maxCharacters: z.ZodOptional<z.ZodNumber>;
pointer: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
schema: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
mote: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
field: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
description: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emoji: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emojiSprite: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
icon: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speaker: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speakerId: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
}, "strip", z.ZodTypeAny, {
stringId: string;
projectId: string;
note?: string | null | undefined;
text: string;
sortKey: string;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: string | undefined;
schema?: string | undefined;
mote?: string | undefined;
field?: string | undefined;
description?: string | undefined;
emoji?: string | undefined;
emojiSprite?: string | undefined;
icon?: string | undefined;
speaker?: string | undefined;
speakerId?: string | undefined;
}, {
projectId: string;
stringId?: unknown;
note?: unknown;
sortKey?: unknown;
text?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: unknown;
schema?: unknown;
mote?: unknown;
field?: unknown;
description?: unknown;
emoji?: unknown;
emojiSprite?: unknown;
icon?: unknown;
speaker?: unknown;
speakerId?: unknown;
}>;

@@ -165,9 +202,19 @@ /**

export declare const stringLatestSchema: z.ZodObject<{
projectId: z.ZodString;
branchId: z.ZodEffects<z.ZodString, string, unknown>;
stringId: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
sortKey: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
immutable: z.ZodOptional<z.ZodBoolean>;
maxCharacters: z.ZodOptional<z.ZodNumber>;
pointer: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
schema: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
mote: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
field: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
description: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emoji: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emojiSprite: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
icon: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speaker: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speakerId: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
projectId: z.ZodString;
branchId: z.ZodEffects<z.ZodString, string, unknown>;
edit: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, unknown>>>;

@@ -183,2 +230,12 @@ audited: z.ZodOptional<z.ZodBoolean>;

maxCharacters?: number | undefined;
pointer?: string | undefined;
schema?: string | undefined;
mote?: string | undefined;
field?: string | undefined;
description?: string | undefined;
emoji?: string | undefined;
emojiSprite?: string | undefined;
icon?: string | undefined;
speaker?: string | undefined;
speakerId?: string | undefined;
edit?: string | null | undefined;

@@ -188,31 +245,21 @@ audited?: boolean | undefined;

projectId: string;
branchId?: unknown;
stringId?: unknown;
text?: unknown;
sortKey?: unknown;
text?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: unknown;
schema?: unknown;
mote?: unknown;
field?: unknown;
description?: unknown;
emoji?: unknown;
emojiSprite?: unknown;
icon?: unknown;
speaker?: unknown;
speakerId?: unknown;
branchId?: unknown;
edit?: unknown;
audited?: boolean | undefined;
}>;
export type GameChangerString = z.infer<typeof gameChangerStringSchema>;
export declare const gameChangerStringSchema: z.ZodObject<{
id: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
sortKey: z.ZodEffects<z.ZodString, string, unknown>;
immutable: z.ZodOptional<z.ZodBoolean>;
maxCharacters: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
text: string;
sortKey: string;
id: string;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
}, {
id?: unknown;
text?: unknown;
sortKey?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
}>;
export type PutStrings = z.infer<typeof putStringsSchema>;

@@ -223,19 +270,49 @@ export declare const putStringsSchema: z.ZodObject<{

strings: z.ZodArray<z.ZodObject<{
id: z.ZodEffects<z.ZodString, string, unknown>;
stringId: z.ZodEffects<z.ZodString, string, unknown>;
sortKey: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
sortKey: z.ZodEffects<z.ZodString, string, unknown>;
immutable: z.ZodOptional<z.ZodBoolean>;
maxCharacters: z.ZodOptional<z.ZodNumber>;
pointer: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
schema: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
mote: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
field: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
description: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emoji: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emojiSprite: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
icon: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speaker: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speakerId: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
}, "strip", z.ZodTypeAny, {
stringId: string;
text: string;
sortKey: string;
id: string;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: string | undefined;
schema?: string | undefined;
mote?: string | undefined;
field?: string | undefined;
description?: string | undefined;
emoji?: string | undefined;
emojiSprite?: string | undefined;
icon?: string | undefined;
speaker?: string | undefined;
speakerId?: string | undefined;
}, {
id?: unknown;
stringId?: unknown;
sortKey?: unknown;
text?: unknown;
sortKey?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: unknown;
schema?: unknown;
mote?: unknown;
field?: unknown;
description?: unknown;
emoji?: unknown;
emojiSprite?: unknown;
icon?: unknown;
speaker?: unknown;
speakerId?: unknown;
}>, "many">;

@@ -246,7 +323,17 @@ }, "strip", z.ZodTypeAny, {

strings: {
stringId: string;
text: string;
sortKey: string;
id: string;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: string | undefined;
schema?: string | undefined;
mote?: string | undefined;
field?: string | undefined;
description?: string | undefined;
emoji?: string | undefined;
emojiSprite?: string | undefined;
icon?: string | undefined;
speaker?: string | undefined;
speakerId?: string | undefined;
}[];

@@ -256,7 +343,17 @@ }, {

strings: {
id?: unknown;
stringId?: unknown;
sortKey?: unknown;
text?: unknown;
sortKey?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: unknown;
schema?: unknown;
mote?: unknown;
field?: unknown;
description?: unknown;
emoji?: unknown;
emojiSprite?: unknown;
icon?: unknown;
speaker?: unknown;
speakerId?: unknown;
}[];

@@ -270,9 +367,19 @@ branchId?: unknown;

strings: z.ZodArray<z.ZodObject<{
projectId: z.ZodString;
branchId: z.ZodEffects<z.ZodString, string, unknown>;
stringId: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
sortKey: z.ZodEffects<z.ZodString, string, unknown>;
text: z.ZodEffects<z.ZodString, string, unknown>;
immutable: z.ZodOptional<z.ZodBoolean>;
maxCharacters: z.ZodOptional<z.ZodNumber>;
pointer: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
schema: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
mote: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
field: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
description: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emoji: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
emojiSprite: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
icon: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speaker: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
speakerId: z.ZodOptional<z.ZodEffects<z.ZodString, string, unknown>>;
projectId: z.ZodString;
branchId: z.ZodEffects<z.ZodString, string, unknown>;
edit: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, unknown>>>;

@@ -288,2 +395,12 @@ audited: z.ZodOptional<z.ZodBoolean>;

maxCharacters?: number | undefined;
pointer?: string | undefined;
schema?: string | undefined;
mote?: string | undefined;
field?: string | undefined;
description?: string | undefined;
emoji?: string | undefined;
emojiSprite?: string | undefined;
icon?: string | undefined;
speaker?: string | undefined;
speakerId?: string | undefined;
edit?: string | null | undefined;

@@ -293,8 +410,18 @@ audited?: boolean | undefined;

projectId: string;
branchId?: unknown;
stringId?: unknown;
text?: unknown;
sortKey?: unknown;
text?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: unknown;
schema?: unknown;
mote?: unknown;
field?: unknown;
description?: unknown;
emoji?: unknown;
emojiSprite?: unknown;
icon?: unknown;
speaker?: unknown;
speakerId?: unknown;
branchId?: unknown;
edit?: unknown;

@@ -314,2 +441,12 @@ audited?: boolean | undefined;

maxCharacters?: number | undefined;
pointer?: string | undefined;
schema?: string | undefined;
mote?: string | undefined;
field?: string | undefined;
description?: string | undefined;
emoji?: string | undefined;
emojiSprite?: string | undefined;
icon?: string | undefined;
speaker?: string | undefined;
speakerId?: string | undefined;
edit?: string | null | undefined;

@@ -322,8 +459,18 @@ audited?: boolean | undefined;

projectId: string;
branchId?: unknown;
stringId?: unknown;
text?: unknown;
sortKey?: unknown;
text?: unknown;
immutable?: boolean | undefined;
maxCharacters?: number | undefined;
pointer?: unknown;
schema?: unknown;
mote?: unknown;
field?: unknown;
description?: unknown;
emoji?: unknown;
emojiSprite?: unknown;
icon?: unknown;
speaker?: unknown;
speakerId?: unknown;
branchId?: unknown;
edit?: unknown;

@@ -330,0 +477,0 @@ audited?: boolean | undefined;

36

dist/types.js

@@ -78,18 +78,25 @@ import { z } from 'zod';

});
export const stringContextSchema = z.object({
projectId: projectIdSchema,
export const gameChangerStringSchema = z.object({
stringId: stringIdSchema,
note: noteSchema,
sortKey: sortKeySchema,
text: stringTextSchema,
immutable: isImmutableSchema,
maxCharacters: maxLengthSchema,
pointer: stringSchema.optional(),
schema: stringSchema.optional(),
mote: stringSchema.optional(),
field: stringSchema.optional(),
description: stringSchema.optional(),
emoji: stringSchema.optional(),
emojiSprite: stringSchema.optional(),
icon: stringSchema.optional(),
speaker: stringSchema.optional(),
speakerId: stringSchema.optional(),
});
export const stringLatestSchema = z.object({
export const stringLatestSchema = gameChangerStringSchema.extend({
//#region CONSTANT IDENTIFIERS
projectId: projectIdSchema,
branchId: branchIdSchema,
stringId: stringIdSchema,
//#endregion
//#region Un-editable data
sortKey: sortKeySchema,
text: stringTextSchema,
immutable: isImmutableSchema,
maxCharacters: maxLengthSchema,
//#region From GameChanger/Game Data
//#endregion

@@ -101,11 +108,2 @@ //#region Server-editable data

});
export const gameChangerStringSchema = z
.object({
id: stringIdSchema,
text: stringTextSchema,
sortKey: sortKeySchema,
immutable: isImmutableSchema,
maxCharacters: maxLengthSchema,
})
.describe('String data as provided by the GameChanger.');
export const putStringsSchema = z.object({

@@ -112,0 +110,0 @@ commitNumber: commitNumberSchema,

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

export type AsyncFunction = (...args: any[]) => Promise<any>;
export type AnyFunction = (...args: any[]) => any;
export declare function isObject<T extends object>(value: unknown): value is Exclude<T, null>;

@@ -6,2 +8,3 @@ export interface Substring<W = string> {

isWord?: boolean;
isVariable?: boolean;
}

@@ -8,0 +11,0 @@ export declare function parseText(text: string): Substring[];

export function isObject(value) {
return typeof value === 'object' && value !== null;
}
const variablePattern = /^\{[a-z0-9_]+\}$/;
const textPartsPattern = /(\{[a-z0-9_]+\}|[<>(){}[\]:;|@#,!?+/*="“”\s&-]|['’](?:s|ve|d|ll|re)\b|\.{3}|\.[^A-Za-z]|\.$|\b[\d]+(?:\.\d+)?%?)/u;
export function parseText(text) {
const substrings = [];
const parts = text.split(/([<>(){}[\]:;|@#,!?"“”*=\s-]|['’](?:s|ve|d|ll|re)\b|\. |\.$|\b[\d]+(?:\.\d+)?%?)/u);
const parts = text.split(textPartsPattern);
let lastEndIdx = 0;

@@ -11,2 +13,3 @@ for (let i = 0; i < parts.length; i++) {

const substr = parts[i];
const isVariable = variablePattern.test(substr);
substrings.push({

@@ -16,2 +19,3 @@ start: lastEndIdx,

isWord,
isVariable,
});

@@ -18,0 +22,0 @@ lastEndIdx += substr.length;

{
"name": "@bscotch/cl2-string-server-shared",
"type": "module",
"publishConfig": {
"access": "public"
},
"version": "0.1.0",
"version": "0.2.0",
"description": "",
"main": "dist/index.js",
"keywords": [],
"license": "ISC",
"author": "",
"license": "ISC",
"type": "module",
"main": "dist/index.js",
"dependencies": {

@@ -21,7 +18,10 @@ "nspell": "2.1.5",

},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "node -r source-map-support/register --test dist"
"test": "node -r source-map-support/register --test dist",
"watch": "tsc -w"
}
}

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