@0xtorch/csv 0.0.92 → 0.0.93

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtorch/csv",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "description": "Cryptorch CSV extension",
5
5
  "keywords": [
6
6
  "cryptorch",
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  type Action,
3
+ type ActionCrossType,
3
4
  type ActionEvidence,
4
5
  type ActionType,
5
6
  type CryptoCurrency,
@@ -106,6 +107,15 @@ export const parseRowsToActionsByParser = ({
106
107
  : stringify(
107
108
  getAllValue({ schema: generator.crossId, rows, service, fileId }),
108
109
  )
110
+ const crossType =
111
+ generator.crossType === undefined
112
+ ? undefined
113
+ : typeof generator.crossType === 'string'
114
+ ? generator.crossType
115
+ : stringify(getCellValue({ schema: generator.crossType, rows }))
116
+ if (crossType !== undefined && !isActionCrossType(crossType)) {
117
+ continue
118
+ }
109
119
  const loanId =
110
120
  generator.loanId === undefined
111
121
  ? undefined
@@ -141,7 +151,7 @@ export const parseRowsToActionsByParser = ({
141
151
  }),
142
152
  ),
143
153
  crossId,
144
- crossType: generator.crossType,
154
+ crossType,
145
155
  loanId,
146
156
  target:
147
157
  target === undefined || target.type !== 'Nft' ? undefined : target,
@@ -161,3 +171,6 @@ const isActionEvidence = (value: string): value is ActionEvidence =>
161
171
  ['contract', 'system-rule', 'user-rule', 'manual-check', 'none'].includes(
162
172
  value,
163
173
  )
174
+
175
+ const isActionCrossType = (value: string): value is ActionCrossType =>
176
+ ['start', 'middle', 'end'].includes(value)
package/schemas/parser.ts CHANGED
@@ -208,7 +208,7 @@ const generatorSchema = z.object({
208
208
  comment: allValueSchema.optional(),
209
209
  app: allValueSchema.optional(),
210
210
  crossId: allValueSchema.optional(),
211
- crossType: actionCrossTypeUnionSchema.optional(),
211
+ crossType: z.union([actionCrossTypeUnionSchema, cellValueSchema]).optional(),
212
212
  loanId: allValueSchema.optional(),
213
213
  target: assetIdSchema.optional(),
214
214
  transfers: z.array(transferComponentSchema),