🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

create-oc

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-oc - npm Package Compare versions

Comparing version

to
0.0.12

templates/elm/public/logo.png

2

package.json
{
"name": "create-oc",
"version": "0.0.11",
"version": "0.0.12",
"type": "module",

@@ -5,0 +5,0 @@ "description": "",

@@ -10,5 +10,8 @@ {

"template": {
"src": "src/Main.elm",
"src": "src/index.js",
"type": "oc-template-elm"
}
},
"static": [
"public"
]
},

@@ -15,0 +18,0 @@ "parameters": {

import { Server } from 'oc-server';
const database = [
{ name: 'John Doe', email: 'john@doe.com', age: 32 },
{ name: 'Jane Doe', email: 'jane@doe.com', age: 31 }
const userDatabase = [
{ name: 'John Doe', born: 1986, hobbies: ['Swimming', 'Basketball'] },
{ name: 'Jane Doe', born: 1991, hobbies: ['Running', 'Rugby'] },
];
const yearsFunFactDatabase: Record<number, string> = {
1986: "Halley's Comet made its closest approach to Earth in 1986, visible to the naked eye.",
1987: 'The first Final Fantasy game was released in 1987.',
1991: 'The first web page was created in 1991 by Tim Berners-Lee.',
};
async function getUser(userId: number) {
return database[userId];
return userDatabase[userId];
}
export const server = new Server(async (params: { userId: number; moreData?: boolean }) => {
const { moreData, userId } = params;
const { email, name, age } = await getUser(userId);
async function getFunFact(year: number) {
return yearsFunFactDatabase[year];
}
export const server = new Server(async (params: { userId: number }, ctx) => {
const { userId } = params;
const user = await getUser(userId);
const [firstName, lastName] = user.name.split(/\s+/);
if (firstName === 'Invalid') {
return;
}
return {
userId,
name,
email,
age: moreData && age
firstName,
lastName,
born: user.born,
hobbies: user.hobbies,
staticPath: ctx.staticPath,
};
}).action('funFact', async (params: { year: number }) => {
const { year } = params;
const funFact = await getFunFact(year);
return {
funFact,
};
});
declare module 'oc-server' {
interface Register {
server: typeof server;
}
}

@@ -33,2 +33,3 @@ {

"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"@testing-library/react": "^14.0.0",

@@ -38,3 +39,3 @@ "@testing-library/user-event": "^14.4.3",

"oc-server": "^0.3.0",
"oc-template-preact-compiler": "^0.4.0",
"oc-template-preact-compiler": "^0.4.1",
"preact": "^10.13.2",

@@ -41,0 +42,0 @@ "typescript": "5.0.2",

import { Server } from 'oc-server';
import { ClientProps, OcParameters } from './types';
const database = [
{ name: 'John Doe', age: 34, hobbies: ['Swimming', 'Basketball'] },
{ name: 'Jane Doe', age: 35, hobbies: ['Running', 'Rugby'] }
const userDatabase = [
{ name: 'John Doe', born: 1986, hobbies: ['Swimming', 'Basketball'] },
{ name: 'Jane Doe', born: 1991, hobbies: ['Running', 'Rugby'] },
];
const yearsFunFactDatabase: Record<number, string> = {
1986: "Halley's Comet made its closest approach to Earth in 1986, visible to the naked eye.",
1987: 'The first Final Fantasy game was released in 1987.',
1991: 'The first web page was created in 1991 by Tim Berners-Lee.',
};
async function getUser(userId: number) {
return database[userId];
return userDatabase[userId];
}
export const server = new Server(async (params: OcParameters): Promise<ClientProps> => {
async function getFunFact(year: number) {
return yearsFunFactDatabase[year];
}
export const server = new Server(async (params: { userId: number }) => {
const { userId } = params;
const user = await getUser(userId);
const [firstName, lastName] = user.name.split(/\s+/);
const [firstName, lastName] = user.name.split(/\s+/);
if (firstName === 'Invalid') {
return;
}
return {
userId,
firstName,
lastName
lastName,
born: user.born,
hobbies: user.hobbies,
};
}).action('getMoreData', async (params: OcParameters) => {
const { userId } = params;
const user = await getUser(userId);
}).action('funFact', async (params: { year: number }) => {
const { year } = params;
const funFact = await getFunFact(year);
return {
age: user.age,
hobbies: user.hobbies
funFact,
};

@@ -30,0 +44,0 @@ });

{
"name": "base-component-solid",
"name": "base-component-vue",
"description": "",

@@ -4,0 +4,0 @@ "version": "1.0.0",

import { Server } from 'oc-server';
import { ClientProps, OcParameters } from './types';
const database = [
{ name: 'John Doe', age: 34, hobbies: ['Swimming', 'Basketball'] },
{ name: 'Jane Doe', age: 35, hobbies: ['Running', 'Rugby'] }
const userDatabase = [
{ name: 'John Doe', born: 1986, hobbies: ['Swimming', 'Basketball'] },
{ name: 'Jane Doe', born: 1991, hobbies: ['Running', 'Rugby'] },
];
const yearsFunFactDatabase: Record<number, string> = {
1986: "Halley's Comet made its closest approach to Earth in 1986, visible to the naked eye.",
1987: 'The first Final Fantasy game was released in 1987.',
1991: 'The first web page was created in 1991 by Tim Berners-Lee.',
};
async function getUser(userId: number) {
return database[userId];
return userDatabase[userId];
}
export const server = new Server(async (params: OcParameters): Promise<ClientProps> => {
async function getFunFact(year: number) {
return yearsFunFactDatabase[year];
}
export const server = new Server(async (params: { userId: number }) => {
const { userId } = params;
const user = await getUser(userId);
const [firstName, lastName] = user.name.split(/\s+/);
const [firstName, lastName] = user.name.split(/\s+/);
if (firstName === 'Invalid') {
return;
}
return {
userId,
firstName,
lastName
lastName,
born: user.born,
hobbies: user.hobbies,
};
}).action('getMoreData', async (params: OcParameters) => {
const { userId } = params;
const user = await getUser(userId);
}).action('funFact', async (params: { year: number }) => {
const { year } = params;
const funFact = await getFunFact(year);
return {
age: user.age,
hobbies: user.hobbies
funFact,
};

@@ -30,0 +44,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet