@enhance-eng/enhance 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.mjs +14 -18
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -188,10 +188,10 @@ const restoreCanvasInputSchema = z.object({ canvasId: z.uuid() });
|
|
|
188
188
|
const restoreCanvasOutputSchema = z.object({ canvasId: z.uuid() });
|
|
189
189
|
//#endregion
|
|
190
190
|
//#region ../../packages/contract/src/canvas/canvas-presentation.schema.ts
|
|
191
|
-
const
|
|
191
|
+
const MAX_CANVAS_VALUE = 1e5;
|
|
192
192
|
const MAX_ITEM_ID_LENGTH$1 = 200;
|
|
193
|
-
const boundedNumber$1 = z.number().min(-1e5).max(
|
|
194
|
-
const nonNegativeNumber$1 = z.number().nonnegative().max(
|
|
193
|
+
const boundedNumber$1 = z.number().min(-1e5).max(MAX_CANVAS_VALUE);
|
|
194
|
+
const nonNegativeNumber$1 = z.number().nonnegative().max(MAX_CANVAS_VALUE);
|
|
195
195
|
const ratio = z.number().min(0).max(1);
|
|
196
196
|
const itemId = z.string().min(1).max(MAX_ITEM_ID_LENGTH$1);
|
|
197
197
|
const canvasColorSchema = z.object({
|
|
@@ -451,7 +451,7 @@ const canvasNodeLayoutSchema = z.object({
|
|
|
451
451
|
flipHorizontal: z.boolean().optional(),
|
|
452
452
|
flipVertical: z.boolean().optional(),
|
|
453
453
|
aspectRatioLocked: z.boolean().optional(),
|
|
454
|
-
aspectRatio: z.number().positive().max(
|
|
454
|
+
aspectRatio: z.number().positive().max(MAX_CANVAS_VALUE).optional(),
|
|
455
455
|
horizontal: canvasSizeIntentSchema,
|
|
456
456
|
vertical: canvasSizeIntentSchema,
|
|
457
457
|
position: z.enum(["flow", "absolute"]),
|
|
@@ -469,20 +469,16 @@ const canvasNodeLayoutSchema = z.object({
|
|
|
469
469
|
clipContent: z.boolean().optional(),
|
|
470
470
|
container: canvasFlexLayoutSchema.optional()
|
|
471
471
|
});
|
|
472
|
-
|
|
473
|
-
//#region ../../packages/contract/src/canvas/canvas-content-styles.schema.ts
|
|
474
|
-
const MAX_ABSOLUTE_VALUE = 1e5;
|
|
475
|
-
const MAX_FONT_WEIGHT = 1e3;
|
|
472
|
+
const MAX_CANVAS_FONT_WEIGHT = 1e3;
|
|
476
473
|
const MAX_ITEM_ID_LENGTH = 200;
|
|
477
|
-
const
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
const nonNegativeNumber = z.number().nonnegative().max(MAX_ABSOLUTE_VALUE);
|
|
474
|
+
const MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH = 1e4;
|
|
475
|
+
const boundedNumber = z.number().min(-1e5).max(MAX_CANVAS_VALUE);
|
|
476
|
+
const nonNegativeNumber = z.number().nonnegative().max(MAX_CANVAS_VALUE);
|
|
481
477
|
const canvasTypographySchema = z.object({
|
|
482
|
-
family: z.string().min(1).max(
|
|
483
|
-
fallbackFamilies: z.array(z.string().min(1).max(
|
|
478
|
+
family: z.string().min(1).max(500),
|
|
479
|
+
fallbackFamilies: z.array(z.string().min(1).max(500)).max(20),
|
|
484
480
|
size: nonNegativeNumber,
|
|
485
|
-
weight: z.number().int().min(1).max(
|
|
481
|
+
weight: z.number().int().min(1).max(MAX_CANVAS_FONT_WEIGHT),
|
|
486
482
|
style: z.enum([
|
|
487
483
|
"normal",
|
|
488
484
|
"italic",
|
|
@@ -542,7 +538,7 @@ const canvasTypographySchema = z.object({
|
|
|
542
538
|
const unsafeStyleValue = /javascript|vbscript|data\s*:\s*text\/html|expression\s*\(|@import/iu;
|
|
543
539
|
const blockedStyleProperty = /^(?:behavior|-moz-binding)$/iu;
|
|
544
540
|
const canvasAdditionalStylePropertySchema = z.string().min(1).max(MAX_ITEM_ID_LENGTH).regex(/^(?:--[\w-]+|[a-z][a-z\d-]*)$/iu).refine((property) => !blockedStyleProperty.test(property), "unsafe CSS property");
|
|
545
|
-
const canvasAdditionalStyleValueSchema = z.string().max(
|
|
541
|
+
const canvasAdditionalStyleValueSchema = z.string().max(MAX_CANVAS_ADDITIONAL_STYLE_VALUE_LENGTH).refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
|
|
546
542
|
const canvasAdditionalStyleSchema = z.object({
|
|
547
543
|
id: z.string().min(1).max(MAX_ITEM_ID_LENGTH),
|
|
548
544
|
property: canvasAdditionalStylePropertySchema,
|
|
@@ -10022,7 +10018,7 @@ const createCliProgram = (input) => {
|
|
|
10022
10018
|
const configuredDirectory = process.env["ENHANCE3_CONFIG_DIR"];
|
|
10023
10019
|
const configuredApi = process.env["ENHANCE3_API_URL"];
|
|
10024
10020
|
const CLI_CONFIG = {
|
|
10025
|
-
apiUrl: configuredApi === void 0 || configuredApi === "" ? "
|
|
10021
|
+
apiUrl: configuredApi === void 0 || configuredApi === "" ? "https://api.enhancelabs.ai" : configuredApi,
|
|
10026
10022
|
configDirectory: configuredDirectory === void 0 || configuredDirectory === "" ? path.join(homedir(), ".config", "enhance") : configuredDirectory
|
|
10027
10023
|
};
|
|
10028
10024
|
//#endregion
|
|
@@ -10347,7 +10343,7 @@ const main = async () => {
|
|
|
10347
10343
|
const credentials = createFileCredentialAdapter(CLI_CONFIG.configDirectory);
|
|
10348
10344
|
const mutationKey = createMutationKeyAdapter();
|
|
10349
10345
|
const cli = createCliProgram({
|
|
10350
|
-
version: "0.1.
|
|
10346
|
+
version: "0.1.4",
|
|
10351
10347
|
credentials,
|
|
10352
10348
|
remote: createHttpRemoteAdapter(CLI_CONFIG.apiUrl, credentials, mutationKey),
|
|
10353
10349
|
mutationKey,
|