@onereach/types-contacts-api 4.2.2-beta.2126.0 → 4.3.0

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