postgresdk 0.6.11 → 0.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,83 @@
1
+ import type { Model } from "./introspect";
2
+ import type { Config, AuthConfig } from "./types";
3
+ export interface UnifiedContract {
4
+ version: string;
5
+ generatedAt: string;
6
+ description: string;
7
+ sdk: {
8
+ initialization: SDKInitExample[];
9
+ authentication: SDKAuthExample[];
10
+ };
11
+ resources: ResourceWithSDK[];
12
+ relationships: RelationshipContract[];
13
+ }
14
+ export interface SDKInitExample {
15
+ description: string;
16
+ code: string;
17
+ }
18
+ export interface SDKAuthExample {
19
+ strategy: string;
20
+ description: string;
21
+ code: string;
22
+ }
23
+ export interface ResourceWithSDK {
24
+ name: string;
25
+ tableName: string;
26
+ description: string;
27
+ sdk: {
28
+ client: string;
29
+ methods: SDKMethod[];
30
+ };
31
+ api: {
32
+ endpoints: EndpointContract[];
33
+ };
34
+ fields: FieldContract[];
35
+ }
36
+ export interface SDKMethod {
37
+ name: string;
38
+ signature: string;
39
+ description: string;
40
+ example: string;
41
+ correspondsTo?: string;
42
+ }
43
+ export interface EndpointContract {
44
+ method: string;
45
+ path: string;
46
+ description: string;
47
+ requestBody?: string;
48
+ responseBody?: string;
49
+ queryParameters?: Record<string, string>;
50
+ }
51
+ export interface FieldContract {
52
+ name: string;
53
+ type: string;
54
+ tsType: string;
55
+ required: boolean;
56
+ description: string;
57
+ foreignKey?: {
58
+ table: string;
59
+ field: string;
60
+ };
61
+ }
62
+ export interface RelationshipContract {
63
+ from: string;
64
+ to: string;
65
+ type: "one-to-many" | "many-to-one" | "many-to-many";
66
+ description: string;
67
+ }
68
+ /**
69
+ * Generate a unified contract showing both API and SDK usage
70
+ */
71
+ export declare function generateUnifiedContract(model: Model, config: Config & {
72
+ auth?: AuthConfig;
73
+ }): UnifiedContract;
74
+ /**
75
+ * Generate markdown documentation for the unified contract
76
+ */
77
+ export declare function generateUnifiedContractMarkdown(contract: UnifiedContract): string;
78
+ /**
79
+ * Emit the unified contract as TypeScript code
80
+ */
81
+ export declare function emitUnifiedContract(model: Model, config: Config & {
82
+ auth?: AuthConfig;
83
+ }): string;