@apso/cli 0.7.4 → 0.8.3

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.
Files changed (203) hide show
  1. package/dist/autogen/index.d.ts +2 -0
  2. package/dist/autogen/index.js +3 -0
  3. package/dist/commands/server/new.d.ts +4 -1
  4. package/dist/commands/server/new.js +115 -22
  5. package/dist/commands/server/scaffold.d.ts +10 -0
  6. package/dist/commands/server/scaffold.js +200 -10
  7. package/dist/lib/api/client.d.ts +65 -0
  8. package/dist/lib/api/client.js +305 -0
  9. package/dist/lib/api/index.d.ts +8 -0
  10. package/dist/lib/api/index.js +22 -0
  11. package/dist/lib/api/services.d.ts +166 -0
  12. package/dist/lib/api/services.js +202 -0
  13. package/dist/lib/api/types.d.ts +212 -0
  14. package/dist/lib/api/types.js +7 -0
  15. package/dist/lib/apsorc-parser.d.ts +3 -0
  16. package/dist/lib/apsorc-parser.js +4 -0
  17. package/dist/lib/config/index.d.ts +8 -0
  18. package/dist/lib/config/index.js +17 -0
  19. package/dist/lib/config/manager.d.ts +127 -0
  20. package/dist/lib/config/manager.js +304 -0
  21. package/dist/lib/config/paths.d.ts +65 -0
  22. package/dist/lib/config/paths.js +127 -0
  23. package/dist/lib/config/types.d.ts +230 -0
  24. package/dist/lib/config/types.js +30 -0
  25. package/dist/lib/generators/base.d.ts +93 -0
  26. package/dist/lib/generators/base.js +90 -0
  27. package/dist/lib/generators/go.d.ts +37 -0
  28. package/dist/lib/generators/go.js +340 -0
  29. package/dist/lib/generators/index.d.ts +21 -0
  30. package/dist/lib/generators/index.js +51 -0
  31. package/dist/lib/generators/python.d.ts +21 -0
  32. package/dist/lib/generators/python.js +253 -0
  33. package/dist/lib/generators/typescript.d.ts +25 -0
  34. package/dist/lib/generators/typescript.js +373 -0
  35. package/dist/lib/index.d.ts +2 -0
  36. package/dist/lib/index.js +9 -1
  37. package/dist/lib/templates/entities/entity-col-timestamp.eta +9 -2
  38. package/dist/lib/templates/entities/entity-col-timestamptz.eta +9 -2
  39. package/dist/lib/templates/entities/entity.eta +16 -3
  40. package/dist/lib/templates/go/dto/dto-col-array.eta +7 -0
  41. package/dist/lib/templates/go/dto/dto-col-boolean.eta +7 -0
  42. package/dist/lib/templates/go/dto/dto-col-date.eta +7 -0
  43. package/dist/lib/templates/go/dto/dto-col-decimal.eta +7 -0
  44. package/dist/lib/templates/go/dto/dto-col-enum.eta +8 -0
  45. package/dist/lib/templates/go/dto/dto-col-float.eta +7 -0
  46. package/dist/lib/templates/go/dto/dto-col-integer.eta +7 -0
  47. package/dist/lib/templates/go/dto/dto-col-json.eta +7 -0
  48. package/dist/lib/templates/go/dto/dto-col-jsonb.eta +7 -0
  49. package/dist/lib/templates/go/dto/dto-col-numeric.eta +7 -0
  50. package/dist/lib/templates/go/dto/dto-col-string.eta +7 -0
  51. package/dist/lib/templates/go/dto/dto-col-text.eta +7 -0
  52. package/dist/lib/templates/go/dto/dto-col-timestamp.eta +7 -0
  53. package/dist/lib/templates/go/dto/dto-col-timestamptz.eta +7 -0
  54. package/dist/lib/templates/go/dto/dto-col-uuid.eta +7 -0
  55. package/dist/lib/templates/go/dto/dto-col-varchar.eta +7 -0
  56. package/dist/lib/templates/go/dto/dto.eta +78 -0
  57. package/dist/lib/templates/go/enums.eta +44 -0
  58. package/dist/lib/templates/go/handlers/handler.eta +212 -0
  59. package/dist/lib/templates/go/header.eta +3 -0
  60. package/dist/lib/templates/go/index-module.eta +53 -0
  61. package/dist/lib/templates/go/middleware/auth.eta +101 -0
  62. package/dist/lib/templates/go/models/model-col-array.eta +1 -0
  63. package/dist/lib/templates/go/models/model-col-boolean.eta +1 -0
  64. package/dist/lib/templates/go/models/model-col-date.eta +1 -0
  65. package/dist/lib/templates/go/models/model-col-decimal.eta +1 -0
  66. package/dist/lib/templates/go/models/model-col-enum.eta +2 -0
  67. package/dist/lib/templates/go/models/model-col-float.eta +1 -0
  68. package/dist/lib/templates/go/models/model-col-integer.eta +1 -0
  69. package/dist/lib/templates/go/models/model-col-json.eta +1 -0
  70. package/dist/lib/templates/go/models/model-col-jsonb.eta +1 -0
  71. package/dist/lib/templates/go/models/model-col-numeric.eta +1 -0
  72. package/dist/lib/templates/go/models/model-col-string.eta +1 -0
  73. package/dist/lib/templates/go/models/model-col-text.eta +1 -0
  74. package/dist/lib/templates/go/models/model-col-timestamp.eta +1 -0
  75. package/dist/lib/templates/go/models/model-col-timestamptz.eta +1 -0
  76. package/dist/lib/templates/go/models/model-col-uuid.eta +1 -0
  77. package/dist/lib/templates/go/models/model-col-varchar.eta +1 -0
  78. package/dist/lib/templates/go/models/model.eta +53 -0
  79. package/dist/lib/templates/go/services/service.eta +190 -0
  80. package/dist/lib/templates/python/enums.eta +10 -0
  81. package/dist/lib/templates/python/header.eta +6 -0
  82. package/dist/lib/templates/python/index-module.eta +18 -0
  83. package/dist/lib/templates/python/models/model-col-array.eta +4 -0
  84. package/dist/lib/templates/python/models/model-col-boolean.eta +5 -0
  85. package/dist/lib/templates/python/models/model-col-date.eta +4 -0
  86. package/dist/lib/templates/python/models/model-col-decimal.eta +4 -0
  87. package/dist/lib/templates/python/models/model-col-enum.eta +16 -0
  88. package/dist/lib/templates/python/models/model-col-float.eta +5 -0
  89. package/dist/lib/templates/python/models/model-col-integer.eta +6 -0
  90. package/dist/lib/templates/python/models/model-col-json.eta +4 -0
  91. package/dist/lib/templates/python/models/model-col-jsonb.eta +4 -0
  92. package/dist/lib/templates/python/models/model-col-numeric.eta +4 -0
  93. package/dist/lib/templates/python/models/model-col-string.eta +6 -0
  94. package/dist/lib/templates/python/models/model-col-text.eta +6 -0
  95. package/dist/lib/templates/python/models/model-col-timestamp.eta +11 -0
  96. package/dist/lib/templates/python/models/model-col-timestamptz.eta +11 -0
  97. package/dist/lib/templates/python/models/model-col-uuid.eta +5 -0
  98. package/dist/lib/templates/python/models/model-col-varchar.eta +6 -0
  99. package/dist/lib/templates/python/models/model.eta +124 -0
  100. package/dist/lib/templates/python/routers/router.eta +206 -0
  101. package/dist/lib/templates/python/schemas/schema-col-array.eta +1 -0
  102. package/dist/lib/templates/python/schemas/schema-col-boolean.eta +1 -0
  103. package/dist/lib/templates/python/schemas/schema-col-date.eta +1 -0
  104. package/dist/lib/templates/python/schemas/schema-col-decimal.eta +1 -0
  105. package/dist/lib/templates/python/schemas/schema-col-enum.eta +6 -0
  106. package/dist/lib/templates/python/schemas/schema-col-float.eta +1 -0
  107. package/dist/lib/templates/python/schemas/schema-col-integer.eta +1 -0
  108. package/dist/lib/templates/python/schemas/schema-col-json.eta +1 -0
  109. package/dist/lib/templates/python/schemas/schema-col-jsonb.eta +1 -0
  110. package/dist/lib/templates/python/schemas/schema-col-numeric.eta +1 -0
  111. package/dist/lib/templates/python/schemas/schema-col-string.eta +1 -0
  112. package/dist/lib/templates/python/schemas/schema-col-text.eta +1 -0
  113. package/dist/lib/templates/python/schemas/schema-col-timestamp.eta +1 -0
  114. package/dist/lib/templates/python/schemas/schema-col-timestamptz.eta +1 -0
  115. package/dist/lib/templates/python/schemas/schema-col-uuid.eta +1 -0
  116. package/dist/lib/templates/python/schemas/schema-col-varchar.eta +1 -0
  117. package/dist/lib/templates/python/schemas/schema.eta +87 -0
  118. package/dist/lib/templates/python/services/service.eta +163 -0
  119. package/dist/lib/templates/rest/controller-rest.eta +13 -12
  120. package/dist/lib/templates/rest/dto-rest.eta +173 -59
  121. package/dist/lib/types/generator.d.ts +241 -0
  122. package/dist/lib/types/generator.js +2 -0
  123. package/dist/lib/types/index.d.ts +1 -0
  124. package/dist/lib/utils/casing.d.ts +1 -0
  125. package/dist/lib/utils/casing.js +11 -1
  126. package/oclif.manifest.json +32 -3
  127. package/package.json +4 -2
  128. package/dist/lib/utils/relationships/parse.spec.d.ts +0 -1
  129. package/dist/lib/utils/relationships/parse.spec.js +0 -402
  130. package/dist/tests/templates/entities/types/array-template.spec.d.ts +0 -1
  131. package/dist/tests/templates/entities/types/array-template.spec.js +0 -82
  132. package/dist/tests/templates/entities/types/bigint-template.spec.d.ts +0 -1
  133. package/dist/tests/templates/entities/types/bigint-template.spec.js +0 -82
  134. package/dist/tests/templates/entities/types/boolean-template.spec.d.ts +0 -1
  135. package/dist/tests/templates/entities/types/boolean-template.spec.js +0 -77
  136. package/dist/tests/templates/entities/types/bytea-template.spec.d.ts +0 -1
  137. package/dist/tests/templates/entities/types/bytea-template.spec.js +0 -68
  138. package/dist/tests/templates/entities/types/char-template.spec.d.ts +0 -1
  139. package/dist/tests/templates/entities/types/char-template.spec.js +0 -68
  140. package/dist/tests/templates/entities/types/date-template.spec.d.ts +0 -1
  141. package/dist/tests/templates/entities/types/date-template.spec.js +0 -56
  142. package/dist/tests/templates/entities/types/decimal-field-validation.spec.d.ts +0 -1
  143. package/dist/tests/templates/entities/types/decimal-field-validation.spec.js +0 -100
  144. package/dist/tests/templates/entities/types/decimal-template.spec.d.ts +0 -1
  145. package/dist/tests/templates/entities/types/decimal-template.spec.js +0 -86
  146. package/dist/tests/templates/entities/types/double-template.spec.d.ts +0 -1
  147. package/dist/tests/templates/entities/types/double-template.spec.js +0 -70
  148. package/dist/tests/templates/entities/types/enum-template.spec.d.ts +0 -1
  149. package/dist/tests/templates/entities/types/enum-template.spec.js +0 -85
  150. package/dist/tests/templates/entities/types/float-template.spec.d.ts +0 -1
  151. package/dist/tests/templates/entities/types/float-template.spec.js +0 -70
  152. package/dist/tests/templates/entities/types/geometry-template.spec.d.ts +0 -1
  153. package/dist/tests/templates/entities/types/geometry-template.spec.js +0 -58
  154. package/dist/tests/templates/entities/types/inet-template.spec.d.ts +0 -1
  155. package/dist/tests/templates/entities/types/inet-template.spec.js +0 -69
  156. package/dist/tests/templates/entities/types/int4range-template.spec.d.ts +0 -1
  157. package/dist/tests/templates/entities/types/int4range-template.spec.js +0 -72
  158. package/dist/tests/templates/entities/types/integer-template.spec.d.ts +0 -1
  159. package/dist/tests/templates/entities/types/integer-template.spec.js +0 -79
  160. package/dist/tests/templates/entities/types/interval-template.spec.d.ts +0 -1
  161. package/dist/tests/templates/entities/types/interval-template.spec.js +0 -68
  162. package/dist/tests/templates/entities/types/json-plain-template.spec.d.ts +0 -1
  163. package/dist/tests/templates/entities/types/json-plain-template.spec.js +0 -54
  164. package/dist/tests/templates/entities/types/json-template.spec.d.ts +0 -1
  165. package/dist/tests/templates/entities/types/json-template.spec.js +0 -40
  166. package/dist/tests/templates/entities/types/jsonb-template.spec.d.ts +0 -1
  167. package/dist/tests/templates/entities/types/jsonb-template.spec.js +0 -40
  168. package/dist/tests/templates/entities/types/money-template.spec.d.ts +0 -1
  169. package/dist/tests/templates/entities/types/money-template.spec.js +0 -68
  170. package/dist/tests/templates/entities/types/numeric-template.spec.d.ts +0 -1
  171. package/dist/tests/templates/entities/types/numeric-template.spec.js +0 -84
  172. package/dist/tests/templates/entities/types/point-template.spec.d.ts +0 -1
  173. package/dist/tests/templates/entities/types/point-template.spec.js +0 -64
  174. package/dist/tests/templates/entities/types/polygon-template.spec.d.ts +0 -1
  175. package/dist/tests/templates/entities/types/polygon-template.spec.js +0 -70
  176. package/dist/tests/templates/entities/types/real-template.spec.d.ts +0 -1
  177. package/dist/tests/templates/entities/types/real-template.spec.js +0 -67
  178. package/dist/tests/templates/entities/types/serial-template.spec.d.ts +0 -1
  179. package/dist/tests/templates/entities/types/serial-template.spec.js +0 -113
  180. package/dist/tests/templates/entities/types/smallint-template.spec.d.ts +0 -1
  181. package/dist/tests/templates/entities/types/smallint-template.spec.js +0 -82
  182. package/dist/tests/templates/entities/types/string-template.spec.d.ts +0 -1
  183. package/dist/tests/templates/entities/types/string-template.spec.js +0 -111
  184. package/dist/tests/templates/entities/types/text-template.spec.d.ts +0 -1
  185. package/dist/tests/templates/entities/types/text-template.spec.js +0 -70
  186. package/dist/tests/templates/entities/types/time-template.spec.d.ts +0 -1
  187. package/dist/tests/templates/entities/types/time-template.spec.js +0 -68
  188. package/dist/tests/templates/entities/types/timestamp-template.spec.d.ts +0 -1
  189. package/dist/tests/templates/entities/types/timestamp-template.spec.js +0 -74
  190. package/dist/tests/templates/entities/types/timetz-template.spec.d.ts +0 -1
  191. package/dist/tests/templates/entities/types/timetz-template.spec.js +0 -68
  192. package/dist/tests/templates/entities/types/tsvector-template.spec.d.ts +0 -1
  193. package/dist/tests/templates/entities/types/tsvector-template.spec.js +0 -55
  194. package/dist/tests/templates/entities/types/uuid-template.spec.d.ts +0 -1
  195. package/dist/tests/templates/entities/types/uuid-template.spec.js +0 -82
  196. package/dist/tests/templates/entities/types/varchar-template.spec.d.ts +0 -1
  197. package/dist/tests/templates/entities/types/varchar-template.spec.js +0 -105
  198. package/dist/tests/templates/entities/types/xml-template.spec.d.ts +0 -1
  199. package/dist/tests/templates/entities/types/xml-template.spec.js +0 -55
  200. package/dist/tests/templates/entities/uuid-entity-template.spec.d.ts +0 -1
  201. package/dist/tests/templates/entities/uuid-entity-template.spec.js +0 -277
  202. package/dist/tests/utils/relationship-deduplication.spec.d.ts +0 -1
  203. package/dist/tests/utils/relationship-deduplication.spec.js +0 -98
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Platform API Types
3
+ *
4
+ * TypeScript interfaces for platform API responses and requests.
5
+ */
6
+ /**
7
+ * API error response structure
8
+ */
9
+ export interface ApiError {
10
+ statusCode: number;
11
+ message: string;
12
+ error?: string;
13
+ details?: Record<string, unknown>;
14
+ }
15
+ /**
16
+ * Paginated response wrapper
17
+ */
18
+ export interface PaginatedResponse<T> {
19
+ data: T[];
20
+ meta: {
21
+ total: number;
22
+ page: number;
23
+ pageSize: number;
24
+ totalPages: number;
25
+ };
26
+ }
27
+ /**
28
+ * Workspace from platform API
29
+ */
30
+ export interface Workspace {
31
+ id: string;
32
+ slug: string;
33
+ name: string;
34
+ type: "personal" | "company";
35
+ description?: string;
36
+ avatarUrl?: string;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ membersCount?: number;
40
+ servicesCount?: number;
41
+ githubConnected?: boolean;
42
+ }
43
+ /**
44
+ * Service from platform API
45
+ */
46
+ export interface Service {
47
+ id: string;
48
+ workspaceId: string;
49
+ slug: string;
50
+ name: string;
51
+ description?: string;
52
+ status: "active" | "building" | "error" | "archived";
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ lastDeployedAt?: string;
56
+ githubRepo?: string;
57
+ githubBranch?: string;
58
+ endpoint?: string;
59
+ }
60
+ /**
61
+ * Service schema from platform API
62
+ * This represents the platform's ServiceSchema format
63
+ */
64
+ export interface ServiceSchema {
65
+ id: string;
66
+ serviceId: string;
67
+ version: number;
68
+ entities: SchemaEntity[];
69
+ createdAt: string;
70
+ updatedAt: string;
71
+ hash?: string;
72
+ }
73
+ /**
74
+ * Entity in a service schema
75
+ */
76
+ export interface SchemaEntity {
77
+ name: string;
78
+ tableName?: string;
79
+ fields: SchemaField[];
80
+ relationships?: SchemaRelationship[];
81
+ auth?: EntityAuth;
82
+ scopeBy?: string[];
83
+ }
84
+ /**
85
+ * Field in a schema entity
86
+ */
87
+ export interface SchemaField {
88
+ name: string;
89
+ type: string;
90
+ nullable?: boolean;
91
+ unique?: boolean;
92
+ default?: unknown;
93
+ primaryKey?: boolean;
94
+ index?: boolean;
95
+ constraints?: Record<string, unknown>;
96
+ }
97
+ /**
98
+ * Relationship in a schema entity
99
+ */
100
+ export interface SchemaRelationship {
101
+ name: string;
102
+ type: "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
103
+ target: string;
104
+ inverseSide?: string;
105
+ cascade?: boolean;
106
+ nullable?: boolean;
107
+ }
108
+ /**
109
+ * Authentication configuration for an entity
110
+ */
111
+ export interface EntityAuth {
112
+ protected?: boolean;
113
+ roles?: string[];
114
+ owner?: string;
115
+ }
116
+ /**
117
+ * GitHub repository from platform API
118
+ */
119
+ export interface GitHubRepo {
120
+ id: number;
121
+ fullName: string;
122
+ name: string;
123
+ owner: string;
124
+ private: boolean;
125
+ defaultBranch: string;
126
+ url: string;
127
+ }
128
+ /**
129
+ * GitHub connection status
130
+ */
131
+ export interface GitHubConnection {
132
+ connected: boolean;
133
+ installationId?: number;
134
+ login?: string;
135
+ avatarUrl?: string;
136
+ }
137
+ /**
138
+ * Build status from platform API
139
+ */
140
+ export interface BuildStatus {
141
+ id: string;
142
+ serviceId: string;
143
+ status: "pending" | "building" | "success" | "failed";
144
+ startedAt: string;
145
+ completedAt?: string;
146
+ logs?: string;
147
+ error?: string;
148
+ }
149
+ /**
150
+ * User profile from platform API
151
+ */
152
+ export interface UserProfile {
153
+ id: string;
154
+ email: string;
155
+ name?: string;
156
+ avatarUrl?: string;
157
+ createdAt: string;
158
+ defaultWorkspaceId?: string;
159
+ workspaces: Workspace[];
160
+ }
161
+ /**
162
+ * OAuth token exchange response
163
+ */
164
+ export interface TokenExchangeResponse {
165
+ accessToken: string;
166
+ refreshToken: string;
167
+ expiresIn: number;
168
+ tokenType: string;
169
+ user: {
170
+ id: string;
171
+ email: string;
172
+ name?: string;
173
+ avatarUrl?: string;
174
+ };
175
+ }
176
+ /**
177
+ * Token refresh response
178
+ */
179
+ export interface TokenRefreshResponse {
180
+ accessToken: string;
181
+ expiresIn: number;
182
+ tokenType: string;
183
+ }
184
+ /**
185
+ * Request options for API calls
186
+ */
187
+ export interface ApiRequestOptions {
188
+ /**
189
+ * HTTP method
190
+ */
191
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
192
+ /**
193
+ * Request body (will be JSON stringified)
194
+ */
195
+ body?: unknown;
196
+ /**
197
+ * Query parameters
198
+ */
199
+ params?: Record<string, string | number | boolean | undefined>;
200
+ /**
201
+ * Additional headers
202
+ */
203
+ headers?: Record<string, string>;
204
+ /**
205
+ * Request timeout in milliseconds
206
+ */
207
+ timeout?: number;
208
+ /**
209
+ * Skip authentication (for public endpoints)
210
+ */
211
+ skipAuth?: boolean;
212
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Platform API Types
4
+ *
5
+ * TypeScript interfaces for platform API responses and requests.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,7 @@
1
1
  import { Entity } from "./types/entity";
2
2
  import { ApsorcRelationship, RelationshipMap } from "./types/relationship";
3
3
  import { AuthConfig } from "./types/auth";
4
+ import { TargetLanguage } from "./types/generator";
4
5
  export declare enum ApiType {
5
6
  Graphql = "graphql",
6
7
  Rest = "rest"
@@ -12,6 +13,7 @@ export type ApsorcType = {
12
13
  apiType: ApiType;
13
14
  relationships: ApsorcRelationship[];
14
15
  auth?: AuthConfig;
16
+ language?: TargetLanguage;
15
17
  };
16
18
  type ParsedApsorcData = {
17
19
  entities: Entity[];
@@ -23,6 +25,7 @@ type ParsedApsorc = {
23
25
  entities: Entity[];
24
26
  relationshipMap: RelationshipMap;
25
27
  auth?: AuthConfig;
28
+ language?: TargetLanguage;
26
29
  };
27
30
  export declare const parseApsorcV1: (apsorc: ApsorcType) => ParsedApsorcData;
28
31
  export declare const parseApsorcV2: (apsorc: ApsorcType) => ParsedApsorcData;
@@ -35,6 +35,7 @@ const parseRc = () => {
35
35
  const entities = apsoConfig.entities || [];
36
36
  const relationships = apsoConfig.relationships || [];
37
37
  const auth = apsoConfig.auth;
38
+ const language = apsoConfig.language;
38
39
  return {
39
40
  rootFolder,
40
41
  apiType,
@@ -42,6 +43,7 @@ const parseRc = () => {
42
43
  entities,
43
44
  relationships,
44
45
  auth,
46
+ language,
45
47
  };
46
48
  };
47
49
  const parseApsorc = () => {
@@ -60,6 +62,7 @@ const parseApsorc = () => {
60
62
  rootFolder: apsoConfig.rootFolder,
61
63
  apiType: apsoConfig.apiType,
62
64
  auth: apsoConfig.auth,
65
+ language: apsoConfig.language,
63
66
  ...(0, exports.parseApsorcV1)(apsoConfig),
64
67
  };
65
68
  if (debug) {
@@ -75,6 +78,7 @@ const parseApsorc = () => {
75
78
  rootFolder: apsoConfig.rootFolder,
76
79
  apiType: apsoConfig.apiType,
77
80
  auth: apsoConfig.auth,
81
+ language: apsoConfig.language,
78
82
  ...(() => {
79
83
  const relStart = perf_hooks_1.performance.now();
80
84
  const parsed = (0, exports.parseApsorcV2)(apsoConfig);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Platform CLI Configuration Module
3
+ *
4
+ * Exports configuration types, paths, and managers.
5
+ */
6
+ export * from "./types";
7
+ export * from "./paths";
8
+ export { globalConfig, credentials, projectLink, syncQueue, createBackup, } from "./manager";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Platform CLI Configuration Module
4
+ *
5
+ * Exports configuration types, paths, and managers.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createBackup = exports.syncQueue = exports.projectLink = exports.credentials = exports.globalConfig = void 0;
9
+ const tslib_1 = require("tslib");
10
+ tslib_1.__exportStar(require("./types"), exports);
11
+ tslib_1.__exportStar(require("./paths"), exports);
12
+ var manager_1 = require("./manager");
13
+ Object.defineProperty(exports, "globalConfig", { enumerable: true, get: function () { return manager_1.globalConfig; } });
14
+ Object.defineProperty(exports, "credentials", { enumerable: true, get: function () { return manager_1.credentials; } });
15
+ Object.defineProperty(exports, "projectLink", { enumerable: true, get: function () { return manager_1.projectLink; } });
16
+ Object.defineProperty(exports, "syncQueue", { enumerable: true, get: function () { return manager_1.syncQueue; } });
17
+ Object.defineProperty(exports, "createBackup", { enumerable: true, get: function () { return manager_1.createBackup; } });
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Configuration Manager
3
+ *
4
+ * Handles reading/writing configuration and credentials files
5
+ * with proper security measures.
6
+ */
7
+ import { CredentialsFile, GlobalConfigFile, ProjectLinkFile, SyncQueueFile, SyncQueueItem } from "./types";
8
+ /**
9
+ * Global Configuration Manager
10
+ */
11
+ export declare const globalConfig: {
12
+ /**
13
+ * Read global configuration, merging defaults and environment variables
14
+ */
15
+ read(): GlobalConfigFile;
16
+ /**
17
+ * Write global configuration
18
+ */
19
+ write(config: Partial<GlobalConfigFile>): void;
20
+ /**
21
+ * Get a specific configuration value
22
+ */
23
+ get<K extends keyof GlobalConfigFile>(key: K): GlobalConfigFile[K];
24
+ /**
25
+ * Set a specific configuration value
26
+ */
27
+ set<K_1 extends keyof GlobalConfigFile>(key: K_1, value: GlobalConfigFile[K_1]): void;
28
+ /**
29
+ * Reset configuration to defaults
30
+ */
31
+ reset(): void;
32
+ };
33
+ /**
34
+ * Credentials Manager
35
+ */
36
+ export declare const credentials: {
37
+ /**
38
+ * Read stored credentials
39
+ */
40
+ read(): CredentialsFile | null;
41
+ /**
42
+ * Write credentials (with secure file permissions)
43
+ */
44
+ write(creds: Omit<CredentialsFile, "updatedAt" | "cliVersion">): void;
45
+ /**
46
+ * Clear stored credentials
47
+ */
48
+ clear(): void;
49
+ /**
50
+ * Check if credentials exist and are not expired
51
+ */
52
+ isValid(): boolean;
53
+ /**
54
+ * Check if credentials exist (may be expired)
55
+ */
56
+ exists(): boolean;
57
+ /**
58
+ * Check if token needs refresh (expires within 5 minutes)
59
+ */
60
+ needsRefresh(): boolean;
61
+ };
62
+ /**
63
+ * Project Link Manager
64
+ */
65
+ export declare const projectLink: {
66
+ /**
67
+ * Read project link configuration
68
+ */
69
+ read(projectDir?: string): ProjectLinkFile | null;
70
+ /**
71
+ * Write project link configuration
72
+ */
73
+ write(link: ProjectLinkFile, projectDir?: string): void;
74
+ /**
75
+ * Remove project link
76
+ */
77
+ remove(projectDir?: string): void;
78
+ /**
79
+ * Check if project is linked
80
+ */
81
+ exists(projectDir?: string): boolean;
82
+ /**
83
+ * Update sync metadata after successful sync
84
+ */
85
+ updateSyncMetadata(metadata: {
86
+ lastSyncedAt: string;
87
+ localSchemaHash: string;
88
+ remoteSchemaHash: string;
89
+ }, projectDir?: string): void;
90
+ };
91
+ /**
92
+ * Sync Queue Manager
93
+ */
94
+ export declare const syncQueue: {
95
+ /**
96
+ * Read sync queue
97
+ */
98
+ read(projectDir?: string): SyncQueueFile;
99
+ /**
100
+ * Write sync queue
101
+ */
102
+ write(queue: SyncQueueFile, projectDir?: string): void;
103
+ /**
104
+ * Add operation to queue
105
+ */
106
+ add(operation: Omit<SyncQueueItem, "id" | "queuedAt" | "retryCount">, projectDir?: string): string;
107
+ /**
108
+ * Remove operation from queue
109
+ */
110
+ remove(id: string, projectDir?: string): void;
111
+ /**
112
+ * Get pending operations count
113
+ */
114
+ count(projectDir?: string): number;
115
+ /**
116
+ * Clear all operations
117
+ */
118
+ clear(projectDir?: string): void;
119
+ /**
120
+ * Update operation retry count and error
121
+ */
122
+ updateRetry(id: string, error: string, projectDir?: string): void;
123
+ };
124
+ /**
125
+ * Create a backup of a file
126
+ */
127
+ export declare function createBackup(filePath: string, projectDir?: string): string;