@rivascva/dt-idl 1.1.50 → 1.1.52
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.d.ts +2 -1
- package/go/utils/responder/responder.go +7 -7
- package/package.json +1 -1
- package/ts/types/types.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -1434,7 +1434,8 @@ type UpdateUserPayload = UserServiceSchemas['UpdateUserPayload'];
|
|
|
1434
1434
|
type UserServiceError = UserServiceSchemas['Error'];
|
|
1435
1435
|
type ImageType = AssetServiceSchemas['ImageType'];
|
|
1436
1436
|
type UploadImagePayload = AssetServiceSchemas['UploadImagePayload'];
|
|
1437
|
+
type UploadImageResponse = AssetServiceSchemas['UploadImageResponse'];
|
|
1437
1438
|
type DeleteImagePayload = AssetServiceSchemas['DeleteImagePayload'];
|
|
1438
1439
|
type AssetServiceError = AssetServiceSchemas['Error'];
|
|
1439
1440
|
|
|
1440
|
-
export { type AddOrderPayload, type AddUserPayload, type AssetServiceError, type DeleteImagePayload, type FullQuote, type Holding, type ImageType, type MarketServiceError, type NewsArticle, type Order, type OrderType, type Portfolio, type PortfolioType, type SimpleQuote, type StockHistoryEntry, type StockHistoryTimeframe, type StockNewsArticle, type TradeServiceError, type UpdateUserPayload, type UploadImagePayload, type User, type UserServiceError, createAssetServiceClient, createMarketServiceClient, createTradeServiceClient, createUserServiceClient, isAssetServiceError, isMarketServiceError, isTradeServiceError, isUserServiceError };
|
|
1441
|
+
export { type AddOrderPayload, type AddUserPayload, type AssetServiceError, type DeleteImagePayload, type FullQuote, type Holding, type ImageType, type MarketServiceError, type NewsArticle, type Order, type OrderType, type Portfolio, type PortfolioType, type SimpleQuote, type StockHistoryEntry, type StockHistoryTimeframe, type StockNewsArticle, type TradeServiceError, type UpdateUserPayload, type UploadImagePayload, type UploadImageResponse, type User, type UserServiceError, createAssetServiceClient, createMarketServiceClient, createTradeServiceClient, createUserServiceClient, isAssetServiceError, isMarketServiceError, isTradeServiceError, isUserServiceError };
|
|
@@ -24,13 +24,13 @@ type Responder[T ~string] interface {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
type StandardResponder[T ~string] struct {
|
|
27
|
-
|
|
27
|
+
logger logger.Logger
|
|
28
28
|
defaultCode T
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
func NewStandardResponder[T ~string](
|
|
31
|
+
func NewStandardResponder[T ~string](logger logger.Logger, defaultCode T) *StandardResponder[T] {
|
|
32
32
|
return &StandardResponder[T]{
|
|
33
|
-
|
|
33
|
+
logger: logger,
|
|
34
34
|
defaultCode: defaultCode,
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -39,7 +39,7 @@ func (r *StandardResponder[T]) Write(w http.ResponseWriter, status int, data any
|
|
|
39
39
|
// encode the given data object
|
|
40
40
|
out, err := json.Marshal(data)
|
|
41
41
|
if err != nil {
|
|
42
|
-
r.
|
|
42
|
+
r.logger.Error(fmt.Errorf("Write: failed to marshal the data: %w", err))
|
|
43
43
|
r.WriteError(w, http.StatusInternalServerError, "error encoding the data")
|
|
44
44
|
return
|
|
45
45
|
}
|
|
@@ -48,7 +48,7 @@ func (r *StandardResponder[T]) Write(w http.ResponseWriter, status int, data any
|
|
|
48
48
|
w.WriteHeader(status)
|
|
49
49
|
_, err = w.Write(out)
|
|
50
50
|
if err != nil {
|
|
51
|
-
r.
|
|
51
|
+
r.logger.Fatal(fmt.Errorf("Write: failed to write a response: %w", err))
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -64,13 +64,13 @@ func (r *StandardResponder[T]) WriteErrorWithCode(w http.ResponseWriter, status
|
|
|
64
64
|
Message: message,
|
|
65
65
|
})
|
|
66
66
|
if err != nil {
|
|
67
|
-
r.
|
|
67
|
+
r.logger.Fatal(fmt.Errorf("WriteErrorWithCode: failed to marshal the error: %w", err))
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// write the data to the given writer
|
|
71
71
|
w.WriteHeader(status)
|
|
72
72
|
_, err = w.Write(out)
|
|
73
73
|
if err != nil {
|
|
74
|
-
r.
|
|
74
|
+
r.logger.Fatal(fmt.Errorf("WriteErrorWithCode: failed to write a response: %w", err))
|
|
75
75
|
}
|
|
76
76
|
}
|
package/package.json
CHANGED
package/ts/types/types.ts
CHANGED
|
@@ -35,5 +35,6 @@ export type UserServiceError = UserServiceSchemas['Error'];
|
|
|
35
35
|
// Asset Service Types
|
|
36
36
|
export type ImageType = AssetServiceSchemas['ImageType'];
|
|
37
37
|
export type UploadImagePayload = AssetServiceSchemas['UploadImagePayload'];
|
|
38
|
+
export type UploadImageResponse = AssetServiceSchemas['UploadImageResponse'];
|
|
38
39
|
export type DeleteImagePayload = AssetServiceSchemas['DeleteImagePayload'];
|
|
39
40
|
export type AssetServiceError = AssetServiceSchemas['Error'];
|