@coast/service-common 1.0.6 → 1.0.8
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 +14 -8
- package/dist/models/coast-api/CoastApiRequests.d.ts +0 -70
- package/dist/models/coast-api/CoastApiRequests.js +0 -254
- package/dist/models/coast-api/WorkflowEntityGqlFields.d.ts +0 -3
- package/dist/models/coast-api/WorkflowEntityGqlFields.js +0 -14
- package/dist/models/coast-api/WorkflowTemplateGqlFields.d.ts +0 -3
- package/dist/models/coast-api/WorkflowTemplateGqlFields.js +0 -129
- package/dist/modules/coast-api/CoastApiClient.d.ts +0 -46
- package/dist/modules/coast-api/CoastApiClient.js +0 -107
- package/dist/modules/coast-api/CoastApiClientGqlError.d.ts +0 -12
- package/dist/modules/coast-api/CoastApiClientGqlError.js +0 -10
- package/dist/modules/coast-api/CoastApiModule.d.ts +0 -2
- package/dist/modules/coast-api/CoastApiModule.js +0 -28
- package/dist/modules/coast-api/coastApiClientFactory.d.ts +0 -4
- package/dist/modules/coast-api/coastApiClientFactory.js +0 -8
- package/dist/modules/logger/CoastLogger.d.ts +0 -8
- package/dist/modules/logger/CoastLogger.js +0 -6
- package/dist/modules/logger/LoggerModule.d.ts +0 -5
- package/dist/modules/logger/LoggerModule.js +0 -49
- package/dist/modules/logger/PinoLogger.d.ts +0 -13
- package/dist/modules/logger/PinoLogger.js +0 -76
- package/dist/modules/logger/SilentLogger.d.ts +0 -8
- package/dist/modules/logger/SilentLogger.js +0 -22
- package/dist/modules/trace/Trace.d.ts +0 -5
- package/dist/modules/trace/Trace.js +0 -2
- package/dist/modules/trace/TraceId.d.ts +0 -3
- package/dist/modules/trace/TraceId.js +0 -6
- package/dist/modules/trace/TraceInterceptor.d.ts +0 -8
- package/dist/modules/trace/TraceInterceptor.js +0 -30
- package/dist/modules/trace/TraceManager.d.ts +0 -9
- package/dist/modules/trace/TraceManager.js +0 -40
- package/dist/modules/trace/TraceModule.d.ts +0 -2
- package/dist/modules/trace/TraceModule.js +0 -22
- package/dist/modules/trace/Traceable.d.ts +0 -4
- package/dist/modules/trace/Traceable.js +0 -2
- package/dist/modules/utils/graphql/GqlRequestBody.d.ts +0 -8
- package/dist/modules/utils/graphql/GqlRequestBody.js +0 -2
- package/dist/modules/utils/graphql/GqlResponse.d.ts +0 -14
- package/dist/modules/utils/graphql/GqlResponse.js +0 -2
- package/dist/modules/utils/streams/Generators.d.ts +0 -5
- package/dist/modules/utils/streams/Generators.js +0 -34
- package/dist/modules/utils/streams/test/GeneratorsTest.d.ts +0 -1
- package/dist/modules/utils/streams/test/GeneratorsTest.js +0 -49
package/package.json
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coast/service-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Common service package",
|
|
5
|
-
"main": "./modules",
|
|
6
|
-
"types": "./modules",
|
|
7
5
|
"engines": {
|
|
8
6
|
"node": ">=20.0.0"
|
|
9
7
|
},
|
|
10
8
|
"exports": {
|
|
11
|
-
"./*":
|
|
9
|
+
"./*": {
|
|
10
|
+
"types": "./dist/lib/*.d.ts",
|
|
11
|
+
"import": "./dist/lib/*"
|
|
12
|
+
}
|
|
12
13
|
},
|
|
13
14
|
"typesVersions": {
|
|
14
15
|
"*": {
|
|
15
16
|
"*": [
|
|
16
|
-
"./dist/
|
|
17
|
+
"./dist/lib/*"
|
|
17
18
|
]
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
|
-
"dist",
|
|
22
|
+
"dist/lib",
|
|
23
|
+
"!*Test.*",
|
|
22
24
|
"README.md",
|
|
23
25
|
"LICENSE"
|
|
24
26
|
],
|
|
@@ -26,10 +28,10 @@
|
|
|
26
28
|
"prebuild": "rimraf dist",
|
|
27
29
|
"build": "yarn prebuild && yarn dlx @nestjs/cli build",
|
|
28
30
|
"lint": "eslint",
|
|
29
|
-
"lint:fix": "eslint --fix"
|
|
31
|
+
"lint:fix": "eslint --fix",
|
|
32
|
+
"test": "jest --config jest.config.js"
|
|
30
33
|
},
|
|
31
34
|
"dependencies": {
|
|
32
|
-
"@paradoxical-io/types": "^1.0.7",
|
|
33
35
|
"lodash": "^4.17.21",
|
|
34
36
|
"pino": "^9.6.0",
|
|
35
37
|
"superagent": "^10.1.1",
|
|
@@ -41,8 +43,12 @@
|
|
|
41
43
|
"@nestjs/cli": "^10.4.4",
|
|
42
44
|
"@nestjs/common": "^10.4.1",
|
|
43
45
|
"@nestjs/config": "^3.2.3",
|
|
46
|
+
"@nestjs/core": "^11.0.7",
|
|
47
|
+
"@nestjs/platform-express": "^11.0.7",
|
|
44
48
|
"@nestjs/schematics": "^10.1.4",
|
|
49
|
+
"@nestjs/testing": "^11.0.7",
|
|
45
50
|
"@paradoxical-io/common-test": "^1.0.7",
|
|
51
|
+
"@paradoxical-io/types": "^1.0.7",
|
|
46
52
|
"@types/jest": "^29.5.12",
|
|
47
53
|
"@types/lodash": "^4",
|
|
48
54
|
"@types/node": "^22.5.0",
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { SamlUser } from '@coast/core-api-types/auth/SamlUser';
|
|
2
|
-
import { Card } from '@coast/core-api-types/card/Card';
|
|
3
|
-
import { UpdateCard } from '@coast/core-api-types/card/UpdateCard';
|
|
4
|
-
import { Channel } from '@coast/core-api-types/channel/Channel';
|
|
5
|
-
import { ListEntitiesFormData } from '@coast/core-api-types/export/ListEntitiesFormData';
|
|
6
|
-
import { ListEntitiesFormDataResult } from '@coast/core-api-types/export/ListEntitiesFormDataResult';
|
|
7
|
-
import { CreateUserV2 } from '@coast/core-api-types/user/CreateUserV2';
|
|
8
|
-
import { UpdateUser } from '@coast/core-api-types/user/UpdateUser';
|
|
9
|
-
import { User } from '@coast/core-api-types/user/User';
|
|
10
|
-
import { CreateWorkflowAutomationEvent } from '@coast/core-api-types/workflow-automation/CreateWorkflowAutomationEvent';
|
|
11
|
-
import { AggregateNumberStats } from '@coast/core-api-types/workflow-template/entities/AggregateNumberStats';
|
|
12
|
-
import { AggregateRelatedCardQuantity } from '@coast/core-api-types/workflow-template/entities/AggregateRelatedCardQuantity';
|
|
13
|
-
import { CreateEntityAuditTrailEvent } from '@coast/core-api-types/workflow-template/entities/audit-trail/CreateEntityAuditTrailEvent';
|
|
14
|
-
import { EntityAuditTrailEvent } from '@coast/core-api-types/workflow-template/entities/audit-trail/EntityAuditTrailEvent';
|
|
15
|
-
import { CreateWorkflowEntity } from '@coast/core-api-types/workflow-template/entities/CreateWorkflowEntity';
|
|
16
|
-
import { GetWorkflowEntityResult } from '@coast/core-api-types/workflow-template/entities/GetWorkflowEntityResult';
|
|
17
|
-
import { UpdateWorkflowEntity } from '@coast/core-api-types/workflow-template/entities/UpdateWorkflowEntity';
|
|
18
|
-
import { UpdateWorkflowTemplate } from '@coast/core-api-types/workflow-template/UpdateWorkflowTemplate';
|
|
19
|
-
import { WorkflowTemplate } from '@coast/core-api-types/workflow-template/WorkflowTemplate';
|
|
20
|
-
import { GqlRequestBody } from '../../modules/utils/graphql/GqlRequestBody';
|
|
21
|
-
export declare class CoastApiRequests {
|
|
22
|
-
static aggregateRelatedCardQuantityStats(filter: AggregateRelatedCardQuantity): GqlRequestBody<AggregateRelatedCardQuantity, {
|
|
23
|
-
aggregateRelatedCardQuantityStats: AggregateNumberStats;
|
|
24
|
-
}>;
|
|
25
|
-
static createEntityAuditTrailEvent(createEntityAuditTrailEvent: CreateEntityAuditTrailEvent): GqlRequestBody<CreateEntityAuditTrailEvent, {
|
|
26
|
-
createEntityAuditTrailEvent: EntityAuditTrailEvent;
|
|
27
|
-
}>;
|
|
28
|
-
static createUsers(createUsers: CreateUserV2[]): GqlRequestBody<CreateUserV2[], {
|
|
29
|
-
createUserV2: User[];
|
|
30
|
-
}>;
|
|
31
|
-
static createWorkflowAutomationEvent(createWorkflowAutomationEvent: CreateWorkflowAutomationEvent): GqlRequestBody<CreateWorkflowAutomationEvent, {
|
|
32
|
-
createWorkflowAutomationEvent: boolean;
|
|
33
|
-
}>;
|
|
34
|
-
static createWorkflowEntity(createWorkflowEntity: CreateWorkflowEntity): GqlRequestBody<CreateWorkflowEntity, {
|
|
35
|
-
createWorkflowEntity: GetWorkflowEntityResult;
|
|
36
|
-
}>;
|
|
37
|
-
static getCard(cardId: string): GqlRequestBody<string, {
|
|
38
|
-
getCard: Card;
|
|
39
|
-
}>;
|
|
40
|
-
static getChannel(channelId: number): GqlRequestBody<number, {
|
|
41
|
-
getChannel: Channel;
|
|
42
|
-
}>;
|
|
43
|
-
static getSamlUser(email: string, samlOrganizationId: string): GqlRequestBody<{
|
|
44
|
-
email: string;
|
|
45
|
-
samlOrganizationId: string;
|
|
46
|
-
}, {
|
|
47
|
-
getSamlUser: SamlUser;
|
|
48
|
-
}>;
|
|
49
|
-
static getWorkflowEntity(workflowEntityId: string): GqlRequestBody<string, {
|
|
50
|
-
getWorkflowEntity: GetWorkflowEntityResult;
|
|
51
|
-
}>;
|
|
52
|
-
static getWorkflowTemplate(workflowTemplateId: string): GqlRequestBody<string, {
|
|
53
|
-
getWorkflowTemplate: WorkflowTemplate;
|
|
54
|
-
}>;
|
|
55
|
-
static listWorkflowEntitiesFormData(filter: ListEntitiesFormData): GqlRequestBody<ListEntitiesFormData, {
|
|
56
|
-
listEntitiesFormData: ListEntitiesFormDataResult;
|
|
57
|
-
}>;
|
|
58
|
-
static updateCard(card: UpdateCard): GqlRequestBody<UpdateCard, {
|
|
59
|
-
updateCard: Card;
|
|
60
|
-
}>;
|
|
61
|
-
static updateUser(updateUser: UpdateUser): GqlRequestBody<UpdateUser, {
|
|
62
|
-
updateUserV2: User;
|
|
63
|
-
}>;
|
|
64
|
-
static updateWorkflowEntity(updateWorkflowEntity: UpdateWorkflowEntity): GqlRequestBody<UpdateWorkflowEntity, {
|
|
65
|
-
updateWorkflowEntity: GetWorkflowEntityResult;
|
|
66
|
-
}>;
|
|
67
|
-
static updateWorkflowTemplate(updateWorkflowTemplate: UpdateWorkflowTemplate): GqlRequestBody<UpdateWorkflowTemplate, {
|
|
68
|
-
updateWorkflowTemplate: WorkflowTemplate;
|
|
69
|
-
}>;
|
|
70
|
-
}
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoastApiRequests = void 0;
|
|
4
|
-
const WorkflowEntityGqlFields_1 = require("./WorkflowEntityGqlFields");
|
|
5
|
-
const WorkflowTemplateGqlFields_1 = require("./WorkflowTemplateGqlFields");
|
|
6
|
-
class CoastApiRequests {
|
|
7
|
-
static aggregateRelatedCardQuantityStats(filter) {
|
|
8
|
-
return {
|
|
9
|
-
query: `
|
|
10
|
-
query ($input: AggregateRelatedCardQuantity!) {
|
|
11
|
-
aggregateRelatedCardQuantityStats(input: $input)
|
|
12
|
-
}
|
|
13
|
-
`,
|
|
14
|
-
variables: { input: filter },
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
static createEntityAuditTrailEvent(createEntityAuditTrailEvent) {
|
|
18
|
-
return {
|
|
19
|
-
query: `
|
|
20
|
-
mutation ($input: CreateEntityAuditTrailEvent!) {
|
|
21
|
-
createEntityAuditTrailEvent(input: $input) { id }
|
|
22
|
-
}
|
|
23
|
-
`,
|
|
24
|
-
variables: { input: createEntityAuditTrailEvent },
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
static createUsers(createUsers) {
|
|
28
|
-
return {
|
|
29
|
-
query: `
|
|
30
|
-
mutation ($input: [CreateUserV2!]!) {
|
|
31
|
-
createUsersV2(input: $input) {
|
|
32
|
-
id
|
|
33
|
-
firstName
|
|
34
|
-
lastName
|
|
35
|
-
email
|
|
36
|
-
phoneNumber
|
|
37
|
-
role
|
|
38
|
-
createdAt
|
|
39
|
-
updatedAt
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`,
|
|
43
|
-
variables: { input: createUsers },
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
static createWorkflowAutomationEvent(createWorkflowAutomationEvent) {
|
|
47
|
-
return {
|
|
48
|
-
query: `
|
|
49
|
-
mutation ($input: CreateWorkflowAutomationEvent!) {
|
|
50
|
-
createWorkflowAutomationEvent(input: $input)
|
|
51
|
-
}
|
|
52
|
-
`,
|
|
53
|
-
variables: { input: createWorkflowAutomationEvent },
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
static createWorkflowEntity(createWorkflowEntity) {
|
|
57
|
-
return {
|
|
58
|
-
query: `
|
|
59
|
-
mutation ($input: CreateWorkflowEntity!) {
|
|
60
|
-
createWorkflowEntity(input: $input) {
|
|
61
|
-
entity {
|
|
62
|
-
id
|
|
63
|
-
workflowTemplateId
|
|
64
|
-
fields
|
|
65
|
-
}
|
|
66
|
-
refs {
|
|
67
|
-
workflowEntityRefs {
|
|
68
|
-
id
|
|
69
|
-
}
|
|
70
|
-
personRefs {
|
|
71
|
-
id
|
|
72
|
-
}
|
|
73
|
-
workflowTemplateRefs {
|
|
74
|
-
id
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`,
|
|
80
|
-
variables: { input: createWorkflowEntity },
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
static getCard(cardId) {
|
|
84
|
-
return {
|
|
85
|
-
query: `
|
|
86
|
-
query ($id: UUID!) {
|
|
87
|
-
getCard(id: $id) {
|
|
88
|
-
id
|
|
89
|
-
fields
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`,
|
|
93
|
-
variables: { id: cardId },
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
static getChannel(channelId) {
|
|
97
|
-
return {
|
|
98
|
-
query: `
|
|
99
|
-
query ($id: Int!) {
|
|
100
|
-
getChannel(id: $id) {
|
|
101
|
-
id
|
|
102
|
-
name
|
|
103
|
-
slug
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
`,
|
|
107
|
-
variables: { id: channelId },
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
static getSamlUser(email, samlOrganizationId) {
|
|
111
|
-
return {
|
|
112
|
-
query: `
|
|
113
|
-
query ($input: GetSamlUser!) {
|
|
114
|
-
getSamlUser(input: $input) {
|
|
115
|
-
id
|
|
116
|
-
email
|
|
117
|
-
businessId
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
`,
|
|
121
|
-
variables: { input: { email, samlOrganizationId } },
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
static getWorkflowEntity(workflowEntityId) {
|
|
125
|
-
return {
|
|
126
|
-
query: `
|
|
127
|
-
query ($id: UUID!) {
|
|
128
|
-
getWorkflowEntity(id: $id) {
|
|
129
|
-
${WorkflowEntityGqlFields_1.WorkflowEntityGqlFields.fields}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`,
|
|
133
|
-
variables: { id: workflowEntityId },
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
static getWorkflowTemplate(workflowTemplateId) {
|
|
137
|
-
return {
|
|
138
|
-
query: `
|
|
139
|
-
query ($id: UUID!) {
|
|
140
|
-
getWorkflowTemplate(id: $id) {
|
|
141
|
-
components {
|
|
142
|
-
${WorkflowTemplateGqlFields_1.WorkflowTemplateGqlFields.componentFields}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
`,
|
|
147
|
-
variables: { id: workflowTemplateId },
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
static listWorkflowEntitiesFormData(filter) {
|
|
151
|
-
return {
|
|
152
|
-
query: `
|
|
153
|
-
query ($input: ListEntitiesFormData!) {
|
|
154
|
-
listEntitiesFormData(input: $input) {
|
|
155
|
-
hasMore
|
|
156
|
-
totalResults
|
|
157
|
-
exports {
|
|
158
|
-
type
|
|
159
|
-
title
|
|
160
|
-
targetFormat
|
|
161
|
-
data {
|
|
162
|
-
... on ComponentDataExport {
|
|
163
|
-
label
|
|
164
|
-
value
|
|
165
|
-
imageUrls
|
|
166
|
-
type
|
|
167
|
-
}
|
|
168
|
-
... on SubformDataExport {
|
|
169
|
-
type
|
|
170
|
-
title
|
|
171
|
-
businessName
|
|
172
|
-
data {
|
|
173
|
-
... on ComponentDataExport {
|
|
174
|
-
label
|
|
175
|
-
value
|
|
176
|
-
imageUrls
|
|
177
|
-
type
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
businessName
|
|
183
|
-
url
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
`,
|
|
188
|
-
variables: { input: filter },
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
static updateCard(card) {
|
|
192
|
-
return {
|
|
193
|
-
query: `
|
|
194
|
-
mutation ($input: UpdateCard!) {
|
|
195
|
-
updateCard(input: $input) {
|
|
196
|
-
id
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
`,
|
|
200
|
-
variables: { input: card },
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
static updateUser(updateUser) {
|
|
204
|
-
return {
|
|
205
|
-
query: `
|
|
206
|
-
mutation ($input: UpdateUser!) {
|
|
207
|
-
updateUserV2(input: $input) {
|
|
208
|
-
id
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
`,
|
|
212
|
-
variables: { input: updateUser },
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
static updateWorkflowEntity(updateWorkflowEntity) {
|
|
216
|
-
return {
|
|
217
|
-
query: `
|
|
218
|
-
mutation ($input: UpdateWorkflowEntity!) {
|
|
219
|
-
updateWorkflowEntity(input: $input) {
|
|
220
|
-
entity {
|
|
221
|
-
id
|
|
222
|
-
fields
|
|
223
|
-
}
|
|
224
|
-
refs {
|
|
225
|
-
workflowEntityRefs {
|
|
226
|
-
id
|
|
227
|
-
}
|
|
228
|
-
personRefs {
|
|
229
|
-
id
|
|
230
|
-
}
|
|
231
|
-
workflowTemplateRefs {
|
|
232
|
-
id
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
`,
|
|
238
|
-
variables: { input: updateWorkflowEntity },
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
static updateWorkflowTemplate(updateWorkflowTemplate) {
|
|
242
|
-
return {
|
|
243
|
-
query: `
|
|
244
|
-
mutation ($input: UpdateWorkflowTemplate!) {
|
|
245
|
-
updateWorkflowTemplate(input: $input) {
|
|
246
|
-
id
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
`,
|
|
250
|
-
variables: { input: updateWorkflowTemplate },
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
exports.CoastApiRequests = CoastApiRequests;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowEntityGqlFields = void 0;
|
|
4
|
-
const WorkflowTemplateGqlFields_1 = require("./WorkflowTemplateGqlFields");
|
|
5
|
-
exports.WorkflowEntityGqlFields = {
|
|
6
|
-
fields: `
|
|
7
|
-
entity { id workflowTemplateId fields }
|
|
8
|
-
refs {
|
|
9
|
-
workflowEntityRefs { id workflowTemplateId fields }
|
|
10
|
-
personRefs { id }
|
|
11
|
-
workflowTemplateRefs { id components { ${WorkflowTemplateGqlFields_1.WorkflowTemplateGqlFields.componentFields} } }
|
|
12
|
-
}
|
|
13
|
-
`,
|
|
14
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowTemplateGqlFields = void 0;
|
|
4
|
-
const inputComponentFields = [
|
|
5
|
-
'id',
|
|
6
|
-
'type',
|
|
7
|
-
'label',
|
|
8
|
-
'placeholder',
|
|
9
|
-
'readonly',
|
|
10
|
-
'required',
|
|
11
|
-
'isFilterable',
|
|
12
|
-
'isSortable',
|
|
13
|
-
'isServerManaged',
|
|
14
|
-
];
|
|
15
|
-
exports.WorkflowTemplateGqlFields = {
|
|
16
|
-
componentFields: `
|
|
17
|
-
... on AddressComponent {
|
|
18
|
-
${inputComponentFields.join(' ')}
|
|
19
|
-
}
|
|
20
|
-
... on AuditCheckboxComponent {
|
|
21
|
-
${inputComponentFields.join(' ')}
|
|
22
|
-
}
|
|
23
|
-
... on AuditTagComponent {
|
|
24
|
-
${inputComponentFields.join(' ')}
|
|
25
|
-
multiselect
|
|
26
|
-
options { label value archived }
|
|
27
|
-
}
|
|
28
|
-
... on AuditTextComponent {
|
|
29
|
-
${inputComponentFields.join(' ')}
|
|
30
|
-
maxlength
|
|
31
|
-
multiline
|
|
32
|
-
}
|
|
33
|
-
... on CombinedTagsComponent {
|
|
34
|
-
id
|
|
35
|
-
type
|
|
36
|
-
label
|
|
37
|
-
icon
|
|
38
|
-
locked
|
|
39
|
-
isServerManaged
|
|
40
|
-
componentIds
|
|
41
|
-
}
|
|
42
|
-
... on DateComponent {
|
|
43
|
-
${inputComponentFields.join(' ')}
|
|
44
|
-
}
|
|
45
|
-
... on EmailComponent {
|
|
46
|
-
${inputComponentFields.join(' ')}
|
|
47
|
-
default { value }
|
|
48
|
-
}
|
|
49
|
-
... on FileComponent {
|
|
50
|
-
${inputComponentFields.join(' ')}
|
|
51
|
-
acceptedContentTypes
|
|
52
|
-
}
|
|
53
|
-
... on GeolocationComponent {
|
|
54
|
-
${inputComponentFields.join(' ')}
|
|
55
|
-
}
|
|
56
|
-
... on InputButtonComponent {
|
|
57
|
-
id
|
|
58
|
-
type
|
|
59
|
-
locked
|
|
60
|
-
isServerManaged
|
|
61
|
-
buttonText
|
|
62
|
-
inputComponentId
|
|
63
|
-
}
|
|
64
|
-
... on NumberComponent {
|
|
65
|
-
${inputComponentFields.join(' ')}
|
|
66
|
-
format
|
|
67
|
-
}
|
|
68
|
-
... on PersonComponent {
|
|
69
|
-
${inputComponentFields.join(' ')}
|
|
70
|
-
default { token userIds }
|
|
71
|
-
}
|
|
72
|
-
... on RelatedCardComponent {
|
|
73
|
-
${inputComponentFields.join(' ')}
|
|
74
|
-
workflowTemplateId
|
|
75
|
-
default { cardIds }
|
|
76
|
-
listDefault {
|
|
77
|
-
sortByComponents { componentId direction }
|
|
78
|
-
filterByComponents {
|
|
79
|
-
componentId
|
|
80
|
-
value {
|
|
81
|
-
containsCurrentUser { value }
|
|
82
|
-
containsNumber { values }
|
|
83
|
-
containsString { values }
|
|
84
|
-
dateRange { before after }
|
|
85
|
-
dateTokenIs { value }
|
|
86
|
-
isEmpty { value }
|
|
87
|
-
numberIs { value }
|
|
88
|
-
stringWildcard { value }
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
omniSearchQuery
|
|
92
|
-
limit
|
|
93
|
-
offset
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
... on RelatedCardLookupComponent {
|
|
97
|
-
${inputComponentFields.join(' ')}
|
|
98
|
-
relatedCardComponentId
|
|
99
|
-
lookupWorkflowTemplateId
|
|
100
|
-
lookupComponentId
|
|
101
|
-
}
|
|
102
|
-
... on SignatureComponent {
|
|
103
|
-
${inputComponentFields.join(' ')}
|
|
104
|
-
}
|
|
105
|
-
... on StaticTextComponent {
|
|
106
|
-
id type text
|
|
107
|
-
}
|
|
108
|
-
... on SubformComponent {
|
|
109
|
-
${inputComponentFields.join(' ')}
|
|
110
|
-
workflowTemplateIds
|
|
111
|
-
default { workflowTemplateId }
|
|
112
|
-
}
|
|
113
|
-
... on TagComponent {
|
|
114
|
-
${inputComponentFields.join(' ')}
|
|
115
|
-
multiselect
|
|
116
|
-
options { label value archived }
|
|
117
|
-
default { value }
|
|
118
|
-
}
|
|
119
|
-
... on TextComponent {
|
|
120
|
-
${inputComponentFields.join(' ')}
|
|
121
|
-
maxlength
|
|
122
|
-
multiline
|
|
123
|
-
default { text }
|
|
124
|
-
}
|
|
125
|
-
... on TodoComponent {
|
|
126
|
-
${inputComponentFields.join(' ')}
|
|
127
|
-
}
|
|
128
|
-
`,
|
|
129
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { SamlUser } from '@coast/core-api-types/auth/SamlUser';
|
|
2
|
-
import { AutomationId } from '@coast/core-api-types/automations/AutomationId';
|
|
3
|
-
import { BusinessId } from '@coast/core-api-types/business/BusinessId';
|
|
4
|
-
import { Card } from '@coast/core-api-types/card/Card';
|
|
5
|
-
import { UpdateCard } from '@coast/core-api-types/card/UpdateCard';
|
|
6
|
-
import { Channel } from '@coast/core-api-types/channel/Channel';
|
|
7
|
-
import { ListEntitiesFormData } from '@coast/core-api-types/export/ListEntitiesFormData';
|
|
8
|
-
import { ListEntitiesFormDataResult } from '@coast/core-api-types/export/ListEntitiesFormDataResult';
|
|
9
|
-
import { FileDetails } from '@coast/core-api-types/file-upload/FileDetails';
|
|
10
|
-
import { CreateUserV2 } from '@coast/core-api-types/user/CreateUserV2';
|
|
11
|
-
import { UpdateUser } from '@coast/core-api-types/user/UpdateUser';
|
|
12
|
-
import { User } from '@coast/core-api-types/user/User';
|
|
13
|
-
import { CreateWorkflowAutomationEvent } from '@coast/core-api-types/workflow-automation/CreateWorkflowAutomationEvent';
|
|
14
|
-
import { AggregateNumberStats } from '@coast/core-api-types/workflow-template/entities/AggregateNumberStats';
|
|
15
|
-
import { AggregateRelatedCardQuantity } from '@coast/core-api-types/workflow-template/entities/AggregateRelatedCardQuantity';
|
|
16
|
-
import { CreateEntityAuditTrailEvent } from '@coast/core-api-types/workflow-template/entities/audit-trail/CreateEntityAuditTrailEvent';
|
|
17
|
-
import { EntityAuditTrailEvent } from '@coast/core-api-types/workflow-template/entities/audit-trail/EntityAuditTrailEvent';
|
|
18
|
-
import { CreateWorkflowEntity } from '@coast/core-api-types/workflow-template/entities/CreateWorkflowEntity';
|
|
19
|
-
import { GetWorkflowEntityResult } from '@coast/core-api-types/workflow-template/entities/GetWorkflowEntityResult';
|
|
20
|
-
import { UpdateWorkflowEntity } from '@coast/core-api-types/workflow-template/entities/UpdateWorkflowEntity';
|
|
21
|
-
import { UpdateWorkflowTemplate } from '@coast/core-api-types/workflow-template/UpdateWorkflowTemplate';
|
|
22
|
-
import { WorkflowTemplate } from '@coast/core-api-types/workflow-template/WorkflowTemplate';
|
|
23
|
-
import { CoastLogger } from '../logger/CoastLogger';
|
|
24
|
-
export declare class CoastApiClient {
|
|
25
|
-
private readonly coastApiEndpoint;
|
|
26
|
-
private readonly coastApiAuthToken;
|
|
27
|
-
private readonly logger;
|
|
28
|
-
constructor(coastApiEndpoint: string, coastApiAuthToken: string, logger: CoastLogger);
|
|
29
|
-
aggregateRelatedCardQuantityStats(businessId: BusinessId, aggregate: AggregateRelatedCardQuantity): Promise<AggregateNumberStats>;
|
|
30
|
-
createEntityAuditTrailEvent(businessId: BusinessId, createEntityAuditTrailEvent: CreateEntityAuditTrailEvent): Promise<EntityAuditTrailEvent>;
|
|
31
|
-
createUsers(createUsers: CreateUserV2[], businessId: BusinessId): Promise<User[] | undefined>;
|
|
32
|
-
createWorkflowAutomationEvent(businessId: BusinessId, createWorkflowAutomationEvent: CreateWorkflowAutomationEvent): Promise<boolean>;
|
|
33
|
-
createWorkflowEntity(businessId: BusinessId, sourceAutomationId: AutomationId, createWorkflowEntity: CreateWorkflowEntity): Promise<GetWorkflowEntityResult>;
|
|
34
|
-
getCard(businessId: BusinessId, cardId: string): Promise<Card | null>;
|
|
35
|
-
getChannel(businessId: BusinessId, channelId: number): Promise<Channel>;
|
|
36
|
-
getFileDetails(): Promise<FileDetails>;
|
|
37
|
-
getSamlUser(businessId: BusinessId, email: string, samlOrganizationId: string): Promise<SamlUser>;
|
|
38
|
-
getWorkflowEntity(businessId: BusinessId, id: string): Promise<GetWorkflowEntityResult>;
|
|
39
|
-
getWorkflowTemplate(businessId: BusinessId, workflowTemplateId: string): Promise<WorkflowTemplate>;
|
|
40
|
-
listWorkflowEntitiesFormData(businessId: BusinessId, filter: ListEntitiesFormData): Promise<ListEntitiesFormDataResult>;
|
|
41
|
-
updateCard(businessId: BusinessId, updateCard: UpdateCard): Promise<Card>;
|
|
42
|
-
updateUser(businessId: BusinessId, updateUser: UpdateUser): Promise<User>;
|
|
43
|
-
updateWorkflowEntity(businessId: BusinessId, sourceAutomationId: AutomationId, updateWorkflowEntity: UpdateWorkflowEntity): Promise<GetWorkflowEntityResult>;
|
|
44
|
-
updateWorkflowTemplate(businessId: BusinessId, updateWorkflowTemplate: UpdateWorkflowTemplate): Promise<WorkflowTemplate>;
|
|
45
|
-
private execute;
|
|
46
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CoastApiClient = void 0;
|
|
7
|
-
const HeaderKeys_1 = require("@coast/core-api-types/application/HeaderKeys");
|
|
8
|
-
const common_1 = require("@nestjs/common");
|
|
9
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
const superagent_1 = __importDefault(require("superagent"));
|
|
11
|
-
const CoastApiRequests_1 = require("../../models/coast-api/CoastApiRequests");
|
|
12
|
-
const CoastApiClientGqlError_1 = require("./CoastApiClientGqlError");
|
|
13
|
-
class CoastApiClient {
|
|
14
|
-
constructor(coastApiEndpoint, coastApiAuthToken, logger) {
|
|
15
|
-
this.coastApiEndpoint = coastApiEndpoint;
|
|
16
|
-
this.coastApiAuthToken = coastApiAuthToken;
|
|
17
|
-
this.logger = logger;
|
|
18
|
-
}
|
|
19
|
-
async aggregateRelatedCardQuantityStats(businessId, aggregate) {
|
|
20
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.aggregateRelatedCardQuantityStats(aggregate));
|
|
21
|
-
return response.body.data.aggregateRelatedCardQuantityStats;
|
|
22
|
-
}
|
|
23
|
-
async createEntityAuditTrailEvent(businessId, createEntityAuditTrailEvent) {
|
|
24
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.createEntityAuditTrailEvent(createEntityAuditTrailEvent));
|
|
25
|
-
return response.body.data.createEntityAuditTrailEvent;
|
|
26
|
-
}
|
|
27
|
-
async createUsers(createUsers, businessId) {
|
|
28
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.createUsers(createUsers));
|
|
29
|
-
return response.body.data.createUserV2;
|
|
30
|
-
}
|
|
31
|
-
async createWorkflowAutomationEvent(businessId, createWorkflowAutomationEvent) {
|
|
32
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.createWorkflowAutomationEvent(createWorkflowAutomationEvent), {
|
|
33
|
-
sourceAutomationId: createWorkflowAutomationEvent.context?.sourceAutomationId,
|
|
34
|
-
});
|
|
35
|
-
return response.body.data.createWorkflowAutomationEvent;
|
|
36
|
-
}
|
|
37
|
-
async createWorkflowEntity(businessId, sourceAutomationId, createWorkflowEntity) {
|
|
38
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.createWorkflowEntity(createWorkflowEntity), {
|
|
39
|
-
sourceAutomationId,
|
|
40
|
-
});
|
|
41
|
-
return response.body.data.createWorkflowEntity;
|
|
42
|
-
}
|
|
43
|
-
async getCard(businessId, cardId) {
|
|
44
|
-
try {
|
|
45
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.getCard(cardId));
|
|
46
|
-
return response.body.data.getCard;
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async getChannel(businessId, channelId) {
|
|
53
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.getChannel(channelId));
|
|
54
|
-
return response.body.data.getChannel;
|
|
55
|
-
}
|
|
56
|
-
async getFileDetails() {
|
|
57
|
-
throw new common_1.NotImplementedException();
|
|
58
|
-
}
|
|
59
|
-
async getSamlUser(businessId, email, samlOrganizationId) {
|
|
60
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.getSamlUser(email, samlOrganizationId));
|
|
61
|
-
return response.body.data.getSamlUser;
|
|
62
|
-
}
|
|
63
|
-
async getWorkflowEntity(businessId, id) {
|
|
64
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.getWorkflowEntity(id));
|
|
65
|
-
return response.body.data.getWorkflowEntity;
|
|
66
|
-
}
|
|
67
|
-
async getWorkflowTemplate(businessId, workflowTemplateId) {
|
|
68
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.getWorkflowTemplate(workflowTemplateId));
|
|
69
|
-
return response.body.data.getWorkflowTemplate;
|
|
70
|
-
}
|
|
71
|
-
async listWorkflowEntitiesFormData(businessId, filter) {
|
|
72
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.listWorkflowEntitiesFormData(filter));
|
|
73
|
-
return response.body.data.listEntitiesFormData;
|
|
74
|
-
}
|
|
75
|
-
async updateCard(businessId, updateCard) {
|
|
76
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.updateCard(updateCard));
|
|
77
|
-
return response.body.data.updateCard;
|
|
78
|
-
}
|
|
79
|
-
async updateUser(businessId, updateUser) {
|
|
80
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.updateUser(updateUser));
|
|
81
|
-
return response.body.data.updateUserV2;
|
|
82
|
-
}
|
|
83
|
-
async updateWorkflowEntity(businessId, sourceAutomationId, updateWorkflowEntity) {
|
|
84
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.updateWorkflowEntity(updateWorkflowEntity), {
|
|
85
|
-
sourceAutomationId,
|
|
86
|
-
});
|
|
87
|
-
return response.body.data.updateWorkflowEntity;
|
|
88
|
-
}
|
|
89
|
-
async updateWorkflowTemplate(businessId, updateWorkflowTemplate) {
|
|
90
|
-
const response = await this.execute(businessId, CoastApiRequests_1.CoastApiRequests.updateWorkflowTemplate(updateWorkflowTemplate));
|
|
91
|
-
return response.body.data.updateWorkflowTemplate;
|
|
92
|
-
}
|
|
93
|
-
async execute(businessId, query, options = {}) {
|
|
94
|
-
const request = superagent_1.default.post(this.coastApiEndpoint).set(HeaderKeys_1.HeaderKeys.AUTHORIZATION, this.coastApiAuthToken);
|
|
95
|
-
request.set(HeaderKeys_1.HeaderKeys.BUSINESS_ID, businessId.toString());
|
|
96
|
-
if (!lodash_1.default.isNil(options?.sourceAutomationId)) {
|
|
97
|
-
request.set(HeaderKeys_1.HeaderKeys.SOURCE_AUTOMATION_ID, options.sourceAutomationId);
|
|
98
|
-
}
|
|
99
|
-
const response = await request.send(query).retry();
|
|
100
|
-
if (!lodash_1.default.isNil(response.body.errors)) {
|
|
101
|
-
this.logger.error({ errors: response.body.errors, firstError: response.body.errors[0] });
|
|
102
|
-
throw new CoastApiClientGqlError_1.CoastClientGqlError('Error in CoastClient', response.body.errors);
|
|
103
|
-
}
|
|
104
|
-
return response;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.CoastApiClient = CoastApiClient;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface GqlError {
|
|
2
|
-
extensions: {
|
|
3
|
-
code: number;
|
|
4
|
-
};
|
|
5
|
-
message: string;
|
|
6
|
-
path: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare class CoastClientGqlError extends Error {
|
|
9
|
-
readonly details: GqlError[];
|
|
10
|
-
constructor(message: string, details: GqlError[]);
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoastClientGqlError = void 0;
|
|
4
|
-
class CoastClientGqlError extends Error {
|
|
5
|
-
constructor(message, details) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.details = details;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CoastClientGqlError = CoastClientGqlError;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CoastApiModule = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const config_1 = require("@nestjs/config");
|
|
12
|
-
const CoastLogger_1 = require("../logger/CoastLogger");
|
|
13
|
-
const CoastApiClient_1 = require("./CoastApiClient");
|
|
14
|
-
const coastApiClientFactory_1 = require("./coastApiClientFactory");
|
|
15
|
-
const coastApiProvider = {
|
|
16
|
-
inject: [config_1.ConfigService, CoastLogger_1.CoastLogger],
|
|
17
|
-
provide: CoastApiClient_1.CoastApiClient,
|
|
18
|
-
useFactory: coastApiClientFactory_1.coastApiClientFactory,
|
|
19
|
-
};
|
|
20
|
-
let CoastApiModule = class CoastApiModule {
|
|
21
|
-
};
|
|
22
|
-
exports.CoastApiModule = CoastApiModule;
|
|
23
|
-
exports.CoastApiModule = CoastApiModule = __decorate([
|
|
24
|
-
(0, common_1.Module)({
|
|
25
|
-
exports: [CoastApiClient_1.CoastApiClient],
|
|
26
|
-
providers: [coastApiProvider],
|
|
27
|
-
})
|
|
28
|
-
], CoastApiModule);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.coastApiClientFactory = void 0;
|
|
4
|
-
const CoastApiClient_1 = require("./CoastApiClient");
|
|
5
|
-
const coastApiClientFactory = (configService, logger) => {
|
|
6
|
-
return new CoastApiClient_1.CoastApiClient(configService.getOrThrow('COAST_API_ENDPOINT'), configService.getOrThrow('COAST_API_AUTH_TOKEN'), logger);
|
|
7
|
-
};
|
|
8
|
-
exports.coastApiClientFactory = coastApiClientFactory;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LoggerService } from '@nestjs/common';
|
|
2
|
-
export declare abstract class CoastLogger implements LoggerService {
|
|
3
|
-
abstract debug(message: unknown): void;
|
|
4
|
-
abstract error(message: unknown, trace?: string): void;
|
|
5
|
-
abstract log(message: unknown): void;
|
|
6
|
-
abstract verbose(message: unknown): void;
|
|
7
|
-
abstract warn(message: unknown): void;
|
|
8
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var LoggerModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.LoggerModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const config_1 = require("@nestjs/config");
|
|
13
|
-
const TraceManager_1 = require("../trace/TraceManager");
|
|
14
|
-
const TraceModule_1 = require("../trace/TraceModule");
|
|
15
|
-
const CoastLogger_1 = require("./CoastLogger");
|
|
16
|
-
const PinoLogger_1 = require("./PinoLogger");
|
|
17
|
-
const SilentLogger_1 = require("./SilentLogger");
|
|
18
|
-
let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
19
|
-
static disabled() {
|
|
20
|
-
const coastLogger = {
|
|
21
|
-
provide: CoastLogger_1.CoastLogger,
|
|
22
|
-
useValue: new SilentLogger_1.SilentLogger(),
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
exports: [coastLogger],
|
|
26
|
-
imports: [config_1.ConfigModule],
|
|
27
|
-
module: LoggerModule_1,
|
|
28
|
-
providers: [coastLogger],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
static forRootAsync() {
|
|
32
|
-
const coastLogger = {
|
|
33
|
-
inject: [config_1.ConfigService, TraceManager_1.TraceManager],
|
|
34
|
-
provide: CoastLogger_1.CoastLogger,
|
|
35
|
-
useFactory: (configService, traceManager) => new PinoLogger_1.PinoLogger(configService, traceManager),
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
exports: [coastLogger],
|
|
39
|
-
imports: [config_1.ConfigModule, TraceModule_1.TraceModule],
|
|
40
|
-
module: LoggerModule_1,
|
|
41
|
-
providers: [coastLogger],
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
exports.LoggerModule = LoggerModule;
|
|
46
|
-
exports.LoggerModule = LoggerModule = LoggerModule_1 = __decorate([
|
|
47
|
-
(0, common_1.Global)(),
|
|
48
|
-
(0, common_1.Module)({})
|
|
49
|
-
], LoggerModule);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { TraceManager } from '../trace/TraceManager';
|
|
3
|
-
import { CoastLogger } from './CoastLogger';
|
|
4
|
-
export declare class PinoLogger extends CoastLogger {
|
|
5
|
-
private readonly instance;
|
|
6
|
-
private readonly traceManager?;
|
|
7
|
-
constructor(configService: ConfigService, traceManager: TraceManager);
|
|
8
|
-
debug(message: unknown): void;
|
|
9
|
-
error(message: unknown, trace?: string): void;
|
|
10
|
-
log(message: unknown): void;
|
|
11
|
-
verbose(message: unknown): void;
|
|
12
|
-
warn(message: unknown): void;
|
|
13
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.PinoLogger = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const config_1 = require("@nestjs/config");
|
|
18
|
-
const pino_1 = __importDefault(require("pino"));
|
|
19
|
-
const TraceManager_1 = require("../trace/TraceManager");
|
|
20
|
-
const CoastLogger_1 = require("./CoastLogger");
|
|
21
|
-
let PinoLogger = class PinoLogger extends CoastLogger_1.CoastLogger {
|
|
22
|
-
constructor(configService, traceManager) {
|
|
23
|
-
super();
|
|
24
|
-
const level = configService.get('LOG_LEVEL');
|
|
25
|
-
const redact = [
|
|
26
|
-
'MYSQL_PASSWORD',
|
|
27
|
-
'STRIPE_SECRETKEY',
|
|
28
|
-
'JWT_SECRET',
|
|
29
|
-
'headers.authorization',
|
|
30
|
-
'user.passcode',
|
|
31
|
-
'user.lastName',
|
|
32
|
-
'user.phoneNumber',
|
|
33
|
-
'user.email',
|
|
34
|
-
];
|
|
35
|
-
const pino = configService.get('LOG_PRETTY')
|
|
36
|
-
? (0, pino_1.default)({
|
|
37
|
-
level,
|
|
38
|
-
mixin: () => this.traceManager?.getTrace() ?? {},
|
|
39
|
-
redact,
|
|
40
|
-
transport: {
|
|
41
|
-
options: {
|
|
42
|
-
colorize: true,
|
|
43
|
-
translateTime: true,
|
|
44
|
-
},
|
|
45
|
-
target: 'pino-pretty',
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
: (0, pino_1.default)({
|
|
49
|
-
level,
|
|
50
|
-
mixin: () => this.traceManager?.getTrace() ?? {},
|
|
51
|
-
redact,
|
|
52
|
-
});
|
|
53
|
-
this.instance = pino;
|
|
54
|
-
this.traceManager = traceManager;
|
|
55
|
-
}
|
|
56
|
-
debug(message) {
|
|
57
|
-
this.instance.debug(message);
|
|
58
|
-
}
|
|
59
|
-
error(message, trace = '') {
|
|
60
|
-
this.instance.error(message, trace);
|
|
61
|
-
}
|
|
62
|
-
log(message) {
|
|
63
|
-
this.instance.info(message);
|
|
64
|
-
}
|
|
65
|
-
verbose(message) {
|
|
66
|
-
this.instance.trace(message);
|
|
67
|
-
}
|
|
68
|
-
warn(message) {
|
|
69
|
-
this.instance.warn(message);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
exports.PinoLogger = PinoLogger;
|
|
73
|
-
exports.PinoLogger = PinoLogger = __decorate([
|
|
74
|
-
(0, common_1.Injectable)(),
|
|
75
|
-
__metadata("design:paramtypes", [config_1.ConfigService, TraceManager_1.TraceManager])
|
|
76
|
-
], PinoLogger);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SilentLogger = void 0;
|
|
4
|
-
const CoastLogger_1 = require("./CoastLogger");
|
|
5
|
-
class SilentLogger extends CoastLogger_1.CoastLogger {
|
|
6
|
-
debug() {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
error() {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
log() {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
verbose() {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
warn() {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.SilentLogger = SilentLogger;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { TraceManager } from './TraceManager';
|
|
4
|
-
export declare class TraceInterceptor implements NestInterceptor {
|
|
5
|
-
private readonly traceManager;
|
|
6
|
-
constructor(traceManager: TraceManager);
|
|
7
|
-
intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown> | Promise<Observable<unknown>>;
|
|
8
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.TraceInterceptor = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const TraceManager_1 = require("./TraceManager");
|
|
18
|
-
let TraceInterceptor = class TraceInterceptor {
|
|
19
|
-
constructor(traceManager) {
|
|
20
|
-
this.traceManager = traceManager;
|
|
21
|
-
}
|
|
22
|
-
intercept(_context, next) {
|
|
23
|
-
return this.traceManager.withNewTrace(next.handle);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.TraceInterceptor = TraceInterceptor;
|
|
27
|
-
exports.TraceInterceptor = TraceInterceptor = __decorate([
|
|
28
|
-
__param(0, (0, common_1.Inject)()),
|
|
29
|
-
__metadata("design:paramtypes", [TraceManager_1.TraceManager])
|
|
30
|
-
], TraceInterceptor);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
-
import { Trace } from './Trace';
|
|
3
|
-
import { TraceId } from './TraceId';
|
|
4
|
-
export declare class TraceManager {
|
|
5
|
-
private readonly asyncLocalStorage;
|
|
6
|
-
constructor(asyncLocalStorage: AsyncLocalStorage<Trace>);
|
|
7
|
-
getTrace(): Trace | undefined;
|
|
8
|
-
withNewTrace<T>(fn: () => T, traceId?: TraceId): T;
|
|
9
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.TraceManager = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const node_async_hooks_1 = require("node:async_hooks");
|
|
18
|
-
const uuid_1 = require("uuid");
|
|
19
|
-
const TraceId_1 = require("./TraceId");
|
|
20
|
-
let TraceManager = class TraceManager {
|
|
21
|
-
constructor(asyncLocalStorage) {
|
|
22
|
-
this.asyncLocalStorage = asyncLocalStorage;
|
|
23
|
-
}
|
|
24
|
-
getTrace() {
|
|
25
|
-
return this.asyncLocalStorage.getStore();
|
|
26
|
-
}
|
|
27
|
-
withNewTrace(fn, traceId) {
|
|
28
|
-
const trace = {
|
|
29
|
-
subtraceId: (0, TraceId_1.TraceId)((0, uuid_1.v4)()),
|
|
30
|
-
traceId: traceId ?? (0, TraceId_1.TraceId)((0, uuid_1.v4)()),
|
|
31
|
-
};
|
|
32
|
-
return this.asyncLocalStorage.run(trace, fn);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.TraceManager = TraceManager;
|
|
36
|
-
exports.TraceManager = TraceManager = __decorate([
|
|
37
|
-
(0, common_1.Injectable)(),
|
|
38
|
-
__param(0, (0, common_1.Inject)()),
|
|
39
|
-
__metadata("design:paramtypes", [node_async_hooks_1.AsyncLocalStorage])
|
|
40
|
-
], TraceManager);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TraceModule = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const node_async_hooks_1 = require("node:async_hooks");
|
|
12
|
-
const TraceInterceptor_1 = require("./TraceInterceptor");
|
|
13
|
-
const TraceManager_1 = require("./TraceManager");
|
|
14
|
-
let TraceModule = class TraceModule {
|
|
15
|
-
};
|
|
16
|
-
exports.TraceModule = TraceModule;
|
|
17
|
-
exports.TraceModule = TraceModule = __decorate([
|
|
18
|
-
(0, common_1.Module)({
|
|
19
|
-
exports: [TraceManager_1.TraceManager, TraceInterceptor_1.TraceInterceptor],
|
|
20
|
-
providers: [(node_async_hooks_1.AsyncLocalStorage), TraceManager_1.TraceManager, TraceInterceptor_1.TraceInterceptor],
|
|
21
|
-
})
|
|
22
|
-
], TraceModule);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Response } from 'superagent';
|
|
2
|
-
export type GqlResponse<T> = Omit<Response, 'body'> & {
|
|
3
|
-
body: TypedBody<T>;
|
|
4
|
-
};
|
|
5
|
-
interface TypedBody<T> {
|
|
6
|
-
data: T;
|
|
7
|
-
errors?: {
|
|
8
|
-
extensions?: {
|
|
9
|
-
code: number;
|
|
10
|
-
};
|
|
11
|
-
message: string;
|
|
12
|
-
}[];
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare class Generators {
|
|
2
|
-
static chunked<T>(iterator: AsyncGenerator<T>, size: number): AsyncGenerator<T[]>;
|
|
3
|
-
static map<T, Y>(iterator: AsyncGenerator<T>, mapper: (data: T) => Y): AsyncGenerator<Y>;
|
|
4
|
-
static take<T>(iterator: AsyncGenerator<T>, size: number): AsyncGenerator<T>;
|
|
5
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Generators = void 0;
|
|
4
|
-
class Generators {
|
|
5
|
-
static async *chunked(iterator, size) {
|
|
6
|
-
let chunk = [];
|
|
7
|
-
for await (const item of iterator) {
|
|
8
|
-
chunk.push(item);
|
|
9
|
-
if (chunk.length >= size) {
|
|
10
|
-
yield chunk;
|
|
11
|
-
chunk = [];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
yield chunk;
|
|
15
|
-
}
|
|
16
|
-
static async *map(iterator, mapper) {
|
|
17
|
-
for await (const item of iterator) {
|
|
18
|
-
yield mapper(item);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
static async *take(iterator, size) {
|
|
22
|
-
let count = 0;
|
|
23
|
-
for await (const item of iterator) {
|
|
24
|
-
if (count < size) {
|
|
25
|
-
yield item;
|
|
26
|
-
count++;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.Generators = Generators;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_test_1 = require("@paradoxical-io/common-test");
|
|
4
|
-
const Generators_1 = require("../Generators");
|
|
5
|
-
test('take async', async () => {
|
|
6
|
-
const data = [];
|
|
7
|
-
for await (const i of Generators_1.Generators.take(infinityAsync(), 10)) {
|
|
8
|
-
data.push(i);
|
|
9
|
-
}
|
|
10
|
-
(0, common_test_1.safeExpect)(data).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
11
|
-
});
|
|
12
|
-
test('chunked async', async () => {
|
|
13
|
-
const data = [];
|
|
14
|
-
const chunked = Generators_1.Generators.chunked(infinityAsync(), 2);
|
|
15
|
-
for await (const i of Generators_1.Generators.take(chunked, 2)) {
|
|
16
|
-
data.push(i);
|
|
17
|
-
}
|
|
18
|
-
(0, common_test_1.safeExpect)(data).toEqual([
|
|
19
|
-
[0, 1],
|
|
20
|
-
[2, 3],
|
|
21
|
-
]);
|
|
22
|
-
});
|
|
23
|
-
test('chunked async with end', async () => {
|
|
24
|
-
const data = [];
|
|
25
|
-
const chunked = Generators_1.Generators.chunked(Generators_1.Generators.take(infinityAsync(), 10), 4);
|
|
26
|
-
for await (const i of Generators_1.Generators.take(chunked, 3)) {
|
|
27
|
-
data.push(i);
|
|
28
|
-
}
|
|
29
|
-
(0, common_test_1.safeExpect)(data).toEqual([
|
|
30
|
-
[0, 1, 2, 3],
|
|
31
|
-
[4, 5, 6, 7],
|
|
32
|
-
[8, 9],
|
|
33
|
-
]);
|
|
34
|
-
});
|
|
35
|
-
test('map async', async () => {
|
|
36
|
-
const data = [];
|
|
37
|
-
const mapped = Generators_1.Generators.map(infinityAsync(), (i) => i.toString());
|
|
38
|
-
for await (const i of Generators_1.Generators.take(mapped, 2)) {
|
|
39
|
-
data.push(i);
|
|
40
|
-
}
|
|
41
|
-
(0, common_test_1.safeExpect)(data).toEqual(['0', '1']);
|
|
42
|
-
});
|
|
43
|
-
async function* infinityAsync() {
|
|
44
|
-
let start = 0;
|
|
45
|
-
while (true) {
|
|
46
|
-
yield start;
|
|
47
|
-
start++;
|
|
48
|
-
}
|
|
49
|
-
}
|