@onereach/types-contacts-api 4.3.1 → 4.3.2

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/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ src/swagger-type-mock.ts
2
+ dist
@@ -1,355 +1,287 @@
1
1
  declare function OmitType<T, K extends keyof T>(classRef: T, keys: readonly K[]): Omit<T, typeof keys[number]>;
2
2
  declare function IntersectionType<A, B>(classARef: A, classBRef: B): A & B;
3
3
  declare function PartialType<T>(classRef: T): Partial<T>;
4
- declare function PickType<T, K extends keyof T>(classRef: T, keys: readonly K[]): Pick<T, typeof keys[number]>;
5
-
6
4
  export interface BatchProcessResponseDto {
7
- id: string;
8
- created_at: Date;
9
- updated_at: Date;
10
- status: BatchProcessStatus;
11
- results: string[];
12
- messages: string[];
13
- }
14
-
15
- export enum BatchProcessStatus {
16
- pending = 'pending',
17
- success = 'success',
18
- failed = 'failed'
19
- }
20
-
5
+ id: string;
6
+ created_at: Date;
7
+ updated_at: Date;
8
+ status: BatchProcessStatus;
9
+ results: string[];
10
+ messages: string[];
11
+ }
12
+ export declare enum BatchProcessStatus {
13
+ pending = "pending",
14
+ success = "success",
15
+ failed = "failed"
16
+ }
21
17
  export type ColumnNumberValueName = 'number_values' | 'double_values';
22
- export type ColumnValueName = ColumnNumberValueName
23
- | 'string_values'
24
- | 'object_values'
25
- | 'date_values'
26
- | 'array_of_objects';
27
-
18
+ export type ColumnValueName = ColumnNumberValueName | 'string_values' | 'object_values' | 'date_values' | 'array_of_objects';
28
19
  export interface ContactListDto extends ListApiResponse {
29
- items: ContactResponseDto[];
20
+ items: ContactResponseDto[];
30
21
  }
31
-
32
22
  export interface ListApiResponse {
33
- total: number;
23
+ total: number;
34
24
  }
35
-
36
25
  export interface ContactParamsDto {
37
- contact_book?: string;
26
+ contact_book?: string;
38
27
  }
39
-
40
28
  export interface ContactRequestDto {
41
- id?: string;
42
- data: FieldValueRequestDto[];
29
+ id?: string;
30
+ data: FieldValueRequestDto[];
43
31
  }
44
-
45
32
  export interface ContactResponseDto {
46
- id: string;
47
- created_at: Date;
48
- updated_at: Date;
49
- fieldValues: Record<string, FieldValueResponseDto>;
33
+ id: string;
34
+ created_at: Date;
35
+ updated_at: Date;
36
+ fieldValues: Record<string, FieldValueResponseDto>;
50
37
  }
51
-
52
38
  export interface ContactSearchParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
53
- contact_book?: string;
54
- q?: string;
55
- filter?: string | DynamicFilterDto;
56
- contactIds?: string[];
57
- projection?: string[];
39
+ contact_book?: string;
40
+ q?: string;
41
+ filter?: string | DynamicFilterDto;
42
+ contactIds?: string[];
43
+ projection?: string[];
58
44
  }
59
-
60
45
  export interface OrderParams {
61
- order?: string;
46
+ order?: string;
62
47
  }
63
-
64
48
  export interface ListApiParams {
65
- take?: number;
66
- skip?: number;
49
+ take?: number;
50
+ skip?: number;
67
51
  }
68
-
69
52
  export interface CreateContactDto {
70
- contact_book?: string;
71
- data: FieldValueRequestDto[];
53
+ contact_book?: string;
54
+ data: FieldValueRequestDto[];
72
55
  }
73
-
74
56
  export interface CreateMultipleContactsDto {
75
- contact_book?: string;
76
- contacts: ContactRequestDto[];
57
+ contact_book?: string;
58
+ contacts: ContactRequestDto[];
77
59
  }
78
-
79
60
  export interface DeleteContactMultiParamsDto extends DeleteContactParamsDto {
80
- ids?: string[];
81
- contact_book?: string;
82
- all?: true;
61
+ ids?: string[];
62
+ contact_book?: string;
63
+ all?: true;
83
64
  }
84
-
85
65
  export interface DeleteContactParamsDto {
86
- contact_book?: string;
66
+ contact_book?: string;
87
67
  }
88
-
89
68
  export interface FindAllParamsDto extends ReturnType<typeof OmitType<ContactSearchParamsDto, 'order' | 'take' | 'skip'>> {
90
- size?: number;
91
- from?: number;
92
- orderProperty?: string;
93
- orderDirection?: OrderDirection;
69
+ size?: number;
70
+ from?: number;
71
+ orderProperty?: string;
72
+ orderDirection?: OrderDirection;
94
73
  }
95
-
96
74
  export type OrderDirection = 'asc' | 'desc';
97
- export type OrderType = { by: string; order: 'asc' | 'desc'; };
98
-
75
+ export type OrderType = {
76
+ by: string;
77
+ order: 'asc' | 'desc';
78
+ };
99
79
  export interface LinkContactMultiParamsDto {
100
- ids: string[];
101
- contact_books: string[];
80
+ ids: string[];
81
+ contact_books: string[];
102
82
  }
103
-
104
83
  export interface LinkContactParamsDto {
105
- contact_book: string;
84
+ contact_book: string;
106
85
  }
107
-
108
86
  export interface MergeContactParamsDto {
109
- contact_book: string;
110
- mergeContactId: string;
87
+ contact_book: string;
88
+ mergeContactId: string;
111
89
  }
112
-
113
90
  export interface UnlinkContactMultiParamsDto extends UnlinkContactParamsDto {
114
- ids: string[];
91
+ ids: string[];
115
92
  }
116
-
117
93
  export interface UnlinkContactParamsDto {
118
- contact_book: string;
94
+ contact_book: string;
119
95
  }
120
-
121
96
  export interface UpdateContactDto extends CreateContactDto {
122
97
  }
123
-
124
98
  export interface ContactBookDeleteParamsDto {
125
- softDelete?: boolean;
99
+ softDelete?: boolean;
126
100
  }
127
-
128
101
  export interface ContactBookFieldSchemaDto extends CreateFieldSchemaDto {
129
- id?: string;
102
+ id?: string;
130
103
  }
131
-
132
104
  export interface CreateFieldSchemaDto extends MachineNameParamDto {
133
- label: string;
134
- singular_label?: string;
135
- properties?: Record<string, string>;
136
- type: ColumnTypes;
137
- readonly?: boolean;
138
- schemaPresets?: SchemaPresetResponseDto[];
139
- }
140
-
141
- export enum ColumnTypes {
142
- string = 'string',
143
- integer = 'integer',
144
- double = 'double',
145
- date = 'date',
146
- md = 'md',
147
- 'identifier object' = 'identifier object',
148
- 'array of identifiers' = 'array of identifiers',
149
- 'array of objects' = 'array of objects',
150
- 'array of strings' = 'array of strings'
151
- }
152
-
105
+ label: string;
106
+ singular_label?: string;
107
+ properties?: Record<string, string>;
108
+ type: ColumnTypes;
109
+ readonly?: boolean;
110
+ schemaPresets?: SchemaPresetResponseDto[];
111
+ }
112
+ export declare enum ColumnTypes {
113
+ string = "string",
114
+ integer = "integer",
115
+ double = "double",
116
+ date = "date",
117
+ md = "md",
118
+ 'identifier object' = "identifier object",
119
+ 'array of identifiers' = "array of identifiers",
120
+ 'array of objects' = "array of objects",
121
+ 'array of strings' = "array of strings"
122
+ }
153
123
  export interface MachineNameParamDto {
154
- machine_name: string;
124
+ machine_name: string;
155
125
  }
156
-
157
126
  export interface ContactBookListDto extends ListApiResponse {
158
- items: ContactBookResponseDto[];
127
+ items: ContactBookResponseDto[];
159
128
  }
160
-
161
129
  export interface ContactBookParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
162
- q?: string;
130
+ q?: string;
163
131
  }
164
-
165
132
  export interface ContactBookResponseDto extends CreateContactBookDto {
166
- id: string;
167
- created_at: Date;
168
- updated_at: Date;
169
- contactsCount: number;
170
- status?: SharedBookStatus;
171
- sharedBy?: string;
172
- contactPermission: SharedBookContactPermissionResponseDto;
173
- }
174
-
133
+ id: string;
134
+ created_at: Date;
135
+ updated_at: Date;
136
+ contactsCount: number;
137
+ status?: SharedBookStatus;
138
+ sharedBy?: string;
139
+ contactPermission: SharedBookContactPermissionResponseDto;
140
+ }
175
141
  export interface SharedBookContactPermissionResponseDto extends CreateSharedBookContactPermissionDto {
176
- id: string;
142
+ id: string;
177
143
  }
178
-
179
144
  export interface CreateSharedBookContactPermissionDto {
180
- edit?: boolean;
181
- delete?: boolean;
182
- create?: boolean;
145
+ edit?: boolean;
146
+ delete?: boolean;
147
+ create?: boolean;
183
148
  }
184
-
185
149
  export interface CreateContactBookDto {
186
- id?: string;
187
- label: string;
188
- fieldSchemas: ContactBookFieldSchemaDto[];
189
- schemaPresets?: SchemaPresetResponseDto[];
150
+ id?: string;
151
+ label: string;
152
+ fieldSchemas: ContactBookFieldSchemaDto[];
153
+ schemaPresets?: SchemaPresetResponseDto[];
190
154
  }
191
-
192
155
  export interface UpdateContactBookDto extends ReturnType<typeof PartialType<CreateContactBookDto>> {
193
156
  }
194
-
195
157
  export interface CrossAccountMetaDto {
196
- id: string;
197
- created_at: Date;
198
- updated_at: Date;
199
- account_name: string;
200
- account_id: string;
201
- original_book_id: string;
202
- }
203
-
158
+ id: string;
159
+ created_at: Date;
160
+ updated_at: Date;
161
+ account_name: string;
162
+ account_id: string;
163
+ original_book_id: string;
164
+ }
204
165
  export interface MigrationStateResponseDto {
205
- state: MigrationState;
166
+ state: MigrationState;
206
167
  }
207
-
208
- export enum MigrationState {
209
- InProgress = 'InProgress',
210
- ToDo = 'ToDo',
211
- Done = 'Done'
168
+ export declare enum MigrationState {
169
+ InProgress = "InProgress",
170
+ ToDo = "ToDo",
171
+ Done = "Done"
212
172
  }
213
-
214
173
  export interface FieldSchemaDeleteParamsDto {
215
- softDelete?: boolean;
174
+ softDelete?: boolean;
216
175
  }
217
-
218
176
  export interface FieldSchemaListParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
219
- q?: string;
177
+ q?: string;
220
178
  }
221
-
222
179
  export interface FieldSchemaListDto extends ListApiResponse {
223
- items: FieldSchemaResponseDto[];
180
+ items: FieldSchemaResponseDto[];
224
181
  }
225
-
226
182
  export interface FieldSchemaReadonlyParamsDto {
227
- readonly: boolean;
228
- fields: string[];
183
+ readonly: boolean;
184
+ fields: string[];
229
185
  }
230
-
231
186
  export interface FieldSchemaResponseDto extends CreateFieldSchemaDto {
232
- id: string;
187
+ id: string;
233
188
  }
234
-
235
189
  export interface UpdateFieldSchemaDto extends ReturnType<typeof PartialType<ReturnType<typeof OmitType<CreateFieldSchemaDto, 'type' | 'machine_name' | 'readonly'>>>> {
236
190
  }
237
-
238
191
  export interface DeleteFieldValueByMachineNameDto extends ReturnType<typeof OmitType<UpsertFieldValueByMachineNameDto, 'value'>> {
239
192
  }
240
-
241
193
  export interface UpsertFieldValueByMachineNameDto {
242
- contact: string;
243
- machine_name: string;
244
- value: any;
194
+ contact: string;
195
+ machine_name: string;
196
+ value: any;
245
197
  }
246
-
247
198
  export interface FieldValueRequestDto {
248
- value: any;
249
- schemaId?: string;
250
- machine_name?: string;
251
- id?: string;
199
+ value: any;
200
+ schemaId?: string;
201
+ machine_name?: string;
202
+ id?: string;
252
203
  }
253
-
254
204
  export interface FieldValueResponseDto {
255
- id: string;
256
- value: unknown;
257
- schemaId: string;
258
- machine_name: string;
205
+ id: string;
206
+ value: unknown;
207
+ schemaId: string;
208
+ machine_name: string;
259
209
  }
260
-
261
210
  export interface ContactFilterConditionDto extends AbstractFilterCondition {
262
- contactField: 'created_at' | 'updated_at' | 'id';
211
+ contactField: 'created_at' | 'updated_at' | 'id';
263
212
  }
264
-
265
213
  export interface AbstractFilterCondition {
266
- operator: string;
267
- value: any;
214
+ operator: string;
215
+ value: any;
268
216
  }
269
-
270
217
  export interface CreateFilterDto {
271
- name: string;
272
- contact_book?: string;
273
- match_all: boolean;
274
- conditions: FieldValueFilterConditionDto[] | ContactFilterConditionDto[];
218
+ name: string;
219
+ contact_book?: string;
220
+ match_all: boolean;
221
+ conditions: FieldValueFilterConditionDto[] | ContactFilterConditionDto[];
275
222
  }
276
-
277
223
  export interface DynamicFilterDto extends ReturnType<typeof OmitType<CreateFilterDto, 'name'>> {
278
224
  }
279
-
280
225
  export interface FieldValueFilterConditionDto extends AbstractFilterCondition {
281
- machine_name: string;
282
- propertyPath?: string[];
226
+ machine_name: string;
227
+ propertyPath?: string[];
283
228
  }
284
-
285
229
  export interface FilterListParamsDto extends ListApiParams {
286
- contact_book?: string;
230
+ contact_book?: string;
287
231
  }
288
-
289
232
  export interface FilterListDto extends ListApiResponse {
290
- items: FilterResponseDto[];
233
+ items: FilterResponseDto[];
291
234
  }
292
-
293
235
  export interface FilterResponseDto extends ReturnType<typeof OmitType<CreateFilterDto, 'contact_book'>> {
294
- id: string;
295
- created_at: Date;
296
- updated_at: Date;
236
+ id: string;
237
+ created_at: Date;
238
+ updated_at: Date;
297
239
  }
298
-
299
240
  export interface UpdateFilterDto extends ReturnType<typeof PartialType<ReturnType<typeof OmitType<CreateFilterDto, 'contact_book'>>>> {
300
241
  }
301
-
302
242
  export interface CreateSchemaPresetDto {
303
- label: string;
304
- fieldSchemas?: FieldSchemaResponseDto[];
243
+ label: string;
244
+ fieldSchemas?: FieldSchemaResponseDto[];
305
245
  }
306
-
307
246
  export interface SchemaPresetListDto extends ListApiResponse {
308
- items: SchemaPresetResponseDto[];
247
+ items: SchemaPresetResponseDto[];
309
248
  }
310
-
311
249
  export interface SchemaPresetResponseDto extends CreateSchemaPresetDto {
312
- id: string;
313
- created_at: Date;
314
- updated_at: Date;
250
+ id: string;
251
+ created_at: Date;
252
+ updated_at: Date;
315
253
  }
316
-
317
254
  export interface UpdateSchemaPresetDto extends ReturnType<typeof PartialType<CreateSchemaPresetDto>> {
318
255
  }
319
-
320
256
  export interface ShareContactBookParamsDto {
321
- targetAccountId: string;
322
- custom_book_name?: string;
323
- contactPermission?: CreateSharedBookContactPermissionDto;
257
+ targetAccountId: string;
258
+ custom_book_name?: string;
259
+ contactPermission?: CreateSharedBookContactPermissionDto;
324
260
  }
325
-
326
261
  export interface SharedBookResponseDto {
327
- id: string;
328
- approved_by?: string;
329
- created_at: Date;
330
- updated_at: Date;
331
- status: SharedBookStatus;
332
- target_account: string;
333
- account_name?: string;
334
- custom_book_name?: string;
335
- contact_book: string;
336
- contactPermission: SharedBookContactPermissionResponseDto;
337
- }
338
-
339
- export enum SharedBookStatus {
340
- pending = 'pending',
341
- shared = 'shared',
342
- canceled = 'canceled',
343
- deletedFromTarget = 'deletedFromTarget',
344
- deletedFromSource = 'deletedFromSource'
345
- }
346
-
262
+ id: string;
263
+ approved_by?: string;
264
+ created_at: Date;
265
+ updated_at: Date;
266
+ status: SharedBookStatus;
267
+ target_account: string;
268
+ account_name?: string;
269
+ custom_book_name?: string;
270
+ contact_book: string;
271
+ contactPermission: SharedBookContactPermissionResponseDto;
272
+ }
273
+ export declare enum SharedBookStatus {
274
+ pending = "pending",
275
+ shared = "shared",
276
+ canceled = "canceled",
277
+ deletedFromTarget = "deletedFromTarget",
278
+ deletedFromSource = "deletedFromSource"
279
+ }
347
280
  export interface SharedBookContactPermissionListDto extends ListApiResponse {
348
- items: SharedBookContactPermissionResponseDto[];
281
+ items: SharedBookContactPermissionResponseDto[];
349
282
  }
350
-
351
283
  export interface SharedBookContactPermissionParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
352
284
  }
353
-
354
285
  export interface UpdateSharedBookContactPermissionDto extends CreateSharedBookContactPermissionDto {
355
286
  }
287
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharedBookStatus = exports.MigrationState = exports.ColumnTypes = exports.BatchProcessStatus = void 0;
4
+ var BatchProcessStatus;
5
+ (function (BatchProcessStatus) {
6
+ BatchProcessStatus["pending"] = "pending";
7
+ BatchProcessStatus["success"] = "success";
8
+ BatchProcessStatus["failed"] = "failed";
9
+ })(BatchProcessStatus = exports.BatchProcessStatus || (exports.BatchProcessStatus = {}));
10
+ var ColumnTypes;
11
+ (function (ColumnTypes) {
12
+ ColumnTypes["string"] = "string";
13
+ ColumnTypes["integer"] = "integer";
14
+ ColumnTypes["double"] = "double";
15
+ ColumnTypes["date"] = "date";
16
+ ColumnTypes["md"] = "md";
17
+ ColumnTypes["identifier object"] = "identifier object";
18
+ ColumnTypes["array of identifiers"] = "array of identifiers";
19
+ ColumnTypes["array of objects"] = "array of objects";
20
+ ColumnTypes["array of strings"] = "array of strings";
21
+ })(ColumnTypes = exports.ColumnTypes || (exports.ColumnTypes = {}));
22
+ var MigrationState;
23
+ (function (MigrationState) {
24
+ MigrationState["InProgress"] = "InProgress";
25
+ MigrationState["ToDo"] = "ToDo";
26
+ MigrationState["Done"] = "Done";
27
+ })(MigrationState = exports.MigrationState || (exports.MigrationState = {}));
28
+ var SharedBookStatus;
29
+ (function (SharedBookStatus) {
30
+ SharedBookStatus["pending"] = "pending";
31
+ SharedBookStatus["shared"] = "shared";
32
+ SharedBookStatus["canceled"] = "canceled";
33
+ SharedBookStatus["deletedFromTarget"] = "deletedFromTarget";
34
+ SharedBookStatus["deletedFromSource"] = "deletedFromSource";
35
+ })(SharedBookStatus = exports.SharedBookStatus || (exports.SharedBookStatus = {}));
@@ -0,0 +1,287 @@
1
+ declare function OmitType<T, K extends keyof T>(classRef: T, keys: readonly K[]): Omit<T, typeof keys[number]>;
2
+ declare function IntersectionType<A, B>(classARef: A, classBRef: B): A & B;
3
+ declare function PartialType<T>(classRef: T): Partial<T>;
4
+ export interface BatchProcessResponseDto {
5
+ id: string;
6
+ created_at: Date;
7
+ updated_at: Date;
8
+ status: BatchProcessStatus;
9
+ results: string[];
10
+ messages: string[];
11
+ }
12
+ export declare enum BatchProcessStatus {
13
+ pending = "pending",
14
+ success = "success",
15
+ failed = "failed"
16
+ }
17
+ export type ColumnNumberValueName = 'number_values' | 'double_values';
18
+ export type ColumnValueName = ColumnNumberValueName | 'string_values' | 'object_values' | 'date_values' | 'array_of_objects';
19
+ export interface ContactListDto extends ListApiResponse {
20
+ items: ContactResponseDto[];
21
+ }
22
+ export interface ListApiResponse {
23
+ total: number;
24
+ }
25
+ export interface ContactParamsDto {
26
+ contact_book?: string;
27
+ }
28
+ export interface ContactRequestDto {
29
+ id?: string;
30
+ data: FieldValueRequestDto[];
31
+ }
32
+ export interface ContactResponseDto {
33
+ id: string;
34
+ created_at: Date;
35
+ updated_at: Date;
36
+ fieldValues: Record<string, FieldValueResponseDto>;
37
+ }
38
+ export interface ContactSearchParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
39
+ contact_book?: string;
40
+ q?: string;
41
+ filter?: string | DynamicFilterDto;
42
+ contactIds?: string[];
43
+ projection?: string[];
44
+ }
45
+ export interface OrderParams {
46
+ order?: string;
47
+ }
48
+ export interface ListApiParams {
49
+ take?: number;
50
+ skip?: number;
51
+ }
52
+ export interface CreateContactDto {
53
+ contact_book?: string;
54
+ data: FieldValueRequestDto[];
55
+ }
56
+ export interface CreateMultipleContactsDto {
57
+ contact_book?: string;
58
+ contacts: ContactRequestDto[];
59
+ }
60
+ export interface DeleteContactMultiParamsDto extends DeleteContactParamsDto {
61
+ ids?: string[];
62
+ contact_book?: string;
63
+ all?: true;
64
+ }
65
+ export interface DeleteContactParamsDto {
66
+ contact_book?: string;
67
+ }
68
+ export interface FindAllParamsDto extends ReturnType<typeof OmitType<ContactSearchParamsDto, 'order' | 'take' | 'skip'>> {
69
+ size?: number;
70
+ from?: number;
71
+ orderProperty?: string;
72
+ orderDirection?: OrderDirection;
73
+ }
74
+ export type OrderDirection = 'asc' | 'desc';
75
+ export type OrderType = {
76
+ by: string;
77
+ order: 'asc' | 'desc';
78
+ };
79
+ export interface LinkContactMultiParamsDto {
80
+ ids: string[];
81
+ contact_books: string[];
82
+ }
83
+ export interface LinkContactParamsDto {
84
+ contact_book: string;
85
+ }
86
+ export interface MergeContactParamsDto {
87
+ contact_book: string;
88
+ mergeContactId: string;
89
+ }
90
+ export interface UnlinkContactMultiParamsDto extends UnlinkContactParamsDto {
91
+ ids: string[];
92
+ }
93
+ export interface UnlinkContactParamsDto {
94
+ contact_book: string;
95
+ }
96
+ export interface UpdateContactDto extends CreateContactDto {
97
+ }
98
+ export interface ContactBookDeleteParamsDto {
99
+ softDelete?: boolean;
100
+ }
101
+ export interface ContactBookFieldSchemaDto extends CreateFieldSchemaDto {
102
+ id?: string;
103
+ }
104
+ export interface CreateFieldSchemaDto extends MachineNameParamDto {
105
+ label: string;
106
+ singular_label?: string;
107
+ properties?: Record<string, string>;
108
+ type: ColumnTypes;
109
+ readonly?: boolean;
110
+ schemaPresets?: SchemaPresetResponseDto[];
111
+ }
112
+ export declare enum ColumnTypes {
113
+ string = "string",
114
+ integer = "integer",
115
+ double = "double",
116
+ date = "date",
117
+ md = "md",
118
+ 'identifier object' = "identifier object",
119
+ 'array of identifiers' = "array of identifiers",
120
+ 'array of objects' = "array of objects",
121
+ 'array of strings' = "array of strings"
122
+ }
123
+ export interface MachineNameParamDto {
124
+ machine_name: string;
125
+ }
126
+ export interface ContactBookListDto extends ListApiResponse {
127
+ items: ContactBookResponseDto[];
128
+ }
129
+ export interface ContactBookParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
130
+ q?: string;
131
+ }
132
+ export interface ContactBookResponseDto extends CreateContactBookDto {
133
+ id: string;
134
+ created_at: Date;
135
+ updated_at: Date;
136
+ contactsCount: number;
137
+ status?: SharedBookStatus;
138
+ sharedBy?: string;
139
+ contactPermission: SharedBookContactPermissionResponseDto;
140
+ }
141
+ export interface SharedBookContactPermissionResponseDto extends CreateSharedBookContactPermissionDto {
142
+ id: string;
143
+ }
144
+ export interface CreateSharedBookContactPermissionDto {
145
+ edit?: boolean;
146
+ delete?: boolean;
147
+ create?: boolean;
148
+ }
149
+ export interface CreateContactBookDto {
150
+ id?: string;
151
+ label: string;
152
+ fieldSchemas: ContactBookFieldSchemaDto[];
153
+ schemaPresets?: SchemaPresetResponseDto[];
154
+ }
155
+ export interface UpdateContactBookDto extends ReturnType<typeof PartialType<CreateContactBookDto>> {
156
+ }
157
+ export interface CrossAccountMetaDto {
158
+ id: string;
159
+ created_at: Date;
160
+ updated_at: Date;
161
+ account_name: string;
162
+ account_id: string;
163
+ original_book_id: string;
164
+ }
165
+ export interface MigrationStateResponseDto {
166
+ state: MigrationState;
167
+ }
168
+ export declare enum MigrationState {
169
+ InProgress = "InProgress",
170
+ ToDo = "ToDo",
171
+ Done = "Done"
172
+ }
173
+ export interface FieldSchemaDeleteParamsDto {
174
+ softDelete?: boolean;
175
+ }
176
+ export interface FieldSchemaListParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
177
+ q?: string;
178
+ }
179
+ export interface FieldSchemaListDto extends ListApiResponse {
180
+ items: FieldSchemaResponseDto[];
181
+ }
182
+ export interface FieldSchemaReadonlyParamsDto {
183
+ readonly: boolean;
184
+ fields: string[];
185
+ }
186
+ export interface FieldSchemaResponseDto extends CreateFieldSchemaDto {
187
+ id: string;
188
+ }
189
+ export interface UpdateFieldSchemaDto extends ReturnType<typeof PartialType<ReturnType<typeof OmitType<CreateFieldSchemaDto, 'type' | 'machine_name' | 'readonly'>>>> {
190
+ }
191
+ export interface DeleteFieldValueByMachineNameDto extends ReturnType<typeof OmitType<UpsertFieldValueByMachineNameDto, 'value'>> {
192
+ }
193
+ export interface UpsertFieldValueByMachineNameDto {
194
+ contact: string;
195
+ machine_name: string;
196
+ value: any;
197
+ }
198
+ export interface FieldValueRequestDto {
199
+ value: any;
200
+ schemaId?: string;
201
+ machine_name?: string;
202
+ id?: string;
203
+ }
204
+ export interface FieldValueResponseDto {
205
+ id: string;
206
+ value: unknown;
207
+ schemaId: string;
208
+ machine_name: string;
209
+ }
210
+ export interface ContactFilterConditionDto extends AbstractFilterCondition {
211
+ contactField: 'created_at' | 'updated_at' | 'id';
212
+ }
213
+ export interface AbstractFilterCondition {
214
+ operator: string;
215
+ value: any;
216
+ }
217
+ export interface CreateFilterDto {
218
+ name: string;
219
+ contact_book?: string;
220
+ match_all: boolean;
221
+ conditions: FieldValueFilterConditionDto[] | ContactFilterConditionDto[];
222
+ }
223
+ export interface DynamicFilterDto extends ReturnType<typeof OmitType<CreateFilterDto, 'name'>> {
224
+ }
225
+ export interface FieldValueFilterConditionDto extends AbstractFilterCondition {
226
+ machine_name: string;
227
+ propertyPath?: string[];
228
+ }
229
+ export interface FilterListParamsDto extends ListApiParams {
230
+ contact_book?: string;
231
+ }
232
+ export interface FilterListDto extends ListApiResponse {
233
+ items: FilterResponseDto[];
234
+ }
235
+ export interface FilterResponseDto extends ReturnType<typeof OmitType<CreateFilterDto, 'contact_book'>> {
236
+ id: string;
237
+ created_at: Date;
238
+ updated_at: Date;
239
+ }
240
+ export interface UpdateFilterDto extends ReturnType<typeof PartialType<ReturnType<typeof OmitType<CreateFilterDto, 'contact_book'>>>> {
241
+ }
242
+ export interface CreateSchemaPresetDto {
243
+ label: string;
244
+ fieldSchemas?: FieldSchemaResponseDto[];
245
+ }
246
+ export interface SchemaPresetListDto extends ListApiResponse {
247
+ items: SchemaPresetResponseDto[];
248
+ }
249
+ export interface SchemaPresetResponseDto extends CreateSchemaPresetDto {
250
+ id: string;
251
+ created_at: Date;
252
+ updated_at: Date;
253
+ }
254
+ export interface UpdateSchemaPresetDto extends ReturnType<typeof PartialType<CreateSchemaPresetDto>> {
255
+ }
256
+ export interface ShareContactBookParamsDto {
257
+ targetAccountId: string;
258
+ custom_book_name?: string;
259
+ contactPermission?: CreateSharedBookContactPermissionDto;
260
+ }
261
+ export interface SharedBookResponseDto {
262
+ id: string;
263
+ approved_by?: string;
264
+ created_at: Date;
265
+ updated_at: Date;
266
+ status: SharedBookStatus;
267
+ target_account: string;
268
+ account_name?: string;
269
+ custom_book_name?: string;
270
+ contact_book: string;
271
+ contactPermission: SharedBookContactPermissionResponseDto;
272
+ }
273
+ export declare enum SharedBookStatus {
274
+ pending = "pending",
275
+ shared = "shared",
276
+ canceled = "canceled",
277
+ deletedFromTarget = "deletedFromTarget",
278
+ deletedFromSource = "deletedFromSource"
279
+ }
280
+ export interface SharedBookContactPermissionListDto extends ListApiResponse {
281
+ items: SharedBookContactPermissionResponseDto[];
282
+ }
283
+ export interface SharedBookContactPermissionParamsDto extends ReturnType<typeof IntersectionType<OrderParams, ListApiParams>> {
284
+ }
285
+ export interface UpdateSharedBookContactPermissionDto extends CreateSharedBookContactPermissionDto {
286
+ }
287
+ export {};
@@ -0,0 +1,32 @@
1
+ export var BatchProcessStatus;
2
+ (function (BatchProcessStatus) {
3
+ BatchProcessStatus["pending"] = "pending";
4
+ BatchProcessStatus["success"] = "success";
5
+ BatchProcessStatus["failed"] = "failed";
6
+ })(BatchProcessStatus || (BatchProcessStatus = {}));
7
+ export var ColumnTypes;
8
+ (function (ColumnTypes) {
9
+ ColumnTypes["string"] = "string";
10
+ ColumnTypes["integer"] = "integer";
11
+ ColumnTypes["double"] = "double";
12
+ ColumnTypes["date"] = "date";
13
+ ColumnTypes["md"] = "md";
14
+ ColumnTypes["identifier object"] = "identifier object";
15
+ ColumnTypes["array of identifiers"] = "array of identifiers";
16
+ ColumnTypes["array of objects"] = "array of objects";
17
+ ColumnTypes["array of strings"] = "array of strings";
18
+ })(ColumnTypes || (ColumnTypes = {}));
19
+ export var MigrationState;
20
+ (function (MigrationState) {
21
+ MigrationState["InProgress"] = "InProgress";
22
+ MigrationState["ToDo"] = "ToDo";
23
+ MigrationState["Done"] = "Done";
24
+ })(MigrationState || (MigrationState = {}));
25
+ export var SharedBookStatus;
26
+ (function (SharedBookStatus) {
27
+ SharedBookStatus["pending"] = "pending";
28
+ SharedBookStatus["shared"] = "shared";
29
+ SharedBookStatus["canceled"] = "canceled";
30
+ SharedBookStatus["deletedFromTarget"] = "deletedFromTarget";
31
+ SharedBookStatus["deletedFromSource"] = "deletedFromSource";
32
+ })(SharedBookStatus || (SharedBookStatus = {}));
package/package.json CHANGED
@@ -1,19 +1,27 @@
1
1
  {
2
2
  "name": "@onereach/types-contacts-api",
3
3
  "description": "Generated types for Contacts Api",
4
- "version": "4.3.1",
4
+ "version": "4.3.2",
5
5
  "author": "OneReach.ai",
6
- "main": "./dist/index.ts",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
8
+ "types": "dist/esm/index.d.ts",
7
9
  "publishConfig": {
8
10
  "access": "public"
9
11
  },
10
12
  "scripts": {
11
- "build:types": "ts-node ./generate-types.ts"
13
+ "prebuild": "rimraf ./dist",
14
+ "build": "pnpm build:esm && pnpm build:cjs",
15
+ "build:esm": "tsc --project tsconfig.build.esm.json",
16
+ "build:cjs": "tsc --project tsconfig.build.cjs.json",
17
+ "generate": "ts-node ./src/generate-types.ts",
18
+ "build:types": "pnpm generate && pnpm build"
12
19
  },
13
20
  "devDependencies": {
14
- "@types/node": "^18.11.10",
15
- "ts-morph": "^17.0.1",
16
- "ts-node": "^10.9.1"
21
+ "@types/node": "18.11.10",
22
+ "rimraf": "5.0.1",
23
+ "ts-morph": "17.0.1",
24
+ "ts-node": "10.9.1"
17
25
  },
18
- "gitHead": "3283276ad933fcb8333d5a0cb54ddf69ea28e138"
26
+ "gitHead": "473aa3301dc0bb4f7601206c59bf79bc7915b144"
19
27
  }
@@ -13,11 +13,13 @@ import {
13
13
  TypeAliasDeclaration,
14
14
  } from 'ts-morph';
15
15
 
16
- const ROOT = path.resolve(__dirname, './');
17
- const TYPES_DIST = path.resolve(ROOT, 'dist');
16
+ const ROOT = path.resolve(__dirname, '../');
17
+ const TYPES_DIST = path.resolve(ROOT, 'tmp');
18
18
  const API_PATH = path.resolve(ROOT, '../api');
19
19
  const apiTsconfig = path.resolve(API_PATH, 'tsconfig.json');
20
20
  const typesTsconfig = path.resolve(ROOT, 'tsconfig.json');
21
+ const utilsTypes = path.resolve(__dirname, 'swagger-type-mock.ts');
22
+ const rawTypes = path.resolve(ROOT, 'tmp/index.ts');
21
23
 
22
24
  if (fs.existsSync(TYPES_DIST)) {
23
25
  fs.rmSync(TYPES_DIST, { recursive: true });
@@ -32,8 +34,8 @@ const apiProject = new Project({
32
34
  });
33
35
 
34
36
 
35
- const FILE = typesProject.createSourceFile('./dist/index.ts');
36
- const SWAGGER_MOCK = typesProject.getSourceFile('./swagger-type-mock.ts');
37
+ const FILE = typesProject.createSourceFile(rawTypes);
38
+ const SWAGGER_MOCK = typesProject.getSourceFile(utilsTypes);
37
39
 
38
40
  function generateTypes() {
39
41
  FILE.replaceWithText(SWAGGER_MOCK?.getText() || '');
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/cjs",
5
+ "module": "commonjs",
6
+ "target": "es5"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/esm",
5
+ "module": "ES6",
6
+ "target": "es6"
7
+ }
8
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../tsconfig.options.json",
3
+ "include": ["tmp"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "module": "commonjs",
7
+ "strictPropertyInitialization": false,
8
+ "emitDecoratorMetadata": true,
9
+ "experimentalDecorators": true,
10
+ "declaration": true,
11
+ "baseUrl": "./",
12
+ "outDir": "dist",
13
+ "types": ["node"]
14
+ }
15
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "extends": "../../tsconfig.options.json",
3
+ "include": ["src", "tmp"],
3
4
  "exclude": ["node_modules"],
4
5
  "compilerOptions": {
5
6
  "module": "commonjs",