kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
bd5c4a8dac
commit
5a90fe0703
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
description:
|
||||
globs:
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
---
|
||||
|
@ -38,23 +38,14 @@ All packages must follow these `package.json` rules:
|
|||
|
||||
- `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
|
||||
|
||||
- Avoid semicolons at the end of lines
|
||||
- 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
|
||||
- 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)
|
||||
- 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
|
||||
- Good examples:
|
||||
```ts
|
||||
|
@ -77,8 +68,8 @@ 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 unions should always be used instead of enums
|
||||
- For example, this union `z.union([z.literal('youtube'), z.literal('spotify')])` is better than this enum `z.enum(['youtube', 'spotify'])`
|
||||
- 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' ])`
|
||||
- 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 `.then` or `.catch` to handle Promise resolution
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@agentic/platform-api-client",
|
||||
"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>",
|
||||
"license": "UNLICENSED",
|
||||
"repository": {
|
||||
|
@ -20,8 +20,7 @@
|
|||
"generate": "openapi-typescript http://localhost:3000/docs --output ./src/openapi.d.ts",
|
||||
"test": "run-s test:*",
|
||||
"test:lint": "eslint .",
|
||||
"test:typecheck": "tsc --noEmit",
|
||||
"test:unit": "vitest run"
|
||||
"test:typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentic/platform-core": "workspace:*",
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
import type { components } from './openapi'
|
||||
|
||||
export type AuthProvider = components['schemas']['AuthProvider']
|
||||
export type AuthProviders = components['schemas']['AuthProviders']
|
||||
export type Consumer = components['schemas']['Consumer']
|
||||
export type Project = components['schemas']['Project']
|
||||
export type Deployment = components['schemas']['Deployment']
|
||||
export type User = components['schemas']['User']
|
||||
export type Team = components['schemas']['Team']
|
||||
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": {
|
||||
"@agentic/platform-core": "workspace:*",
|
||||
"@agentic/platform-api-client": "workspace:*",
|
||||
"commander": "^14.0.0",
|
||||
"conf": "^13.1.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 Conf from 'conf'
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@agentic/platform-db",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"description": "Postgres database schemas and types for the Agentic platform using Drizzle as the ORM.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
|
@ -36,8 +37,5 @@
|
|||
"postgres": "^3.4.5",
|
||||
"type-fest": "catalog:",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,6 +220,9 @@ importers:
|
|||
|
||||
packages/cli:
|
||||
dependencies:
|
||||
'@agentic/platform-api-client':
|
||||
specifier: workspace:*
|
||||
version: link:../api-client
|
||||
'@agentic/platform-core':
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
|
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
## 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
|
||||
- re-add coupons
|
||||
- declarative json-based pricing
|
||||
|
|
Ładowanie…
Reference in New Issue