@bscotch/cl2-string-server-shared
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -84,2 +84,3 @@ /// <reference types="node" /> | ||
listIssues(projectId: string, branchId?: string): Promise<TranslationIssue[]>; | ||
suppressAllIssues(projectId: string, branchId: string): Promise<void>; | ||
updateIssue(projectId: string, branchId: string, stringId: string, lang: string, code: string, patch: TranslationIssuePatch): Promise<TranslationIssuePatch>; | ||
@@ -86,0 +87,0 @@ } |
@@ -412,2 +412,8 @@ import { User } from './User.js'; | ||
} | ||
async suppressAllIssues(projectId, branchId) { | ||
await this.request('PATCH', `/api/projects/${projectId}/branches/${branchId}/issues`, { | ||
body: { suppress: true }, | ||
assertStatus: 204, | ||
}); | ||
} | ||
async updateIssue(projectId, branchId, stringId, lang, code, patch) { | ||
@@ -414,0 +420,0 @@ const updated = (await this.request('PATCH', `/api/projects/${projectId}/branches/${branchId}/issues/${encodeURIComponent(stringId)}/${lang}/${code}`, { |
@@ -1,7 +0,8 @@ | ||
export * from './User.js'; | ||
export * from './client.js'; | ||
export * from './glossary.js'; | ||
export * from './html.js'; | ||
export * from './types.js'; | ||
export * from './User.js'; | ||
export * from './util.js'; | ||
export * from './websocketEvents.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,7 +0,8 @@ | ||
export * from './User.js'; | ||
export * from './client.js'; | ||
export * from './glossary.js'; | ||
export * from './html.js'; | ||
export * from './types.js'; | ||
export * from './User.js'; | ||
export * from './util.js'; | ||
export * from './websocketEvents.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -13,2 +13,3 @@ import { z } from 'zod'; | ||
message: z.ZodOptional<z.ZodString>; | ||
text: z.ZodOptional<z.ZodString>; | ||
translation: z.ZodOptional<z.ZodString>; | ||
@@ -23,2 +24,3 @@ suppress: z.ZodOptional<z.ZodBoolean>; | ||
message?: string | undefined; | ||
text?: string | undefined; | ||
translation?: string | undefined; | ||
@@ -33,2 +35,3 @@ suppress?: boolean | undefined; | ||
message?: string | undefined; | ||
text?: string | undefined; | ||
translation?: string | undefined; | ||
@@ -46,2 +49,3 @@ suppress?: boolean | undefined; | ||
message: z.ZodOptional<z.ZodString>; | ||
text: z.ZodOptional<z.ZodString>; | ||
translation: z.ZodOptional<z.ZodString>; | ||
@@ -56,2 +60,3 @@ suppress: z.ZodOptional<z.ZodBoolean>; | ||
message?: string | undefined; | ||
text?: string | undefined; | ||
translation?: string | undefined; | ||
@@ -66,2 +71,3 @@ suppress?: boolean | undefined; | ||
message?: string | undefined; | ||
text?: string | undefined; | ||
translation?: string | undefined; | ||
@@ -78,2 +84,3 @@ suppress?: boolean | undefined; | ||
message?: string | undefined; | ||
text?: string | undefined; | ||
translation?: string | undefined; | ||
@@ -90,2 +97,3 @@ suppress?: boolean | undefined; | ||
message?: string | undefined; | ||
text?: string | undefined; | ||
translation?: string | undefined; | ||
@@ -103,2 +111,10 @@ suppress?: boolean | undefined; | ||
}>; | ||
export type TranslationIssuePatchAll = z.infer<typeof translationIssuePatchAllSchema>; | ||
export declare const translationIssuePatchAllSchema: z.ZodObject<{ | ||
suppress: z.ZodLiteral<true>; | ||
}, "strip", z.ZodTypeAny, { | ||
suppress: true; | ||
}, { | ||
suppress: true; | ||
}>; | ||
//# sourceMappingURL=types.issues.d.ts.map |
@@ -20,2 +20,3 @@ import { z } from 'zod'; | ||
message: stringSchema.optional(), | ||
text: stringSchema.optional(), | ||
translation: stringSchema.optional(), | ||
@@ -30,2 +31,5 @@ suppress: z.boolean().optional(), | ||
}); | ||
export const translationIssuePatchAllSchema = z.object({ | ||
suppress: z.literal(true), | ||
}); | ||
//# sourceMappingURL=types.issues.js.map |
@@ -6,2 +6,3 @@ import { z } from 'zod'; | ||
name: z.ZodString; | ||
preserveWhitespace: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>; | ||
languages: z.ZodArray<z.ZodString, "many">; | ||
@@ -12,2 +13,3 @@ }, "strip", z.ZodTypeAny, { | ||
languages: string[]; | ||
preserveWhitespace?: boolean | null | undefined; | ||
}, { | ||
@@ -17,2 +19,3 @@ projectId: string; | ||
languages: string[]; | ||
preserveWhitespace?: boolean | null | undefined; | ||
}>; | ||
@@ -24,2 +27,3 @@ export type ProjectsGet = z.infer<typeof projectsGetSchema>; | ||
name: z.ZodString; | ||
preserveWhitespace: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>; | ||
languages: z.ZodArray<z.ZodString, "many">; | ||
@@ -30,2 +34,3 @@ }, "strip", z.ZodTypeAny, { | ||
languages: string[]; | ||
preserveWhitespace?: boolean | null | undefined; | ||
}, { | ||
@@ -35,2 +40,3 @@ projectId: string; | ||
languages: string[]; | ||
preserveWhitespace?: boolean | null | undefined; | ||
}>, "many">; | ||
@@ -42,2 +48,3 @@ }, "strip", z.ZodTypeAny, { | ||
languages: string[]; | ||
preserveWhitespace?: boolean | null | undefined; | ||
}[]; | ||
@@ -49,2 +56,3 @@ }, { | ||
languages: string[]; | ||
preserveWhitespace?: boolean | null | undefined; | ||
}[]; | ||
@@ -55,10 +63,13 @@ }>; | ||
name: z.ZodOptional<z.ZodString>; | ||
preserveWhitespace: z.ZodOptional<z.ZodBoolean>; | ||
languages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
name?: string | undefined; | ||
preserveWhitespace?: boolean | undefined; | ||
languages?: string[] | undefined; | ||
}, { | ||
name?: string | undefined; | ||
preserveWhitespace?: boolean | undefined; | ||
languages?: string[] | undefined; | ||
}>; | ||
//# sourceMappingURL=types.projects.d.ts.map |
@@ -6,2 +6,3 @@ import { z } from 'zod'; | ||
name: stringSchema, | ||
preserveWhitespace: z.boolean().optional().nullable(), | ||
languages: z.array(stringSchema), | ||
@@ -14,4 +15,5 @@ }); | ||
name: stringSchema.optional(), | ||
preserveWhitespace: z.boolean().optional(), | ||
languages: z.array(stringSchema).optional(), | ||
}); | ||
//# sourceMappingURL=types.projects.js.map |
@@ -7,19 +7,36 @@ import { marked } from 'marked'; | ||
} | ||
const variablePattern = /^\{[a-z0-9_]+\}$/; | ||
const textPartsPattern = /(\{[a-z0-9_]+\}|\d+(?:st|th|rd)|[<>(){}[\]:;|@#,!?+/*="“”\s&-]|['’](?:s|ve|d|ll|re)\b|\.{3}|\.[^A-Za-z]|\.$|\b[\d]+(?:\.\d+)?%?)/u; | ||
const textPartsPattern = /(\n|&[a-z]+;|&#x?[a-f0-9]+;|\d+(?:st|th|rd)|[<>(){}[\]:;|@#,!?+/*="“”`\s&-]|['’](?:s|ve|d|ll|re)\b|\.{3}|\.[^A-Za-z]|\.$|\b[\d]+(?:\.\d+)?%?)/iu; | ||
export function parseText(text) { | ||
const substrings = []; | ||
const parts = text.split(textPartsPattern); | ||
// First split to identify variables | ||
const variableParts = text.split(/(\{{1,3}[a-zA-Z0-9_]+\}{1,3})/); | ||
let lastEndIdx = 0; | ||
for (let i = 0; i < parts.length; i++) { | ||
const isWord = i % 2 === 0; | ||
const substr = parts[i]; | ||
const isVariable = variablePattern.test(substr); | ||
substrings.push({ | ||
start: lastEndIdx, | ||
substr, | ||
isWord, | ||
isVariable, | ||
}); | ||
lastEndIdx += substr.length; | ||
for (let v = 0; v < variableParts.length; v++) { | ||
// If i is even then this is a variable part | ||
const subtext = variableParts[v]; | ||
const isVariable = v % 2 !== 0; | ||
if (isVariable) { | ||
substrings.push({ | ||
start: lastEndIdx, | ||
substr: subtext, | ||
isWord: false, | ||
isVariable, | ||
}); | ||
lastEndIdx += subtext.length; | ||
} | ||
else { | ||
// Break the text into words and punctuation | ||
const parts = subtext.split(textPartsPattern); | ||
for (let i = 0; i < parts.length; i++) { | ||
const isWord = i % 2 === 0; | ||
const substr = parts[i]; | ||
substrings.push({ | ||
start: lastEndIdx, | ||
substr, | ||
isWord: isWord && substr !== '.', | ||
isVariable: false, | ||
}); | ||
lastEndIdx += substr.length; | ||
} | ||
} | ||
} | ||
@@ -26,0 +43,0 @@ return substrings.filter((s) => s.substr); |
{ | ||
"name": "@bscotch/cl2-string-server-shared", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1387295
94
54950
52