chore: stop tracking TypeScript emit under packages/*/src

Ignore .js/.js.map/.d.ts/.d.ts.map next to sources (tsc outDir is dist).
Preserve hand-written packages/auth/src/types/base58-universal.d.ts.

Made-with: Cursor
This commit is contained in:
defiQUG
2026-04-07 22:08:37 -07:00
parent 27c4012431
commit 923b703d97
149 changed files with 8 additions and 5504 deletions

8
.gitignore vendored
View File

@@ -48,6 +48,14 @@ lerna-debug.log*
# TypeScript
*.tsbuildinfo
# Compiler output must not live next to sources (packages use outDir: dist).
# Keep hand-written ambient defs, e.g. packages/auth/src/types/base58-universal.d.ts
packages/**/src/**/*.js
packages/**/src/**/*.js.map
packages/**/src/**/*.d.ts.map
packages/**/src/**/*.d.ts
!packages/auth/src/types/base58-universal.d.ts
# Terraform
*.tfstate
*.tfstate.*

View File

@@ -1,28 +0,0 @@
/**
* DID (Decentralized Identifier) helpers
*/
export interface DIDDocument {
id: string;
'@context': string[];
verificationMethod: VerificationMethod[];
authentication: string[];
}
export interface VerificationMethod {
id: string;
type: string;
controller: string;
publicKeyMultibase?: string;
publicKeyJwk?: {
kty: string;
crv?: string;
x?: string;
y?: string;
n?: string;
e?: string;
};
}
export declare class DIDResolver {
resolve(did: string): Promise<DIDDocument>;
verifySignature(did: string, message: string, signature: string): Promise<boolean>;
}
//# sourceMappingURL=did.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"did.d.ts","sourceRoot":"","sources":["did.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;IACzC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;CACH;AAED,qBAAa,WAAW;IAChB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAwC1C,eAAe,CACnB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;CA4DpB"}

View File

@@ -1,101 +0,0 @@
/**
* DID (Decentralized Identifier) helpers
*/
import fetch from 'node-fetch';
import { createVerify } from 'crypto';
export class DIDResolver {
async resolve(did) {
// Extract method and identifier from DID
const didParts = did.split(':');
if (didParts.length < 3) {
throw new Error(`Invalid DID format: ${did}`);
}
const method = didParts[1];
const identifier = didParts.slice(2).join(':');
// Resolve based on DID method
if (method === 'web') {
// did:web resolution
const url = `https://${identifier}/.well-known/did.json`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to resolve DID: ${response.status}`);
}
return (await response.json());
}
else if (method === 'key') {
// did:key resolution - generate document from key
const publicKeyMultibase = identifier;
return {
id: did,
'@context': ['https://www.w3.org/ns/did/v1'],
verificationMethod: [
{
id: `${did}#keys-1`,
type: 'Ed25519VerificationKey2020',
controller: did,
publicKeyMultibase,
},
],
authentication: [`${did}#keys-1`],
};
}
throw new Error(`Unsupported DID method: ${method}`);
}
async verifySignature(did, message, signature) {
try {
const document = await this.resolve(did);
const verificationMethod = document.verificationMethod[0];
if (!verificationMethod) {
return false;
}
const verify = createVerify('SHA256');
verify.update(message);
verify.end();
// Handle different key formats
if (verificationMethod.publicKeyMultibase) {
// Multibase-encoded public key (e.g., Ed25519)
// Decode multibase format (simplified - in production use proper multibase library)
const multibaseKey = verificationMethod.publicKeyMultibase;
if (multibaseKey.startsWith('z')) {
// Base58btc encoding - decode first byte (0xed for Ed25519)
// For Ed25519, the key is 32 bytes after the prefix
try {
// In production, use proper multibase/base58 decoding
// This is a simplified implementation
const keyBuffer = Buffer.from(multibaseKey.slice(1), 'base64');
return verify.verify(keyBuffer, Buffer.from(signature, 'base64'));
}
catch {
// Fallback: try direct verification if key is already in correct format
return verify.verify(verificationMethod.publicKeyMultibase, Buffer.from(signature, 'base64'));
}
}
}
// Handle JWK format
if (verificationMethod.publicKeyJwk) {
const jwk = verificationMethod.publicKeyJwk;
if (jwk.kty === 'EC' && jwk.crv === 'secp256k1' && jwk.x && jwk.y) {
// ECDSA with secp256k1
// In production, use proper JWK to PEM conversion
// This requires additional crypto libraries
verify.update(message);
// For now, delegate to external verification service
return false; // Requires proper EC key handling
}
if (jwk.kty === 'RSA' && jwk.n && jwk.e) {
// RSA keys
// In production, convert JWK to PEM format and verify
// This requires additional crypto libraries
return false; // Requires proper RSA key handling
}
}
return false;
}
catch (error) {
// Log error in production
console.error('DID signature verification failed:', error);
return false;
}
}
}
//# sourceMappingURL=did.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"did.js","sourceRoot":"","sources":["did.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAwBtC,MAAM,OAAO,WAAW;IACtB,KAAK,CAAC,OAAO,CAAC,GAAW;QACvB,yCAAyC;QACzC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3B,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oBACvB,qDAAqD;oBACrD,OAAO,KAAK,CAAC,CAAC,kCAAkC;gBAClD,CAAC;gBAED,IAAI,GAAG,CAAC,GAAG,KAAK,KAAK,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;oBACxC,WAAW;oBACX,sDAAsD;oBACtD,4CAA4C;oBAC5C,OAAO,KAAK,CAAC,CAAC,mCAAmC;gBACnD,CAAC;YACH,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0BAA0B;YAC1B,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;YAC3D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}

View File

@@ -1,19 +0,0 @@
/**
* eIDAS (electronic IDentification, Authentication and trust Services) helpers
*/
export interface EIDASConfig {
providerUrl: string;
apiKey: string;
}
export interface EIDASSignature {
signature: string;
certificate: string;
timestamp: Date;
}
export declare class EIDASProvider {
private config;
constructor(config: EIDASConfig);
requestSignature(document: string): Promise<EIDASSignature>;
verifySignature(signature: EIDASSignature): Promise<boolean>;
}
//# sourceMappingURL=eidas.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"eidas.d.ts","sourceRoot":"","sources":["eidas.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEjC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA4B3D,eAAe,CAAC,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;CAgEnE"}

View File

@@ -1,82 +0,0 @@
/**
* eIDAS (electronic IDentification, Authentication and trust Services) helpers
*/
import fetch from 'node-fetch';
export class EIDASProvider {
config;
constructor(config) {
this.config = config;
}
async requestSignature(document) {
const response = await fetch(`${this.config.providerUrl}/sign`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.config.apiKey}`,
},
body: JSON.stringify({ document }),
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`eIDAS signature request failed: ${response.status} ${errorText}`);
}
const data = (await response.json());
return {
signature: data.signature,
certificate: data.certificate,
timestamp: new Date(data.timestamp),
};
}
async verifySignature(signature) {
try {
// First, verify with the eIDAS provider (they handle certificate chain validation)
const response = await fetch(`${this.config.providerUrl}/verify`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.config.apiKey}`,
},
body: JSON.stringify({
signature: signature.signature,
certificate: signature.certificate,
timestamp: signature.timestamp.toISOString(),
}),
});
if (!response.ok) {
return false;
}
const result = (await response.json());
if (!result.valid) {
return false;
}
// Additional validation: Check certificate validity period
if (result.validityPeriod) {
const now = new Date();
const notBefore = new Date(result.validityPeriod.notBefore);
const notAfter = new Date(result.validityPeriod.notAfter);
if (now < notBefore || now > notAfter) {
return false; // Certificate expired or not yet valid
}
}
// Additional validation: Verify certificate chain if provided
if (result.certificateChain && result.certificateChain.length > 0) {
// In production, validate the full certificate chain
// This includes checking:
// 1. Each certificate in the chain is valid
// 2. Each certificate is signed by the next in the chain
// 3. The root certificate is trusted
// 4. No certificates are revoked
// For now, we trust the eIDAS provider's validation
// In a production environment, you might want to do additional
// client-side validation of the certificate chain
}
return true;
}
catch (error) {
// Log error in production
console.error('eIDAS signature verification failed:', error);
return false;
}
}
}
//# sourceMappingURL=eidas.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"eidas.js","sourceRoot":"","sources":["eidas.ts"],"names":[],"mappings":"AAAA;;GAEG;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AAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}

View File

@@ -1,7 +0,0 @@
/**
* The Order Auth Package
*/
export * from './oidc';
export * from './did';
export * from './eidas';
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}

View File

@@ -1,7 +0,0 @@
/**
* The Order Auth Package
*/
export * from './oidc';
export * from './did';
export * from './eidas';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}

View File

@@ -1,23 +0,0 @@
/**
* OIDC/OAuth2 helpers
*/
export interface OIDCConfig {
issuer: string;
clientId: string;
clientSecret: string;
redirectUri: string;
}
export interface TokenResponse {
access_token: string;
token_type: string;
expires_in?: number;
refresh_token?: string;
id_token?: string;
}
export declare class OIDCProvider {
private config;
constructor(config: OIDCConfig);
getAuthorizationUrl(state: string): string;
exchangeCodeForToken(code: string): Promise<string>;
}
//# sourceMappingURL=oidc.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["oidc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAWpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA2B1D"}

View File

@@ -1,44 +0,0 @@
/**
* OIDC/OAuth2 helpers
*/
import fetch from 'node-fetch';
export class OIDCProvider {
config;
constructor(config) {
this.config = config;
}
getAuthorizationUrl(state) {
const params = new URLSearchParams({
client_id: this.config.clientId,
redirect_uri: this.config.redirectUri,
response_type: 'code',
scope: 'openid profile email',
state,
});
return `${this.config.issuer}/authorize?${params.toString()}`;
}
async exchangeCodeForToken(code) {
const tokenEndpoint = `${this.config.issuer}/token`;
const params = new URLSearchParams({
grant_type: 'authorization_code',
code,
redirect_uri: this.config.redirectUri,
client_id: this.config.clientId,
client_secret: this.config.clientSecret,
});
const response = await fetch(tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: params.toString(),
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`Token exchange failed: ${response.status} ${errorText}`);
}
const tokenData = (await response.json());
return tokenData.access_token;
}
}
//# sourceMappingURL=oidc.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"oidc.js","sourceRoot":"","sources":["oidc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAiB/B,MAAM,OAAO,YAAY;IACH;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C,mBAAmB,CAAC,KAAa;QAC/B,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,MAAM,CA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":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC"}

View File

@@ -1,5 +0,0 @@
/**
* Cache package for The Order
*/
export * from './redis';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC"}

View File

@@ -1,80 +0,0 @@
/**
* Redis caching layer for The Order
* Implements caching for database queries, cache invalidation, and cache monitoring
*/
export interface CacheConfig {
url?: string;
ttl?: number;
keyPrefix?: string;
enableCompression?: boolean;
}
export interface CacheStats {
hits: number;
misses: number;
sets: number;
deletes: number;
errors: number;
}
/**
* Redis Cache Client
*/
export declare class CacheClient {
private client;
private config;
private stats;
constructor(config?: CacheConfig);
/**
* Initialize Redis client
*/
connect(): Promise<void>;
/**
* Disconnect Redis client
*/
disconnect(): Promise<void>;
/**
* Get value from cache
*/
get<T>(key: string): Promise<T | null>;
/**
* Set value in cache
*/
set(key: string, value: unknown, ttl?: number): Promise<void>;
/**
* Delete value from cache
*/
delete(key: string): Promise<void>;
/**
* Delete multiple keys by pattern
*/
invalidate(pattern: string): Promise<number>;
/**
* Check if key exists
*/
exists(key: string): Promise<boolean>;
/**
* Get cache statistics
*/
getStats(): CacheStats;
/**
* Reset cache statistics
*/
resetStats(): void;
/**
* Get full key with prefix
*/
private getFullKey;
/**
* Serialize value
*/
private serialize;
/**
* Deserialize value
*/
private deserialize;
}
export declare function getCacheClient(config?: CacheConfig): CacheClient;
/**
* Cache decorator for functions
*/
export declare function cached<T extends (...args: unknown[]) => Promise<unknown>>(fn: T, keyGenerator?: (...args: Parameters<T>) => string, ttl?: number): T;
//# sourceMappingURL=redis.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["redis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,WA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;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB;AAOD,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,CAKhE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACvE,EAAE,EAAE,CAAC,EACL,YAAY,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,EACjD,GAAG,CAAC,EAAE,MAAM,GACX,CAAC,CAeH"}

View File

@@ -1,247 +0,0 @@
/**
* Redis caching layer for The Order
* Implements caching for database queries, cache invalidation, and cache monitoring
*/
import { createClient } from 'redis';
import { getEnv, createLogger } from '@the-order/shared';
const logger = createLogger('cache');
/**
* Redis Cache Client
*/
export class CacheClient {
client = null;
config;
stats = {
hits: 0,
misses: 0,
sets: 0,
deletes: 0,
errors: 0,
};
constructor(config = {}) {
const env = getEnv();
this.config = {
url: config.url || env.REDIS_URL || 'redis://localhost:6379',
ttl: config.ttl || 3600, // 1 hour default
keyPrefix: config.keyPrefix || 'the-order:',
enableCompression: config.enableCompression || false,
};
}
/**
* Initialize Redis client
*/
async connect() {
if (this.client) {
return;
}
try {
this.client = createClient({
url: this.config.url,
});
this.client.on('error', (err) => {
logger.error('Redis client error:', err);
this.stats.errors++;
});
this.client.on('connect', () => {
logger.info('Redis client connected');
});
this.client.on('disconnect', () => {
logger.warn('Redis client disconnected');
});
await this.client.connect();
}
catch (error) {
logger.error('Failed to connect to Redis:', error);
throw error;
}
}
/**
* Disconnect Redis client
*/
async disconnect() {
if (this.client) {
await this.client.quit();
this.client = null;
}
}
/**
* Get value from cache
*/
async get(key) {
if (!this.client) {
await this.connect();
}
try {
const fullKey = this.getFullKey(key);
const value = await this.client.get(fullKey);
if (value === null) {
this.stats.misses++;
return null;
}
this.stats.hits++;
return this.deserialize(value);
}
catch (error) {
logger.error(`Cache get error for key ${key}:`, error);
this.stats.errors++;
this.stats.misses++;
return null;
}
}
/**
* Set value in cache
*/
async set(key, value, ttl) {
if (!this.client) {
await this.connect();
}
if (!this.client) {
this.stats.errors++;
return;
}
try {
const fullKey = this.getFullKey(key);
const serialized = this.serialize(value);
const expiresIn = ttl || this.config.ttl;
await this.client.setEx(fullKey, expiresIn, serialized);
this.stats.sets++;
}
catch (error) {
logger.error(`Cache set error for key ${key}:`, error);
this.stats.errors++;
}
}
/**
* Delete value from cache
*/
async delete(key) {
if (!this.client) {
await this.connect();
}
if (!this.client) {
this.stats.errors++;
return;
}
try {
const fullKey = this.getFullKey(key);
await this.client.del(fullKey);
this.stats.deletes++;
}
catch (error) {
logger.error(`Cache delete error for key ${key}:`, error);
this.stats.errors++;
}
}
/**
* Delete multiple keys by pattern
*/
async invalidate(pattern) {
if (!this.client) {
await this.connect();
}
if (!this.client) {
this.stats.errors++;
return 0;
}
try {
const fullPattern = this.getFullKey(pattern);
const keys = await this.client.keys(fullPattern);
if (keys.length === 0) {
return 0;
}
const deleted = await this.client.del(keys);
this.stats.deletes += deleted;
return deleted;
}
catch (error) {
logger.error(`Cache invalidate error for pattern ${pattern}:`, error);
this.stats.errors++;
return 0;
}
}
/**
* Check if key exists
*/
async exists(key) {
if (!this.client) {
await this.connect();
}
if (!this.client) {
this.stats.errors++;
return false;
}
try {
const fullKey = this.getFullKey(key);
const result = await this.client.exists(fullKey);
return result === 1;
}
catch (error) {
logger.error(`Cache exists error for key ${key}:`, error);
this.stats.errors++;
return false;
}
}
/**
* Get cache statistics
*/
getStats() {
return { ...this.stats };
}
/**
* Reset cache statistics
*/
resetStats() {
this.stats = {
hits: 0,
misses: 0,
sets: 0,
deletes: 0,
errors: 0,
};
}
/**
* Get full key with prefix
*/
getFullKey(key) {
return `${this.config.keyPrefix}${key}`;
}
/**
* Serialize value
*/
serialize(value) {
return JSON.stringify(value);
}
/**
* Deserialize value
*/
deserialize(value) {
return JSON.parse(value);
}
}
/**
* Get default cache client
*/
let defaultCacheClient = null;
export function getCacheClient(config) {
if (!defaultCacheClient) {
defaultCacheClient = new CacheClient(config);
}
return defaultCacheClient;
}
/**
* Cache decorator for functions
*/
export function cached(fn, keyGenerator, ttl) {
const cache = getCacheClient();
return (async (...args) => {
const key = keyGenerator ? keyGenerator(...args) : `fn:${fn.name}:${JSON.stringify(args)}`;
const cachedValue = await cache.get(key);
if (cachedValue !== null) {
return cachedValue;
}
const result = await fn(...args);
await cache.set(key, result, ttl);
return result;
});
}
//# sourceMappingURL=redis.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,41 +0,0 @@
/**
* Enhanced audit logging with search capabilities
*/
import type { CredentialAuditLog } from './credential-lifecycle';
export interface AuditSearchFilters {
credentialId?: string;
issuerDid?: string;
subjectDid?: string;
credentialType?: string | string[];
action?: 'issued' | 'revoked' | 'verified' | 'renewed';
performedBy?: string;
startDate?: Date;
endDate?: Date;
ipAddress?: string;
}
export interface AuditSearchResult {
logs: CredentialAuditLog[];
total: number;
page: number;
pageSize: number;
}
/**
* Search audit logs with filters
*/
export declare function searchAuditLogs(filters: AuditSearchFilters, page?: number, pageSize?: number): Promise<AuditSearchResult>;
/**
* Get audit log statistics
*/
export declare function getAuditStatistics(startDate?: Date, endDate?: Date): Promise<{
totalIssuances: number;
totalRevocations: number;
totalVerifications: number;
totalRenewals: number;
byCredentialType: Record<string, number>;
byAction: Record<string, number>;
}>;
/**
* Export audit logs (for compliance/regulatory reporting)
*/
export declare function exportAuditLogs(filters: AuditSearchFilters, format?: 'json' | 'csv'): Promise<string>;
//# sourceMappingURL=audit-search.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"audit-search.d.ts","sourceRoot":"","sources":["audit-search.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,EAC3B,IAAI,SAAI,EACR,QAAQ,SAAK,GACZ,OAAO,CAAC,iBAAiB,CAAC,CA4E5B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,IAAI,GACb,OAAO,CAAC;IACT,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC,CAsDD;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,GAAE,MAAM,GAAG,KAAc,GAC9B,OAAO,CAAC,MAAM,CAAC,CAiCjB"}

View File

@@ -1,144 +0,0 @@
/**
* Enhanced audit logging with search capabilities
*/
import { query } from './client';
/**
* Search audit logs with filters
*/
export async function searchAuditLogs(filters, page = 1, pageSize = 50) {
const conditions = [];
const params = [];
let paramIndex = 1;
if (filters.credentialId) {
conditions.push(`credential_id = $${paramIndex++}`);
params.push(filters.credentialId);
}
if (filters.issuerDid) {
conditions.push(`issuer_did = $${paramIndex++}`);
params.push(filters.issuerDid);
}
if (filters.subjectDid) {
conditions.push(`subject_did = $${paramIndex++}`);
params.push(filters.subjectDid);
}
if (filters.credentialType) {
const types = Array.isArray(filters.credentialType) ? filters.credentialType : [filters.credentialType];
conditions.push(`credential_type && $${paramIndex++}`);
params.push(types);
}
if (filters.action) {
conditions.push(`action = $${paramIndex++}`);
params.push(filters.action);
}
if (filters.performedBy) {
conditions.push(`performed_by = $${paramIndex++}`);
params.push(filters.performedBy);
}
if (filters.startDate) {
conditions.push(`performed_at >= $${paramIndex++}`);
params.push(filters.startDate);
}
if (filters.endDate) {
conditions.push(`performed_at <= $${paramIndex++}`);
params.push(filters.endDate);
}
if (filters.ipAddress) {
conditions.push(`ip_address = $${paramIndex++}`);
params.push(filters.ipAddress);
}
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
const offset = (page - 1) * pageSize;
// Get total count
const countResult = await query(`SELECT COUNT(*) as count FROM credential_issuance_audit ${whereClause}`, params);
const total = parseInt(countResult.rows[0]?.count || '0', 10);
// Get paginated results
const result = await query(`SELECT * FROM credential_issuance_audit
${whereClause}
ORDER BY performed_at DESC
LIMIT $${paramIndex++} OFFSET $${paramIndex++}`, [...params, pageSize, offset]);
return {
logs: result.rows,
total,
page,
pageSize,
};
}
/**
* Get audit log statistics
*/
export async function getAuditStatistics(startDate, endDate) {
const conditions = [];
const params = [];
let paramIndex = 1;
if (startDate) {
conditions.push(`performed_at >= $${paramIndex++}`);
params.push(startDate);
}
if (endDate) {
conditions.push(`performed_at <= $${paramIndex++}`);
params.push(endDate);
}
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
// Get counts by action
const actionResult = await query(`SELECT action, COUNT(*) as count
FROM credential_issuance_audit
${whereClause}
GROUP BY action`, params);
const byAction = {};
actionResult.rows.forEach((row) => {
byAction[row.action] = parseInt(row.count, 10);
});
// Get counts by credential type
const typeResult = await query(`SELECT credential_type, COUNT(*) as count
FROM credential_issuance_audit
${whereClause}
GROUP BY credential_type`, params);
const byCredentialType = {};
typeResult.rows.forEach((row) => {
const types = row.credential_type.join(', ');
byCredentialType[types] = (byCredentialType[types] || 0) + parseInt(row.count, 10);
});
return {
totalIssuances: byAction.issued || 0,
totalRevocations: byAction.revoked || 0,
totalVerifications: byAction.verified || 0,
totalRenewals: byAction.renewed || 0,
byCredentialType,
byAction,
};
}
/**
* Export audit logs (for compliance/regulatory reporting)
*/
export async function exportAuditLogs(filters, format = 'json') {
const result = await searchAuditLogs(filters, 1, 10000); // Large limit for export
if (format === 'csv') {
const headers = [
'id',
'credential_id',
'issuer_did',
'subject_did',
'credential_type',
'action',
'performed_by',
'performed_at',
'ip_address',
'user_agent',
];
const rows = result.logs.map((log) => [
log.id,
log.credential_id,
log.issuer_did,
log.subject_did,
log.credential_type.join(';'),
log.action,
log.performed_by || '',
log.performed_at.toISOString(),
log.ip_address || '',
log.user_agent || '',
]);
return [headers.join(','), ...rows.map((row) => row.join(','))].join('\n');
}
return JSON.stringify(result.logs, null, 2);
}
//# sourceMappingURL=audit-search.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"audit-search.js","sourceRoot":"","sources":["audit-search.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAsBjC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA2B,EAC3B,IAAI,GAAG,CAAC,EACR,QAAQ,GAAG,EAAE;IAEb,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,IAAI,OAAO,CAAC,YAAY,EAAE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UAAU,IAAI,EAAE;YACpB,GAAG,CAAC,UAAU,IAAI,EAAE;SACrB,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC"}

View File

@@ -1,37 +0,0 @@
/**
* PostgreSQL database client with connection pooling
*/
import { Pool, QueryResult, QueryResultRow } from 'pg';
export type { QueryResult, QueryResultRow };
export interface DatabaseConfig {
connectionString?: string;
host?: string;
port?: number;
database?: string;
user?: string;
password?: string;
max?: number;
idleTimeoutMillis?: number;
connectionTimeoutMillis?: number;
}
/**
* Create a PostgreSQL connection pool
*/
export declare function createPool(config: DatabaseConfig): Pool;
/**
* Get or create the default database pool
*/
export declare function getPool(config?: DatabaseConfig): Pool;
/**
* Execute a query
*/
export declare function query<T extends QueryResultRow = QueryResultRow>(text: string, params?: unknown[]): Promise<QueryResult<T>>;
/**
* Close the database pool
*/
export declare function closePool(): Promise<void>;
/**
* Health check for database connection
*/
export declare function healthCheck(): Promise<boolean>;
//# sourceMappingURL=client.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,WAAW,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAGnE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAcvD;AAOD;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAQrD;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACnE,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,OAAO,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAKzB;AAED;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAK/C;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAQpD"}

View File

@@ -1,69 +0,0 @@
/**
* PostgreSQL database client with connection pooling
*/
import { Pool } from 'pg';
/**
* Create a PostgreSQL connection pool
*/
export function createPool(config) {
const poolConfig = {
connectionString: config.connectionString,
host: config.host,
port: config.port,
database: config.database,
user: config.user,
password: config.password,
max: config.max || 20,
idleTimeoutMillis: config.idleTimeoutMillis || 30000,
connectionTimeoutMillis: config.connectionTimeoutMillis || 2000,
};
return new Pool(poolConfig);
}
/**
* Default database pool instance
*/
let defaultPool = null;
/**
* Get or create the default database pool
*/
export function getPool(config) {
if (!defaultPool) {
if (!config) {
throw new Error('Database configuration required for first pool creation');
}
defaultPool = createPool(config);
}
return defaultPool;
}
/**
* Execute a query
*/
export async function query(text, params) {
if (!defaultPool) {
throw new Error('Database pool not initialized. Call getPool() with configuration first.');
}
return defaultPool.query(text, params);
}
/**
* Close the database pool
*/
export async function closePool() {
if (defaultPool) {
await defaultPool.end();
defaultPool = null;
}
}
/**
* Health check for database connection
*/
export async function healthCheck() {
try {
const pool = getPool();
await pool.query('SELECT 1');
return true;
}
catch {
return false;
}
}
//# sourceMappingURL=client.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAA2C,MAAM,IAAI,CAAC;AAiBnE;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAsB;IAC/C,MAAM,UAAU,GAAe;QAC7B,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE;QACrB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,KAAK;QACpD,uBAAuB,EAAE,MAAM,CAAC,uBAAuB,IAAI,IAAI;KAChE,CAAC;IAEF,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,IAAI,WAAW,GAAgB,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,MAAuB;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QACD,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,IAAY,EACZ,MAAkB;IAElB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,WAAW,CAAC,KAAK,CAAI,IAAI,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC;QACxB,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;QACvB,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}

View File

@@ -1,50 +0,0 @@
/**
* Credential lifecycle management operations
*/
export interface CredentialStatusHistory {
id: string;
credential_id: string;
status: string;
reason?: string;
changed_by?: string;
changed_at: Date;
metadata?: unknown;
}
export interface CredentialRevocation {
id: string;
credential_id: string;
issuer_did: string;
revocation_reason?: string;
revoked_by?: string;
revoked_at: Date;
revocation_list_index?: number;
}
export interface CredentialAuditLog {
id: string;
credential_id: string;
issuer_did: string;
subject_did: string;
credential_type: string[];
action: 'issued' | 'revoked' | 'verified' | 'renewed';
performed_by?: string;
performed_at: Date;
metadata?: unknown;
ip_address?: string;
user_agent?: string;
}
export declare function addCredentialStatusHistory(history: Omit<CredentialStatusHistory, 'id' | 'changed_at'>): Promise<CredentialStatusHistory>;
export declare function getCredentialStatusHistory(credentialId: string): Promise<CredentialStatusHistory[]>;
export declare function revokeCredential(revocation: Omit<CredentialRevocation, 'id' | 'revoked_at' | 'revocation_list_index'>): Promise<CredentialRevocation>;
export declare function isCredentialRevoked(credentialId: string): Promise<boolean>;
export declare function getRevocationRegistry(issuerDid: string, limit?: number, offset?: number): Promise<CredentialRevocation[]>;
export declare function logCredentialAction(audit: Omit<CredentialAuditLog, 'id' | 'performed_at'>): Promise<CredentialAuditLog>;
export declare function getCredentialAuditLog(credentialId: string, limit?: number): Promise<CredentialAuditLog[]>;
export declare function getExpiringCredentials(daysAhead: number, limit?: number): Promise<Array<{
credential_id: string;
expiration_date: Date;
subject_did: string;
issuer_did: string;
credential_type: string[];
credential_subject: unknown;
}>>;
//# sourceMappingURL=credential-lifecycle.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"credential-lifecycle.d.ts","sourceRoot":"","sources":["credential-lifecycle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,IAAI,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAA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AC,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC,CAanK"}

View File

@@ -1,97 +0,0 @@
/**
* Credential lifecycle management operations
*/
import { query } from './client';
// Note: CredentialTemplate operations are now in credential-templates.ts
// This file focuses on lifecycle operations (status history, revocation, audit)
// Credential Status History operations
export async function addCredentialStatusHistory(history) {
const result = await query(`INSERT INTO credential_status_history (credential_id, status, reason, changed_by, metadata)
VALUES ($1, $2, $3, $4, $5)
RETURNING *`, [
history.credential_id,
history.status,
history.reason || null,
history.changed_by || null,
history.metadata ? JSON.stringify(history.metadata) : null,
]);
return result.rows[0];
}
export async function getCredentialStatusHistory(credentialId) {
const result = await query(`SELECT * FROM credential_status_history
WHERE credential_id = $1
ORDER BY changed_at DESC`, [credentialId]);
return result.rows;
}
// Credential Revocation operations
export async function revokeCredential(revocation) {
// First, update the credential as revoked
await query(`UPDATE verifiable_credentials
SET revoked = TRUE, updated_at = NOW()
WHERE credential_id = $1`, [revocation.credential_id]);
// Get the next revocation list index
const indexResult = await query(`SELECT MAX(revocation_list_index) as max_index
FROM credential_revocation_registry
WHERE issuer_did = $1`, [revocation.issuer_did]);
const nextIndex = (indexResult.rows[0]?.max_index ?? -1) + 1;
// Add to revocation registry
const result = await query(`INSERT INTO credential_revocation_registry
(credential_id, issuer_did, revocation_reason, revoked_by, revocation_list_index)
VALUES ($1, $2, $3, $4, $5)
RETURNING *`, [
revocation.credential_id,
revocation.issuer_did,
revocation.revocation_reason || null,
revocation.revoked_by || null,
nextIndex,
]);
return result.rows[0];
}
export async function isCredentialRevoked(credentialId) {
const result = await query(`SELECT revoked FROM verifiable_credentials WHERE credential_id = $1`, [credentialId]);
return result.rows[0]?.revoked ?? false;
}
export async function getRevocationRegistry(issuerDid, limit = 100, offset = 0) {
const result = await query(`SELECT * FROM credential_revocation_registry
WHERE issuer_did = $1
ORDER BY revocation_list_index DESC
LIMIT $2 OFFSET $3`, [issuerDid, limit, offset]);
return result.rows;
}
// Credential Audit Log operations
export async function logCredentialAction(audit) {
const result = await query(`INSERT INTO credential_issuance_audit
(credential_id, issuer_did, subject_did, credential_type, action, performed_by, metadata, ip_address, user_agent)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
RETURNING *`, [
audit.credential_id,
audit.issuer_did,
audit.subject_did,
audit.credential_type,
audit.action,
audit.performed_by || null,
audit.metadata ? JSON.stringify(audit.metadata) : null,
audit.ip_address || null,
audit.user_agent || null,
]);
return result.rows[0];
}
export async function getCredentialAuditLog(credentialId, limit = 100) {
const result = await query(`SELECT * FROM credential_issuance_audit
WHERE credential_id = $1
ORDER BY performed_at DESC
LIMIT $2`, [credentialId, limit]);
return result.rows;
}
export async function getExpiringCredentials(daysAhead, limit = 100) {
const result = await query(`SELECT credential_id, expiration_date, subject_did, issuer_did, credential_type, credential_subject
FROM verifiable_credentials
WHERE expiration_date IS NOT NULL
AND expiration_date > NOW()
AND expiration_date < NOW() + INTERVAL '${daysAhead} days'
AND revoked = FALSE
ORDER BY expiration_date ASC
LIMIT $1`, [limit]);
return result.rows;
}
//# sourceMappingURL=credential-lifecycle.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"credential-lifecycle.js","sourceRoot":"","sources":["credential-lifecycle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAoCjC,yEAAyE;AACzE,gFAAgF;AAEhF,uCAAuC;AACvC,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,OAA2D;IAE3D,MAAM,MAAM,GAAG,MAAM,KAAK,CACxB;;iBAEa,EACb;QACE,OAAO,CAAC,aAAa;QACrB,OAAO,CAAC,MAAM;QACd,OAAO,CAAC,MAAM,IAAI,IAAI;QACtB,OAAO,CAAC,UAAU,IAAI,IAAI;QAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CA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C"}

View File

@@ -1,68 +0,0 @@
/**
* Credential template management
*/
import { z } from 'zod';
export declare const CredentialTemplateSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
description: z.ZodOptional<z.ZodString>;
credential_type: z.ZodArray<z.ZodString, "many">;
template_data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
version: z.ZodNumber;
is_active: z.ZodBoolean;
created_by: z.ZodNullable<z.ZodString>;
created_at: z.ZodDate;
updated_at: z.ZodDate;
}, "strip", z.ZodTypeAny, {
name: string;
id: string;
created_at: Date;
updated_at: Date;
created_by: string | null;
credential_type: string[];
template_data: Record<string, unknown>;
version: number;
is_active: boolean;
description?: string | undefined;
}, {
name: string;
id: string;
created_at: Date;
updated_at: Date;
created_by: string | null;
credential_type: string[];
template_data: Record<string, unknown>;
version: number;
is_active: boolean;
description?: string | undefined;
}>;
export type CredentialTemplate = z.infer<typeof CredentialTemplateSchema>;
/**
* Create a credential template
*/
export declare function createCredentialTemplate(template: Omit<CredentialTemplate, 'id' | 'created_at' | 'updated_at'>): Promise<CredentialTemplate>;
/**
* Get credential template by ID
*/
export declare function getCredentialTemplate(id: string): Promise<CredentialTemplate | null>;
/**
* Get credential template by name and version
*/
export declare function getCredentialTemplateByName(name: string, version?: number): Promise<CredentialTemplate | null>;
/**
* List all credential templates
*/
export declare function listCredentialTemplates(activeOnly?: boolean, limit?: number, offset?: number): Promise<CredentialTemplate[]>;
/**
* Update credential template
*/
export declare function updateCredentialTemplate(id: string, updates: Partial<Pick<CredentialTemplate, 'description' | 'template_data' | 'is_active'>>): Promise<CredentialTemplate | null>;
/**
* Create new version of credential template
*/
export declare function createTemplateVersion(templateId: string, updates: Partial<Pick<CredentialTemplate, 'template_data' | 'description'>>): Promise<CredentialTemplate>;
/**
* Render credential from template with variable substitution
*/
export declare function renderCredentialFromTemplate(template: CredentialTemplate, variables: Record<string, unknown>): Record<string, unknown>;
//# sourceMappingURL=credential-templates.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,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AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,EAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}

View File

@@ -1,148 +0,0 @@
/**
* Credential template management
*/
import { query } from './client';
import { z } from 'zod';
export const CredentialTemplateSchema = z.object({
id: z.string().uuid(),
name: z.string(),
description: z.string().optional(),
credential_type: z.array(z.string()),
template_data: z.record(z.unknown()),
version: z.number().int().positive(),
is_active: z.boolean(),
created_by: z.string().uuid().nullable(),
created_at: z.date(),
updated_at: z.date(),
});
/**
* Create a credential template
*/
export async function createCredentialTemplate(template) {
const result = await query(`INSERT INTO credential_templates
(name, description, credential_type, template_data, version, is_active, created_by)
VALUES ($1, $2, $3, $4, $5, $6, $7)
RETURNING *`, [
template.name,
template.description || null,
template.credential_type,
JSON.stringify(template.template_data),
template.version,
template.is_active,
template.created_by || null,
]);
return result.rows[0];
}
/**
* Get credential template by ID
*/
export async function getCredentialTemplate(id) {
const result = await query(`SELECT * FROM credential_templates WHERE id = $1`, [id]);
return result.rows[0] || null;
}
/**
* Get credential template by name and version
*/
export async function getCredentialTemplateByName(name, version) {
if (version) {
const result = await query(`SELECT * FROM credential_templates WHERE name = $1 AND version = $2`, [name, version]);
return result.rows[0] || null;
}
else {
// Get latest active version
const result = await query(`SELECT * FROM credential_templates
WHERE name = $1 AND is_active = TRUE
ORDER BY version DESC
LIMIT 1`, [name]);
return result.rows[0] || null;
}
}
/**
* List all credential templates
*/
export async function listCredentialTemplates(activeOnly = true, limit = 100, offset = 0) {
const whereClause = activeOnly ? 'WHERE is_active = TRUE' : '';
const result = await query(`SELECT * FROM credential_templates
${whereClause}
ORDER BY name, version DESC
LIMIT $1 OFFSET $2`, [limit, offset]);
return result.rows;
}
/**
* Update credential template
*/
export async function updateCredentialTemplate(id, updates) {
const fields = [];
const values = [];
let paramIndex = 1;
if (updates.description !== undefined) {
fields.push(`description = $${paramIndex++}`);
values.push(updates.description);
}
if (updates.template_data !== undefined) {
fields.push(`template_data = $${paramIndex++}`);
values.push(JSON.stringify(updates.template_data));
}
if (updates.is_active !== undefined) {
fields.push(`is_active = $${paramIndex++}`);
values.push(updates.is_active);
}
if (fields.length === 0) {
return getCredentialTemplate(id);
}
fields.push(`updated_at = NOW()`);
values.push(id);
const result = await query(`UPDATE credential_templates
SET ${fields.join(', ')}
WHERE id = $${paramIndex}
RETURNING *`, values);
return result.rows[0] || null;
}
/**
* Create new version of credential template
*/
export async function createTemplateVersion(templateId, updates) {
const original = await getCredentialTemplate(templateId);
if (!original) {
throw new Error(`Template ${templateId} not found`);
}
// Get next version number
const versionResult = await query(`SELECT MAX(version) as max_version FROM credential_templates WHERE name = $1`, [original.name]);
const nextVersion = (versionResult.rows[0]?.max_version || 0) + 1;
return createCredentialTemplate({
name: original.name,
description: updates.description || original.description,
credential_type: original.credential_type,
template_data: updates.template_data || original.template_data,
version: nextVersion,
is_active: true,
created_by: original.created_by,
});
}
/**
* Render credential from template with variable substitution
*/
export function renderCredentialFromTemplate(template, variables) {
const rendered = JSON.parse(JSON.stringify(template.template_data));
function substitute(obj) {
if (typeof obj === 'string') {
// Replace {{variable}} patterns
return obj.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
return variables[varName] !== undefined ? String(variables[varName]) : match;
});
}
else if (Array.isArray(obj)) {
return obj.map(substitute);
}
else if (obj && typeof obj === 'object') {
const result = {};
for (const [key, value] of Object.entries(obj)) {
result[key] = substitute(value);
}
return result;
}
return obj;
}
return substitute(rendered);
}
//# sourceMappingURL=credential-templates.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"credential-templates.js","sourceRoot":"","sources":["credential-templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,wBAAwB,G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B,EAAE,CAAC;YAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,UAAU,CAAC,QAAQ,CAA4B,CAAC;AACzD,CAAC"}

View File

@@ -1,59 +0,0 @@
/**
* eResidency Application Database Operations
*/
import { type eResidencyApplication, type eCitizenshipApplication, ApplicationStatus } from '@the-order/schemas';
/**
* Create eResidency application
*/
export declare function createEResidencyApplication(application: Omit<eResidencyApplication, 'id' | 'createdAt' | 'updatedAt'>): Promise<eResidencyApplication>;
/**
* Get eResidency application by ID
*/
export declare function getEResidencyApplicationById(id: string): Promise<eResidencyApplication | null>;
/**
* Update eResidency application
*/
export declare function updateEResidencyApplication(id: string, updates: {
status?: ApplicationStatus;
kycStatus?: 'pending' | 'passed' | 'failed' | 'requires_edd';
sanctionsStatus?: 'pending' | 'clear' | 'flag';
pepStatus?: 'pending' | 'clear' | 'flag';
riskScore?: number;
kycResults?: unknown;
sanctionsResults?: unknown;
riskAssessment?: unknown;
reviewedAt?: string;
reviewedBy?: string;
rejectionReason?: string;
}): Promise<eResidencyApplication>;
/**
* Get review queue
*/
export declare function getReviewQueue(filters: {
riskBand?: 'low' | 'medium' | 'high';
status?: ApplicationStatus;
assignedTo?: string;
limit?: number;
offset?: number;
}): Promise<{
applications: eResidencyApplication[];
total: number;
}>;
/**
* Create eCitizenship application
*/
export declare function createECitizenshipApplication(application: Omit<eCitizenshipApplication, 'id' | 'createdAt' | 'updatedAt'>): Promise<eCitizenshipApplication>;
/**
* Get eCitizenship application by ID
*/
export declare function getECitizenshipApplicationById(id: string): Promise<eCitizenshipApplication | null>;
/**
* Update eCitizenship application
*/
export declare function updateECitizenshipApplication(id: string, updates: {
status?: ApplicationStatus;
reviewedAt?: string;
reviewedBy?: string;
rejectionReason?: string;
}): Promise<eCitizenshipApplication>;
//# sourceMappingURL=eresidency-applications.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"eresidency-applications.d.ts","sourceRoot":"","sources":["eresidency-applications.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AA4C5B;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,IAAI,CAAC,qBAAqB,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GACzE,OAAO,CAAC,qBAAqB,CAAC,CA2BhC;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAWpG;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;IACP,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,CAAC;IAC7D,eAAe,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/C,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,qBAAqB,CAAC,CA2DhC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAkDpE;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CACjD,WAAW,EAAE,IAAI,CAAC,uBAAuB,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GAC3E,OAAO,CAAC,uBAAuB,CAAC,CAuDlC;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CA6CxG;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CACjD,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;IACP,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,uBAAuB,CAAC,CAiElC"}

View File

@@ -1,340 +0,0 @@
/**
* eResidency Application Database Operations
*/
import { query } from './client';
/**
* Map database row to application object
*/
function mapRowToApplication(row) {
return {
id: row.id,
applicantDid: row.applicant_did || undefined,
email: row.email,
givenName: row.given_name,
familyName: row.family_name,
dateOfBirth: row.date_of_birth ? (row.date_of_birth instanceof Date ? row.date_of_birth.toISOString().split('T')[0] : row.date_of_birth) : undefined,
nationality: row.nationality || undefined,
phone: row.phone || undefined,
address: row.address ? (typeof row.address === 'string' ? JSON.parse(row.address) : row.address) : undefined,
deviceFingerprint: row.device_fingerprint || undefined,
identityDocument: row.identity_document
? typeof row.identity_document === 'string'
? JSON.parse(row.identity_document)
: row.identity_document
: undefined,
selfieLiveness: row.selfie_liveness
? typeof row.selfie_liveness === 'string'
? JSON.parse(row.selfie_liveness)
: row.selfie_liveness
: undefined,
status: row.status,
submittedAt: row.submitted_at ? (row.submitted_at instanceof Date ? row.submitted_at.toISOString() : row.submitted_at) : undefined,
reviewedAt: row.reviewed_at ? (row.reviewed_at instanceof Date ? row.reviewed_at.toISOString() : row.reviewed_at) : undefined,
reviewedBy: row.reviewed_by || undefined,
rejectionReason: row.rejection_reason || undefined,
kycStatus: row.kyc_status || undefined,
sanctionsStatus: row.sanctions_status || undefined,
pepStatus: row.pep_status || undefined,
riskScore: row.risk_score ? parseFloat(String(row.risk_score)) : undefined,
kycResults: row.kyc_results ? (typeof row.kyc_results === 'string' ? JSON.parse(row.kyc_results) : row.kyc_results) : undefined,
sanctionsResults: row.sanctions_results ? (typeof row.sanctions_results === 'string' ? JSON.parse(row.sanctions_results) : row.sanctions_results) : undefined,
riskAssessment: row.risk_assessment ? (typeof row.risk_assessment === 'string' ? JSON.parse(row.risk_assessment) : row.risk_assessment) : undefined,
createdAt: row.created_at instanceof Date ? row.created_at.toISOString() : row.created_at,
updatedAt: row.updated_at instanceof Date ? row.updated_at.toISOString() : row.updated_at,
};
}
/**
* Create eResidency application
*/
export async function createEResidencyApplication(application) {
const result = await query(`INSERT INTO eresidency_applications
(applicant_did, email, given_name, family_name, date_of_birth, nationality, phone, address,
device_fingerprint, identity_document, selfie_liveness, status, kyc_status, sanctions_status, pep_status)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)
RETURNING *`, [
application.applicantDid || null,
application.email,
application.givenName,
application.familyName,
application.dateOfBirth || null,
application.nationality || null,
application.phone || null,
application.address ? JSON.stringify(application.address) : null,
application.deviceFingerprint || null,
application.identityDocument ? JSON.stringify(application.identityDocument) : null,
application.selfieLiveness ? JSON.stringify(application.selfieLiveness) : null,
application.status,
application.kycStatus || null,
application.sanctionsStatus || null,
application.pepStatus || null,
]);
return mapRowToApplication(result.rows[0]);
}
/**
* Get eResidency application by ID
*/
export async function getEResidencyApplicationById(id) {
const result = await query('SELECT * FROM eresidency_applications WHERE id = $1', [id]);
if (!result.rows[0]) {
return null;
}
return mapRowToApplication(result.rows[0]);
}
/**
* Update eResidency application
*/
export async function updateEResidencyApplication(id, updates) {
const fields = [];
const values = [];
let paramIndex = 1;
if (updates.status !== undefined) {
fields.push(`status = $${paramIndex++}`);
values.push(updates.status);
}
if (updates.kycStatus !== undefined) {
fields.push(`kyc_status = $${paramIndex++}`);
values.push(updates.kycStatus);
}
if (updates.sanctionsStatus !== undefined) {
fields.push(`sanctions_status = $${paramIndex++}`);
values.push(updates.sanctionsStatus);
}
if (updates.pepStatus !== undefined) {
fields.push(`pep_status = $${paramIndex++}`);
values.push(updates.pepStatus);
}
if (updates.riskScore !== undefined) {
fields.push(`risk_score = $${paramIndex++}`);
values.push(updates.riskScore);
}
if (updates.kycResults !== undefined) {
fields.push(`kyc_results = $${paramIndex++}`);
values.push(JSON.stringify(updates.kycResults));
}
if (updates.sanctionsResults !== undefined) {
fields.push(`sanctions_results = $${paramIndex++}`);
values.push(JSON.stringify(updates.sanctionsResults));
}
if (updates.riskAssessment !== undefined) {
fields.push(`risk_assessment = $${paramIndex++}`);
values.push(JSON.stringify(updates.riskAssessment));
}
if (updates.reviewedAt !== undefined) {
fields.push(`reviewed_at = $${paramIndex++}`);
values.push(updates.reviewedAt);
}
if (updates.reviewedBy !== undefined) {
fields.push(`reviewed_by = $${paramIndex++}`);
values.push(updates.reviewedBy);
}
if (updates.rejectionReason !== undefined) {
fields.push(`rejection_reason = $${paramIndex++}`);
values.push(updates.rejectionReason);
}
fields.push(`updated_at = NOW()`);
values.push(id);
const result = await query(`UPDATE eresidency_applications SET ${fields.join(', ')} WHERE id = $${paramIndex} RETURNING *`, values);
return mapRowToApplication(result.rows[0]);
}
/**
* Get review queue
*/
export async function getReviewQueue(filters) {
const conditions = [];
const params = [];
let paramIndex = 1;
if (filters.riskBand) {
// Map risk band to risk score range
const riskRanges = {
low: [0, 0.3],
medium: [0.3, 0.8],
high: [0.8, 1.0],
};
const [min, max] = riskRanges[filters.riskBand];
conditions.push(`risk_score >= $${paramIndex++} AND risk_score < $${paramIndex++}`);
params.push(min, max);
}
if (filters.status) {
conditions.push(`status = $${paramIndex++}`);
params.push(filters.status);
}
if (filters.assignedTo) {
conditions.push(`reviewed_by = $${paramIndex++}`);
params.push(filters.assignedTo);
}
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
const limit = filters.limit || 50;
const offset = filters.offset || 0;
// Get total count
const countResult = await query(`SELECT COUNT(*) as count FROM eresidency_applications ${whereClause}`, params);
const total = parseInt(countResult.rows[0]?.count || '0', 10);
// Get applications
const result = await query(`SELECT * FROM eresidency_applications
${whereClause}
ORDER BY created_at DESC
LIMIT $${paramIndex++} OFFSET $${paramIndex++}`, [...params, limit, offset]);
const applications = result.rows.map((row) => mapRowToApplication(row));
return { applications, total };
}
/**
* Create eCitizenship application
*/
export async function createECitizenshipApplication(application) {
const result = await query(`INSERT INTO ecitizenship_applications
(applicant_did, resident_did, residency_tenure, sponsor_did, service_merit, video_interview,
background_attestations, oath_ceremony, status)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
RETURNING *`, [
application.applicantDid,
application.residentDid,
application.residencyTenure,
application.sponsorDid || null,
application.serviceMerit ? JSON.stringify(application.serviceMerit) : null,
application.videoInterview ? JSON.stringify(application.videoInterview) : null,
application.backgroundAttestations ? JSON.stringify(application.backgroundAttestations) : null,
application.oathCeremony ? JSON.stringify(application.oathCeremony) : null,
application.status,
]);
const row = result.rows[0];
return {
id: row.id,
applicantDid: row.applicant_did,
residentDid: row.resident_did,
residencyTenure: row.residency_tenure || undefined,
sponsorDid: row.sponsor_did || undefined,
serviceMerit: row.service_merit
? typeof row.service_merit === 'string'
? JSON.parse(row.service_merit)
: row.service_merit
: undefined,
videoInterview: row.video_interview
? typeof row.video_interview === 'string'
? JSON.parse(row.video_interview)
: row.video_interview
: undefined,
backgroundAttestations: row.background_attestations
? typeof row.background_attestations === 'string'
? JSON.parse(row.background_attestations)
: row.background_attestations
: undefined,
oathCeremony: row.oath_ceremony
? typeof row.oath_ceremony === 'string'
? JSON.parse(row.oath_ceremony)
: row.oath_ceremony
: undefined,
status: row.status,
submittedAt: row.submitted_at ? (row.submitted_at instanceof Date ? row.submitted_at.toISOString() : row.submitted_at) : undefined,
reviewedAt: row.reviewed_at ? (row.reviewed_at instanceof Date ? row.reviewed_at.toISOString() : row.reviewed_at) : undefined,
reviewedBy: row.reviewed_by || undefined,
rejectionReason: row.rejection_reason || undefined,
createdAt: row.created_at instanceof Date ? row.created_at.toISOString() : row.created_at,
updatedAt: row.updated_at instanceof Date ? row.updated_at.toISOString() : row.updated_at,
};
}
/**
* Get eCitizenship application by ID
*/
export async function getECitizenshipApplicationById(id) {
const result = await query('SELECT * FROM ecitizenship_applications WHERE id = $1', [id]);
if (!result.rows[0]) {
return null;
}
const row = result.rows[0];
return {
id: row.id,
applicantDid: row.applicant_did,
residentDid: row.resident_did,
residencyTenure: row.residency_tenure || undefined,
sponsorDid: row.sponsor_did || undefined,
serviceMerit: row.service_merit
? typeof row.service_merit === 'string'
? JSON.parse(row.service_merit)
: row.service_merit
: undefined,
videoInterview: row.video_interview
? typeof row.video_interview === 'string'
? JSON.parse(row.video_interview)
: row.video_interview
: undefined,
backgroundAttestations: row.background_attestations
? typeof row.background_attestations === 'string'
? JSON.parse(row.background_attestations)
: row.background_attestations
: undefined,
oathCeremony: row.oath_ceremony
? typeof row.oath_ceremony === 'string'
? JSON.parse(row.oath_ceremony)
: row.oath_ceremony
: undefined,
status: row.status,
submittedAt: row.submitted_at ? (row.submitted_at instanceof Date ? row.submitted_at.toISOString() : row.submitted_at) : undefined,
reviewedAt: row.reviewed_at ? (row.reviewed_at instanceof Date ? row.reviewed_at.toISOString() : row.reviewed_at) : undefined,
reviewedBy: row.reviewed_by || undefined,
rejectionReason: row.rejection_reason || undefined,
createdAt: row.created_at instanceof Date ? row.created_at.toISOString() : row.created_at,
updatedAt: row.updated_at instanceof Date ? row.updated_at.toISOString() : row.updated_at,
};
}
/**
* Update eCitizenship application
*/
export async function updateECitizenshipApplication(id, updates) {
const fields = [];
const values = [];
let paramIndex = 1;
if (updates.status !== undefined) {
fields.push(`status = $${paramIndex++}`);
values.push(updates.status);
}
if (updates.reviewedAt !== undefined) {
fields.push(`reviewed_at = $${paramIndex++}`);
values.push(updates.reviewedAt);
}
if (updates.reviewedBy !== undefined) {
fields.push(`reviewed_by = $${paramIndex++}`);
values.push(updates.reviewedBy);
}
if (updates.rejectionReason !== undefined) {
fields.push(`rejection_reason = $${paramIndex++}`);
values.push(updates.rejectionReason);
}
fields.push(`updated_at = NOW()`);
values.push(id);
const result = await query(`UPDATE ecitizenship_applications SET ${fields.join(', ')} WHERE id = $${paramIndex} RETURNING *`, values);
const row = result.rows[0];
return {
id: row.id,
applicantDid: row.applicant_did,
residentDid: row.resident_did,
residencyTenure: row.residency_tenure || undefined,
sponsorDid: row.sponsor_did || undefined,
serviceMerit: row.service_merit
? typeof row.service_merit === 'string'
? JSON.parse(row.service_merit)
: row.service_merit
: undefined,
videoInterview: row.video_interview
? typeof row.video_interview === 'string'
? JSON.parse(row.video_interview)
: row.video_interview
: undefined,
backgroundAttestations: row.background_attestations
? typeof row.background_attestations === 'string'
? JSON.parse(row.background_attestations)
: row.background_attestations
: undefined,
oathCeremony: row.oath_ceremony
? typeof row.oath_ceremony === 'string'
? JSON.parse(row.oath_ceremony)
: row.oath_ceremony
: undefined,
status: row.status,
submittedAt: row.submitted_at ? (row.submitted_at instanceof Date ? row.submitted_at.toISOString() : row.submitted_at) : undefined,
reviewedAt: row.reviewed_at ? (row.reviewed_at instanceof Date ? row.reviewed_at.toISOString() : row.reviewed_at) : undefined,
reviewedBy: row.reviewed_by || undefined,
rejectionReason: row.rejection_reason || undefined,
createdAt: row.created_at instanceof Date ? row.created_at.toISOString() : row.created_at,
updatedAt: row.updated_at instanceof Date ? row.updated_at.toISOString() : row.updated_at,
};
}
//# sourceMappingURL=eresidency-applications.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +0,0 @@
/**
* Database utilities for The Order
*/
export * from './client';
export * from './schema';
export * from './credential-lifecycle';
export * from './credential-templates';
export * from './audit-search';
export * from './query-cache';
export * from './eresidency-applications';
export { getCredentialTemplateByName, renderCredentialFromTemplate, } from './credential-templates';
export type { QueryResult, QueryResultRow } from './client';
export type { User, Document, Deal, VerifiableCredential, Signature, LedgerEntry, Payment, } from './schema';
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAG1C,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG5D,YAAY,EACV,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,OAAO,GACR,MAAM,UAAU,CAAC"}

View File

@@ -1,13 +0,0 @@
/**
* Database utilities for The Order
*/
export * from './client';
export * from './schema';
export * from './credential-lifecycle';
export * from './credential-templates';
export * from './audit-search';
export * from './query-cache';
export * from './eresidency-applications';
// Re-export template functions for convenience
export { getCredentialTemplateByName, renderCredentialFromTemplate, } from './credential-templates';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAE1C,+CAA+C;AAC/C,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}

View File

@@ -1,33 +0,0 @@
/**
* Database query caching with Redis
* Implements query result caching with automatic invalidation
*
* Note: This module uses optional dynamic import for @the-order/cache
* to avoid requiring it as a direct dependency. If cache is not available,
* queries will execute directly without caching.
*/
import type { QueryResult, QueryResultRow } from './client';
export interface CacheOptions {
ttl?: number;
keyPrefix?: string;
enabled?: boolean;
}
/**
* Execute a query with caching
*/
export declare function cachedQuery<T extends QueryResultRow = QueryResultRow>(sql: string, params?: unknown[], options?: CacheOptions): Promise<QueryResult<T>>;
/**
* Invalidate cache for a pattern
*/
export declare function invalidateCache(pattern: string): Promise<number>;
/**
* Invalidate cache for a specific query
*/
export declare function invalidateQueryCache(sql: string, params?: unknown[]): Promise<void>;
/**
* Cache decorator for database functions
* Note: This is a simplified implementation. In production, you'd need to
* extract SQL and params from the function or pass them as metadata.
*/
export declare function cached<T extends (...args: unknown[]) => Promise<QueryResult<QueryResultRow>>>(fn: T): T;
//# sourceMappingURL=query-cache.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"query-cache.d.ts","sourceRoot":"","sources":["query-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAuCD;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACzE,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAAE,EAClB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CA4BzB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOzF;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,EAC3F,EAAE,EAAE,CAAC,GACJ,CAAC,CAKH"}

View File

@@ -1,93 +0,0 @@
/**
* Database query caching with Redis
* Implements query result caching with automatic invalidation
*
* Note: This module uses optional dynamic import for @the-order/cache
* to avoid requiring it as a direct dependency. If cache is not available,
* queries will execute directly without caching.
*/
import { query } from './client';
// Cache client instance (lazy-loaded via dynamic import)
let cacheClientPromise = null;
/**
* Get cache client (lazy-loaded via dynamic import)
* Returns null if cache module is not available
*/
async function getCacheClient() {
if (cacheClientPromise === null) {
cacheClientPromise = (async () => {
try {
// Use dynamic import with a string literal that TypeScript can't resolve at compile time
// This is done by constructing the import path dynamically
const cacheModulePath = '@the-order/cache';
// eslint-disable-next-line @typescript-eslint/no-implied-eval
const importFunc = new Function('specifier', 'return import(specifier)');
const cacheModule = await importFunc(cacheModulePath);
return cacheModule.getCacheClient();
}
catch {
// Cache module not available - caching will be disabled
return null;
}
})();
}
return cacheClientPromise;
}
/**
* Execute a query with caching
*/
export async function cachedQuery(sql, params, options = {}) {
const { ttl = 3600, keyPrefix = 'db:query:', enabled = true } = options;
if (!enabled) {
return query(sql, params);
}
const cache = await getCacheClient();
if (!cache) {
// Cache not available - execute query directly
return query(sql, params);
}
const cacheKey = `${keyPrefix}${sql}:${JSON.stringify(params || [])}`;
// Try to get from cache
const cached = await cache.get(cacheKey);
if (cached) {
return cached;
}
// Execute query
const result = await query(sql, params);
// Cache result
await cache.set(cacheKey, result, ttl);
return result;
}
/**
* Invalidate cache for a pattern
*/
export async function invalidateCache(pattern) {
const cache = await getCacheClient();
if (!cache) {
return 0;
}
return cache.invalidate(`db:query:${pattern}*`);
}
/**
* Invalidate cache for a specific query
*/
export async function invalidateQueryCache(sql, params) {
const cache = await getCacheClient();
if (!cache) {
return;
}
const cacheKey = `db:query:${sql}:${JSON.stringify(params || [])}`;
await cache.delete(cacheKey);
}
/**
* Cache decorator for database functions
* Note: This is a simplified implementation. In production, you'd need to
* extract SQL and params from the function or pass them as metadata.
*/
export function cached(fn) {
return (async (...args) => {
const result = await fn(...args);
return result;
});
}
//# sourceMappingURL=query-cache.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"query-cache.js","sourceRoot":"","sources":["query-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAkBjC,yDAAyD;AACzD,IAAI,kBAAkB,GAAuC,IAAI,CAAC;AAElE;;;GAGG;AACH,KAAK,UAAU,cAAc;IAC3B,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;QAChC,kBAAkB,GAAG,CAAC,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC;gBACH,yFAAyF;gBACzF,2DAA2D;gBAC3D,MAAM,eAAe,GAAG,kBAAkB,CAAC;gBAC3C,8DAA8D;gBAC9D,MAAM,UAAU,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;gBACzE,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,eAAe,CAAC,CAAC;gBACtD,OAAO,WAAW,CAAC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CAAC;IACrC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC,UAAU,CAAC,YAAY,OAAO,GAAG,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,MAAkB;IACxE,MAAM,KAAK,GAAG,MAAM,cAAc,EAAE,CAAC;IACrC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;IACnE,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CACpB,EAAK;IAEL,OAAO,CAAC,KAAK,EAAE,GAAG,IAAmB,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAM,CAAC;AACV,CAAC"}

View File

@@ -1,98 +0,0 @@
/**
* Database schema types and queries
*/
export interface User {
id: string;
email: string;
name: string;
did?: string;
roles?: string[];
created_at: Date;
updated_at: Date;
}
export interface Document {
id: string;
title: string;
type: string;
content?: string;
file_url?: string;
storage_key?: string;
user_id?: string;
status: string;
classification?: string;
ocr_text?: string;
extracted_data?: unknown;
created_at: Date;
updated_at: Date;
}
export interface Deal {
id: string;
name: string;
status: string;
dataroom_id?: string;
created_by?: string;
created_at: Date;
updated_at: Date;
}
export interface VerifiableCredential {
id: string;
credential_id: string;
issuer_did: string;
subject_did: string;
credential_type: string[];
credential_subject: unknown;
issuance_date: Date;
expiration_date?: Date;
proof?: unknown;
revoked: boolean;
created_at: Date;
updated_at: Date;
}
export interface Signature {
id: string;
document_id?: string;
signer_did: string;
signature_data: string;
signature_timestamp: Date;
signature_type: string;
created_at: Date;
}
export interface LedgerEntry {
id: string;
account_id: string;
type: 'debit' | 'credit';
amount: number;
currency: string;
description?: string;
reference?: string;
created_at: Date;
}
export interface Payment {
id: string;
amount: number;
currency: string;
status: string;
payment_method: string;
transaction_id?: string;
gateway_response?: unknown;
created_at: Date;
updated_at: Date;
}
export declare function createUser(user: Omit<User, 'id' | 'created_at' | 'updated_at'>): Promise<User>;
export declare function getUserById(id: string): Promise<User | null>;
export declare function createDocument(doc: Omit<Document, 'id' | 'created_at' | 'updated_at'>): Promise<Document>;
export declare function getDocumentById(id: string): Promise<Document | null>;
export declare function updateDocument(id: string, updates: Partial<Pick<Document, 'status' | 'classification' | 'ocr_text' | 'extracted_data'>>): Promise<Document>;
export declare function createDeal(deal: Omit<Deal, 'id' | 'created_at' | 'updated_at'>): Promise<Deal>;
export declare function getDealById(id: string): Promise<Deal | null>;
export declare function createDealDocument(dealId: string, documentId: string, storageKey: string, accessLevel?: string): Promise<void>;
export declare function createVerifiableCredential(vc: Omit<VerifiableCredential, 'id' | 'created_at' | 'updated_at' | 'revoked'>): Promise<VerifiableCredential>;
export declare function getVerifiableCredentialById(credentialId: string): Promise<VerifiableCredential | null>;
export declare function revokeVerifiableCredential(credentialId: string): Promise<void>;
export declare function createSignature(signature: Omit<Signature, 'id' | 'created_at'>): Promise<Signature>;
export declare function createLedgerEntry(entry: Omit<LedgerEntry, 'id' | 'created_at'>): Promise<LedgerEntry>;
export declare function createPayment(payment: Omit<Payment, 'id' | 'created_at' | 'updated_at'>): Promise<Payment>;
export declare function updatePaymentStatus(id: string, status: string, transactionId?: string, gatewayResponse?: unknown): Promise<Payment>;
export declare function createWorkflowState(workflowId: string, workflowType: string, documentId: string, state: unknown): Promise<void>;
export declare function getWorkflowState(workflowId: string): Promise<unknown>;
//# sourceMappingURL=schema.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings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,YAAY,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAczG;AAGD,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,YAAY,CAAC,GAC5C,OAAO,CAAC,WAAW,CAAC,CAetB;AAGD,wBAAsB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,YAAY,GAAG,YAAY,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBhH;AAED,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAGD,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS3E"}

View File

@@ -1,193 +0,0 @@
/**
* Database schema types and queries
*/
import { query } from './client';
// User operations
export async function createUser(user) {
const result = await query(`INSERT INTO users (email, name, did, roles)
VALUES ($1, $2, $3, $4)
RETURNING *`, [user.email, user.name, user.did || null, user.roles || []]);
return result.rows[0];
}
export async function getUserById(id) {
const result = await query('SELECT * FROM users WHERE id = $1', [id]);
return result.rows[0] || null;
}
// Document operations
export async function createDocument(doc) {
const result = await query(`INSERT INTO documents (title, type, content, file_url, storage_key, user_id, status, classification, ocr_text, extracted_data)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
RETURNING *`, [
doc.title,
doc.type,
doc.content || null,
doc.file_url || null,
doc.storage_key || null,
doc.user_id || null,
doc.status || 'pending',
doc.classification || null,
doc.ocr_text || null,
doc.extracted_data ? JSON.stringify(doc.extracted_data) : null,
]);
return result.rows[0];
}
export async function getDocumentById(id) {
const result = await query('SELECT * FROM documents WHERE id = $1', [id]);
if (result.rows[0]?.extracted_data && typeof result.rows[0].extracted_data === 'string') {
result.rows[0].extracted_data = JSON.parse(result.rows[0].extracted_data);
}
return result.rows[0] || null;
}
export async function updateDocument(id, updates) {
const fields = [];
const values = [];
let paramIndex = 1;
if (updates.status !== undefined) {
fields.push(`status = $${paramIndex++}`);
values.push(updates.status);
}
if (updates.classification !== undefined) {
fields.push(`classification = $${paramIndex++}`);
values.push(updates.classification);
}
if (updates.ocr_text !== undefined) {
fields.push(`ocr_text = $${paramIndex++}`);
values.push(updates.ocr_text);
}
if (updates.extracted_data !== undefined) {
fields.push(`extracted_data = $${paramIndex++}`);
values.push(JSON.stringify(updates.extracted_data));
}
fields.push(`updated_at = NOW()`);
values.push(id);
const result = await query(`UPDATE documents SET ${fields.join(', ')} WHERE id = $${paramIndex} RETURNING *`, values);
return result.rows[0];
}
// Deal operations
export async function createDeal(deal) {
const result = await query(`INSERT INTO deals (name, status, dataroom_id, created_by)
VALUES ($1, $2, $3, $4)
RETURNING *`, [deal.name, deal.status || 'draft', deal.dataroom_id || null, deal.created_by || null]);
return result.rows[0];
}
export async function getDealById(id) {
const result = await query('SELECT * FROM deals WHERE id = $1', [id]);
return result.rows[0] || null;
}
export async function createDealDocument(dealId, documentId, storageKey, accessLevel = 'viewer') {
await query(`INSERT INTO deal_documents (deal_id, document_id, storage_key, access_level)
VALUES ($1, $2, $3, $4)
ON CONFLICT (deal_id, document_id) DO NOTHING`, [dealId, documentId, storageKey, accessLevel]);
}
// VC operations
export async function createVerifiableCredential(vc) {
const result = await query(`INSERT INTO verifiable_credentials
(credential_id, issuer_did, subject_did, credential_type, credential_subject, issuance_date, expiration_date, proof)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING *`, [
vc.credential_id,
vc.issuer_did,
vc.subject_did,
vc.credential_type,
JSON.stringify(vc.credential_subject),
vc.issuance_date,
vc.expiration_date || null,
vc.proof ? JSON.stringify(vc.proof) : null,
]);
const row = result.rows[0];
row.credential_subject = JSON.parse(row.credential_subject);
if (row.proof && typeof row.proof === 'string') {
row.proof = JSON.parse(row.proof);
}
return row;
}
export async function getVerifiableCredentialById(credentialId) {
const result = await query('SELECT * FROM verifiable_credentials WHERE credential_id = $1', [credentialId]);
if (result.rows[0]) {
const row = result.rows[0];
row.credential_subject = JSON.parse(row.credential_subject);
if (row.proof && typeof row.proof === 'string') {
row.proof = JSON.parse(row.proof);
}
}
return result.rows[0] || null;
}
export async function revokeVerifiableCredential(credentialId) {
await query('UPDATE verifiable_credentials SET revoked = TRUE WHERE credential_id = $1', [credentialId]);
}
// Signature operations
export async function createSignature(signature) {
const result = await query(`INSERT INTO signatures (document_id, signer_did, signature_data, signature_timestamp, signature_type)
VALUES ($1, $2, $3, $4, $5)
RETURNING *`, [
signature.document_id || null,
signature.signer_did,
signature.signature_data,
signature.signature_timestamp,
signature.signature_type || 'kms',
]);
return result.rows[0];
}
// Ledger operations
export async function createLedgerEntry(entry) {
const result = await query(`INSERT INTO ledger_entries (account_id, type, amount, currency, description, reference)
VALUES ($1, $2, $3, $4, $5, $6)
RETURNING *`, [
entry.account_id,
entry.type,
entry.amount.toString(),
entry.currency,
entry.description || null,
entry.reference || null,
]);
return result.rows[0];
}
// Payment operations
export async function createPayment(payment) {
const result = await query(`INSERT INTO payments (amount, currency, status, payment_method, transaction_id, gateway_response)
VALUES ($1, $2, $3, $4, $5, $6)
RETURNING *`, [
payment.amount.toString(),
payment.currency,
payment.status || 'pending',
payment.payment_method,
payment.transaction_id || null,
payment.gateway_response ? JSON.stringify(payment.gateway_response) : null,
]);
const row = result.rows[0];
if (row.gateway_response && typeof row.gateway_response === 'string') {
row.gateway_response = JSON.parse(row.gateway_response);
}
return row;
}
export async function updatePaymentStatus(id, status, transactionId, gatewayResponse) {
const result = await query(`UPDATE payments
SET status = $1, transaction_id = COALESCE($2, transaction_id),
gateway_response = COALESCE($3, gateway_response), updated_at = NOW()
WHERE id = $4
RETURNING *`, [
status,
transactionId || null,
gatewayResponse ? JSON.stringify(gatewayResponse) : null,
id,
]);
const row = result.rows[0];
if (row.gateway_response && typeof row.gateway_response === 'string') {
row.gateway_response = JSON.parse(row.gateway_response);
}
return row;
}
// Workflow operations
export async function createWorkflowState(workflowId, workflowType, documentId, state) {
await query(`INSERT INTO workflow_state (workflow_id, workflow_type, document_id, state)
VALUES ($1, $2, $3, $4)
ON CONFLICT (workflow_id) DO UPDATE SET state = $4, updated_at = NOW()`, [workflowId, workflowType, documentId, JSON.stringify(state)]);
}
export async function getWorkflowState(workflowId) {
const result = await query('SELECT state FROM workflow_state WHERE workflow_id = $1', [workflowId]);
if (result.rows[0]?.state && typeof result.rows[0].state === 'string') {
return JSON.parse(result.rows[0].state);
}
return result.rows[0]?.state || null;
}
//# sourceMappingURL=schema.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,45 +0,0 @@
/**
* OCR service client
*/
import { StorageClient } from '@the-order/storage';
export interface OCRResult {
text: string;
confidence: number;
words: Array<{
text: string;
confidence: number;
bbox: {
x0: number;
y0: number;
x1: number;
y1: number;
};
}>;
}
export declare class OCRClient {
private storageClient?;
constructor(storageClient?: StorageClient);
/**
* Process document from storage key with retry logic
*/
processFromStorage(storageKey: string, options?: {
maxRetries?: number;
initialDelay?: number;
}): Promise<OCRResult>;
/**
* Process document from buffer with retry logic
*/
processBuffer(buffer: Buffer, options?: {
maxRetries?: number;
initialDelay?: number;
}): Promise<OCRResult>;
/**
* Process with external OCR service
*/
private processWithExternalService;
/**
* Process with local Tesseract.js
*/
private processWithTesseract;
}
//# sourceMappingURL=client.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1D,CAAC,CAAC;CACJ;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,aAAa,CAAC,CAAgB;gBAE1B,aAAa,CAAC,EAAE,aAAa;IAIzC;;OAEG;IACG,kBAAkB,CACtB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,SAAS,CAAC;IASrB;;OAEG;IACG,aAAa,CACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,SAAS,CAAC;IAkCrB;;OAEG;YACW,0BAA0B;IAkBxC;;OAEG;YACW,oBAAoB;CAwBnC"}

View File

@@ -1,97 +0,0 @@
/**
* OCR service client
*/
import { createWorker } from 'tesseract.js';
import { getEnv } from '@the-order/shared';
export class OCRClient {
storageClient;
constructor(storageClient) {
this.storageClient = storageClient;
}
/**
* Process document from storage key with retry logic
*/
async processFromStorage(storageKey, options) {
if (!this.storageClient) {
throw new Error('Storage client required for processing from storage');
}
const fileBuffer = await this.storageClient.download(storageKey);
return this.processBuffer(fileBuffer, options);
}
/**
* Process document from buffer with retry logic
*/
async processBuffer(buffer, options) {
const maxRetries = options?.maxRetries ?? 3;
const initialDelay = options?.initialDelay ?? 1000;
let lastError = null;
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const env = getEnv();
// Use external OCR service if configured
if (env.OCR_SERVICE_URL) {
return await this.processWithExternalService(buffer);
}
// Fallback to local Tesseract.js
return await this.processWithTesseract(buffer);
}
catch (error) {
lastError = error instanceof Error ? error : new Error(String(error));
// Don't retry on the last attempt
if (attempt === maxRetries - 1) {
throw lastError;
}
// Exponential backoff: delay = initialDelay * 2^attempt
const delay = initialDelay * Math.pow(2, attempt);
await new Promise((resolve) => setTimeout(resolve, delay));
}
}
// This should never be reached, but TypeScript needs it
throw lastError || new Error('OCR processing failed after retries');
}
/**
* Process with external OCR service
*/
async processWithExternalService(buffer) {
const env = getEnv();
const response = await fetch(`${env.OCR_SERVICE_URL}/process`, {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
Authorization: `Bearer ${env.OCR_SERVICE_API_KEY}`,
},
body: buffer,
});
if (!response.ok) {
throw new Error(`OCR service error: ${response.status}`);
}
return (await response.json());
}
/**
* Process with local Tesseract.js
*/
async processWithTesseract(buffer) {
const worker = await createWorker('eng');
try {
const { data } = await worker.recognize(buffer);
return {
text: data.text,
confidence: data.confidence || 0,
words: data.words.map((word) => ({
text: word.text,
confidence: word.confidence || 0,
bbox: {
x0: word.bbox.x0,
y0: word.bbox.y0,
x1: word.bbox.x1,
y1: word.bbox.y1,
},
})),
};
}
finally {
await worker.terminate();
}
}
}
//# sourceMappingURL=client.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAa3C,MAAM,OAAO,SAAS;IACZ,aAAa,CAAiB;IAEtC,YAAY,aAA6B;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,UAAkB,EAClB,OAAwD;QAExD,IAAI,CAAC,I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,CAAC,UAAU,IAAI,CAAC;oBAChC,IAAI,EAAE;wBACJ,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;wBAChB,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;wBAChB,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;wBAChB,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;qBACjB;iBACF,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;CACF"}

View File

@@ -1,5 +0,0 @@
/**
* OCR service client
*/
export * from './client';
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC"}

View File

@@ -1,5 +0,0 @@
/**
* OCR service client
*/
export * from './client';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC"}

View File

@@ -1,5 +0,0 @@
/**
* Payment gateway integration
*/
export * from './stripe';
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC"}

View File

@@ -1,5 +0,0 @@
/**
* Payment gateway integration
*/
export * from './stripe';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC"}

View File

@@ -1,26 +0,0 @@
/**
* Stripe payment gateway integration
*/
import Stripe from 'stripe';
export interface PaymentIntent {
id: string;
amount: number;
currency: string;
status: string;
client_secret?: string;
}
export interface PaymentResult {
success: boolean;
transactionId: string;
status: string;
gatewayResponse: unknown;
}
export declare class StripePaymentGateway {
private stripe;
constructor();
createPaymentIntent(amount: number, currency: string, paymentMethod: string, metadata?: Record<string, string>): Promise<PaymentIntent>;
confirmPayment(paymentIntentId: string): Promise<PaymentResult>;
processPayment(amount: number, currency: string, paymentMethod: string, metadata?: Record<string, string>): Promise<PaymentResult>;
verifyWebhook(payload: string | Buffer, signature: string): Promise<Stripe.Event>;
}
//# sourceMappingURL=stripe.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["stripe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAS;;IAejB,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,aAAa,CAAC;IAiBnB,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAW/D,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,aAAa,CAAC;IAsBnB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;CAUxF"}

View File

@@ -1,70 +0,0 @@
/**
* Stripe payment gateway integration
*/
import Stripe from 'stripe';
import { getEnv } from '@the-order/shared';
export class StripePaymentGateway {
stripe;
constructor() {
const env = getEnv();
const apiKey = env.PAYMENT_GATEWAY_API_KEY;
if (!apiKey) {
throw new Error('PAYMENT_GATEWAY_API_KEY is required');
}
this.stripe = new Stripe(apiKey, {
apiVersion: '2023-10-16',
});
}
async createPaymentIntent(amount, currency, paymentMethod, metadata) {
const paymentIntent = await this.stripe.paymentIntents.create({
amount: Math.round(amount * 100), // Convert to cents
currency: currency.toLowerCase(),
payment_method_types: [paymentMethod === 'credit_card' ? 'card' : paymentMethod],
metadata,
});
return {
id: paymentIntent.id,
amount: paymentIntent.amount / 100,
currency: paymentIntent.currency.toUpperCase(),
status: paymentIntent.status,
client_secret: paymentIntent.client_secret || undefined,
};
}
async confirmPayment(paymentIntentId) {
const paymentIntent = await this.stripe.paymentIntents.retrieve(paymentIntentId);
return {
success: paymentIntent.status === 'succeeded',
transactionId: paymentIntent.id,
status: paymentIntent.status,
gatewayResponse: paymentIntent,
};
}
async processPayment(amount, currency, paymentMethod, metadata) {
const paymentIntent = await this.createPaymentIntent(amount, currency, paymentMethod, metadata);
// For immediate payment, confirm the intent
if (paymentIntent.status === 'requires_payment_method') {
const confirmed = await this.stripe.paymentIntents.confirm(paymentIntent.id);
return {
success: confirmed.status === 'succeeded',
transactionId: confirmed.id,
status: confirmed.status,
gatewayResponse: confirmed,
};
}
return {
success: paymentIntent.status === 'succeeded',
transactionId: paymentIntent.id,
status: paymentIntent.status,
gatewayResponse: paymentIntent,
};
}
async verifyWebhook(payload, signature) {
const env = getEnv();
const webhookSecret = env.PAYMENT_GATEWAY_WEBHOOK_SECRET;
if (!webhookSecret) {
throw new Error('PAYMENT_GATEWAY_WEBHOOK_SECRET is required for webhook verification');
}
return this.stripe.webhooks.constructEvent(payload, signature, webhookSecret);
}
}
//# sourceMappingURL=stripe.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"stripe.js","sourceRoot":"","sources":["stripe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAiB3C,MAAM,OAAO,oBAAoB;IACvB,MAAM,CAAS;IAEvB;QACE,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,GAAG,CAAC,uBAAuB,CAAC;QAE3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE;YAC/B,UAAU,EAAE,YAAY;SACzB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,MAAc,EACd,QAAgB,EAChB,aAAqB,EACrB,QAAiC;QAEjC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC;YAC5D,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,mBAAmB;YACrD,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;YAChC,oBAAoB,EAAE,CAAC,aAAa,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC;YAChF,QAAQ;SACT,CAAC,CAAC;QAEH,OAAO;YACL,EAAE,EAAE,aAAa,CAAC,EAAE;YACpB,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,GAAG;YAClC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,W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AC7D,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;QACrB,MAAM,aAAa,GAAG,GAAG,CAAC,8BAA8B,CAAC;QAEzD,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACzF,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAChF,CAAC;CACF"}

View File

@@ -1,43 +0,0 @@
import { z } from 'zod';
export declare const DealStatusSchema: z.ZodEnum<["draft", "active", "closed", "archived"]>;
export declare const DealSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
status: z.ZodEnum<["draft", "active", "closed", "archived"]>;
dataroomId: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "strip", z.ZodTypeAny, {
status: "draft" | "active" | "closed" | "archived";
name: string;
id: string;
createdAt: string | Date;
updatedAt: string | Date;
dataroomId?: string | undefined;
}, {
status: "draft" | "active" | "closed" | "archived";
name: string;
id: string;
createdAt: string | Date;
updatedAt: string | Date;
dataroomId?: string | undefined;
}>;
export type Deal = z.infer<typeof DealSchema>;
export declare const CreateDealSchema: z.ZodObject<Omit<{
id: z.ZodString;
name: z.ZodString;
status: z.ZodEnum<["draft", "active", "closed", "archived"]>;
dataroomId: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
status: "draft" | "active" | "closed" | "archived";
name: string;
dataroomId?: string | undefined;
}, {
status: "draft" | "active" | "closed" | "archived";
name: string;
dataroomId?: string | undefined;
}>;
export type CreateDeal = z.infer<typeof CreateDealSchema>;
//# sourceMappingURL=deal.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"deal.d.ts","sourceRoot":"","sources":["deal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,sDAAoD,CAAC;AAElF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAI3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}

View File

@@ -1,16 +0,0 @@
import { z } from 'zod';
export const DealStatusSchema = z.enum(['draft', 'active', 'closed', 'archived']);
export const DealSchema = z.object({
id: z.string().uuid(),
name: z.string().min(1),
status: DealStatusSchema,
dataroomId: z.string().uuid().optional(),
createdAt: z.date().or(z.string().datetime()),
updatedAt: z.date().or(z.string().datetime()),
});
export const CreateDealSchema = DealSchema.omit({
id: true,
createdAt: true,
updatedAt: true,
});
//# sourceMappingURL=deal.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"deal.js","sourceRoot":"","sources":["deal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,gBAAgB;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;CAC9C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,CAAC;IAC9C,EAAE,EAAE,IAAI;IACR,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC"}

View File

@@ -1,49 +0,0 @@
import { z } from 'zod';
export declare const DocumentTypeSchema: z.ZodEnum<["legal", "treaty", "finance", "history"]>;
export declare const DocumentSchema: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
type: z.ZodEnum<["legal", "treaty", "finance", "history"]>;
content: z.ZodOptional<z.ZodString>;
fileUrl: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
type: "treaty" | "legal" | "finance" | "history";
createdAt: string | Date;
updatedAt: string | Date;
content?: string | undefined;
fileUrl?: string | undefined;
}, {
id: string;
title: string;
type: "treaty" | "legal" | "finance" | "history";
createdAt: string | Date;
updatedAt: string | Date;
content?: string | undefined;
fileUrl?: string | undefined;
}>;
export type Document = z.infer<typeof DocumentSchema>;
export declare const CreateDocumentSchema: z.ZodObject<Omit<{
id: z.ZodString;
title: z.ZodString;
type: z.ZodEnum<["legal", "treaty", "finance", "history"]>;
content: z.ZodOptional<z.ZodString>;
fileUrl: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
title: string;
type: "treaty" | "legal" | "finance" | "history";
content?: string | undefined;
fileUrl?: string | undefined;
}, {
title: string;
type: "treaty" | "legal" | "finance" | "history";
content?: string | undefined;
fileUrl?: string | undefined;
}>;
export type CreateDocument = z.infer<typeof CreateDocumentSchema>;
//# sourceMappingURL=document.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB,sDAAoD,CAAC;AAEpF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EAQzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}

View File

@@ -1,17 +0,0 @@
import { z } from 'zod';
export const DocumentTypeSchema = z.enum(['legal', 'treaty', 'finance', 'history']);
export const DocumentSchema = z.object({
id: z.string().uuid(),
title: z.string().min(1),
type: DocumentTypeSchema,
content: z.string().optional(),
fileUrl: z.string().url().optional(),
createdAt: z.date().or(z.string().datetime()),
updatedAt: z.date().or(z.string().datetime()),
});
export const CreateDocumentSchema = DocumentSchema.omit({
id: true,
createdAt: true,
updatedAt: true,
});
//# sourceMappingURL=document.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"document.js","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACpC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;CAC9C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,IAAI,CAAC;IACtD,EAAE,EAAE,IAAI;IACR,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC"}

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
{"version":3,"file":"eresidency.d.ts","sourceRoot":"","sources":["eresidency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,IAAI,SAAS,CAAE,8BAA8B;IAC7C,IAAI,SAAS,CAAE,qDAAqD;IACpE,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,oB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H,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}

View File

@@ -1,315 +0,0 @@
/**
* eResidency and eCitizenship Verifiable Credential Schemas
* Based on W3C Verifiable Credentials Data Model
* Version 0.9 - MVP Schema Registry
*/
import { z } from 'zod';
/**
* Levels of Assurance (LOA)
*/
export var LevelOfAssurance;
(function (LevelOfAssurance) {
LevelOfAssurance["LOA1"] = "LOA1";
LevelOfAssurance["LOA2"] = "LOA2";
LevelOfAssurance["LOA3"] = "LOA3";
})(LevelOfAssurance || (LevelOfAssurance = {}));
/**
* Membership Classes
*/
export var MembershipClass;
(function (MembershipClass) {
MembershipClass["RESIDENT"] = "Resident";
MembershipClass["CITIZEN"] = "Citizen";
MembershipClass["HONORARY"] = "Honorary";
MembershipClass["SERVICE"] = "Service";
})(MembershipClass || (MembershipClass = {}));
/**
* Evidence Types
*/
export var EvidenceType;
(function (EvidenceType) {
EvidenceType["DocumentVerification"] = "DocumentVerification";
EvidenceType["LivenessCheck"] = "LivenessCheck";
EvidenceType["SanctionsScreen"] = "SanctionsScreen";
EvidenceType["VideoInterview"] = "VideoInterview";
EvidenceType["Sponsorship"] = "Sponsorship";
EvidenceType["ResidencyTenure"] = "ResidencyTenure";
EvidenceType["BackgroundAttestation"] = "BackgroundAttestation";
})(EvidenceType || (EvidenceType = {}));
/**
* Evidence Result
*/
export var EvidenceResult;
(function (EvidenceResult) {
EvidenceResult["pass"] = "pass";
EvidenceResult["fail"] = "fail";
EvidenceResult["manual"] = "manual";
})(EvidenceResult || (EvidenceResult = {}));
/**
* eResident Credential Subject (v0.9)
* Matches DSB Schema Registry specification
*/
export const eResidentCredentialSubjectSchema = z.object({
id: z.string().describe('DID of the eResident'),
legalName: z.string().describe('Legal name of the eResident'),
publicHandle: z.string().optional().describe('Optional pseudonymous public handle'),
assuranceLevel: z.enum([LevelOfAssurance.LOA1, LevelOfAssurance.LOA2]).describe('Level of Assurance'),
residentNumber: z.string().describe('Unique resident number'),
issueJurisdiction: z.literal('DSB').describe('Issuing jurisdiction'),
});
/**
* eCitizen Credential Subject (v0.9)
* Matches DSB Schema Registry specification
*/
export const eCitizenCredentialSubjectSchema = z.object({
id: z.string().describe('DID of the eCitizen'),
citizenNumber: z.string().describe('Unique citizen number'),
assuranceLevel: z.enum([LevelOfAssurance.LOA2, LevelOfAssurance.LOA3]).describe('Level of Assurance (minimum LOA2)'),
oathDate: z.string().describe('ISO 8601 date when oath was taken'),
governanceRights: z.array(z.string()).optional().describe('Governance rights granted'),
sponsoringMember: z.string().optional().describe('DID of the sponsoring member if applicable'),
});
/**
* Evidence Schema
*/
export const evidenceSchema = z.object({
type: z.nativeEnum(EvidenceType),
verifier: z.string().optional().describe('DID or identifier of the verifier'),
txn: z.string().optional().describe('Transaction ID or reference'),
result: z.nativeEnum(EvidenceResult),
timestamp: z.string().optional().describe('ISO 8601 timestamp of the evidence'),
});
/**
* Address Attestation Credential Subject
*/
export const addressAttestationCredentialSubjectSchema = z.object({
id: z.string().describe('DID of the subject'),
address: z.object({
street: z.string(),
city: z.string(),
region: z.string().optional(),
postalCode: z.string(),
country: z.string(),
}),
attestedSince: z.string().describe('ISO 8601 date when address was attested'),
attestedUntil: z.string().optional().describe('ISO 8601 date when attestation expires'),
attestedBy: z.string().describe('DID of the attesting authority'),
});
/**
* Good Standing Credential Subject
*/
export const goodStandingCredentialSubjectSchema = z.object({
id: z.string().describe('DID of the subject'),
membershipClass: z.nativeEnum(MembershipClass),
goodStanding: z.boolean(),
verifiedSince: z.string().describe('ISO 8601 date when good standing was verified'),
verifiedUntil: z.string().optional().describe('ISO 8601 date when verification expires'),
complianceChecks: z
.array(z.object({
check: z.string(),
passed: z.boolean(),
checkedAt: z.string(),
}))
.optional(),
});
/**
* Professional Order Credential Subject
*/
export const professionalOrderCredentialSubjectSchema = z.object({
id: z.string().describe('DID of the subject'),
order: z.string().describe('Name of the professional order'),
role: z.string().describe('Role within the order'),
membershipSince: z.string().describe('ISO 8601 date when membership began'),
membershipUntil: z.string().optional().describe('ISO 8601 date when membership expires'),
credentials: z.array(z.string()).optional().describe('Professional credentials held'),
status: z.enum(['active', 'suspended', 'revoked', 'expired']),
});
/**
* eResident Credential Schema (v0.9)
* Matches DSB Schema Registry specification
*/
export const eResidentCredentialSchema = z.object({
'@context': z.array(z.string()).min(1),
type: z.array(z.string()).refine((arr) => arr.includes('VerifiableCredential') && arr.includes('eResidentCredential'), {
message: 'Type must include VerifiableCredential and eResidentCredential',
}),
issuer: z.string().describe('DID of the issuing authority'),
issuanceDate: z.string().describe('ISO 8601 date when credential was issued'),
expirationDate: z.string().optional().describe('ISO 8601 date when credential expires'),
credentialSubject: eResidentCredentialSubjectSchema,
credentialStatus: z
.object({
id: z.string(),
type: z.string(),
})
.optional(),
evidence: z.array(evidenceSchema).optional().describe('Evidence supporting the credential'),
proof: z.object({
type: z.string(),
created: z.string(),
proofPurpose: z.string(),
verificationMethod: z.string(),
jws: z.string().optional(),
}),
});
/**
* eCitizen Credential Schema (v0.9)
* Matches DSB Schema Registry specification
*/
export const eCitizenCredentialSchema = z.object({
'@context': z.array(z.string()).min(1),
type: z.array(z.string()).refine((arr) => arr.includes('VerifiableCredential') && arr.includes('eCitizenCredential'), {
message: 'Type must include VerifiableCredential and eCitizenCredential',
}),
issuer: z.string().describe('DID of the issuing authority'),
issuanceDate: z.string().describe('ISO 8601 date when credential was issued'),
expirationDate: z.string().optional().describe('ISO 8601 date when credential expires'),
credentialSubject: eCitizenCredentialSubjectSchema,
credentialStatus: z
.object({
id: z.string(),
type: z.string(),
})
.optional(),
evidence: z.array(evidenceSchema).optional().describe('Evidence supporting the credential'),
proof: z.object({
type: z.string(),
created: z.string(),
proofPurpose: z.string(),
verificationMethod: z.string(),
jws: z.string().optional(),
}),
});
/**
* Verifiable Presentation Schema
*/
export const verifiablePresentationSchema = z.object({
'@context': z.array(z.string()).min(1),
type: z.array(z.string()).refine((arr) => arr.includes('VerifiablePresentation'), {
message: 'Type must include VerifiablePresentation',
}),
verifiableCredential: z.array(z.union([eResidentCredentialSchema, eCitizenCredentialSchema])).min(1),
holder: z.string().describe('DID of the holder'),
proof: z.object({
type: z.string(),
created: z.string(),
challenge: z.string().optional(),
proofPurpose: z.string(),
verificationMethod: z.string(),
jws: z.string().optional(),
}),
});
/**
* Application Status
*/
export var ApplicationStatus;
(function (ApplicationStatus) {
ApplicationStatus["DRAFT"] = "draft";
ApplicationStatus["SUBMITTED"] = "submitted";
ApplicationStatus["UNDER_REVIEW"] = "under_review";
ApplicationStatus["KYC_PENDING"] = "kyc_pending";
ApplicationStatus["APPROVED"] = "approved";
ApplicationStatus["REJECTED"] = "rejected";
ApplicationStatus["APPEALED"] = "appealed";
ApplicationStatus["CANCELLED"] = "cancelled";
})(ApplicationStatus || (ApplicationStatus = {}));
/**
* eResidency Application Schema
*/
export const eResidencyApplicationSchema = z.object({
id: z.string().uuid(),
applicantDid: z.string().optional(),
email: z.string().email(),
givenName: z.string(),
familyName: z.string(),
dateOfBirth: z.string().optional(),
nationality: z.string().optional(),
phone: z.string().optional(),
address: z
.object({
street: z.string().optional(),
city: z.string().optional(),
region: z.string().optional(),
postalCode: z.string().optional(),
country: z.string().optional(),
})
.optional(),
deviceFingerprint: z.string().optional(),
identityDocument: z
.object({
type: z.enum(['passport', 'national_id', 'drivers_license']),
number: z.string(),
issuingCountry: z.string(),
expiryDate: z.string().optional(),
documentHash: z.string().optional(),
})
.optional(),
selfieLiveness: z
.object({
imageHash: z.string(),
livenessScore: z.number().min(0).max(1),
verifiedAt: z.string(),
})
.optional(),
status: z.nativeEnum(ApplicationStatus),
submittedAt: z.string().optional(),
reviewedAt: z.string().optional(),
reviewedBy: z.string().optional(),
rejectionReason: z.string().optional(),
kycStatus: z.enum(['pending', 'passed', 'failed', 'requires_edd']).optional(),
sanctionsStatus: z.enum(['pending', 'clear', 'flag']).optional(),
pepStatus: z.enum(['pending', 'clear', 'flag']).optional(),
riskScore: z.number().min(0).max(1).optional(),
kycResults: z.record(z.unknown()).optional(),
sanctionsResults: z.record(z.unknown()).optional(),
riskAssessment: z.record(z.unknown()).optional(),
createdAt: z.string(),
updatedAt: z.string(),
});
/**
* eCitizenship Application Schema
*/
export const eCitizenshipApplicationSchema = z.object({
id: z.string().uuid(),
applicantDid: z.string(),
residentDid: z.string().describe('DID of the eResident applying for citizenship'),
residencyTenure: z.number().describe('Months as eResident'),
sponsorDid: z.string().optional().describe('DID of the sponsor if applicable'),
serviceMerit: z
.object({
serviceHours: z.number(),
contributions: z.array(z.string()),
})
.optional(),
videoInterview: z
.object({
scheduledAt: z.string().optional(),
completedAt: z.string().optional(),
recordingHash: z.string().optional(),
interviewerDid: z.string().optional(),
})
.optional(),
backgroundAttestations: z
.array(z.object({
attesterDid: z.string(),
attestation: z.string(),
attestedAt: z.string(),
}))
.optional(),
oathCeremony: z
.object({
scheduledAt: z.string().optional(),
completedAt: z.string().optional(),
ceremonyHash: z.string().optional(),
oathVersion: z.string().optional(),
})
.optional(),
status: z.nativeEnum(ApplicationStatus),
submittedAt: z.string().optional(),
reviewedAt: z.string().optional(),
reviewedBy: z.string().optional(),
rejectionReason: z.string().optional(),
createdAt: z.string(),
updatedAt: z.string(),
});
//# sourceMappingURL=eresidency.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,11 +0,0 @@
/**
* The Order Schemas
*/
export * from './user';
export * from './document';
export * from './deal';
export * from './vc';
export * from './payment';
export * from './ledger';
export * from './eresidency';
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}

View File

@@ -1,11 +0,0 @@
/**
* The Order Schemas
*/
export * from './user';
export * from './document';
export * from './deal';
export * from './vc';
export * from './payment';
export * from './ledger';
export * from './eresidency';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}

View File

@@ -1,57 +0,0 @@
import { z } from 'zod';
export declare const LedgerEntryTypeSchema: z.ZodEnum<["debit", "credit"]>;
export declare const LedgerEntrySchema: z.ZodObject<{
id: z.ZodString;
accountId: z.ZodString;
type: z.ZodEnum<["debit", "credit"]>;
amount: z.ZodNumber;
currency: z.ZodString;
description: z.ZodOptional<z.ZodString>;
reference: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "strip", z.ZodTypeAny, {
id: string;
type: "debit" | "credit";
amount: number;
currency: string;
createdAt: string | Date;
accountId: string;
description?: string | undefined;
reference?: string | undefined;
}, {
id: string;
type: "debit" | "credit";
amount: number;
currency: string;
createdAt: string | Date;
accountId: string;
description?: string | undefined;
reference?: string | undefined;
}>;
export type LedgerEntry = z.infer<typeof LedgerEntrySchema>;
export declare const CreateLedgerEntrySchema: z.ZodObject<Omit<{
id: z.ZodString;
accountId: z.ZodString;
type: z.ZodEnum<["debit", "credit"]>;
amount: z.ZodNumber;
currency: z.ZodString;
description: z.ZodOptional<z.ZodString>;
reference: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "id" | "createdAt">, "strip", z.ZodTypeAny, {
type: "debit" | "credit";
amount: number;
currency: string;
accountId: string;
description?: string | undefined;
reference?: string | undefined;
}, {
type: "debit" | "credit";
amount: number;
currency: string;
accountId: string;
description?: string | undefined;
reference?: string | undefined;
}>;
export type CreateLedgerEntry = z.infer<typeof CreateLedgerEntrySchema>;
//# sourceMappingURL=ledger.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB,gCAA8B,CAAC;AAEjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;EAGlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}

View File

@@ -1,17 +0,0 @@
import { z } from 'zod';
export const LedgerEntryTypeSchema = z.enum(['debit', 'credit']);
export const LedgerEntrySchema = z.object({
id: z.string().uuid(),
accountId: z.string().uuid(),
type: LedgerEntryTypeSchema,
amount: z.number().positive(),
currency: z.string().length(3),
description: z.string().optional(),
reference: z.string().optional(),
createdAt: z.date().or(z.string().datetime()),
});
export const CreateLedgerEntrySchema = LedgerEntrySchema.omit({
id: true,
createdAt: true,
});
//# sourceMappingURL=ledger.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,IAAI,EAAE,qBAAqB;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;CAC9C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,IAAI,CAAC;IAC5D,EAAE,EAAE,IAAI;IACR,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC"}

View File

@@ -1,51 +0,0 @@
import { z } from 'zod';
export declare const PaymentStatusSchema: z.ZodEnum<["pending", "processing", "completed", "failed", "refunded"]>;
export declare const PaymentSchema: z.ZodObject<{
id: z.ZodString;
amount: z.ZodNumber;
currency: z.ZodString;
status: z.ZodEnum<["pending", "processing", "completed", "failed", "refunded"]>;
paymentMethod: z.ZodString;
transactionId: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "strip", z.ZodTypeAny, {
status: "failed" | "completed" | "pending" | "processing" | "refunded";
id: string;
amount: number;
currency: string;
createdAt: string | Date;
updatedAt: string | Date;
paymentMethod: string;
transactionId?: string | undefined;
}, {
status: "failed" | "completed" | "pending" | "processing" | "refunded";
id: string;
amount: number;
currency: string;
createdAt: string | Date;
updatedAt: string | Date;
paymentMethod: string;
transactionId?: string | undefined;
}>;
export type Payment = z.infer<typeof PaymentSchema>;
export declare const CreatePaymentSchema: z.ZodObject<Omit<{
id: z.ZodString;
amount: z.ZodNumber;
currency: z.ZodString;
status: z.ZodEnum<["pending", "processing", "completed", "failed", "refunded"]>;
paymentMethod: z.ZodString;
transactionId: z.ZodOptional<z.ZodString>;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "status" | "id" | "createdAt" | "updatedAt" | "transactionId">, "strip", z.ZodTypeAny, {
amount: number;
currency: string;
paymentMethod: string;
}, {
amount: number;
currency: string;
paymentMethod: string;
}>;
export type CreatePayment = z.infer<typeof CreatePaymentSchema>;
//# sourceMappingURL=payment.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB,yEAAuE,CAAC;AAExG,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;EAM9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}

View File

@@ -1,20 +0,0 @@
import { z } from 'zod';
export const PaymentStatusSchema = z.enum(['pending', 'processing', 'completed', 'failed', 'refunded']);
export const PaymentSchema = z.object({
id: z.string().uuid(),
amount: z.number().positive(),
currency: z.string().length(3),
status: PaymentStatusSchema,
paymentMethod: z.string(),
transactionId: z.string().optional(),
createdAt: z.date().or(z.string().datetime()),
updatedAt: z.date().or(z.string().datetime()),
});
export const CreatePaymentSchema = PaymentSchema.omit({
id: true,
status: true,
transactionId: true,
createdAt: true,
updatedAt: true,
});
//# sourceMappingURL=payment.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"payment.js","sourceRoot":"","sources":["payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAExG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,mBAAmB;IAC3B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;CAC9C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC;IACpD,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,IAAI;IACZ,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC"}

View File

@@ -1,36 +0,0 @@
import { z } from 'zod';
export declare const UserSchema: z.ZodObject<{
id: z.ZodString;
email: z.ZodString;
name: z.ZodString;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "strip", z.ZodTypeAny, {
name: string;
id: string;
email: string;
createdAt: string | Date;
updatedAt: string | Date;
}, {
name: string;
id: string;
email: string;
createdAt: string | Date;
updatedAt: string | Date;
}>;
export type User = z.infer<typeof UserSchema>;
export declare const CreateUserSchema: z.ZodObject<Omit<{
id: z.ZodString;
email: z.ZodString;
name: z.ZodString;
createdAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
updatedAt: z.ZodUnion<[z.ZodDate, z.ZodString]>;
}, "id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
name: string;
email: string;
}, {
name: string;
email: string;
}>;
export type CreateUser = z.infer<typeof CreateUserSchema>;
//# sourceMappingURL=user.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}

View File

@@ -1,14 +0,0 @@
import { z } from 'zod';
export const UserSchema = z.object({
id: z.string().uuid(),
email: z.string().email(),
name: z.string().min(1),
createdAt: z.date().or(z.string().datetime()),
updatedAt: z.date().or(z.string().datetime()),
});
export const CreateUserSchema = UserSchema.omit({
id: true,
createdAt: true,
updatedAt: true,
});
//# sourceMappingURL=user.js.map

Some files were not shown because too many files have changed in this diff Show More