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

@workflowai/schema

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@workflowai/schema - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

17

dist/esm/atoms/buffer.js

@@ -1,17 +0,14 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BASE64_TO_BUFFER = exports.BUFFER_TO_BASE64 = exports.BUFFER = void 0;
const zod_1 = require("zod");
exports.BUFFER = zod_1.z.union([
zod_1.z.instanceof(Buffer),
zod_1.z
import { z } from 'zod';
export const BUFFER = z.union([
z.instanceof(Buffer),
z
.instanceof(ArrayBuffer)
.transform((arrBuff) => Buffer.from(arrBuff)),
]);
exports.BUFFER_TO_BASE64 = zod_1.z
.union([exports.BUFFER, zod_1.z.promise(exports.BUFFER)])
export const BUFFER_TO_BASE64 = z
.union([BUFFER, z.promise(BUFFER)])
.transform(async (buf) => (await buf).toString('base64'));
exports.BASE64_TO_BUFFER = zod_1.z
export const BASE64_TO_BUFFER = z
.string()
.base64()
.transform((b64) => Buffer.from(b64, 'base64'));

@@ -1,14 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DATETIME_LOCAL = void 0;
const zod_1 = require("zod");
exports.DATETIME_LOCAL = zod_1.z
import { z } from 'zod';
export const DATETIME_LOCAL = z
.object({
date: zod_1.z.string().date().describe('The date of the local datetime.'),
local_time: zod_1.z
date: z.string().date().describe('The date of the local datetime.'),
local_time: z
.string()
.time()
.describe('The time of the local datetime without timezone info.'),
timezone: zod_1.z.string().describe('The timezone of the local time.'),
timezone: z.string().describe('The timezone of the local time.'),
})
.describe('This class represents a local datetime, with a datetime and a timezone.');

@@ -1,7 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IMAGE_OUTPUT = exports.IMAGE_INPUT = void 0;
const zod_1 = require("zod");
const buffer_1 = require("./buffer");
const IMAGE_CONTENT_TYPE = zod_1.z.enum([
import { z } from 'zod';
import { BASE64_TO_BUFFER, BUFFER_TO_BASE64 } from './buffer';
const IMAGE_CONTENT_TYPE = z.enum([
'image/png',

@@ -14,11 +11,11 @@ 'image/jpg',

]);
exports.IMAGE_INPUT = zod_1.z.object({
name: zod_1.z.string().optional().describe('An optional name'),
export const IMAGE_INPUT = z.object({
name: z.string().optional().describe('An optional name'),
content_type: IMAGE_CONTENT_TYPE.describe('The content type of the image'),
data: buffer_1.BUFFER_TO_BASE64.describe('The base64 encoded data of the image'),
data: BUFFER_TO_BASE64.describe('The base64 encoded data of the image'),
});
exports.IMAGE_OUTPUT = zod_1.z.object({
name: zod_1.z.string().optional().describe('An optional name'),
export const IMAGE_OUTPUT = z.object({
name: z.string().optional().describe('An optional name'),
content_type: IMAGE_CONTENT_TYPE.describe('The content type of the image'),
data: buffer_1.BASE64_TO_BUFFER.describe('The base64 encoded data of the image'),
data: BASE64_TO_BUFFER.describe('The base64 encoded data of the image'),
});

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

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./buffer"), exports);
__exportStar(require("./datetime-local"), exports);
__exportStar(require("./image"), exports);
export * from './buffer';
export * from './datetime-local';
export * from './image';

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.definitions = void 0;
exports.definitions = [
export const definitions = [
{

@@ -6,0 +3,0 @@ jsonSchemaTitle: 'DatetimeLocal',

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

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./schemaToZod"), exports);
__exportStar(require("./zod"), exports);
__exportStar(require("./zodToSchema"), exports);
export * from './schemaToZod';
export * from './zod';
export * from './zodToSchema';

@@ -1,10 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.outputSchemaToZod = exports.inputSchemaToZod = void 0;
const json_refs_1 = require("json-refs");
const json_schema_to_zod_1 = require("json-schema-to-zod");
const definitions_1 = require("./definitions");
import { resolveRefs } from 'json-refs';
import { jsonSchemaToZod, } from 'json-schema-to-zod';
import { definitions } from './definitions';
const makeParserOverride = (type) => (schema, _refs) => {
if (schema.title) {
const definition = definitions_1.definitions.find(({ jsonSchemaTitle }) => jsonSchemaTitle === schema.title);
const definition = definitions.find(({ jsonSchemaTitle }) => jsonSchemaTitle === schema.title);
if (definition) {

@@ -19,12 +16,10 @@ return `z.${definition.zodSchema[type]}()`;

const schemaToZod = async (jsonSchema, parserOverride) => {
const { resolved: resolvedJsonSchema } = await (0, json_refs_1.resolveRefs)(jsonSchema);
return (0, json_schema_to_zod_1.jsonSchemaToZod)(resolvedJsonSchema, { parserOverride });
const { resolved: resolvedJsonSchema } = await resolveRefs(jsonSchema);
return jsonSchemaToZod(resolvedJsonSchema, { parserOverride });
};
const inputSchemaToZod = async (jsonSchema) => {
export const inputSchemaToZod = async (jsonSchema) => {
return schemaToZod(jsonSchema, inputParserOverride);
};
exports.inputSchemaToZod = inputSchemaToZod;
const outputSchemaToZod = async (jsonSchema) => {
export const outputSchemaToZod = async (jsonSchema) => {
return schemaToZod(jsonSchema, outputParserOverride);
};
exports.outputSchemaToZod = outputSchemaToZod;

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.datetimeLocal = exports.imageOutput = exports.imageInput = void 0;
const atoms_1 = require("../atoms");
const imageInput = () => atoms_1.IMAGE_INPUT;
exports.imageInput = imageInput;
const imageOutput = () => atoms_1.IMAGE_OUTPUT;
exports.imageOutput = imageOutput;
const datetimeLocal = () => atoms_1.DATETIME_LOCAL;
exports.datetimeLocal = datetimeLocal;
import { DATETIME_LOCAL, IMAGE_INPUT, IMAGE_OUTPUT } from '../atoms';
export const imageInput = () => IMAGE_INPUT;
export const imageOutput = () => IMAGE_OUTPUT;
export const datetimeLocal = () => DATETIME_LOCAL;

@@ -1,27 +0,1 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.z = void 0;
exports.z = __importStar(require("./zod"));
export * as z from './zod';

@@ -1,18 +0,2 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./extensions"), exports);
__exportStar(require("zod"), exports);
export * from './extensions';
export * from 'zod';

@@ -1,19 +0,16 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.outputZodToSchema = exports.inputZodToSchema = void 0;
const zod_to_json_schema_1 = require("zod-to-json-schema");
const definitions_1 = require("./definitions");
const zod_1 = require("./zod");
const { input: inputSchemaDefinitions, output: outputSchemaDefinitions } = definitions_1.definitions.reduce((result, { jsonSchemaTitle, zodSchema }) => ({
import { zodToJsonSchema } from 'zod-to-json-schema';
import { definitions } from './definitions';
import { z } from './zod';
const { input: inputSchemaDefinitions, output: outputSchemaDefinitions } = definitions.reduce((result, { jsonSchemaTitle, zodSchema }) => ({
input: {
...result.input,
[jsonSchemaTitle]: zod_1.z[zodSchema.input](),
[jsonSchemaTitle]: z[zodSchema.input](),
},
output: {
...result.output,
[jsonSchemaTitle]: zod_1.z[zodSchema.output](),
[jsonSchemaTitle]: z[zodSchema.output](),
},
}), { input: {}, output: {} });
const zodToSchema = (zodSchema, definitions) => {
return (0, zod_to_json_schema_1.zodToJsonSchema)(zodSchema, {
return zodToJsonSchema(zodSchema, {
definitionPath: '$defs',

@@ -26,9 +23,7 @@ target: 'openApi3',

};
const inputZodToSchema = async (zodSchema) => {
export const inputZodToSchema = async (zodSchema) => {
return zodToSchema(zodSchema, inputSchemaDefinitions);
};
exports.inputZodToSchema = inputZodToSchema;
const outputZodToSchema = async (zodSchema) => {
export const outputZodToSchema = async (zodSchema) => {
return zodToSchema(zodSchema, outputSchemaDefinitions);
};
exports.outputZodToSchema = outputZodToSchema;
{
"name": "@workflowai/schema",
"version": "1.0.0",
"version": "1.0.1",
"description": "workflowAI schema helpers",

@@ -16,9 +16,6 @@ "author": "workflowAI",

"exports": {
"import": {
".": {
"types": "./dist/types/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/types/index.d.ts",
"default": "./dist/cjs/index.js"
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}

@@ -25,0 +22,0 @@ },

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