@rivascva/dt-idl 1.1.30 → 1.1.34

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.
package/dist/index.esm.js CHANGED
@@ -487,8 +487,10 @@ function mergeHeaders(...allHeaders) {
487
487
 
488
488
  const createMarketServiceClient = (options) => createClient(options);
489
489
  const createTradeServiceClient = (options) => createClient(options);
490
+ const createAppServiceClient = (options) => createClient(options);
490
491
 
491
492
  const isMarketServiceError = (error) => typeof error === 'object';
492
493
  const isTradeServiceError = (error) => typeof error === 'object';
494
+ const isAppServiceError = (error) => typeof error === 'object';
493
495
 
494
- export { createMarketServiceClient, createTradeServiceClient, isMarketServiceError, isTradeServiceError };
496
+ export { createAppServiceClient, createMarketServiceClient, createTradeServiceClient, isAppServiceError, isMarketServiceError, isTradeServiceError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.30",
3
+ "version": "1.1.34",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/redocly.yaml CHANGED
@@ -7,3 +7,7 @@ apis:
7
7
  root: ./services/dt-trade-service.yaml
8
8
  x-openapi-ts:
9
9
  output: ./ts/services/dt-trade-service.ts
10
+ dt-app-service@v1:
11
+ root: ./services/dt-app-service.yaml
12
+ x-openapi-ts:
13
+ output: ./ts/services/dt-app-service.ts
@@ -0,0 +1,210 @@
1
+ openapi: 3.0.0
2
+
3
+ info:
4
+ version: 1.0.0
5
+ title: Dream Trade App Service
6
+ description: Support the client applications.
7
+
8
+ servers:
9
+ - url: http://localhost:8084/v1
10
+
11
+ paths:
12
+ /users:
13
+ get:
14
+ description: Gets all users
15
+ operationId: getUsers
16
+ tags:
17
+ - Users
18
+ responses:
19
+ 200:
20
+ description: Success
21
+ content:
22
+ application/json:
23
+ schema:
24
+ type: array
25
+ items:
26
+ $ref: '#/components/schemas/User'
27
+ 404:
28
+ $ref: '#/components/responses/NotFound'
29
+ 500:
30
+ $ref: '#/components/responses/InternalServerError'
31
+ post:
32
+ description: Adds a new user
33
+ operationId: addUser
34
+ tags:
35
+ - Users
36
+ requestBody:
37
+ description: The request body to add a user
38
+ required: true
39
+ content:
40
+ application/json:
41
+ schema:
42
+ $ref: '#/components/schemas/AddUserPayload'
43
+ responses:
44
+ 201:
45
+ description: Added
46
+ content:
47
+ application/json:
48
+ schema:
49
+ $ref: '#/components/schemas/User'
50
+ 400:
51
+ $ref: '#/components/responses/BadRequest'
52
+ 500:
53
+ $ref: '#/components/responses/InternalServerError'
54
+
55
+ /users/{userId}:
56
+ get:
57
+ description: Gets a user
58
+ operationId: getUser
59
+ tags:
60
+ - Users
61
+ parameters:
62
+ - in: path
63
+ name: userId
64
+ description: The user id
65
+ required: true
66
+ schema:
67
+ type: string
68
+ example: 123456
69
+ responses:
70
+ 200:
71
+ description: Success
72
+ content:
73
+ application/json:
74
+ schema:
75
+ type: object
76
+ $ref: '#/components/schemas/User'
77
+ 404:
78
+ $ref: '#/components/responses/NotFound'
79
+ 500:
80
+ $ref: '#/components/responses/InternalServerError'
81
+ put:
82
+ description: Updates an existing user
83
+ operationId: updateUser
84
+ tags:
85
+ - Users
86
+ parameters:
87
+ - in: path
88
+ name: userId
89
+ description: The user id
90
+ required: true
91
+ schema:
92
+ type: string
93
+ example: 123456
94
+ requestBody:
95
+ description: The request body to updated a user
96
+ required: true
97
+ content:
98
+ application/json:
99
+ schema:
100
+ $ref: '#/components/schemas/UpdateUserPayload'
101
+ responses:
102
+ 200:
103
+ description: Success
104
+ content:
105
+ application/json:
106
+ schema:
107
+ $ref: '#/components/schemas/User'
108
+ 400:
109
+ $ref: '#/components/responses/BadRequest'
110
+ 404:
111
+ $ref: '#/components/responses/NotFound'
112
+ 500:
113
+ $ref: '#/components/responses/InternalServerError'
114
+
115
+ components:
116
+ schemas:
117
+ AddUserPayload:
118
+ description: Payload to add a new user
119
+ properties:
120
+ email:
121
+ type: string
122
+ example: sam.smith@example.com
123
+ name:
124
+ type: string
125
+ example: Sam Smith
126
+ country:
127
+ type: string
128
+ example: USA
129
+ imageUrl:
130
+ type: string
131
+ example: https://www.assets.com/image.png
132
+ required:
133
+ - email
134
+ - name
135
+ - country
136
+
137
+ UpdateUserPayload:
138
+ description: Payload to update an existing user
139
+ allOf:
140
+ - $ref: '#/components/schemas/AddUserPayload'
141
+
142
+ User:
143
+ description: A user
144
+ allOf:
145
+ - $ref: '#/components/schemas/AddUserPayload'
146
+ - type: object
147
+ properties:
148
+ id:
149
+ type: string
150
+ example: 123456
151
+ dateCreated:
152
+ type: integer
153
+ format: int64
154
+ example: 1713398544000
155
+ dateUpdated:
156
+ type: integer
157
+ format: int64
158
+ example: 1713398544000
159
+ required:
160
+ - id
161
+ - dateCreated
162
+ - dateUpdated
163
+
164
+ Error:
165
+ description: A generic error
166
+ properties:
167
+ status:
168
+ type: integer
169
+ format: int64
170
+ example: 500
171
+ code:
172
+ $ref: '#/components/schemas/ErrorCode'
173
+ example: ERROR
174
+ message:
175
+ type: string
176
+ example: Error
177
+ required:
178
+ - status
179
+ - code
180
+ - message
181
+
182
+ ErrorCode:
183
+ type: string
184
+ enum:
185
+ - ERROR
186
+
187
+ responses:
188
+ NoContent:
189
+ description: No content
190
+
191
+ NotFound:
192
+ description: The resource was not found
193
+ content:
194
+ application/json:
195
+ schema:
196
+ $ref: '#/components/schemas/Error'
197
+
198
+ BadRequest:
199
+ description: Invalid request payload
200
+ content:
201
+ application/json:
202
+ schema:
203
+ $ref: '#/components/schemas/Error'
204
+
205
+ InternalServerError:
206
+ description: There was an internal server error
207
+ content:
208
+ application/json:
209
+ schema:
210
+ $ref: '#/components/schemas/Error'
@@ -166,18 +166,21 @@ paths:
166
166
  $ref: '#/components/responses/NotFound'
167
167
  500:
168
168
  $ref: '#/components/responses/InternalServerError'
169
+
170
+ /orders/{orderId}:
169
171
  delete:
170
172
  description: Deletes an existing order
171
173
  operationId: deleteOrder
172
174
  tags:
173
175
  - Orders
174
- requestBody:
175
- description: The request body to delete an existing order
176
- required: true
177
- content:
178
- application/json:
179
- schema:
180
- $ref: '#/components/schemas/DeleteOrderPayload'
176
+ parameters:
177
+ - in: path
178
+ name: orderId
179
+ description: The order id
180
+ required: true
181
+ schema:
182
+ type: string
183
+ example: 123456
181
184
  responses:
182
185
  204:
183
186
  $ref: '#/components/responses/NoContent'
@@ -209,7 +212,6 @@ components:
209
212
  - email
210
213
  - name
211
214
  - country
212
- - imageUrl
213
215
 
214
216
  UpdateUserPayload:
215
217
  description: Payload to update an existing user
@@ -340,15 +342,6 @@ components:
340
342
  - targetPrice
341
343
  - shares
342
344
 
343
- DeleteOrderPayload:
344
- description: Payload to delete an existing order
345
- properties:
346
- id:
347
- type: string
348
- example: 123456
349
- required:
350
- - id
351
-
352
345
  Order:
353
346
  description: An order
354
347
  allOf:
@@ -2,9 +2,13 @@ import createClient, { ClientOptions } from 'openapi-fetch';
2
2
 
3
3
  import { paths as MarketServicePaths } from '@ts/services/dt-market-service';
4
4
  import { paths as TradeServicePaths } from '@ts/services/dt-trade-service';
5
+ import { paths as AppServicePaths } from '@ts/services/dt-app-service';
5
6
 
6
7
  export const createMarketServiceClient = (options: ClientOptions) =>
7
8
  createClient<MarketServicePaths>(options);
8
9
 
9
10
  export const createTradeServiceClient = (options: ClientOptions) =>
10
11
  createClient<TradeServicePaths>(options);
12
+
13
+ export const createAppServiceClient = (options: ClientOptions) =>
14
+ createClient<AppServicePaths>(options);
@@ -1,7 +1,10 @@
1
- import { MarketServiceError, TradeServiceError } from '@ts/types';
1
+ import { MarketServiceError, TradeServiceError, AppServiceError } from '@ts/types';
2
2
 
3
3
  export const isMarketServiceError = (error: unknown): error is MarketServiceError =>
4
4
  typeof error === 'object';
5
5
 
6
6
  export const isTradeServiceError = (error: unknown): error is TradeServiceError =>
7
7
  typeof error === 'object';
8
+
9
+ export const isAppServiceError = (error: unknown): error is AppServiceError =>
10
+ typeof error === 'object';
@@ -0,0 +1,238 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ "/users": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ /** @description Gets all users */
15
+ get: operations["getUsers"];
16
+ put?: never;
17
+ /** @description Adds a new user */
18
+ post: operations["addUser"];
19
+ delete?: never;
20
+ options?: never;
21
+ head?: never;
22
+ patch?: never;
23
+ trace?: never;
24
+ };
25
+ "/users/{userId}": {
26
+ parameters: {
27
+ query?: never;
28
+ header?: never;
29
+ path?: never;
30
+ cookie?: never;
31
+ };
32
+ /** @description Gets a user */
33
+ get: operations["getUser"];
34
+ /** @description Updates an existing user */
35
+ put: operations["updateUser"];
36
+ post?: never;
37
+ delete?: never;
38
+ options?: never;
39
+ head?: never;
40
+ patch?: never;
41
+ trace?: never;
42
+ };
43
+ }
44
+ export type webhooks = Record<string, never>;
45
+ export interface components {
46
+ schemas: {
47
+ /** @description Payload to add a new user */
48
+ AddUserPayload: {
49
+ /** @example sam.smith@example.com */
50
+ email: string;
51
+ /** @example Sam Smith */
52
+ name: string;
53
+ /** @example USA */
54
+ country: string;
55
+ /** @example https://www.assets.com/image.png */
56
+ imageUrl?: string;
57
+ };
58
+ /** @description Payload to update an existing user */
59
+ UpdateUserPayload: components["schemas"]["AddUserPayload"];
60
+ /** @description A user */
61
+ User: components["schemas"]["AddUserPayload"] & {
62
+ /** @example 123456 */
63
+ id: string;
64
+ /**
65
+ * Format: int64
66
+ * @example 1713398544000
67
+ */
68
+ dateCreated: number;
69
+ /**
70
+ * Format: int64
71
+ * @example 1713398544000
72
+ */
73
+ dateUpdated: number;
74
+ };
75
+ /** @description A generic error */
76
+ Error: {
77
+ /**
78
+ * Format: int64
79
+ * @example 500
80
+ */
81
+ status: number;
82
+ /** @example ERROR */
83
+ code: components["schemas"]["ErrorCode"];
84
+ /** @example Error */
85
+ message: string;
86
+ };
87
+ /** @enum {string} */
88
+ ErrorCode: "ERROR";
89
+ };
90
+ responses: {
91
+ /** @description No content */
92
+ NoContent: {
93
+ headers: {
94
+ [name: string]: unknown;
95
+ };
96
+ content?: never;
97
+ };
98
+ /** @description The resource was not found */
99
+ NotFound: {
100
+ headers: {
101
+ [name: string]: unknown;
102
+ };
103
+ content: {
104
+ "application/json": components["schemas"]["Error"];
105
+ };
106
+ };
107
+ /** @description Invalid request payload */
108
+ BadRequest: {
109
+ headers: {
110
+ [name: string]: unknown;
111
+ };
112
+ content: {
113
+ "application/json": components["schemas"]["Error"];
114
+ };
115
+ };
116
+ /** @description There was an internal server error */
117
+ InternalServerError: {
118
+ headers: {
119
+ [name: string]: unknown;
120
+ };
121
+ content: {
122
+ "application/json": components["schemas"]["Error"];
123
+ };
124
+ };
125
+ };
126
+ parameters: never;
127
+ requestBodies: never;
128
+ headers: never;
129
+ pathItems: never;
130
+ }
131
+ export type $defs = Record<string, never>;
132
+ export interface operations {
133
+ getUsers: {
134
+ parameters: {
135
+ query?: never;
136
+ header?: never;
137
+ path?: never;
138
+ cookie?: never;
139
+ };
140
+ requestBody?: never;
141
+ responses: {
142
+ /** @description Success */
143
+ 200: {
144
+ headers: {
145
+ [name: string]: unknown;
146
+ };
147
+ content: {
148
+ "application/json": components["schemas"]["User"][];
149
+ };
150
+ };
151
+ 404: components["responses"]["NotFound"];
152
+ 500: components["responses"]["InternalServerError"];
153
+ };
154
+ };
155
+ addUser: {
156
+ parameters: {
157
+ query?: never;
158
+ header?: never;
159
+ path?: never;
160
+ cookie?: never;
161
+ };
162
+ /** @description The request body to add a user */
163
+ requestBody: {
164
+ content: {
165
+ "application/json": components["schemas"]["AddUserPayload"];
166
+ };
167
+ };
168
+ responses: {
169
+ /** @description Added */
170
+ 201: {
171
+ headers: {
172
+ [name: string]: unknown;
173
+ };
174
+ content: {
175
+ "application/json": components["schemas"]["User"];
176
+ };
177
+ };
178
+ 400: components["responses"]["BadRequest"];
179
+ 500: components["responses"]["InternalServerError"];
180
+ };
181
+ };
182
+ getUser: {
183
+ parameters: {
184
+ query?: never;
185
+ header?: never;
186
+ path: {
187
+ /** @description The user id */
188
+ userId: string;
189
+ };
190
+ cookie?: never;
191
+ };
192
+ requestBody?: never;
193
+ responses: {
194
+ /** @description Success */
195
+ 200: {
196
+ headers: {
197
+ [name: string]: unknown;
198
+ };
199
+ content: {
200
+ "application/json": components["schemas"]["User"];
201
+ };
202
+ };
203
+ 404: components["responses"]["NotFound"];
204
+ 500: components["responses"]["InternalServerError"];
205
+ };
206
+ };
207
+ updateUser: {
208
+ parameters: {
209
+ query?: never;
210
+ header?: never;
211
+ path: {
212
+ /** @description The user id */
213
+ userId: string;
214
+ };
215
+ cookie?: never;
216
+ };
217
+ /** @description The request body to updated a user */
218
+ requestBody: {
219
+ content: {
220
+ "application/json": components["schemas"]["UpdateUserPayload"];
221
+ };
222
+ };
223
+ responses: {
224
+ /** @description Success */
225
+ 200: {
226
+ headers: {
227
+ [name: string]: unknown;
228
+ };
229
+ content: {
230
+ "application/json": components["schemas"]["User"];
231
+ };
232
+ };
233
+ 400: components["responses"]["BadRequest"];
234
+ 404: components["responses"]["NotFound"];
235
+ 500: components["responses"]["InternalServerError"];
236
+ };
237
+ };
238
+ }
@@ -68,6 +68,22 @@ export interface paths {
68
68
  put?: never;
69
69
  /** @description Adds a new order */
70
70
  post: operations["addOrder"];
71
+ delete?: never;
72
+ options?: never;
73
+ head?: never;
74
+ patch?: never;
75
+ trace?: never;
76
+ };
77
+ "/orders/{orderId}": {
78
+ parameters: {
79
+ query?: never;
80
+ header?: never;
81
+ path?: never;
82
+ cookie?: never;
83
+ };
84
+ get?: never;
85
+ put?: never;
86
+ post?: never;
71
87
  /** @description Deletes an existing order */
72
88
  delete: operations["deleteOrder"];
73
89
  options?: never;
@@ -88,7 +104,7 @@ export interface components {
88
104
  /** @example USA */
89
105
  country: string;
90
106
  /** @example https://www.assets.com/image.png */
91
- imageUrl: string;
107
+ imageUrl?: string;
92
108
  };
93
109
  /** @description Payload to update an existing user */
94
110
  UpdateUserPayload: components["schemas"]["AddUserPayload"];
@@ -179,11 +195,6 @@ export interface components {
179
195
  */
180
196
  shares: number;
181
197
  };
182
- /** @description Payload to delete an existing order */
183
- DeleteOrderPayload: {
184
- /** @example 123456 */
185
- id: string;
186
- };
187
198
  /** @description An order */
188
199
  Order: components["schemas"]["AddOrderPayload"] & {
189
200
  /** @example 123456 */
@@ -433,15 +444,13 @@ export interface operations {
433
444
  parameters: {
434
445
  query?: never;
435
446
  header?: never;
436
- path?: never;
437
- cookie?: never;
438
- };
439
- /** @description The request body to delete an existing order */
440
- requestBody: {
441
- content: {
442
- "application/json": components["schemas"]["DeleteOrderPayload"];
447
+ path: {
448
+ /** @description The order id */
449
+ orderId: string;
443
450
  };
451
+ cookie?: never;
444
452
  };
453
+ requestBody?: never;
445
454
  responses: {
446
455
  204: components["responses"]["NoContent"];
447
456
  400: components["responses"]["BadRequest"];
package/ts/types/types.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { components as MarketServiceComponents } from '@ts/services/dt-market-service';
2
2
  import { components as TradeServiceComponents } from '@ts/services/dt-trade-service';
3
+ import { components as AppServiceComponents } from '@ts/services/dt-app-service';
3
4
 
4
5
  type MarketServiceSchemas = MarketServiceComponents['schemas'];
5
6
  type TradeServiceSchemas = TradeServiceComponents['schemas'];
7
+ type AppServiceSchemas = AppServiceComponents['schemas'];
6
8
 
7
9
  // Market Service Types
8
10
  export type SimpleQuote = MarketServiceSchemas['SimpleQuote'];
@@ -14,12 +16,16 @@ export type StockHistoryTimeframe = MarketServiceSchemas['StockHistoryTimeframe'
14
16
  export type StockHistoryEntry = MarketServiceSchemas['StockHistoryEntry'];
15
17
 
16
18
  // Trade Service Types
17
- export type User = TradeServiceSchemas['User'];
18
19
  export type Portfolio = TradeServiceSchemas['Portfolio'];
19
20
  export type PortfolioType = TradeServiceSchemas['PortfolioType'];
20
21
  export type AddOrderPayload = TradeServiceSchemas['AddOrderPayload'];
21
- export type DeleteOrderPayload = TradeServiceSchemas['DeleteOrderPayload'];
22
22
  export type Order = TradeServiceSchemas['Order'];
23
23
  export type OrderType = TradeServiceSchemas['OrderType'];
24
24
  export type Holding = TradeServiceSchemas['Holding'];
25
25
  export type TradeServiceError = TradeServiceSchemas['Error'];
26
+
27
+ // App Service Types
28
+ export type User = AppServiceSchemas['User'];
29
+ export type AddUserPayload = AppServiceSchemas['AddUserPayload'];
30
+ export type UpdateUserPayload = AppServiceSchemas['UpdateUserPayload'];
31
+ export type AppServiceError = AppServiceSchemas['Error'];