@interweave/interweave
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -12,5 +12,2 @@ export interface Error { | ||
export interface KeyConfiguration { | ||
form?: { | ||
out_key?: string; | ||
}; | ||
schema: { | ||
@@ -103,4 +100,9 @@ type: "string" | "number" | "boolean" | "object"; | ||
*/ | ||
attributes?: { | ||
form?: { | ||
/** | ||
* Key to use in the body of the sent request | ||
* Overrides the default key | ||
*/ | ||
out_key?: string; | ||
/** | ||
* Helper text to render near the input element | ||
@@ -125,2 +127,4 @@ */ | ||
* Whether to hide this element from the interface | ||
* Hiding the element in the form will skip its validation client-side | ||
* Useful for fields that get set server-side like `id` | ||
*/ | ||
@@ -127,0 +131,0 @@ hidden?: boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path_1 = require("path"); | ||
const fs_1 = require("fs"); | ||
const validate_1 = require("./validate"); | ||
@@ -13,82 +15,75 @@ // Steps | ||
keys: { | ||
products: { | ||
id: { | ||
schema: { | ||
type: "object", | ||
is_array: true, | ||
object_schema: { | ||
keys: { | ||
id: { | ||
schema: { | ||
// type: "number", | ||
}, | ||
interface: { | ||
table: { | ||
hidden: true, | ||
}, | ||
}, | ||
}, | ||
title: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
description: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
price: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
discountPercentage: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
rating: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
stock: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
brand: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
category: { | ||
schema: { | ||
type: "string", | ||
enum: [ | ||
"smartphones", | ||
"laptops", | ||
"fragrances", | ||
"skincare", | ||
"groceries", | ||
"home-decoration", | ||
], | ||
default_value: "smartphones", | ||
}, | ||
}, | ||
thumbnail: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
images: { | ||
schema: { | ||
type: "string", | ||
is_array: true, | ||
}, | ||
}, | ||
}, | ||
type: "string", | ||
}, | ||
interface: { | ||
form: { | ||
hidden: true, | ||
}, | ||
table: { | ||
hidden: true, | ||
}, | ||
}, | ||
}, | ||
title: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
description: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
price: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
discountPercentage: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
rating: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
stock: { | ||
schema: { | ||
type: "number", | ||
}, | ||
}, | ||
brand: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
category: { | ||
schema: { | ||
type: "string", | ||
enum: [ | ||
"smartphones", | ||
"laptops", | ||
"fragrances", | ||
"skincare", | ||
"groceries", | ||
"home-decoration", | ||
], | ||
default_value: "smartphones", | ||
}, | ||
}, | ||
thumbnail: { | ||
schema: { | ||
type: "string", | ||
}, | ||
}, | ||
images: { | ||
schema: { | ||
type: "string", | ||
is_array: true, | ||
}, | ||
}, | ||
}, | ||
@@ -101,6 +96,9 @@ requests: { | ||
}, | ||
create: { | ||
http_method: "POST", | ||
uri: "https://dummyjson.com/products/add", | ||
}, | ||
}, | ||
}; | ||
// This can be executed at build time | ||
/* @ts-expect-error */ | ||
const x = (0, validate_1.validateSchema)(newOne); | ||
@@ -110,7 +108,10 @@ console.log(x); | ||
// validate(_, newOne); | ||
// const newObj = { | ||
// // queries: schema.queries, | ||
// keys: newOne.keys, | ||
// requests: newOne.requests, | ||
// }; | ||
const newObj = { | ||
// queries: schema.queries, | ||
keys: newOne.keys, | ||
requests: newOne.requests, | ||
}; | ||
(0, fs_1.writeFile)((0, path_1.join)(__dirname, "../hm.json"), JSON.stringify(newObj), (err) => { | ||
console.log(err); | ||
}); | ||
// (async () => { | ||
@@ -117,0 +118,0 @@ // try { |
{ | ||
"name": "@interweave/interweave", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,5 +17,2 @@ export interface Error { | ||
export interface KeyConfiguration { | ||
form?: { | ||
out_key?: string; | ||
}; | ||
schema: { | ||
@@ -118,4 +115,9 @@ // We need to expand this to support more DB types | ||
*/ | ||
attributes?: { | ||
form?: { | ||
/** | ||
* Key to use in the body of the sent request | ||
* Overrides the default key | ||
*/ | ||
out_key?: string; | ||
/** | ||
* Helper text to render near the input element | ||
@@ -140,2 +142,4 @@ */ | ||
* Whether to hide this element from the interface | ||
* Hiding the element in the form will skip its validation client-side | ||
* Useful for fields that get set server-side like `id` | ||
*/ | ||
@@ -142,0 +146,0 @@ hidden?: boolean; |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1984
68402
2