@erxes/core-contract 0.1.0-v2.5 → 0.1.0-v2.6
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/customers.js +2 -2
- package/dist/db/src/schema/customerAuth.js +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/leads.d.ts +0 -5
- package/dist/leads.js +2 -4
- package/dist/values.d.ts +5 -0
- package/dist/values.js +4 -2
- package/package.json +1 -1
package/dist/customers.js
CHANGED
|
@@ -3,9 +3,9 @@ import { customers } from "./db/src/schema/customers.js";
|
|
|
3
3
|
import { companies, customerCompanies } from "./db/src/schema/companies.js";
|
|
4
4
|
import "./db/src/schema/index.js";
|
|
5
5
|
import { COMMON_ERRORS, ERRORS } from "./errors.js";
|
|
6
|
-
import { CustomerSex } from "./values.js";
|
|
6
|
+
import { ContactState, CustomerSex } from "./values.js";
|
|
7
7
|
import { CursorQuery, CustomFields, CustomFieldsPatch, DESCRIPTION_MAX, EmailAddress, Id, IdList, ImageAddress, PhoneNumber, cursorPageOf, isoDate, listOf } from "./common.js";
|
|
8
|
-
import {
|
|
8
|
+
import { LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, lifecycleInput, lifecycleRow } from "./leads.js";
|
|
9
9
|
import { oc } from "@orpc/contract";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { createSelectSchema, createUpdateSchema } from "drizzle-zod";
|
|
@@ -79,6 +79,13 @@ const customerSessions = pgTable("customer_sessions", {
|
|
|
79
79
|
clientId: text().notNull(),
|
|
80
80
|
tokenHash: text().notNull(),
|
|
81
81
|
previousTokenHash: text(),
|
|
82
|
+
/**
|
|
83
|
+
* The current refresh token, sealed with core's key, and when it replaced
|
|
84
|
+
* the previous one: a refresh with the previous token just after (a second
|
|
85
|
+
* tab, a retried request) gets this same token instead of ending the session.
|
|
86
|
+
*/
|
|
87
|
+
tokenSealed: text(),
|
|
88
|
+
rotatedAt: timestamptz(),
|
|
82
89
|
userAgent: text(),
|
|
83
90
|
ip: text(),
|
|
84
91
|
createdAt: createdAt(),
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { EmailMessage, emailsContract } from "./emails.js";
|
|
|
16
16
|
import { CoreEvent, EventFailure, EventFailureStatus, EventInput, EventNotify, eventsContract } from "./events.js";
|
|
17
17
|
import { Field, FieldGroup, FieldUsage, fieldGroupsContract, fieldsContract } from "./fields.js";
|
|
18
18
|
import { FileInfo, FileSettings, UploadTarget, filesContract } from "./files.js";
|
|
19
|
-
import {
|
|
19
|
+
import { LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow } from "./leads.js";
|
|
20
20
|
import { COUNTRIES, Country, Currency, currencyDigits, currencyOfCountry } from "./money.js";
|
|
21
21
|
import { CORE_NOTIFICATION_KINDS, CoreNotificationKind, Notification, NotificationGroupSetting, NotificationInput, NotificationSettings, notificationsContract } from "./notifications.js";
|
|
22
22
|
import { ActorType, AppLink, DedupeKey, EntityType, EventType } from "./platform.js";
|
|
@@ -30,7 +30,7 @@ import { Tag, tagsContract } from "./tags.js";
|
|
|
30
30
|
import { TrashItem, trashContract } from "./trash.js";
|
|
31
31
|
import { Export, ExportQuery, Import, ImportOptions, ImportRow, ImportStatus, TransferColumn, TransferRecordType, transferContract } from "./transfer.js";
|
|
32
32
|
import { DateOnly, User, UserLinks, UserStatus, usersContract } from "./users.js";
|
|
33
|
-
import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
|
|
33
|
+
import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, ContactState, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
|
|
34
34
|
import { FilterField, RecordFilter, View, ViewRecordType, ViewSort, viewsContract } from "./views.js";
|
|
35
35
|
import { CORE_EVENT_TYPES, EventPattern, EventTypeInfo, Webhook, WebhookDelivery, webhooksContract } from "./webhooks.js";
|
|
36
36
|
/** The whole core API. Core implements it; plugins call it with a typed client. */
|
package/dist/index.js
CHANGED
|
@@ -23,14 +23,14 @@ import { CORE_EVENT_TYPES, EventPattern, EventTypeInfo, Webhook, WebhookDelivery
|
|
|
23
23
|
import { EntitlementStatus, OrganizationStatus, PluginAccess, PluginPlan, PluginTier, SaasWorkspace, SubscriptionInfo, saasContract } from "./saas.js";
|
|
24
24
|
import { FilterField, RecordFilter, View, ViewRecordType, ViewSort, viewsContract } from "./views.js";
|
|
25
25
|
import { Export, ExportQuery, Import, ImportOptions, ImportRow, ImportStatus, TransferColumn, TransferRecordType, transferContract } from "./transfer.js";
|
|
26
|
-
import {
|
|
26
|
+
import { LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow } from "./leads.js";
|
|
27
27
|
import { ActionInput, Audience, AutomationDefinition, AutomationStep, AutomationTrigger, ConditionGroup, ConditionOperator, ConditionRule, ContextPath, Reentry, RelativeAmount } from "./db/src/automationDefinition.js";
|
|
28
28
|
import { ActionField, ActionInfo, AutomationRun, RunStatus, RunStep } from "./automationRuns.js";
|
|
29
29
|
import { ContentType, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue, DESCRIPTION_MAX, EmailAddress, FieldContentType, Id, IdList, ImageAddress, InvalidInput, LIST_MAX, PageInfo, PhoneNumber, QueryBoolean, QueryFlag, cursorPageOf, isoDate, listOf } from "./common.js";
|
|
30
30
|
import { COMMON_ERRORS, ERRORS } from "./errors.js";
|
|
31
31
|
import { COUNTRIES, Country, Currency, currencyDigits, currencyOfCountry } from "./money.js";
|
|
32
32
|
import { ActorType, AppLink, DedupeKey, EntityType, EventType } from "./platform.js";
|
|
33
|
-
import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
|
|
33
|
+
import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, ContactState, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
|
|
34
34
|
// src/index.ts
|
|
35
35
|
/** The whole core API. Core implements it; plugins call it with a typed client. */
|
|
36
36
|
const coreContract = {
|
package/dist/leads.d.ts
CHANGED
|
@@ -20,11 +20,6 @@ export declare const LeadRecordType: z.ZodEnum<{
|
|
|
20
20
|
customer: "customer";
|
|
21
21
|
}>;
|
|
22
22
|
export type LeadRecordType = z.infer<typeof LeadRecordType>;
|
|
23
|
-
/** `lead`: not a customer yet. People and companies alike. */
|
|
24
|
-
export declare const ContactState: z.ZodEnum<{
|
|
25
|
-
customer: "customer";
|
|
26
|
-
lead: "lead";
|
|
27
|
-
}>;
|
|
28
23
|
/**
|
|
29
24
|
* The lifecycle columns every contact (person or company) carries:
|
|
30
25
|
* `state`, `leadStageId` (stays after conversion), `leadStageChangedAt`,
|
package/dist/leads.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONTENT_TYPES,
|
|
1
|
+
import { CONTENT_TYPES, LEAD_STAGE_KINDS } from "./db/src/enums.js";
|
|
2
2
|
import { leadStages } from "./db/src/schema/leadStages.js";
|
|
3
3
|
import { leadEvents } from "./db/src/schema/leads.js";
|
|
4
4
|
import "./db/src/schema/index.js";
|
|
@@ -34,8 +34,6 @@ const LeadSource = z.string().trim().toLowerCase().regex(/^[a-z0-9][a-z0-9_.:-]{
|
|
|
34
34
|
const SourceDetails = z.record(z.string().max(50), z.string().max(500)).refine((value) => Object.keys(value).length <= 20, "at most 20 details");
|
|
35
35
|
/** Whom a lead action is about: people or companies (both go through the same stages). */
|
|
36
36
|
const LeadRecordType = z.enum(CONTENT_TYPES);
|
|
37
|
-
/** `lead`: not a customer yet. People and companies alike. */
|
|
38
|
-
const ContactState = z.enum(CUSTOMER_STATES);
|
|
39
37
|
/**
|
|
40
38
|
* The lifecycle columns every contact (person or company) carries:
|
|
41
39
|
* `state`, `leadStageId` (stays after conversion), `leadStageChangedAt`,
|
|
@@ -241,4 +239,4 @@ const leadsContract = {
|
|
|
241
239
|
to: z.iso.datetime().optional()
|
|
242
240
|
})).output(LeadReport)
|
|
243
241
|
};
|
|
244
|
-
export {
|
|
242
|
+
export { LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow };
|
package/dist/values.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export type UserLinkName = z.infer<typeof UserLinkName>;
|
|
|
23
23
|
/** ISO/IEC 5218, as in erxes until now: 0 not known, 1 male, 2 female, 9 not applicable. */
|
|
24
24
|
export declare const CustomerSex: z.ZodUnion<z.ZodLiteral<0 | 1 | 2 | 9>[]>;
|
|
25
25
|
export type CustomerSex = z.infer<typeof CustomerSex>;
|
|
26
|
+
/** `lead`: not a customer yet. People and companies alike. */
|
|
27
|
+
export declare const ContactState: z.ZodEnum<{
|
|
28
|
+
customer: "customer";
|
|
29
|
+
lead: "lead";
|
|
30
|
+
}>;
|
|
26
31
|
export declare const ProductKind: z.ZodEnum<{
|
|
27
32
|
goods: "goods";
|
|
28
33
|
service: "service";
|
package/dist/values.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AUDIT_STREAM_FORMATS, AUTOMATION_STATUSES, CUSTOMER_SEXES, FIELD_TYPES, FIELD_VALIDATIONS, INVOICE_STATUSES, LIVE_MODES, NOTIFICATION_DELIVERIES, PAYMENT_GATEWAY_KINDS, PRODUCT_KINDS } from "./db/src/enums.js";
|
|
1
|
+
import { AUDIT_STREAM_FORMATS, AUTOMATION_STATUSES, CUSTOMER_SEXES, CUSTOMER_STATES, FIELD_TYPES, FIELD_VALIDATIONS, INVOICE_STATUSES, LIVE_MODES, NOTIFICATION_DELIVERIES, PAYMENT_GATEWAY_KINDS, PRODUCT_KINDS } from "./db/src/enums.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
// src/values.ts
|
|
4
4
|
const CORE_API_VERSION = "v1";
|
|
@@ -22,6 +22,8 @@ const USER_LINK_NAMES = [
|
|
|
22
22
|
const UserLinkName = z.enum(USER_LINK_NAMES);
|
|
23
23
|
/** ISO/IEC 5218, as in erxes until now: 0 not known, 1 male, 2 female, 9 not applicable. */
|
|
24
24
|
const CustomerSex = z.union(CUSTOMER_SEXES.map((code) => z.literal(code)));
|
|
25
|
+
/** `lead`: not a customer yet. People and companies alike. */
|
|
26
|
+
const ContactState = z.enum(CUSTOMER_STATES);
|
|
25
27
|
const ProductKind = z.enum(PRODUCT_KINDS);
|
|
26
28
|
const FieldType = z.enum(FIELD_TYPES);
|
|
27
29
|
/** Field types whose values are chosen from `options`. */
|
|
@@ -136,4 +138,4 @@ const CORE_NOTIFICATION_GROUPS = [
|
|
|
136
138
|
];
|
|
137
139
|
/** The group a notification belongs to: a core group, or the plugin that sent it. */
|
|
138
140
|
const notificationGroupOf = (source, kind) => source === "core" ? CORE_NOTIFICATION_GROUPS.find((group) => group.kinds.includes(kind))?.key ?? "records" : source;
|
|
139
|
-
export { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf };
|
|
141
|
+
export { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, ContactState, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf };
|
package/package.json
CHANGED