Update README.md to provide a comprehensive overview of The Order monorepo, including repository structure, quickstart guide, development workflow, and contribution guidelines.
This commit is contained in:
20
packages/auth/README.md
Normal file
20
packages/auth/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# @the-order/auth
|
||||
|
||||
Authentication and authorization helpers for The Order.
|
||||
|
||||
## Features
|
||||
|
||||
- OIDC/OAuth2 support
|
||||
- DID (Decentralized Identifier) support
|
||||
- eIDAS integration
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { OIDCProvider, DIDResolver, EIDASProvider } from '@the-order/auth';
|
||||
|
||||
const oidc = new OIDCProvider(config);
|
||||
const didResolver = new DIDResolver();
|
||||
const eidas = new EIDASProvider(config);
|
||||
```
|
||||
|
||||
23
packages/auth/package.json
Normal file
23
packages/auth/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@the-order/auth",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Authentication and authorization helpers for The Order",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsonwebtoken": "^9.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jsonwebtoken": "^9.0.5",
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
34
packages/auth/src/did.ts
Normal file
34
packages/auth/src/did.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
export class DIDResolver {
|
||||
async resolve(did: string): Promise<DIDDocument> {
|
||||
// Implementation for DID resolution
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async verifySignature(
|
||||
did: string,
|
||||
message: string,
|
||||
signature: string
|
||||
): Promise<boolean> {
|
||||
// Implementation for signature verification
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
29
packages/auth/src/eidas.ts
Normal file
29
packages/auth/src/eidas.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 class EIDASProvider {
|
||||
constructor(private config: EIDASConfig) {}
|
||||
|
||||
async requestSignature(document: string): Promise<EIDASSignature> {
|
||||
// Implementation for eIDAS signature request
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async verifySignature(signature: EIDASSignature): Promise<boolean> {
|
||||
// Implementation for eIDAS signature verification
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
8
packages/auth/src/index.ts
Normal file
8
packages/auth/src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The Order Auth Package
|
||||
*/
|
||||
|
||||
export * from './oidc';
|
||||
export * from './did';
|
||||
export * from './eidas';
|
||||
|
||||
31
packages/auth/src/oidc.ts
Normal file
31
packages/auth/src/oidc.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* OIDC/OAuth2 helpers
|
||||
*/
|
||||
|
||||
export interface OIDCConfig {
|
||||
issuer: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
redirectUri: string;
|
||||
}
|
||||
|
||||
export class OIDCProvider {
|
||||
constructor(private config: OIDCConfig) {}
|
||||
|
||||
async getAuthorizationUrl(state: string): Promise<string> {
|
||||
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: string): Promise<string> {
|
||||
// Implementation for token exchange
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/auth/tsconfig.json
Normal file
10
packages/auth/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
22
packages/crypto/README.md
Normal file
22
packages/crypto/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# @the-order/crypto
|
||||
|
||||
KMS/HSM client, key management, and signatures for eIDAS/DID.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { KMSClient, SignatureService } from '@the-order/crypto';
|
||||
|
||||
const kms = new KMSClient(config);
|
||||
const signatureService = new SignatureService(kms);
|
||||
|
||||
const signature = await signatureService.sign(data, options);
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- KMS/HSM integration
|
||||
- Key management
|
||||
- Digital signatures
|
||||
- eIDAS/DID support
|
||||
|
||||
22
packages/crypto/package.json
Normal file
22
packages/crypto/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@the-order/crypto",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "KMS/HSM client, key management, and signatures for eIDAS/DID",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-kms": "^3.490.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
7
packages/crypto/src/index.ts
Normal file
7
packages/crypto/src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* The Order Crypto Package
|
||||
*/
|
||||
|
||||
export * from './kms';
|
||||
export * from './signature';
|
||||
|
||||
34
packages/crypto/src/kms.ts
Normal file
34
packages/crypto/src/kms.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* KMS/HSM client for key management
|
||||
*/
|
||||
|
||||
export interface KMSConfig {
|
||||
provider: 'aws' | 'gcp' | 'azure' | 'hsm';
|
||||
keyId: string;
|
||||
region?: string;
|
||||
}
|
||||
|
||||
export class KMSClient {
|
||||
constructor(private config: KMSConfig) {}
|
||||
|
||||
async encrypt(plaintext: Buffer): Promise<Buffer> {
|
||||
// Implementation for encryption
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async decrypt(ciphertext: Buffer): Promise<Buffer> {
|
||||
// Implementation for decryption
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async sign(data: Buffer): Promise<Buffer> {
|
||||
// Implementation for signing
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async verify(data: Buffer, signature: Buffer): Promise<boolean> {
|
||||
// Implementation for signature verification
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
33
packages/crypto/src/signature.ts
Normal file
33
packages/crypto/src/signature.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Signature utilities for eIDAS/DID
|
||||
*/
|
||||
|
||||
import { KMSClient } from './kms';
|
||||
|
||||
export interface SignatureOptions {
|
||||
algorithm: 'RS256' | 'ES256' | 'EdDSA';
|
||||
keyId: string;
|
||||
}
|
||||
|
||||
export class SignatureService {
|
||||
constructor(private kms: KMSClient) {}
|
||||
|
||||
async sign(data: Buffer, options: SignatureOptions): Promise<Buffer> {
|
||||
return this.kms.sign(data);
|
||||
}
|
||||
|
||||
async verify(
|
||||
data: Buffer,
|
||||
signature: Buffer,
|
||||
options: SignatureOptions
|
||||
): Promise<boolean> {
|
||||
return this.kms.verify(data, signature);
|
||||
}
|
||||
|
||||
async signJSON(data: unknown, options: SignatureOptions): Promise<string> {
|
||||
const jsonString = JSON.stringify(data);
|
||||
const signature = await this.sign(Buffer.from(jsonString), options);
|
||||
return signature.toString('base64');
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/crypto/tsconfig.json
Normal file
10
packages/crypto/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
25
packages/schemas/README.md
Normal file
25
packages/schemas/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# @the-order/schemas
|
||||
|
||||
Shared schemas and contracts for The Order using Zod.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { UserSchema, DocumentSchema } from '@the-order/schemas';
|
||||
|
||||
const user = UserSchema.parse(userData);
|
||||
const document = DocumentSchema.parse(documentData);
|
||||
```
|
||||
|
||||
## Available Schemas
|
||||
|
||||
- `UserSchema` - User entity schema
|
||||
- `DocumentSchema` - Document entity schema
|
||||
- `DealSchema` - Deal entity schema
|
||||
|
||||
## OpenAPI Generation
|
||||
|
||||
```bash
|
||||
pnpm generate:openapi
|
||||
```
|
||||
|
||||
24
packages/schemas/package.json
Normal file
24
packages/schemas/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@the-order/schemas",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Shared schemas and contracts for The Order",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit",
|
||||
"generate:openapi": "ts-node scripts/generate-openapi.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3",
|
||||
"zod-to-openapi": "^0.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
23
packages/schemas/src/deal.ts
Normal file
23
packages/schemas/src/deal.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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 type Deal = z.infer<typeof DealSchema>;
|
||||
|
||||
export const CreateDealSchema = DealSchema.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
});
|
||||
|
||||
export type CreateDeal = z.infer<typeof CreateDealSchema>;
|
||||
|
||||
24
packages/schemas/src/document.ts
Normal file
24
packages/schemas/src/document.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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 type Document = z.infer<typeof DocumentSchema>;
|
||||
|
||||
export const CreateDocumentSchema = DocumentSchema.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
});
|
||||
|
||||
export type CreateDocument = z.infer<typeof CreateDocumentSchema>;
|
||||
|
||||
8
packages/schemas/src/index.ts
Normal file
8
packages/schemas/src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The Order Schemas
|
||||
*/
|
||||
|
||||
export * from './user';
|
||||
export * from './document';
|
||||
export * from './deal';
|
||||
|
||||
20
packages/schemas/src/user.ts
Normal file
20
packages/schemas/src/user.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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 type User = z.infer<typeof UserSchema>;
|
||||
|
||||
export const CreateUserSchema = UserSchema.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
});
|
||||
|
||||
export type CreateUser = z.infer<typeof CreateUserSchema>;
|
||||
|
||||
10
packages/schemas/tsconfig.json
Normal file
10
packages/schemas/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
22
packages/storage/README.md
Normal file
22
packages/storage/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# @the-order/storage
|
||||
|
||||
Storage abstraction for S3/GCS with WORM mode support.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { StorageClient, WORMStorage } from '@the-order/storage';
|
||||
|
||||
const storage = new StorageClient(config);
|
||||
const wormStorage = new WORMStorage(config);
|
||||
|
||||
await storage.upload({ key: 'file.txt', content: 'Hello' });
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- S3 and GCS support
|
||||
- WORM (Write Once Read Many) mode
|
||||
- Presigned URL generation
|
||||
- Object lifecycle management
|
||||
|
||||
22
packages/storage/package.json
Normal file
22
packages/storage/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@the-order/storage",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Storage abstraction for S3/GCS with WORM mode support",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.490.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
7
packages/storage/src/index.ts
Normal file
7
packages/storage/src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* The Order Storage Package
|
||||
*/
|
||||
|
||||
export * from './storage';
|
||||
export * from './worm';
|
||||
|
||||
43
packages/storage/src/storage.ts
Normal file
43
packages/storage/src/storage.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Storage abstraction for S3/GCS
|
||||
*/
|
||||
|
||||
export interface StorageConfig {
|
||||
provider: 's3' | 'gcs';
|
||||
bucket: string;
|
||||
region?: string;
|
||||
accessKeyId?: string;
|
||||
secretAccessKey?: string;
|
||||
}
|
||||
|
||||
export interface StorageObject {
|
||||
key: string;
|
||||
content: Buffer | string;
|
||||
contentType?: string;
|
||||
metadata?: Record<string, string>;
|
||||
}
|
||||
|
||||
export class StorageClient {
|
||||
constructor(private config: StorageConfig) {}
|
||||
|
||||
async upload(object: StorageObject): Promise<string> {
|
||||
// Implementation for file upload
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async download(key: string): Promise<Buffer> {
|
||||
// Implementation for file download
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async delete(key: string): Promise<void> {
|
||||
// Implementation for file deletion
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
async getPresignedUrl(key: string, expiresIn: number): Promise<string> {
|
||||
// Implementation for presigned URL generation
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
26
packages/storage/src/worm.ts
Normal file
26
packages/storage/src/worm.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* WORM (Write Once Read Many) mode storage
|
||||
*/
|
||||
|
||||
import { StorageClient, StorageObject } from './storage';
|
||||
|
||||
export class WORMStorage extends StorageClient {
|
||||
async upload(object: StorageObject): Promise<string> {
|
||||
// WORM mode: prevent overwrites
|
||||
const exists = await this.objectExists(object.key);
|
||||
if (exists) {
|
||||
throw new Error(`Object ${object.key} already exists in WORM storage`);
|
||||
}
|
||||
return super.upload(object);
|
||||
}
|
||||
|
||||
async delete(key: string): Promise<void> {
|
||||
throw new Error('Deletion not allowed in WORM mode');
|
||||
}
|
||||
|
||||
private async objectExists(key: string): Promise<boolean> {
|
||||
// Implementation to check if object exists
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/storage/tsconfig.json
Normal file
10
packages/storage/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
21
packages/test-utils/README.md
Normal file
21
packages/test-utils/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# @the-order/test-utils
|
||||
|
||||
Shared testing utilities for The Order monorepo.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { createTestUser, createTestDocument, sleep } from '@the-order/test-utils';
|
||||
|
||||
const user = createTestUser({ email: 'custom@example.com' });
|
||||
const doc = createTestDocument({ title: 'My Document' });
|
||||
await sleep(1000);
|
||||
```
|
||||
|
||||
## Available Utilities
|
||||
|
||||
- `createTestUser()` - Create a test user object
|
||||
- `createTestDocument()` - Create a test document object
|
||||
- `sleep()` - Wait for a specified number of milliseconds
|
||||
- `createMockResponse()` - Create a mock fetch response
|
||||
|
||||
22
packages/test-utils/package.json
Normal file
22
packages/test-utils/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@the-order/test-utils",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Shared testing utilities for The Order",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitest/ui": "^1.1.0",
|
||||
"vitest": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
62
packages/test-utils/src/index.ts
Normal file
62
packages/test-utils/src/index.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Test utilities for The Order
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a test user object
|
||||
*/
|
||||
export function createTestUser(overrides?: Partial<TestUser>): TestUser {
|
||||
return {
|
||||
id: 'test-user-id',
|
||||
email: 'test@example.com',
|
||||
name: 'Test User',
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a test document object
|
||||
*/
|
||||
export function createTestDocument(overrides?: Partial<TestDocument>): TestDocument {
|
||||
return {
|
||||
id: 'test-doc-id',
|
||||
title: 'Test Document',
|
||||
type: 'legal',
|
||||
content: 'Test content',
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a specified number of milliseconds
|
||||
*/
|
||||
export function sleep(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock fetch response
|
||||
*/
|
||||
export function createMockResponse(data: unknown, status = 200): Response {
|
||||
return new Response(JSON.stringify(data), {
|
||||
status,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Types
|
||||
export interface TestUser {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface TestDocument {
|
||||
id: string;
|
||||
title: string;
|
||||
type: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
10
packages/test-utils/tsconfig.json
Normal file
10
packages/test-utils/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
28
packages/ui/README.md
Normal file
28
packages/ui/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# @the-order/ui
|
||||
|
||||
Design system and UI components for The Order.
|
||||
|
||||
## Usage
|
||||
|
||||
```tsx
|
||||
import { Button } from '@the-order/ui';
|
||||
|
||||
function MyComponent() {
|
||||
return <Button variant="primary">Click me</Button>;
|
||||
}
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
- `Button` - Button component with variants
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# Build
|
||||
pnpm build
|
||||
|
||||
# Watch mode
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
28
packages/ui/package.json
Normal file
28
packages/ui/package.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@the-order/ui",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Design system and UI components for The Order",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts,.tsx",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.45",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
36
packages/ui/src/components/Button.tsx
Normal file
36
packages/ui/src/components/Button.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
|
||||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: 'primary' | 'secondary' | 'outline';
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}
|
||||
|
||||
export const Button: React.FC<ButtonProps> = ({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
children,
|
||||
className = '',
|
||||
...props
|
||||
}) => {
|
||||
const baseClasses = 'font-medium rounded-lg transition-colors';
|
||||
const variantClasses = {
|
||||
primary: 'bg-blue-600 text-white hover:bg-blue-700',
|
||||
secondary: 'bg-gray-600 text-white hover:bg-gray-700',
|
||||
outline: 'border border-gray-300 text-gray-700 hover:bg-gray-50',
|
||||
};
|
||||
const sizeClasses = {
|
||||
sm: 'px-3 py-1.5 text-sm',
|
||||
md: 'px-4 py-2 text-base',
|
||||
lg: 'px-6 py-3 text-lg',
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${className}`}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
7
packages/ui/src/components/index.ts
Normal file
7
packages/ui/src/components/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* UI Components
|
||||
*/
|
||||
|
||||
// Export components here as they are created
|
||||
export { Button } from './Button';
|
||||
|
||||
6
packages/ui/src/index.ts
Normal file
6
packages/ui/src/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* The Order UI Component Library
|
||||
*/
|
||||
|
||||
export * from './components';
|
||||
|
||||
11
packages/ui/tsconfig.json
Normal file
11
packages/ui/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"]
|
||||
}
|
||||
|
||||
21
packages/workflows/README.md
Normal file
21
packages/workflows/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# @the-order/workflows
|
||||
|
||||
Temporal/Step Functions workflow definitions for The Order.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { intakeWorkflow, reviewWorkflow } from '@the-order/workflows';
|
||||
|
||||
const result = await intakeWorkflow({
|
||||
documentId: 'doc-123',
|
||||
fileUrl: 'https://...',
|
||||
userId: 'user-123',
|
||||
});
|
||||
```
|
||||
|
||||
## Workflows
|
||||
|
||||
- `intakeWorkflow` - Document intake and processing
|
||||
- `reviewWorkflow` - Document review and approval
|
||||
|
||||
22
packages/workflows/package.json
Normal file
22
packages/workflows/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@the-order/workflows",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Temporal/Step Functions workflow definitions",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@temporalio/workflow": "^1.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.6",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
7
packages/workflows/src/index.ts
Normal file
7
packages/workflows/src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* The Order Workflows Package
|
||||
*/
|
||||
|
||||
export * from './intake';
|
||||
export * from './review';
|
||||
|
||||
28
packages/workflows/src/intake.ts
Normal file
28
packages/workflows/src/intake.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Intake workflow definitions
|
||||
*/
|
||||
|
||||
export interface IntakeWorkflowInput {
|
||||
documentId: string;
|
||||
fileUrl: string;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface IntakeWorkflowOutput {
|
||||
documentId: string;
|
||||
processed: boolean;
|
||||
classification: string;
|
||||
extractedData?: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intake workflow: ingestion → OCR → classify → route
|
||||
*/
|
||||
export async function intakeWorkflow(
|
||||
input: IntakeWorkflowInput
|
||||
): Promise<IntakeWorkflowOutput> {
|
||||
// Implementation using Temporal or Step Functions
|
||||
// This is a placeholder structure
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
28
packages/workflows/src/review.ts
Normal file
28
packages/workflows/src/review.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Review workflow definitions
|
||||
*/
|
||||
|
||||
export interface ReviewWorkflowInput {
|
||||
documentId: string;
|
||||
reviewerId: string;
|
||||
workflowType: 'legal' | 'finance' | 'compliance';
|
||||
}
|
||||
|
||||
export interface ReviewWorkflowOutput {
|
||||
documentId: string;
|
||||
approved: boolean;
|
||||
comments?: string;
|
||||
nextStep?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Review workflow: document review → approval → publish
|
||||
*/
|
||||
export async function reviewWorkflow(
|
||||
input: ReviewWorkflowInput
|
||||
): Promise<ReviewWorkflowOutput> {
|
||||
// Implementation using Temporal or Step Functions
|
||||
// This is a placeholder structure
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
10
packages/workflows/tsconfig.json
Normal file
10
packages/workflows/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user