New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@interweave/interweave

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interweave/interweave - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

67

dist/thoughts.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -24,3 +15,3 @@ const validate_1 = require("./validate");

schema: {
type: "object",
// type: "object",
is_array: true,

@@ -113,30 +104,34 @@ object_schema: {

// This can be executed at build time
(0, validate_1.validateSchema)(newOne);
/* @ts-expect-error */
const x = (0, validate_1.validateSchema)(newOne);
console.log(x);
// This can be executed at runtime
// validate(_, newOne);
const newObj = {
// queries: schema.queries,
keys: newOne.keys,
requests: newOne.requests,
};
(() => __awaiter(void 0, void 0, void 0, function* () {
try {
const res = yield fetch("https://type-house-api-production.up.railway.app/api/v1/projects/d19c3797-4059-4fb4-9aae-e0f4f42bf57b/interfaces", {
method: "POST",
body: JSON.stringify({
endpoint: "https://dummyjson.com/products",
schema_config: newObj,
}),
headers: {
"Content-Type": "application/json",
},
});
const data = yield res.json();
console.log(`Update responded with a status of ${data.http_status}.`);
console.log("interface: ", data.results.data.id);
}
catch (err) {
console.log(err);
}
}))();
// const newObj = {
// // queries: schema.queries,
// keys: newOne.keys,
// requests: newOne.requests,
// };
// (async () => {
// try {
// const res = await fetch(
// "https://type-house-api-production.up.railway.app/api/v1/projects/d19c3797-4059-4fb4-9aae-e0f4f42bf57b/interfaces",
// {
// method: "POST",
// body: JSON.stringify({
// endpoint: "https://dummyjson.com/products",
// schema_config: newObj,
// }),
// headers: {
// "Content-Type": "application/json",
// },
// }
// );
// const data = await res.json();
// console.log(`Update responded with a status of ${data.http_status}.`);
// console.log("interface: ", data.results.data.id);
// } catch (err) {
// console.log(err);
// }
// })();
// build({

@@ -143,0 +138,0 @@ // apiKey: "123213",

@@ -59,7 +59,3 @@ "use strict";

function validateKeyConfiguration(key, value, config, fullValueObject) {
var _a, _b, _c, _d, _e;
// Ensure type is specified
if (!((_a = config === null || config === void 0 ? void 0 : config.schema) === null || _a === void 0 ? void 0 : _a.type)) {
throwError(`Key '${key}' is missing a spcified type in ${key}.schema.type.`);
}
var _a, _b, _c, _d;
// Make sure required keys have a value

@@ -230,9 +226,9 @@ if (!config.schema.is_optional) {

if (typeof config.validation.is_email === "object") {
if ((_b = config.validation.is_email) === null || _b === void 0 ? void 0 : _b.forbidden_domains) {
if ((_c = config.validation.is_email) === null || _c === void 0 ? void 0 : _c.forbidden_domains.includes(domain)) {
if ((_a = config.validation.is_email) === null || _a === void 0 ? void 0 : _a.forbidden_domains) {
if ((_b = config.validation.is_email) === null || _b === void 0 ? void 0 : _b.forbidden_domains.includes(domain)) {
throwError(`Key '${key}' was passed an email with a forbidden domain '${domain}'.`);
}
}
if ((_d = config.validation.is_email) === null || _d === void 0 ? void 0 : _d.forbidden_tlds) {
if ((_e = config.validation.is_email) === null || _e === void 0 ? void 0 : _e.forbidden_tlds.includes(tld)) {
if ((_c = config.validation.is_email) === null || _c === void 0 ? void 0 : _c.forbidden_tlds) {
if ((_d = config.validation.is_email) === null || _d === void 0 ? void 0 : _d.forbidden_tlds.includes(tld)) {
throwError(`Key '${key}' was passed an email with an invalid TLD '${tld}'.`);

@@ -309,2 +305,3 @@ }

const ensureFieldSet = (fieldName, value, why) => fieldMustBeSet(key, fieldName, value, why);
ensureFieldSet("schema.type", schema === null || schema === void 0 ? void 0 : schema.type, "; field is required");
if (!schema.is_optional) {

@@ -311,0 +308,0 @@ const reason = "if schema.is_optional is false";

{
"name": "@interweave/interweave",
"version": "0.0.2",
"version": "0.0.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -84,9 +84,2 @@ import { type Schema, type KeyConfiguration } from "./interfaces";

) {
// Ensure type is specified
if (!config?.schema?.type) {
throwError(
`Key '${key}' is missing a spcified type in ${key}.schema.type.`
);
}
// Make sure required keys have a value

@@ -455,2 +448,4 @@ if (!config.schema.is_optional) {

ensureFieldSet("schema.type", schema?.type, "; field is required");
if (!schema.is_optional) {

@@ -457,0 +452,0 @@ const reason = "if schema.is_optional is false";

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