@erxes/core-contract 0.1.0-v2.4 → 0.1.0-v2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +298 -0
- package/dist/client.js +16 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -30981,6 +30981,304 @@ export declare const memberQueries: {
|
|
|
30981
30981
|
};
|
|
30982
30982
|
}>>>, "input" | "staleTime">>;
|
|
30983
30983
|
};
|
|
30984
|
+
/**
|
|
30985
|
+
* Where erxes-ui's `ContactLink` reads a customer or company:
|
|
30986
|
+
* `<ContactLink contentType="core:customer" contentId={id} contacts={contactQueries} />`.
|
|
30987
|
+
* It is the query web's panel reads, so a name edited there shows in every link.
|
|
30988
|
+
*/
|
|
30989
|
+
export declare const contactQueries: {
|
|
30990
|
+
customer: (id: string) => NoInfer<{
|
|
30991
|
+
input: {
|
|
30992
|
+
id: string;
|
|
30993
|
+
};
|
|
30994
|
+
staleTime: number;
|
|
30995
|
+
} & Omit<import("@orpc/tanstack-query").QueryOptionsBase<{
|
|
30996
|
+
id: string;
|
|
30997
|
+
state: "customer" | "lead";
|
|
30998
|
+
firstName: string | null;
|
|
30999
|
+
middleName: string | null;
|
|
31000
|
+
lastName: string | null;
|
|
31001
|
+
avatarUrl: string | null;
|
|
31002
|
+
primaryEmail: string | null;
|
|
31003
|
+
emails: string[];
|
|
31004
|
+
primaryPhone: string | null;
|
|
31005
|
+
phones: string[];
|
|
31006
|
+
sex: 0 | 1 | 2 | 9 | null;
|
|
31007
|
+
birthDate: string | null;
|
|
31008
|
+
position: string | null;
|
|
31009
|
+
department: string | null;
|
|
31010
|
+
code: string | null;
|
|
31011
|
+
description: string | null;
|
|
31012
|
+
ownerId: string | null;
|
|
31013
|
+
leadStageId: string | null;
|
|
31014
|
+
leadStageChangedAt: string | null;
|
|
31015
|
+
disqualifyReason: string | null;
|
|
31016
|
+
source: string | null;
|
|
31017
|
+
sourceDetails: Record<string, string>;
|
|
31018
|
+
convertedAt: string | null;
|
|
31019
|
+
lastActivityAt: string;
|
|
31020
|
+
createdAt: string;
|
|
31021
|
+
updatedAt: string;
|
|
31022
|
+
tagIds: string[];
|
|
31023
|
+
customFields: Record<string, string | number | boolean | string[]>;
|
|
31024
|
+
}, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
31025
|
+
UNAUTHORIZED: {
|
|
31026
|
+
status: number;
|
|
31027
|
+
};
|
|
31028
|
+
NOT_ALLOWED: {
|
|
31029
|
+
status: number;
|
|
31030
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
31031
|
+
permission: import("zod").ZodString;
|
|
31032
|
+
}, import("zod/v4/core").$strip>>;
|
|
31033
|
+
};
|
|
31034
|
+
PLUGIN_ONLY: {
|
|
31035
|
+
status: number;
|
|
31036
|
+
};
|
|
31037
|
+
MEMBERS_ONLY: {
|
|
31038
|
+
status: number;
|
|
31039
|
+
};
|
|
31040
|
+
ORG_REQUIRED: {
|
|
31041
|
+
status: number;
|
|
31042
|
+
};
|
|
31043
|
+
SCOPE_REQUIRED: {
|
|
31044
|
+
status: number;
|
|
31045
|
+
};
|
|
31046
|
+
SERVICE_TOKEN_REQUIRED: {
|
|
31047
|
+
status: number;
|
|
31048
|
+
};
|
|
31049
|
+
ORGANIZATION_DISABLED: {
|
|
31050
|
+
status: number;
|
|
31051
|
+
data: import("zod").ZodObject<{
|
|
31052
|
+
manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
|
|
31053
|
+
}, import("zod/v4/core").$strip>;
|
|
31054
|
+
};
|
|
31055
|
+
NOT_IN_PLAN: {
|
|
31056
|
+
status: number;
|
|
31057
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
31058
|
+
manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
|
|
31059
|
+
}, import("zod/v4/core").$strip>>;
|
|
31060
|
+
};
|
|
31061
|
+
READ_ONLY: {
|
|
31062
|
+
status: number;
|
|
31063
|
+
};
|
|
31064
|
+
TOO_MANY_REQUESTS: {
|
|
31065
|
+
status: number;
|
|
31066
|
+
};
|
|
31067
|
+
INVALID_INPUT: {
|
|
31068
|
+
status: number;
|
|
31069
|
+
data: import("zod").ZodObject<{
|
|
31070
|
+
issues: import("zod").ZodArray<import("zod").ZodObject<{
|
|
31071
|
+
path: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
|
|
31072
|
+
message: import("zod").ZodString;
|
|
31073
|
+
}, import("zod/v4/core").$strip>>;
|
|
31074
|
+
}, import("zod/v4/core").$strip>;
|
|
31075
|
+
};
|
|
31076
|
+
NOT_FOUND: {
|
|
31077
|
+
status: number;
|
|
31078
|
+
};
|
|
31079
|
+
TAKEN: {
|
|
31080
|
+
status: number;
|
|
31081
|
+
data: import("zod").ZodObject<{
|
|
31082
|
+
field: import("zod").ZodString;
|
|
31083
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31084
|
+
values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
31085
|
+
}, import("zod/v4/core").$strip>;
|
|
31086
|
+
};
|
|
31087
|
+
INVALID_CURSOR: {
|
|
31088
|
+
status: number;
|
|
31089
|
+
};
|
|
31090
|
+
INVALID_REFERENCE: {
|
|
31091
|
+
status: number;
|
|
31092
|
+
data: import("zod").ZodObject<{
|
|
31093
|
+
field: import("zod").ZodString;
|
|
31094
|
+
}, import("zod/v4/core").$strip>;
|
|
31095
|
+
};
|
|
31096
|
+
INVALID_FILTER: {
|
|
31097
|
+
status: number;
|
|
31098
|
+
};
|
|
31099
|
+
FILTER_TOO_SLOW: {
|
|
31100
|
+
status: number;
|
|
31101
|
+
};
|
|
31102
|
+
INVALID_ACTOR: {
|
|
31103
|
+
status: number;
|
|
31104
|
+
};
|
|
31105
|
+
INVALID_FIELD: {
|
|
31106
|
+
status: number;
|
|
31107
|
+
data: import("zod").ZodObject<{
|
|
31108
|
+
fieldId: import("zod").ZodString;
|
|
31109
|
+
}, import("zod/v4/core").$strip>;
|
|
31110
|
+
};
|
|
31111
|
+
INVALID_FIELD_VALUE: {
|
|
31112
|
+
status: number;
|
|
31113
|
+
data: import("zod").ZodObject<{
|
|
31114
|
+
fieldId: import("zod").ZodString;
|
|
31115
|
+
}, import("zod/v4/core").$strip>;
|
|
31116
|
+
};
|
|
31117
|
+
INVALID_OWNER: {
|
|
31118
|
+
status: number;
|
|
31119
|
+
};
|
|
31120
|
+
INVALID_TAG: {
|
|
31121
|
+
status: number;
|
|
31122
|
+
};
|
|
31123
|
+
INVALID_TYPE: {
|
|
31124
|
+
status: number;
|
|
31125
|
+
};
|
|
31126
|
+
MASS_DELETE_STOPPED: {
|
|
31127
|
+
status: number;
|
|
31128
|
+
};
|
|
31129
|
+
NOT_A_LEAD: {
|
|
31130
|
+
status: number;
|
|
31131
|
+
};
|
|
31132
|
+
TAG_LIMIT: {
|
|
31133
|
+
status: number;
|
|
31134
|
+
};
|
|
31135
|
+
}>>>, "input" | "staleTime">>;
|
|
31136
|
+
company: (id: string) => NoInfer<{
|
|
31137
|
+
input: {
|
|
31138
|
+
id: string;
|
|
31139
|
+
};
|
|
31140
|
+
staleTime: number;
|
|
31141
|
+
} & Omit<import("@orpc/tanstack-query").QueryOptionsBase<{
|
|
31142
|
+
id: string;
|
|
31143
|
+
primaryName: string;
|
|
31144
|
+
state: "customer" | "lead";
|
|
31145
|
+
names: string[];
|
|
31146
|
+
avatarUrl: string | null;
|
|
31147
|
+
primaryEmail: string | null;
|
|
31148
|
+
emails: string[];
|
|
31149
|
+
primaryPhone: string | null;
|
|
31150
|
+
phones: string[];
|
|
31151
|
+
website: string | null;
|
|
31152
|
+
industry: string | null;
|
|
31153
|
+
size: number | null;
|
|
31154
|
+
businessType: string | null;
|
|
31155
|
+
code: string | null;
|
|
31156
|
+
description: string | null;
|
|
31157
|
+
ownerId: string | null;
|
|
31158
|
+
leadStageId: string | null;
|
|
31159
|
+
leadStageChangedAt: string | null;
|
|
31160
|
+
disqualifyReason: string | null;
|
|
31161
|
+
source: string | null;
|
|
31162
|
+
sourceDetails: Record<string, string>;
|
|
31163
|
+
convertedAt: string | null;
|
|
31164
|
+
lastActivityAt: string;
|
|
31165
|
+
createdAt: string;
|
|
31166
|
+
updatedAt: string;
|
|
31167
|
+
tagIds: string[];
|
|
31168
|
+
customFields: Record<string, string | number | boolean | string[]>;
|
|
31169
|
+
}, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
31170
|
+
UNAUTHORIZED: {
|
|
31171
|
+
status: number;
|
|
31172
|
+
};
|
|
31173
|
+
NOT_ALLOWED: {
|
|
31174
|
+
status: number;
|
|
31175
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
31176
|
+
permission: import("zod").ZodString;
|
|
31177
|
+
}, import("zod/v4/core").$strip>>;
|
|
31178
|
+
};
|
|
31179
|
+
PLUGIN_ONLY: {
|
|
31180
|
+
status: number;
|
|
31181
|
+
};
|
|
31182
|
+
MEMBERS_ONLY: {
|
|
31183
|
+
status: number;
|
|
31184
|
+
};
|
|
31185
|
+
ORG_REQUIRED: {
|
|
31186
|
+
status: number;
|
|
31187
|
+
};
|
|
31188
|
+
SCOPE_REQUIRED: {
|
|
31189
|
+
status: number;
|
|
31190
|
+
};
|
|
31191
|
+
SERVICE_TOKEN_REQUIRED: {
|
|
31192
|
+
status: number;
|
|
31193
|
+
};
|
|
31194
|
+
ORGANIZATION_DISABLED: {
|
|
31195
|
+
status: number;
|
|
31196
|
+
data: import("zod").ZodObject<{
|
|
31197
|
+
manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
|
|
31198
|
+
}, import("zod/v4/core").$strip>;
|
|
31199
|
+
};
|
|
31200
|
+
NOT_IN_PLAN: {
|
|
31201
|
+
status: number;
|
|
31202
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
31203
|
+
manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
|
|
31204
|
+
}, import("zod/v4/core").$strip>>;
|
|
31205
|
+
};
|
|
31206
|
+
READ_ONLY: {
|
|
31207
|
+
status: number;
|
|
31208
|
+
};
|
|
31209
|
+
TOO_MANY_REQUESTS: {
|
|
31210
|
+
status: number;
|
|
31211
|
+
};
|
|
31212
|
+
INVALID_INPUT: {
|
|
31213
|
+
status: number;
|
|
31214
|
+
data: import("zod").ZodObject<{
|
|
31215
|
+
issues: import("zod").ZodArray<import("zod").ZodObject<{
|
|
31216
|
+
path: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
|
|
31217
|
+
message: import("zod").ZodString;
|
|
31218
|
+
}, import("zod/v4/core").$strip>>;
|
|
31219
|
+
}, import("zod/v4/core").$strip>;
|
|
31220
|
+
};
|
|
31221
|
+
NOT_FOUND: {
|
|
31222
|
+
status: number;
|
|
31223
|
+
};
|
|
31224
|
+
TAKEN: {
|
|
31225
|
+
status: number;
|
|
31226
|
+
data: import("zod").ZodObject<{
|
|
31227
|
+
field: import("zod").ZodString;
|
|
31228
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31229
|
+
values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
31230
|
+
}, import("zod/v4/core").$strip>;
|
|
31231
|
+
};
|
|
31232
|
+
INVALID_CURSOR: {
|
|
31233
|
+
status: number;
|
|
31234
|
+
};
|
|
31235
|
+
INVALID_REFERENCE: {
|
|
31236
|
+
status: number;
|
|
31237
|
+
data: import("zod").ZodObject<{
|
|
31238
|
+
field: import("zod").ZodString;
|
|
31239
|
+
}, import("zod/v4/core").$strip>;
|
|
31240
|
+
};
|
|
31241
|
+
INVALID_FILTER: {
|
|
31242
|
+
status: number;
|
|
31243
|
+
};
|
|
31244
|
+
FILTER_TOO_SLOW: {
|
|
31245
|
+
status: number;
|
|
31246
|
+
};
|
|
31247
|
+
INVALID_ACTOR: {
|
|
31248
|
+
status: number;
|
|
31249
|
+
};
|
|
31250
|
+
INVALID_FIELD: {
|
|
31251
|
+
status: number;
|
|
31252
|
+
data: import("zod").ZodObject<{
|
|
31253
|
+
fieldId: import("zod").ZodString;
|
|
31254
|
+
}, import("zod/v4/core").$strip>;
|
|
31255
|
+
};
|
|
31256
|
+
INVALID_FIELD_VALUE: {
|
|
31257
|
+
status: number;
|
|
31258
|
+
data: import("zod").ZodObject<{
|
|
31259
|
+
fieldId: import("zod").ZodString;
|
|
31260
|
+
}, import("zod/v4/core").$strip>;
|
|
31261
|
+
};
|
|
31262
|
+
INVALID_OWNER: {
|
|
31263
|
+
status: number;
|
|
31264
|
+
};
|
|
31265
|
+
INVALID_TAG: {
|
|
31266
|
+
status: number;
|
|
31267
|
+
};
|
|
31268
|
+
INVALID_TYPE: {
|
|
31269
|
+
status: number;
|
|
31270
|
+
};
|
|
31271
|
+
MASS_DELETE_STOPPED: {
|
|
31272
|
+
status: number;
|
|
31273
|
+
};
|
|
31274
|
+
NOT_A_LEAD: {
|
|
31275
|
+
status: number;
|
|
31276
|
+
};
|
|
31277
|
+
TAG_LIMIT: {
|
|
31278
|
+
status: number;
|
|
31279
|
+
};
|
|
31280
|
+
}>>>, "input" | "staleTime">>;
|
|
31281
|
+
};
|
|
30984
31282
|
/** Any error core answers with: one per code in `ERRORS`, with that code's `data`. */
|
|
30985
31283
|
type ApiError = ORPCErrorFromErrorMap<typeof ERRORS>;
|
|
30986
31284
|
/**
|
package/dist/client.js
CHANGED
|
@@ -48,6 +48,21 @@ const memberQueries = {
|
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
|
+
* Where erxes-ui's `ContactLink` reads a customer or company:
|
|
52
|
+
* `<ContactLink contentType="core:customer" contentId={id} contacts={contactQueries} />`.
|
|
53
|
+
* It is the query web's panel reads, so a name edited there shows in every link.
|
|
54
|
+
*/
|
|
55
|
+
const contactQueries = {
|
|
56
|
+
customer: (id) => orpc.customers.get.queryOptions({
|
|
57
|
+
input: { id },
|
|
58
|
+
staleTime: 6e4
|
|
59
|
+
}),
|
|
60
|
+
company: (id) => orpc.companies.get.queryOptions({
|
|
61
|
+
input: { id },
|
|
62
|
+
staleTime: 6e4
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
51
66
|
* Whether core answered with `code` (`TAKEN`, `NOT_FOUND`, …). It narrows
|
|
52
67
|
* `error.data` to what `ERRORS` declares for the code, so the field a
|
|
53
68
|
* `TAKEN` is about reads as `error.data.field`.
|
|
@@ -59,4 +74,4 @@ const messageOf = (error) => {
|
|
|
59
74
|
if (issue) return `${issue.path.join(".")}: ${issue.message}`;
|
|
60
75
|
return error instanceof Error ? error.message : "Something went wrong. Try again.";
|
|
61
76
|
};
|
|
62
|
-
export { isApiError, memberQueries, messageOf, orpc };
|
|
77
|
+
export { contactQueries, isApiError, memberQueries, messageOf, orpc };
|
package/package.json
CHANGED