Socket
Socket
Sign inDemoInstall

rokay

Package Overview
Dependencies
297
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.9 to 0.0.10-alpha.0

4

_dist/cli/client/build.js

@@ -9,2 +9,6 @@ import { Command } from "commander";

const log = Log("client:build");
if (ctx.client === "skip") {
log("Skipping client:build due to Rokay config.");
return Promise.resolve();
}
log("Building Client...");

@@ -11,0 +15,0 @@ return buildEsbuild(ctx)

import { Command } from "commander";
import { lintProject } from "../tslint.js";
import { getClientTsconfig } from "./tsconfig.js";
import { getRokayCtx } from "../utils/rokay-ctx.js";
import { Log } from "../utils/log.js";
export const clientLint = () => new Command("client:lint")
.description("Run tslint --fix on the client project")
.action(() => lintProject(getClientTsconfig));
.action(() => {
const ctx = getRokayCtx(), log = Log("client:lint");
if (ctx.client === "skip") {
log("Skipping client:lint due to Rokay config.");
return Promise.resolve();
}
return lintProject(getClientTsconfig);
});

@@ -14,2 +14,6 @@ import { Command } from "commander";

const log = Log("client:package");
if (ctx.client === "skip") {
log("Skipping client:package due to Rokay config.");
return Promise.resolve();
}
log("Compiling Client for NPM Packaging...");

@@ -20,2 +24,6 @@ return getPackageFiles(ctx.dir)

const log = Log("client:package:watch");
if (ctx.client === "skip") {
log("Not watching client:package due to Rokay config.");
return Promise.resolve();
}
log("Compiling Client for NPM Packaging...");

@@ -22,0 +30,0 @@ return getPackageFiles(ctx.dir)

@@ -6,5 +6,13 @@ import { Command } from "commander";

import { getRokayCtx } from "../utils/rokay-ctx.js";
import { Log } from "../utils/log.js";
export const clientTsconfig = () => new Command("client:tsconfig")
.description("Write out the tsconfig file for the client to src/client for editor integration")
.action(() => ejectClientTsconfig(getRokayCtx())), ejectClientTsconfig = (ctx) => {
.action(() => {
const ctx = getRokayCtx(), log = Log("client:tsconfig");
if (ctx.client === "skip") {
log("Skipping client:tsconfig due to Rokay config");
return Promise.resolve();
}
return ejectClientTsconfig(getRokayCtx());
}), ejectClientTsconfig = (ctx) => {
const clientDir = resolve(ctx.dir, "src", "client");

@@ -11,0 +19,0 @@ return writeFile(resolve(clientDir, "tsconfig.json"), JSON.stringify(getClientTsconfig(ctx, clientDir), null, 2) + "\n");

@@ -13,2 +13,6 @@ import { Command } from "commander";

const log = Log("client:typecheck");
if (ctx.client === "skip") {
log("Skipping client:typecheck due to Rokay config");
return Promise.resolve();
}
log("Checking Client Types...");

@@ -18,4 +22,8 @@ return build(ctx, log, [resolve(ctx.dir, "src", "client", `${ctx.name}.ts`)], getClientCompilerOptions());

const log = Log("client:typecheck:watch");
if (ctx.client === "skip") {
log("Not watching client:typecheck due to Rokay config");
return Promise.resolve();
}
log("Checking Client Types...");
watch(ctx, log, [resolve(ctx.dir, "src", "client", `${ctx.name}.ts`)], getClientCompilerOptions());
};

@@ -9,3 +9,7 @@ import { Command } from "commander";

const log = Log("client:watch");
if (ctx.client === "skip") {
log("Not watching client due to Rokay config");
return Promise.resolve();
}
return watchEsbuild(ctx, log);
};

@@ -13,2 +13,3 @@ import { readFileSync } from "fs";

BUNDLER: (_a = optional(r, "bundler", asOneOf("esbuild", "rollup"))) !== null && _a !== void 0 ? _a : "esbuild",
client: optional(r, "client", asOneOf("skip")),
description: optional(r, "description", asString) || required(pj, "description", asString),

@@ -15,0 +16,0 @@ dir,

2

_dist/lib/data/validation.d.ts
export declare const asArray: <T>(map: (v: unknown) => T) => (v: unknown) => T[], asBoolean: (v: unknown) => boolean, asInt: (v: unknown) => number, asLiteral: <T extends string | number>(l: T) => (v: unknown) => T, asMap: <V>(map: (v: unknown) => V) => (v: unknown) => {
[key: string]: V;
}, asNil: (v: unknown) => undefined, asNumber: (v: unknown) => number, asObject: <T>(map: (v: {}) => T) => (v: unknown) => T, asOneOf: <T extends string | number>(...options: T[]) => (v: unknown) => T, asString: (v: unknown) => string, asStringLiteral: <T extends string>(l: T) => (v: unknown) => T, asUnion: <T>(...options: ((v: unknown) => T)[]) => (v: unknown) => T, excludes: (...values: string[]) => (v: string) => string | undefined, getInt: (id: string) => Promise<number>, getObject: (body: unknown) => Promise<object>, hasOwnProperty: <X extends {}, Y extends PropertyKey>(obj: X, prop: Y) => obj is X & Record<Y, unknown>, matches: (re: RegExp) => (v: string) => " contains invalid characters" | undefined, maxLength: (max: number) => (v: string) => string | undefined, maxLengthArray: <T>(max: number) => (v: T[]) => string | undefined, minLength: (min: number) => (v: string) => string | undefined, minLengthArray: <T>(min: number) => (v: T[]) => string | undefined, notEmpty: (v: string) => " is Required" | undefined, optional: <X extends {}, Y extends string, V, E extends string>(obj: X, prop: Y, map: (u: unknown) => V, getError?: (v: V) => void | E | undefined) => V | undefined, required: <X extends {}, Y extends string, V, E extends string>(obj: X, prop: Y, map: (u: unknown) => V, getError?: (v: V) => void | E | undefined) => V, validateAll: <V, E extends string>(...validators: ((v: V) => E | undefined)[]) => (v: V) => E | undefined;
}, asNil: (v: unknown) => undefined, asNumber: (v: unknown) => number, asObject: <T>(map: (v: {}) => T) => (v: unknown) => T, asOneOf: <T extends string | number>(...options: T[]) => (v: unknown) => T, asString: (v: unknown) => string, asStringLiteral: <T extends string>(l: T) => (v: unknown) => T, asUnion: <T>(...options: ((v: unknown) => T)[]) => (v: unknown) => T, excludes: (...values: string[]) => (v: string) => string | undefined, getInt: (id: string) => Promise<number>, getObject: (body: unknown) => Promise<object>, hasOwnProperty: <X extends {}, Y extends PropertyKey>(obj: X, prop: Y) => obj is X & Record<Y, unknown>, matches: (re: RegExp) => (v: string) => " contains invalid characters" | undefined, max: (max: number) => (v: number) => string | undefined, maxLength: (max: number) => (v: string) => string | undefined, maxLengthArray: <T>(max: number) => (v: T[]) => string | undefined, min: (min: number) => (v: number) => string | undefined, minLength: (min: number) => (v: string) => string | undefined, minLengthArray: <T>(min: number) => (v: T[]) => string | undefined, notEmpty: (v: string) => " is Required" | undefined, optional: <X extends {}, Y extends string, V, E extends string>(obj: X, prop: Y, map: (u: unknown) => V, getError?: (v: V) => void | E | undefined) => V | undefined, required: <X extends {}, Y extends string, V, E extends string>(obj: X, prop: Y, map: (u: unknown) => V, getError?: (v: V) => void | E | undefined) => V, validateAll: <V, E extends string>(...validators: ((v: V) => E | undefined)[]) => (v: V) => E | undefined;

@@ -76,3 +76,3 @@ import { nop } from "../data/fun.js";

res(body);
}), hasOwnProperty = (obj, prop) => obj.hasOwnProperty(prop), matches = (re) => (v) => !re.test(v) ? " contains invalid characters" : undefined, maxLength = (max) => (v) => v.length > max ? ` cannot be longer than ${max} characters` : undefined, maxLengthArray = (max) => (v) => v.length > max ? ` cannot contain more than ${max} entries` : undefined, minLength = (min) => (v) => v.length < min ? ` cannot be shorter than ${min} characters` : undefined, minLengthArray = (min) => (v) => v.length < min ? ` cannot contain fewer than ${min} entries` : undefined, notEmpty = (v) => !v ? " is Required" : undefined, optional = (obj, prop, map, getError = nop) => {
}), hasOwnProperty = (obj, prop) => obj.hasOwnProperty(prop), matches = (re) => (v) => !re.test(v) ? " contains invalid characters" : undefined, max = (max) => (v) => v > max ? ` cannot be greater than ${max}` : undefined, maxLength = (max) => (v) => v.length > max ? ` cannot be longer than ${max} characters` : undefined, maxLengthArray = (max) => (v) => v.length > max ? ` cannot contain more than ${max} entries` : undefined, min = (min) => (v) => v < min ? ` cannot be less than ${min}` : undefined, minLength = (min) => (v) => v.length < min ? ` cannot be shorter than ${min} characters` : undefined, minLengthArray = (min) => (v) => v.length < min ? ` cannot contain fewer than ${min} entries` : undefined, notEmpty = (v) => !v ? " is Required" : undefined, optional = (obj, prop, map, getError = nop) => {
if (!hasOwnProperty(obj, prop)) {

@@ -79,0 +79,0 @@ return undefined;

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

/// <reference types="node" />
/// <reference types="node" />
import express from "express";

@@ -17,2 +19,2 @@ import { Elt } from "./core.js";

staticDir: string;
}, apis: RokayHandler[], notFound: (req: RokayRequest, res: RokayResponse) => Promise<Elt>) => void;
}, apis: RokayHandler[], notFound: (req: RokayRequest, res: RokayResponse) => Elt | string | Promise<Elt | string>) => import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;

@@ -25,3 +25,7 @@ import express from "express";

// using NODE_ENV and "production" makes Express do things to work faster!
production = process.env.NODE_ENV === "production", sslConfig = getSSLConfig(), staticDir, }, apis, notFound) => {
production = process.env.NODE_ENV === "production", sslConfig = getSSLConfig(), staticDir, }, apis,
/**
* @returns an Elt or a string pointing to an index file that will be sent as the response
**/
notFound) => {
const app = express().set("title", title);

@@ -51,4 +55,11 @@ if (production) {

if (req.headers.accept && req.headers.accept.includes("text/html")) {
notFound(req, res)
.then(elt => { res.send(renderPage(elt)); }, next);
Promise.resolve(notFound(req, res))
.then(elt => {
if (typeof elt === "string") {
res.sendFile(elt);
}
else {
res.send(renderPage(elt));
}
}, next);
}

@@ -78,3 +89,3 @@ else {

}));
(sslConfig ?
return (sslConfig ?
createServer(sslConfig, app)

@@ -81,0 +92,0 @@ :

{
"name": "rokay",
"version": "0.0.9",
"version": "0.0.10-alpha.0",
"description": "A full-stack framework for making CRUD apps in TypeScript.",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc