kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
bd5c4a8dac
commit
5a90fe0703
|
@ -38,23 +38,14 @@ All packages must follow these `package.json` rules:
|
||||||
|
|
||||||
- `type` must be set to `module`
|
- `type` must be set to `module`
|
||||||
|
|
||||||
#### Directory Structure
|
|
||||||
|
|
||||||
This project has the following structure:
|
|
||||||
|
|
||||||
- A `src/` directory containing the core source code.
|
|
||||||
- A single entrypoint in index.ts that exports the package's public API.
|
|
||||||
- Place test helpers, utilities, or mocks in `src/test/` with a single entrypoint in `src/test/index.ts`.
|
|
||||||
- Tests should be placed beside source code like `src/my-file.ts` and `src/my-file.test.ts` (NOT `src/test/my-file.test.ts` or `test/my-file.test.ts`).
|
|
||||||
|
|
||||||
## TypeScript
|
## TypeScript
|
||||||
|
|
||||||
- Avoid semicolons at the end of lines
|
- Avoid semicolons at the end of lines
|
||||||
- Use TypeScript's utility types (e.g., `Partial`, `Pick`, `Omit`) to manipulate existing types
|
- Use TypeScript's utility types (e.g., `Partial`, `Pick`, `Omit`) to manipulate existing types
|
||||||
- Create custom types for complex data structures used throughout the application
|
- Create custom types for complex data structures used throughout the application
|
||||||
- If possible, avoid using `any`/`unknown` or casting values like `(value as any)` or `value!` in TypeScript outside of test files e.g. `*.test.ts` or test fixtures e.g. `**/test-data.ts`.
|
- If possible, avoid using `any`/`unknown` or casting values like `(value as any)` in TypeScript outside of test files e.g. `*.test.ts` or test fixtures e.g. `**/test-data.ts`.
|
||||||
- Don't rely on `typeof`, `ReturnType<>`, `Awaited<>`, etc for complex type inference (it's ok for simple types)
|
- Don't rely on `typeof`, `ReturnType<>`, `Awaited<>`, etc for complex type inference (it's ok for simple types)
|
||||||
- Use `as const` for better type inference
|
- You can use `as const` as needed for better type inference
|
||||||
- Functions should accept an object parameter instead of multiple parameters
|
- Functions should accept an object parameter instead of multiple parameters
|
||||||
- Good examples:
|
- Good examples:
|
||||||
```ts
|
```ts
|
||||||
|
@ -77,7 +68,7 @@ This project has the following structure:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
- Zod should be used to parse untrusted data, but not for data that is trusted like function arguments
|
- Zod should be used to parse untrusted data, but not for data that is trusted like function arguments
|
||||||
- Zod unions should always be used instead of enums
|
- Prefer Zod unions over Zod enums
|
||||||
- For example, this union `z.union([ z.literal('youtube'), z.literal('spotify') ])` is better than this enum `z.enum([ 'youtube', 'spotify' ])`
|
- For example, this union `z.union([ z.literal('youtube'), z.literal('spotify') ])` is better than this enum `z.enum([ 'youtube', 'spotify' ])`
|
||||||
- Promises (and `async` functions which implicitly create Promises) must always be properly handled, either via:
|
- Promises (and `async` functions which implicitly create Promises) must always be properly handled, either via:
|
||||||
- Using `await` to wait for the Promise to resolve successfully
|
- Using `await` to wait for the Promise to resolve successfully
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@agentic/platform-api-client",
|
"name": "@agentic/platform-api-client",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Core utilities for the Agentic platform.",
|
"description": "TS API client for the Agentic platform.",
|
||||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -20,8 +20,7 @@
|
||||||
"generate": "openapi-typescript http://localhost:3000/docs --output ./src/openapi.d.ts",
|
"generate": "openapi-typescript http://localhost:3000/docs --output ./src/openapi.d.ts",
|
||||||
"test": "run-s test:*",
|
"test": "run-s test:*",
|
||||||
"test:lint": "eslint .",
|
"test:lint": "eslint .",
|
||||||
"test:typecheck": "tsc --noEmit",
|
"test:typecheck": "tsc --noEmit"
|
||||||
"test:unit": "vitest run"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@agentic/platform-core": "workspace:*",
|
"@agentic/platform-core": "workspace:*",
|
||||||
|
|
|
@ -1,7 +1,28 @@
|
||||||
import type { components } from './openapi'
|
import type { components } from './openapi'
|
||||||
|
|
||||||
export type AuthProvider = components['schemas']['AuthProvider']
|
export type Consumer = components['schemas']['Consumer']
|
||||||
export type AuthProviders = components['schemas']['AuthProviders']
|
export type Project = components['schemas']['Project']
|
||||||
|
export type Deployment = components['schemas']['Deployment']
|
||||||
export type User = components['schemas']['User']
|
export type User = components['schemas']['User']
|
||||||
export type Team = components['schemas']['Team']
|
export type Team = components['schemas']['Team']
|
||||||
export type TeamMember = components['schemas']['TeamMember']
|
export type TeamMember = components['schemas']['TeamMember']
|
||||||
|
|
||||||
|
export type AuthProviderType = components['schemas']['AuthProviderType']
|
||||||
|
export type AuthProvider = components['schemas']['AuthProvider']
|
||||||
|
export type AuthProviders = components['schemas']['AuthProviders']
|
||||||
|
|
||||||
|
export type ProjectIdentifier = components['schemas']['ProjectIdentifier']
|
||||||
|
export type DeploymentIdentifier = components['schemas']['DeploymentIdentifier']
|
||||||
|
|
||||||
|
export type DeploymentOriginAdapter =
|
||||||
|
components['schemas']['DeploymentOriginAdapter']
|
||||||
|
|
||||||
|
export type RateLimit = components['schemas']['RateLimit']
|
||||||
|
export type PricingInterval = components['schemas']['PricingInterval']
|
||||||
|
export type PricingPlanTier = components['schemas']['PricingPlanTier']
|
||||||
|
export type PricingPlanLineItem = components['schemas']['PricingPlanLineItem']
|
||||||
|
export type PricingPlan = components['schemas']['PricingPlan']
|
||||||
|
|
||||||
|
export type PricingPlanName = components['schemas']['name']
|
||||||
|
export type PricingPlanSlug = components['schemas']['slug']
|
||||||
|
export type PricingPlanLabel = components['schemas']['label']
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@agentic/platform-core": "workspace:*",
|
"@agentic/platform-core": "workspace:*",
|
||||||
|
"@agentic/platform-api-client": "workspace:*",
|
||||||
"commander": "^14.0.0",
|
"commander": "^14.0.0",
|
||||||
"conf": "^13.1.0",
|
"conf": "^13.1.0",
|
||||||
"ora": "^8.2.0",
|
"ora": "^8.2.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { User } from '@agentic/platform-db'
|
import type { User } from '@agentic/platform-api-client'
|
||||||
import { assert } from '@agentic/platform-core'
|
import { assert } from '@agentic/platform-core'
|
||||||
import Conf from 'conf'
|
import Conf from 'conf'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@agentic/platform-db",
|
"name": "@agentic/platform-db",
|
||||||
|
"private": true,
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Postgres database schemas and types for the Agentic platform using Drizzle as the ORM.",
|
"description": "Postgres database schemas and types for the Agentic platform using Drizzle as the ORM.",
|
||||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||||
|
@ -36,8 +37,5 @@
|
||||||
"postgres": "^3.4.5",
|
"postgres": "^3.4.5",
|
||||||
"type-fest": "catalog:",
|
"type-fest": "catalog:",
|
||||||
"zod": "catalog:"
|
"zod": "catalog:"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,9 @@ importers:
|
||||||
|
|
||||||
packages/cli:
|
packages/cli:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@agentic/platform-api-client':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../api-client
|
||||||
'@agentic/platform-core':
|
'@agentic/platform-core':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../core
|
version: link:../core
|
||||||
|
|
|
@ -7,13 +7,6 @@
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- **replace Project.id and Deployment.id with cuids**
|
|
||||||
- move others to `alias` or `publicIdentifier`?
|
|
||||||
- won't work with hono routing? test this
|
|
||||||
- add prefixes to model ids
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- stripe
|
- stripe
|
||||||
- re-add coupons
|
- re-add coupons
|
||||||
- declarative json-based pricing
|
- declarative json-based pricing
|
||||||
|
|
Ładowanie…
Reference in New Issue