Initial commit - Event Planner application

This commit is contained in:
mberlin
2026-03-18 14:55:56 -03:00
commit 86d779eb4d
7548 changed files with 1006324 additions and 0 deletions

42
node_modules/@mikro-orm/core/cache/CacheAdapter.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
/** Interface for async-capable cache storage used by result cache and metadata cache. */
export interface CacheAdapter {
/**
* Gets the items under `name` key from the cache.
*/
get<T = any>(name: string): T | Promise<T | undefined> | undefined;
/**
* Sets the item to the cache. `origin` is used for cache invalidation and should reflect the change in data.
*/
set(name: string, data: any, origin: string, expiration?: number): void | Promise<void>;
/**
* Removes the item from cache.
*/
remove(name: string): void | Promise<void>;
/**
* Clears all items stored in the cache.
*/
clear(): void | Promise<void>;
/**
* Called inside `MikroORM.close()` Allows graceful shutdowns (e.g. for redis).
*/
close?(): void | Promise<void>;
}
/** Synchronous variant of CacheAdapter, used for metadata cache where async access is not needed. */
export interface SyncCacheAdapter extends CacheAdapter {
/**
* Gets the items under `name` key from the cache.
*/
get<T = any>(name: string): T | undefined;
/**
* Sets the item to the cache. `origin` is used for cache invalidation and should reflect the change in data.
*/
set(name: string, data: any, origin: string, expiration?: number): void;
/**
* Removes the item from cache.
*/
remove(name: string): void;
/**
* Generates a combined cache from all existing entries.
*/
combine?(): string | void;
}

1
node_modules/@mikro-orm/core/cache/CacheAdapter.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,33 @@
import type { SyncCacheAdapter } from './CacheAdapter.js';
export declare class FileCacheAdapter implements SyncCacheAdapter {
#private;
constructor(
options:
| {
cacheDir: string;
combined?: boolean | string;
}
| undefined,
baseDir: string,
pretty?: boolean,
);
/**
* @inheritDoc
*/
get(name: string): any;
/**
* @inheritDoc
*/
set(name: string, data: any, origin: string): void;
/**
* @inheritDoc
*/
remove(name: string): void;
/**
* @inheritDoc
*/
clear(): void;
combine(): string | void;
private path;
private getHash;
}

91
node_modules/@mikro-orm/core/cache/FileCacheAdapter.js generated vendored Normal file
View File

@@ -0,0 +1,91 @@
import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'node:fs';
import { fs } from '../utils/fs-utils.js';
import { Utils } from '../utils/Utils.js';
export class FileCacheAdapter {
#VERSION = Utils.getORMVersion();
#cache = {};
#options;
#baseDir;
#pretty;
constructor(options = {}, baseDir, pretty = false) {
this.#options = options;
this.#baseDir = baseDir;
this.#pretty = pretty;
this.#options.cacheDir ??= process.cwd() + '/temp';
}
/**
* @inheritDoc
*/
get(name) {
const path = this.path(name);
if (!existsSync(path)) {
return null;
}
const payload = fs.readJSONSync(path);
const hash = this.getHash(payload.origin);
if (!hash || payload.hash !== hash) {
return null;
}
return payload.data;
}
/**
* @inheritDoc
*/
set(name, data, origin) {
if (this.#options.combined) {
this.#cache[name.replace(/\.[jt]s$/, '')] = data;
return;
}
const path = this.path(name);
const hash = this.getHash(origin);
writeFileSync(
path,
JSON.stringify({ data, origin, hash, version: this.#VERSION }, null, this.#pretty ? 2 : undefined),
);
}
/**
* @inheritDoc
*/
remove(name) {
const path = this.path(name);
unlinkSync(path);
}
/**
* @inheritDoc
*/
clear() {
const path = this.path('*');
const files = fs.glob(path);
for (const file of files) {
/* v8 ignore next */
try {
unlinkSync(file);
} catch {
// ignore if file is already gone
}
}
this.#cache = {};
}
combine() {
if (!this.#options.combined) {
return;
}
let path = typeof this.#options.combined === 'string' ? this.#options.combined : './metadata.json';
path = fs.normalizePath(this.#options.cacheDir, path);
this.#options.combined = path; // override in the options, so we can log it from the CLI in `cache:generate` command
writeFileSync(path, JSON.stringify(this.#cache, null, this.#pretty ? 2 : undefined));
return path;
}
path(name) {
fs.ensureDir(this.#options.cacheDir);
return `${this.#options.cacheDir}/${name}.json`;
}
getHash(origin) {
origin = fs.absolutePath(origin, this.#baseDir);
if (!existsSync(origin)) {
return null;
}
const contents = readFileSync(origin);
return Utils.hash(contents.toString() + this.#VERSION);
}
}

View File

@@ -0,0 +1,23 @@
import type { CacheAdapter } from './CacheAdapter.js';
import type { Dictionary } from '../typings.js';
/** Cache adapter backed by pre-generated static data, typically produced by the CLI cache:generate command. */
export declare class GeneratedCacheAdapter implements CacheAdapter {
#private;
constructor(options: { data: Dictionary });
/**
* @inheritDoc
*/
get<T = any>(name: string): T | undefined;
/**
* @inheritDoc
*/
set(name: string, data: any, origin: string): void;
/**
* @inheritDoc
*/
remove(name: string): void;
/**
* @inheritDoc
*/
clear(): void;
}

View File

@@ -0,0 +1,33 @@
/** Cache adapter backed by pre-generated static data, typically produced by the CLI cache:generate command. */
export class GeneratedCacheAdapter {
#data;
constructor(options) {
this.#data = new Map(Object.entries(options.data));
}
/**
* @inheritDoc
*/
get(name) {
const key = name.replace(/\.[jt]s$/, '');
const data = this.#data.get(key);
return data;
}
/**
* @inheritDoc
*/
set(name, data, origin) {
this.#data.set(name, { data });
}
/**
* @inheritDoc
*/
remove(name) {
this.#data.delete(name);
}
/**
* @inheritDoc
*/
clear() {
this.#data.clear();
}
}

View File

@@ -0,0 +1,22 @@
import type { CacheAdapter } from './CacheAdapter.js';
/** In-memory cache adapter with time-based expiration. Used as the default result cache. */
export declare class MemoryCacheAdapter implements CacheAdapter {
#private;
constructor(options: { expiration: number });
/**
* @inheritDoc
*/
get<T = any>(name: string): T | undefined;
/**
* @inheritDoc
*/
set(name: string, data: any, origin: string, expiration?: number): void;
/**
* @inheritDoc
*/
remove(name: string): void;
/**
* @inheritDoc
*/
clear(): void;
}

View File

@@ -0,0 +1,40 @@
/** In-memory cache adapter with time-based expiration. Used as the default result cache. */
export class MemoryCacheAdapter {
#data = new Map();
#options;
constructor(options) {
this.#options = options;
}
/**
* @inheritDoc
*/
get(name) {
const data = this.#data.get(name);
if (data) {
if (data.expiration < Date.now()) {
this.#data.delete(name);
} else {
return data.data;
}
}
return undefined;
}
/**
* @inheritDoc
*/
set(name, data, origin, expiration) {
this.#data.set(name, { data, expiration: Date.now() + (expiration ?? this.#options.expiration) });
}
/**
* @inheritDoc
*/
remove(name) {
this.#data.delete(name);
}
/**
* @inheritDoc
*/
clear() {
this.#data.clear();
}
}

View File

@@ -0,0 +1,20 @@
import type { SyncCacheAdapter } from './CacheAdapter.js';
/** No-op cache adapter that never stores or returns any data. Used to disable caching. */
export declare class NullCacheAdapter implements SyncCacheAdapter {
/**
* @inheritDoc
*/
get(name: string): any;
/**
* @inheritDoc
*/
set(name: string, data: any, origin: string): void;
/**
* @inheritDoc
*/
remove(name: string): void;
/**
* @inheritDoc
*/
clear(): void;
}

27
node_modules/@mikro-orm/core/cache/NullCacheAdapter.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/** No-op cache adapter that never stores or returns any data. Used to disable caching. */
export class NullCacheAdapter {
/**
* @inheritDoc
*/
get(name) {
return null;
}
/**
* @inheritDoc
*/
set(name, data, origin) {
// ignore
}
/**
* @inheritDoc
*/
remove(name) {
// ignore
}
/**
* @inheritDoc
*/
clear() {
// ignore
}
}

4
node_modules/@mikro-orm/core/cache/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export type * from './CacheAdapter.js';
export * from './NullCacheAdapter.js';
export * from './MemoryCacheAdapter.js';
export * from './GeneratedCacheAdapter.js';

3
node_modules/@mikro-orm/core/cache/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from './NullCacheAdapter.js';
export * from './MemoryCacheAdapter.js';
export * from './GeneratedCacheAdapter.js';