@erxes/core-contract 0.1.0-v2.5 → 0.1.0-v2.7
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 +39 -0
- package/dist/customers.js +2 -2
- package/dist/db/src/schema/customerAuth.js +7 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +1 -0
- package/dist/index.d.ts +34 -3
- package/dist/index.js +4 -3
- package/dist/leads.d.ts +0 -5
- package/dist/leads.js +2 -4
- package/dist/pluginJobs.d.ts +28 -0
- package/dist/pluginJobs.js +36 -0
- package/dist/plugins.d.ts +39 -0
- package/dist/plugins.js +6 -2
- package/dist/values.d.ts +5 -0
- package/dist/values.js +4 -2
- package/package.json +2 -1
package/dist/client.d.ts
CHANGED
|
@@ -21786,6 +21786,9 @@ export declare const orpc: {
|
|
|
21786
21786
|
INVALID_CLIENT: {
|
|
21787
21787
|
status: number;
|
|
21788
21788
|
};
|
|
21789
|
+
INVALID_SCHEDULE: {
|
|
21790
|
+
status: number;
|
|
21791
|
+
};
|
|
21789
21792
|
LIMIT_EXCEEDED: {
|
|
21790
21793
|
status: number;
|
|
21791
21794
|
};
|
|
@@ -21877,6 +21880,15 @@ export declare const orpc: {
|
|
|
21877
21880
|
color?: string | undefined;
|
|
21878
21881
|
}[] | undefined;
|
|
21879
21882
|
subscriptions?: string[] | undefined;
|
|
21883
|
+
jobs?: {
|
|
21884
|
+
name: string;
|
|
21885
|
+
cron?: string | undefined;
|
|
21886
|
+
retry?: {
|
|
21887
|
+
attempts: number;
|
|
21888
|
+
delay: number;
|
|
21889
|
+
maxDelay: number;
|
|
21890
|
+
} | undefined;
|
|
21891
|
+
}[] | undefined;
|
|
21880
21892
|
events?: {
|
|
21881
21893
|
type: string;
|
|
21882
21894
|
label: string;
|
|
@@ -21972,6 +21984,9 @@ export declare const orpc: {
|
|
|
21972
21984
|
INVALID_CLIENT: {
|
|
21973
21985
|
status: number;
|
|
21974
21986
|
};
|
|
21987
|
+
INVALID_SCHEDULE: {
|
|
21988
|
+
status: number;
|
|
21989
|
+
};
|
|
21975
21990
|
LIMIT_EXCEEDED: {
|
|
21976
21991
|
status: number;
|
|
21977
21992
|
};
|
|
@@ -22057,6 +22072,15 @@ export declare const orpc: {
|
|
|
22057
22072
|
color?: string | undefined;
|
|
22058
22073
|
}[] | undefined;
|
|
22059
22074
|
subscriptions?: string[] | undefined;
|
|
22075
|
+
jobs?: {
|
|
22076
|
+
name: string;
|
|
22077
|
+
cron?: string | undefined;
|
|
22078
|
+
retry?: {
|
|
22079
|
+
attempts: number;
|
|
22080
|
+
delay: number;
|
|
22081
|
+
maxDelay: number;
|
|
22082
|
+
} | undefined;
|
|
22083
|
+
}[] | undefined;
|
|
22060
22084
|
events?: {
|
|
22061
22085
|
type: string;
|
|
22062
22086
|
label: string;
|
|
@@ -22176,6 +22200,9 @@ export declare const orpc: {
|
|
|
22176
22200
|
INVALID_CLIENT: {
|
|
22177
22201
|
status: number;
|
|
22178
22202
|
};
|
|
22203
|
+
INVALID_SCHEDULE: {
|
|
22204
|
+
status: number;
|
|
22205
|
+
};
|
|
22179
22206
|
LIMIT_EXCEEDED: {
|
|
22180
22207
|
status: number;
|
|
22181
22208
|
};
|
|
@@ -22307,6 +22334,9 @@ export declare const orpc: {
|
|
|
22307
22334
|
INVALID_CLIENT: {
|
|
22308
22335
|
status: number;
|
|
22309
22336
|
};
|
|
22337
|
+
INVALID_SCHEDULE: {
|
|
22338
|
+
status: number;
|
|
22339
|
+
};
|
|
22310
22340
|
LIMIT_EXCEEDED: {
|
|
22311
22341
|
status: number;
|
|
22312
22342
|
};
|
|
@@ -22440,6 +22470,9 @@ export declare const orpc: {
|
|
|
22440
22470
|
INVALID_CLIENT: {
|
|
22441
22471
|
status: number;
|
|
22442
22472
|
};
|
|
22473
|
+
INVALID_SCHEDULE: {
|
|
22474
|
+
status: number;
|
|
22475
|
+
};
|
|
22443
22476
|
LIMIT_EXCEEDED: {
|
|
22444
22477
|
status: number;
|
|
22445
22478
|
};
|
|
@@ -22554,6 +22587,9 @@ export declare const orpc: {
|
|
|
22554
22587
|
INVALID_CLIENT: {
|
|
22555
22588
|
status: number;
|
|
22556
22589
|
};
|
|
22590
|
+
INVALID_SCHEDULE: {
|
|
22591
|
+
status: number;
|
|
22592
|
+
};
|
|
22557
22593
|
LIMIT_EXCEEDED: {
|
|
22558
22594
|
status: number;
|
|
22559
22595
|
};
|
|
@@ -22667,6 +22703,9 @@ export declare const orpc: {
|
|
|
22667
22703
|
INVALID_CLIENT: {
|
|
22668
22704
|
status: number;
|
|
22669
22705
|
};
|
|
22706
|
+
INVALID_SCHEDULE: {
|
|
22707
|
+
status: number;
|
|
22708
|
+
};
|
|
22670
22709
|
LIMIT_EXCEEDED: {
|
|
22671
22710
|
status: number;
|
|
22672
22711
|
};
|
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/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
|
@@ -168,6 +168,7 @@ const ERRORS = {
|
|
|
168
168
|
INVALID_CLIENT: { status: 401 },
|
|
169
169
|
NOT_INSTALLED: { status: 403 },
|
|
170
170
|
NAMESPACE_REQUIRED: { status: 400 },
|
|
171
|
+
INVALID_SCHEDULE: { status: 400 },
|
|
171
172
|
PLUGIN_NOT_FOUND: { status: 404 },
|
|
172
173
|
INVALID_SUBDOMAIN: { status: 400 },
|
|
173
174
|
UNKNOWN_PERMISSION: {
|
package/dist/index.d.ts
CHANGED
|
@@ -16,12 +16,13 @@ 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";
|
|
23
23
|
import { Organization, OrganizationRegion, organizationsContract } from "./organizations.js";
|
|
24
24
|
import { GatewayConfig, Invoice, InvoiceLine, InvoiceLineInput, InvoiceMetadata, PaymentGateway, PluginPaymentSettings, Refund, paymentsContract } from "./payments.js";
|
|
25
|
+
import { JobName, PluginJobDelivery, PluginJobs } from "./pluginJobs.js";
|
|
25
26
|
import { LiveTopic, PLUGIN_SCOPES, Plugin, PluginInstallation, PluginManifest, PluginName, PluginScope, TokenResponse, pluginsContract } from "./plugins.js";
|
|
26
27
|
import { Product, ProductCategory, ProductStatus, productCategoriesContract, productsContract } from "./products.js";
|
|
27
28
|
import { CORE_PERMISSIONS, CorePermission, ManifestPermissionSet, OWNER_ONLY_PERMISSIONS, PermissionAction, PermissionInfo, PermissionSet, Role, rolesContract } from "./roles.js";
|
|
@@ -30,7 +31,7 @@ import { Tag, tagsContract } from "./tags.js";
|
|
|
30
31
|
import { TrashItem, trashContract } from "./trash.js";
|
|
31
32
|
import { Export, ExportQuery, Import, ImportOptions, ImportRow, ImportStatus, TransferColumn, TransferRecordType, transferContract } from "./transfer.js";
|
|
32
33
|
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";
|
|
34
|
+
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
35
|
import { FilterField, RecordFilter, View, ViewRecordType, ViewSort, viewsContract } from "./views.js";
|
|
35
36
|
import { CORE_EVENT_TYPES, EventPattern, EventTypeInfo, Webhook, WebhookDelivery, webhooksContract } from "./webhooks.js";
|
|
36
37
|
/** The whole core API. Core implements it; plugins call it with a typed client. */
|
|
@@ -22399,6 +22400,9 @@ export declare const coreContract: {
|
|
|
22399
22400
|
INVALID_CLIENT: {
|
|
22400
22401
|
status: number;
|
|
22401
22402
|
};
|
|
22403
|
+
INVALID_SCHEDULE: {
|
|
22404
|
+
status: number;
|
|
22405
|
+
};
|
|
22402
22406
|
LIMIT_EXCEEDED: {
|
|
22403
22407
|
status: number;
|
|
22404
22408
|
};
|
|
@@ -22519,6 +22523,15 @@ export declare const coreContract: {
|
|
|
22519
22523
|
color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22520
22524
|
}, import("zod/v4/core").$strip>>>;
|
|
22521
22525
|
subscriptions: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
22526
|
+
jobs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
22527
|
+
name: import("zod").ZodString;
|
|
22528
|
+
cron: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22529
|
+
retry: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
22530
|
+
attempts: import("zod").ZodInt;
|
|
22531
|
+
delay: import("zod").ZodInt;
|
|
22532
|
+
maxDelay: import("zod").ZodInt;
|
|
22533
|
+
}, import("zod/v4/core").$strip>>;
|
|
22534
|
+
}, import("zod/v4/core").$strip>>>;
|
|
22522
22535
|
events: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
22523
22536
|
type: import("zod").ZodString;
|
|
22524
22537
|
label: import("zod").ZodString;
|
|
@@ -22617,6 +22630,9 @@ export declare const coreContract: {
|
|
|
22617
22630
|
INVALID_CLIENT: {
|
|
22618
22631
|
status: number;
|
|
22619
22632
|
};
|
|
22633
|
+
INVALID_SCHEDULE: {
|
|
22634
|
+
status: number;
|
|
22635
|
+
};
|
|
22620
22636
|
LIMIT_EXCEEDED: {
|
|
22621
22637
|
status: number;
|
|
22622
22638
|
};
|
|
@@ -22757,6 +22773,9 @@ export declare const coreContract: {
|
|
|
22757
22773
|
INVALID_CLIENT: {
|
|
22758
22774
|
status: number;
|
|
22759
22775
|
};
|
|
22776
|
+
INVALID_SCHEDULE: {
|
|
22777
|
+
status: number;
|
|
22778
|
+
};
|
|
22760
22779
|
LIMIT_EXCEEDED: {
|
|
22761
22780
|
status: number;
|
|
22762
22781
|
};
|
|
@@ -22897,6 +22916,9 @@ export declare const coreContract: {
|
|
|
22897
22916
|
INVALID_CLIENT: {
|
|
22898
22917
|
status: number;
|
|
22899
22918
|
};
|
|
22919
|
+
INVALID_SCHEDULE: {
|
|
22920
|
+
status: number;
|
|
22921
|
+
};
|
|
22900
22922
|
LIMIT_EXCEEDED: {
|
|
22901
22923
|
status: number;
|
|
22902
22924
|
};
|
|
@@ -23037,6 +23059,9 @@ export declare const coreContract: {
|
|
|
23037
23059
|
INVALID_CLIENT: {
|
|
23038
23060
|
status: number;
|
|
23039
23061
|
};
|
|
23062
|
+
INVALID_SCHEDULE: {
|
|
23063
|
+
status: number;
|
|
23064
|
+
};
|
|
23040
23065
|
LIMIT_EXCEEDED: {
|
|
23041
23066
|
status: number;
|
|
23042
23067
|
};
|
|
@@ -23149,6 +23174,9 @@ export declare const coreContract: {
|
|
|
23149
23174
|
INVALID_CLIENT: {
|
|
23150
23175
|
status: number;
|
|
23151
23176
|
};
|
|
23177
|
+
INVALID_SCHEDULE: {
|
|
23178
|
+
status: number;
|
|
23179
|
+
};
|
|
23152
23180
|
LIMIT_EXCEEDED: {
|
|
23153
23181
|
status: number;
|
|
23154
23182
|
};
|
|
@@ -23260,6 +23288,9 @@ export declare const coreContract: {
|
|
|
23260
23288
|
INVALID_CLIENT: {
|
|
23261
23289
|
status: number;
|
|
23262
23290
|
};
|
|
23291
|
+
INVALID_SCHEDULE: {
|
|
23292
|
+
status: number;
|
|
23293
|
+
};
|
|
23263
23294
|
LIMIT_EXCEEDED: {
|
|
23264
23295
|
status: number;
|
|
23265
23296
|
};
|
|
@@ -31661,4 +31692,4 @@ export declare const coreContract: {
|
|
|
31661
31692
|
}>, Record<never, never>>;
|
|
31662
31693
|
};
|
|
31663
31694
|
};
|
|
31664
|
-
export { ActionField, ActionInfo, ActionInput, Activity, ActivityInput, ActivityTarget, ActorType, AppLink, Audience, AuditEntry, AuditStream, AuditStreamFormat, Automation, AutomationDefinition, AutomationFieldPath, AutomationRun, AutomationStatus, AutomationStep, AutomationTrigger, COMMON_ERRORS, CONDITION_OPERATORS, CORE_ACTIVITY_TYPES, CORE_API_PREFIX, CORE_API_VERSION, CORE_EVENT_TYPES, CORE_NOTIFICATION_GROUPS, CORE_NOTIFICATION_KINDS, CORE_PERMISSIONS, COUNTRIES, Company, CompanyFields, CompanyInput, CompanyRef, ConditionGroup, ConditionOperator, ConditionRule, ContactLink, ContactLinkInput, ContactState, ContentType, ContextPath, CoreEvent, CoreNotificationKind, CorePermission, Country, Currency, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue, Customer, CustomerFields, CustomerInput, CustomerLogin, CustomerProfile, CustomerSession, CustomerSex, CustomerState, CustomerTokens, DESCRIPTION_MAX, DateOnly, DedupeKey, DryRunStep, ERRORS, EmailAddress, EmailMessage, EntitlementStatus, EntityType, ErrorCode, EventFailure, EventFailureStatus, EventInput, EventNotify, EventPattern, EventType, EventTypeInfo, Export, ExportQuery, FIELD_TYPE_FAMILIES, Field, FieldContentType, FieldGroup, FieldType, FieldUsage, FieldValidation, FileInfo, FileSettings, FilterField, GatewayConfig, Id, IdList, ImageAddress, Import, ImportOptions, ImportRow, ImportStatus, InvalidInput, InviteRole, Invoice, InvoiceLine, InvoiceLineInput, InvoiceMetadata, InvoiceStatus, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LIST_MAX, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, LiveMode, LiveTopic, ManifestPermissionSet, NewPassword, Note, NoteInput, NoteVersion, Notification, NotificationDelivery, NotificationGroupSetting, NotificationInput, NotificationSettings, OPTION_FIELD_TYPES, OWNER_ONLY_PERMISSIONS, Organization, OrganizationRegion, OrganizationStatus, PAYMENT_GATEWAYS, PLUGIN_SCOPES, PageInfo, PaymentGateway, PaymentGatewayKind, PermissionAction, PermissionInfo, PermissionSet, PersonRef, PhoneNumber, Plugin, PluginAccess, PluginInstallation, PluginManifest, PluginName, PluginPaymentSettings, PluginPlan, PluginScope, PluginTier, Product, ProductCategory, ProductKind, ProductStatus, QueryBoolean, QueryFlag, RecordFilter, Reentry, Refund, RelativeAmount, Role, RoleKey, RunStatus, RunStep, SaasWorkspace, Session, SourceDetails, SubscriptionInfo, Tag, TimelineKind, TimelineTarget, TokenResponse, TransferColumn, TransferRecordType, TrashItem, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UploadTarget, User, UserLinkName, UserLinks, UserStatus, View, ViewRecordType, ViewSort, Webhook, WebhookDelivery, activitiesContract, auditContract, authContract, automationsContract, companiesContract, currencyDigits, currencyOfCountry, cursorPageOf, customerAccountContract, customerAuthContract, customersContract, emailsContract, eventsContract, fieldGroupsContract, fieldsContract, filesContract, gatewayTakes, isoDate, leadsContract, lifecycleInput, lifecycleRow, listOf, notificationGroupOf, notificationsContract, organizationsContract, paymentsContract, pluginsContract, productCategoriesContract, productsContract, rolesContract, saasContract, tagsContract, transferContract, trashContract, usersContract, viewsContract, webhooksContract };
|
|
31695
|
+
export { ActionField, ActionInfo, ActionInput, Activity, ActivityInput, ActivityTarget, ActorType, AppLink, Audience, AuditEntry, AuditStream, AuditStreamFormat, Automation, AutomationDefinition, AutomationFieldPath, AutomationRun, AutomationStatus, AutomationStep, AutomationTrigger, COMMON_ERRORS, CONDITION_OPERATORS, CORE_ACTIVITY_TYPES, CORE_API_PREFIX, CORE_API_VERSION, CORE_EVENT_TYPES, CORE_NOTIFICATION_GROUPS, CORE_NOTIFICATION_KINDS, CORE_PERMISSIONS, COUNTRIES, Company, CompanyFields, CompanyInput, CompanyRef, ConditionGroup, ConditionOperator, ConditionRule, ContactLink, ContactLinkInput, ContactState, ContentType, ContextPath, CoreEvent, CoreNotificationKind, CorePermission, Country, Currency, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue, Customer, CustomerFields, CustomerInput, CustomerLogin, CustomerProfile, CustomerSession, CustomerSex, CustomerState, CustomerTokens, DESCRIPTION_MAX, DateOnly, DedupeKey, DryRunStep, ERRORS, EmailAddress, EmailMessage, EntitlementStatus, EntityType, ErrorCode, EventFailure, EventFailureStatus, EventInput, EventNotify, EventPattern, EventType, EventTypeInfo, Export, ExportQuery, FIELD_TYPE_FAMILIES, Field, FieldContentType, FieldGroup, FieldType, FieldUsage, FieldValidation, FileInfo, FileSettings, FilterField, GatewayConfig, Id, IdList, ImageAddress, Import, ImportOptions, ImportRow, ImportStatus, InvalidInput, InviteRole, Invoice, InvoiceLine, InvoiceLineInput, InvoiceMetadata, InvoiceStatus, JobName, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LIST_MAX, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, LiveMode, LiveTopic, ManifestPermissionSet, NewPassword, Note, NoteInput, NoteVersion, Notification, NotificationDelivery, NotificationGroupSetting, NotificationInput, NotificationSettings, OPTION_FIELD_TYPES, OWNER_ONLY_PERMISSIONS, Organization, OrganizationRegion, OrganizationStatus, PAYMENT_GATEWAYS, PLUGIN_SCOPES, PageInfo, PaymentGateway, PaymentGatewayKind, PermissionAction, PermissionInfo, PermissionSet, PersonRef, PhoneNumber, Plugin, PluginAccess, PluginInstallation, PluginJobDelivery, PluginJobs, PluginManifest, PluginName, PluginPaymentSettings, PluginPlan, PluginScope, PluginTier, Product, ProductCategory, ProductKind, ProductStatus, QueryBoolean, QueryFlag, RecordFilter, Reentry, Refund, RelativeAmount, Role, RoleKey, RunStatus, RunStep, SaasWorkspace, Session, SourceDetails, SubscriptionInfo, Tag, TimelineKind, TimelineTarget, TokenResponse, TransferColumn, TransferRecordType, TrashItem, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UploadTarget, User, UserLinkName, UserLinks, UserStatus, View, ViewRecordType, ViewSort, Webhook, WebhookDelivery, activitiesContract, auditContract, authContract, automationsContract, companiesContract, currencyDigits, currencyOfCountry, cursorPageOf, customerAccountContract, customerAuthContract, customersContract, emailsContract, eventsContract, fieldGroupsContract, fieldsContract, filesContract, gatewayTakes, isoDate, leadsContract, lifecycleInput, lifecycleRow, listOf, notificationGroupOf, notificationsContract, organizationsContract, paymentsContract, pluginsContract, productCategoriesContract, productsContract, rolesContract, saasContract, tagsContract, transferContract, trashContract, usersContract, viewsContract, webhooksContract };
|
package/dist/index.js
CHANGED
|
@@ -23,14 +23,15 @@ 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 {
|
|
33
|
+
import { JobName, PluginJobDelivery, PluginJobs } from "./pluginJobs.js";
|
|
34
|
+
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
35
|
// src/index.ts
|
|
35
36
|
/** The whole core API. Core implements it; plugins call it with a typed client. */
|
|
36
37
|
const coreContract = {
|
|
@@ -63,4 +64,4 @@ const coreContract = {
|
|
|
63
64
|
views: viewsContract,
|
|
64
65
|
webhooks: webhooksContract
|
|
65
66
|
};
|
|
66
|
-
export { ActionField, ActionInfo, ActionInput, Activity, ActivityInput, ActivityTarget, ActorType, AppLink, Audience, AuditEntry, AuditStream, AuditStreamFormat, Automation, AutomationDefinition, AutomationFieldPath, AutomationRun, AutomationStatus, AutomationStep, AutomationTrigger, COMMON_ERRORS, CONDITION_OPERATORS, CORE_ACTIVITY_TYPES, CORE_API_PREFIX, CORE_API_VERSION, CORE_EVENT_TYPES, CORE_NOTIFICATION_GROUPS, CORE_NOTIFICATION_KINDS, CORE_PERMISSIONS, COUNTRIES, Company, CompanyFields, CompanyRef, ConditionGroup, ConditionOperator, ConditionRule, ContactLink, ContactLinkInput, ContactState, ContentType, ContextPath, CoreEvent, Country, Currency, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue, Customer, CustomerFields, CustomerLogin, CustomerProfile, CustomerSession, CustomerSex, CustomerState, CustomerTokens, DESCRIPTION_MAX, DateOnly, DedupeKey, DryRunStep, ERRORS, EmailAddress, EmailMessage, EntitlementStatus, EntityType, EventFailure, EventFailureStatus, EventInput, EventNotify, EventPattern, EventType, EventTypeInfo, Export, ExportQuery, FIELD_TYPE_FAMILIES, Field, FieldContentType, FieldGroup, FieldType, FieldUsage, FieldValidation, FileInfo, FileSettings, FilterField, GatewayConfig, Id, IdList, ImageAddress, Import, ImportOptions, ImportRow, ImportStatus, InvalidInput, InviteRole, Invoice, InvoiceLine, InvoiceLineInput, InvoiceMetadata, InvoiceStatus, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LIST_MAX, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, LiveMode, LiveTopic, ManifestPermissionSet, NewPassword, Note, NoteInput, NoteVersion, Notification, NotificationDelivery, NotificationGroupSetting, NotificationInput, NotificationSettings, OPTION_FIELD_TYPES, OWNER_ONLY_PERMISSIONS, Organization, OrganizationRegion, OrganizationStatus, PAYMENT_GATEWAYS, PLUGIN_SCOPES, PageInfo, PaymentGateway, PaymentGatewayKind, PermissionAction, PermissionInfo, PermissionSet, PersonRef, PhoneNumber, Plugin, PluginAccess, PluginInstallation, PluginManifest, PluginName, PluginPaymentSettings, PluginPlan, PluginScope, PluginTier, Product, ProductCategory, ProductKind, ProductStatus, QueryBoolean, QueryFlag, RecordFilter, Reentry, Refund, RelativeAmount, Role, RoleKey, RunStatus, RunStep, SaasWorkspace, Session, SourceDetails, SubscriptionInfo, Tag, TimelineKind, TimelineTarget, TokenResponse, TransferColumn, TransferRecordType, TrashItem, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UploadTarget, User, UserLinkName, UserLinks, UserStatus, View, ViewRecordType, ViewSort, Webhook, WebhookDelivery, activitiesContract, auditContract, authContract, automationsContract, companiesContract, coreContract, currencyDigits, currencyOfCountry, cursorPageOf, customerAccountContract, customerAuthContract, customersContract, emailsContract, eventsContract, fieldGroupsContract, fieldsContract, filesContract, gatewayTakes, isoDate, leadsContract, lifecycleInput, lifecycleRow, listOf, notificationGroupOf, notificationsContract, organizationsContract, paymentsContract, pluginsContract, productCategoriesContract, productsContract, rolesContract, saasContract, tagsContract, transferContract, trashContract, usersContract, viewsContract, webhooksContract };
|
|
67
|
+
export { ActionField, ActionInfo, ActionInput, Activity, ActivityInput, ActivityTarget, ActorType, AppLink, Audience, AuditEntry, AuditStream, AuditStreamFormat, Automation, AutomationDefinition, AutomationFieldPath, AutomationRun, AutomationStatus, AutomationStep, AutomationTrigger, COMMON_ERRORS, CONDITION_OPERATORS, CORE_ACTIVITY_TYPES, CORE_API_PREFIX, CORE_API_VERSION, CORE_EVENT_TYPES, CORE_NOTIFICATION_GROUPS, CORE_NOTIFICATION_KINDS, CORE_PERMISSIONS, COUNTRIES, Company, CompanyFields, CompanyRef, ConditionGroup, ConditionOperator, ConditionRule, ContactLink, ContactLinkInput, ContactState, ContentType, ContextPath, CoreEvent, Country, Currency, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue, Customer, CustomerFields, CustomerLogin, CustomerProfile, CustomerSession, CustomerSex, CustomerState, CustomerTokens, DESCRIPTION_MAX, DateOnly, DedupeKey, DryRunStep, ERRORS, EmailAddress, EmailMessage, EntitlementStatus, EntityType, EventFailure, EventFailureStatus, EventInput, EventNotify, EventPattern, EventType, EventTypeInfo, Export, ExportQuery, FIELD_TYPE_FAMILIES, Field, FieldContentType, FieldGroup, FieldType, FieldUsage, FieldValidation, FileInfo, FileSettings, FilterField, GatewayConfig, Id, IdList, ImageAddress, Import, ImportOptions, ImportRow, ImportStatus, InvalidInput, InviteRole, Invoice, InvoiceLine, InvoiceLineInput, InvoiceMetadata, InvoiceStatus, JobName, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LIST_MAX, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, LiveMode, LiveTopic, ManifestPermissionSet, NewPassword, Note, NoteInput, NoteVersion, Notification, NotificationDelivery, NotificationGroupSetting, NotificationInput, NotificationSettings, OPTION_FIELD_TYPES, OWNER_ONLY_PERMISSIONS, Organization, OrganizationRegion, OrganizationStatus, PAYMENT_GATEWAYS, PLUGIN_SCOPES, PageInfo, PaymentGateway, PaymentGatewayKind, PermissionAction, PermissionInfo, PermissionSet, PersonRef, PhoneNumber, Plugin, PluginAccess, PluginInstallation, PluginJobDelivery, PluginJobs, PluginManifest, PluginName, PluginPaymentSettings, PluginPlan, PluginScope, PluginTier, Product, ProductCategory, ProductKind, ProductStatus, QueryBoolean, QueryFlag, RecordFilter, Reentry, Refund, RelativeAmount, Role, RoleKey, RunStatus, RunStep, SaasWorkspace, Session, SourceDetails, SubscriptionInfo, Tag, TimelineKind, TimelineTarget, TokenResponse, TransferColumn, TransferRecordType, TrashItem, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UploadTarget, User, UserLinkName, UserLinks, UserStatus, View, ViewRecordType, ViewSort, Webhook, WebhookDelivery, activitiesContract, auditContract, authContract, automationsContract, companiesContract, coreContract, currencyDigits, currencyOfCountry, cursorPageOf, customerAccountContract, customerAuthContract, customersContract, emailsContract, eventsContract, fieldGroupsContract, fieldsContract, filesContract, gatewayTakes, isoDate, leadsContract, lifecycleInput, lifecycleRow, listOf, notificationGroupOf, notificationsContract, organizationsContract, paymentsContract, pluginsContract, productCategoriesContract, productsContract, rolesContract, saasContract, tagsContract, transferContract, trashContract, usersContract, viewsContract, webhooksContract };
|
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 };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** A plugin job's name, the last part of its address: `mail.sync`, `token-refresh`. */
|
|
3
|
+
export declare const JobName: z.ZodString;
|
|
4
|
+
/**
|
|
5
|
+
* The manifest's `jobs`: background work at the plugin's API. The plugin
|
|
6
|
+
* queues a job with `core_enqueue_job()` in its own transaction; core POSTs
|
|
7
|
+
* each attempt to `<api.url>/jobs/<name>` with a core token and
|
|
8
|
+
* `Idempotency-Key: <job id>`, and retries until it answers 2xx. A job with
|
|
9
|
+
* `cron` also runs on that schedule, once for each organisation that has the plugin.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PluginJobs: z.ZodArray<z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
cron: z.ZodOptional<z.ZodString>;
|
|
14
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
attempts: z.ZodInt;
|
|
16
|
+
delay: z.ZodInt;
|
|
17
|
+
maxDelay: z.ZodInt;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
/** One attempt of a plugin job, as core POSTs it to `<api.url>/jobs/<name>`. */
|
|
21
|
+
export declare const PluginJobDelivery: z.ZodObject<{
|
|
22
|
+
jobId: z.ZodString;
|
|
23
|
+
orgId: z.ZodString;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
attempt: z.ZodInt;
|
|
26
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type PluginJobDelivery = z.infer<typeof PluginJobDelivery>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// src/pluginJobs.ts
|
|
3
|
+
/** A plugin job's name, the last part of its address: `mail.sync`, `token-refresh`. */
|
|
4
|
+
const JobName = z.string().trim().regex(/^[a-z][a-z0-9_.-]{0,59}$/, "lower case letters, digits and . _ - (starting with a letter)");
|
|
5
|
+
const PluginJob = z.object({
|
|
6
|
+
name: JobName,
|
|
7
|
+
/** A cron schedule in UTC (`0 3 * * *`): one job per organisation each time it comes due. */
|
|
8
|
+
cron: z.string().trim().min(1).max(100).optional(),
|
|
9
|
+
/**
|
|
10
|
+
* Attempts in all; the first retry waits `delay` seconds, each next one
|
|
11
|
+
* about twice as long, up to `maxDelay`. Default: 8 attempts, 30 s, 6 hours.
|
|
12
|
+
*/
|
|
13
|
+
retry: z.object({
|
|
14
|
+
attempts: z.int().min(1).max(25),
|
|
15
|
+
delay: z.int().min(1).max(86400),
|
|
16
|
+
maxDelay: z.int().min(1).max(604800)
|
|
17
|
+
}).refine((retry) => retry.maxDelay >= retry.delay, "maxDelay is at least delay").optional()
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* The manifest's `jobs`: background work at the plugin's API. The plugin
|
|
21
|
+
* queues a job with `core_enqueue_job()` in its own transaction; core POSTs
|
|
22
|
+
* each attempt to `<api.url>/jobs/<name>` with a core token and
|
|
23
|
+
* `Idempotency-Key: <job id>`, and retries until it answers 2xx. A job with
|
|
24
|
+
* `cron` also runs on that schedule, once for each organisation that has the plugin.
|
|
25
|
+
*/
|
|
26
|
+
const PluginJobs = z.array(PluginJob).max(50).refine((jobs) => new Set(jobs.map((job) => job.name)).size === jobs.length, "each job name once");
|
|
27
|
+
/** One attempt of a plugin job, as core POSTs it to `<api.url>/jobs/<name>`. */
|
|
28
|
+
const PluginJobDelivery = z.object({
|
|
29
|
+
jobId: z.string(),
|
|
30
|
+
orgId: z.string(),
|
|
31
|
+
name: JobName,
|
|
32
|
+
/** 1 on the first try. */
|
|
33
|
+
attempt: z.int().min(1),
|
|
34
|
+
payload: z.record(z.string(), z.unknown())
|
|
35
|
+
});
|
|
36
|
+
export { JobName, PluginJobDelivery, PluginJobs };
|
package/dist/plugins.d.ts
CHANGED
|
@@ -128,6 +128,15 @@ export declare const PluginManifest: z.ZodObject<{
|
|
|
128
128
|
color: z.ZodOptional<z.ZodString>;
|
|
129
129
|
}, z.core.$strip>>>;
|
|
130
130
|
subscriptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
|
+
jobs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
132
|
+
name: z.ZodString;
|
|
133
|
+
cron: z.ZodOptional<z.ZodString>;
|
|
134
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
attempts: z.ZodInt;
|
|
136
|
+
delay: z.ZodInt;
|
|
137
|
+
maxDelay: z.ZodInt;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
}, z.core.$strip>>>;
|
|
131
140
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
132
141
|
type: z.ZodString;
|
|
133
142
|
label: z.ZodString;
|
|
@@ -290,6 +299,9 @@ export declare const pluginsContract: {
|
|
|
290
299
|
INVALID_CLIENT: {
|
|
291
300
|
status: number;
|
|
292
301
|
};
|
|
302
|
+
INVALID_SCHEDULE: {
|
|
303
|
+
status: number;
|
|
304
|
+
};
|
|
293
305
|
LIMIT_EXCEEDED: {
|
|
294
306
|
status: number;
|
|
295
307
|
};
|
|
@@ -410,6 +422,15 @@ export declare const pluginsContract: {
|
|
|
410
422
|
color: z.ZodOptional<z.ZodString>;
|
|
411
423
|
}, z.core.$strip>>>;
|
|
412
424
|
subscriptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
425
|
+
jobs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
426
|
+
name: z.ZodString;
|
|
427
|
+
cron: z.ZodOptional<z.ZodString>;
|
|
428
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
429
|
+
attempts: z.ZodInt;
|
|
430
|
+
delay: z.ZodInt;
|
|
431
|
+
maxDelay: z.ZodInt;
|
|
432
|
+
}, z.core.$strip>>;
|
|
433
|
+
}, z.core.$strip>>>;
|
|
413
434
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
414
435
|
type: z.ZodString;
|
|
415
436
|
label: z.ZodString;
|
|
@@ -508,6 +529,9 @@ export declare const pluginsContract: {
|
|
|
508
529
|
INVALID_CLIENT: {
|
|
509
530
|
status: number;
|
|
510
531
|
};
|
|
532
|
+
INVALID_SCHEDULE: {
|
|
533
|
+
status: number;
|
|
534
|
+
};
|
|
511
535
|
LIMIT_EXCEEDED: {
|
|
512
536
|
status: number;
|
|
513
537
|
};
|
|
@@ -648,6 +672,9 @@ export declare const pluginsContract: {
|
|
|
648
672
|
INVALID_CLIENT: {
|
|
649
673
|
status: number;
|
|
650
674
|
};
|
|
675
|
+
INVALID_SCHEDULE: {
|
|
676
|
+
status: number;
|
|
677
|
+
};
|
|
651
678
|
LIMIT_EXCEEDED: {
|
|
652
679
|
status: number;
|
|
653
680
|
};
|
|
@@ -788,6 +815,9 @@ export declare const pluginsContract: {
|
|
|
788
815
|
INVALID_CLIENT: {
|
|
789
816
|
status: number;
|
|
790
817
|
};
|
|
818
|
+
INVALID_SCHEDULE: {
|
|
819
|
+
status: number;
|
|
820
|
+
};
|
|
791
821
|
LIMIT_EXCEEDED: {
|
|
792
822
|
status: number;
|
|
793
823
|
};
|
|
@@ -928,6 +958,9 @@ export declare const pluginsContract: {
|
|
|
928
958
|
INVALID_CLIENT: {
|
|
929
959
|
status: number;
|
|
930
960
|
};
|
|
961
|
+
INVALID_SCHEDULE: {
|
|
962
|
+
status: number;
|
|
963
|
+
};
|
|
931
964
|
LIMIT_EXCEEDED: {
|
|
932
965
|
status: number;
|
|
933
966
|
};
|
|
@@ -1040,6 +1073,9 @@ export declare const pluginsContract: {
|
|
|
1040
1073
|
INVALID_CLIENT: {
|
|
1041
1074
|
status: number;
|
|
1042
1075
|
};
|
|
1076
|
+
INVALID_SCHEDULE: {
|
|
1077
|
+
status: number;
|
|
1078
|
+
};
|
|
1043
1079
|
LIMIT_EXCEEDED: {
|
|
1044
1080
|
status: number;
|
|
1045
1081
|
};
|
|
@@ -1151,6 +1187,9 @@ export declare const pluginsContract: {
|
|
|
1151
1187
|
INVALID_CLIENT: {
|
|
1152
1188
|
status: number;
|
|
1153
1189
|
};
|
|
1190
|
+
INVALID_SCHEDULE: {
|
|
1191
|
+
status: number;
|
|
1192
|
+
};
|
|
1154
1193
|
LIMIT_EXCEEDED: {
|
|
1155
1194
|
status: number;
|
|
1156
1195
|
};
|
package/dist/plugins.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Id, isoDate, listOf } from "./common.js";
|
|
|
7
7
|
import { ActionField } from "./automationRuns.js";
|
|
8
8
|
import { Country } from "./money.js";
|
|
9
9
|
import { EventType } from "./platform.js";
|
|
10
|
+
import { PluginJobs } from "./pluginJobs.js";
|
|
10
11
|
import { ManifestPermissionSet } from "./roles.js";
|
|
11
12
|
import { oc } from "@orpc/contract";
|
|
12
13
|
import { z } from "zod";
|
|
@@ -135,6 +136,8 @@ const PluginManifest = z.object({
|
|
|
135
136
|
* other plugins' events need `events:read`. Its own events are not sent back.
|
|
136
137
|
*/
|
|
137
138
|
subscriptions: z.array(EventPattern).max(100).optional(),
|
|
139
|
+
/** Background work at its API (`PluginJobs`): core POSTs each job to `<api.url>/jobs/<name>`. */
|
|
140
|
+
jobs: PluginJobs.optional(),
|
|
138
141
|
/**
|
|
139
142
|
* Events it publishes: triggers for automations. `subject`: what its events
|
|
140
143
|
* are about (published with `subject`), so automations started by it can
|
|
@@ -187,13 +190,14 @@ const TokenResponse = z.object({
|
|
|
187
190
|
* plugin UIs (a member's short-lived session for one plugin's API), and live
|
|
188
191
|
* signals to plugin UIs.
|
|
189
192
|
*/
|
|
190
|
-
const { CROSS_SITE, DUPLICATE_PERMISSION_SET, INVALID_CLIENT, LIMIT_EXCEEDED, NAMESPACE_REQUIRED, NOT_INSTALLED, PLUGIN_NOT_FOUND, UNKNOWN_PERMISSION } = ERRORS;
|
|
193
|
+
const { CROSS_SITE, DUPLICATE_PERMISSION_SET, INVALID_CLIENT, INVALID_SCHEDULE, LIMIT_EXCEEDED, NAMESPACE_REQUIRED, NOT_INSTALLED, PLUGIN_NOT_FOUND, UNKNOWN_PERMISSION } = ERRORS;
|
|
191
194
|
/** What these procedures answer with besides the common errors. */
|
|
192
195
|
const base = oc.errors({
|
|
193
196
|
...COMMON_ERRORS,
|
|
194
197
|
CROSS_SITE,
|
|
195
198
|
DUPLICATE_PERMISSION_SET,
|
|
196
199
|
INVALID_CLIENT,
|
|
200
|
+
INVALID_SCHEDULE,
|
|
197
201
|
LIMIT_EXCEEDED,
|
|
198
202
|
NAMESPACE_REQUIRED,
|
|
199
203
|
NOT_INSTALLED,
|
|
@@ -214,7 +218,7 @@ const pluginsContract = {
|
|
|
214
218
|
registerManifest: base.route({
|
|
215
219
|
method: "PUT",
|
|
216
220
|
path: "/plugins/manifest",
|
|
217
|
-
summary: "The calling plugin declares its UI, API, scopes, permissions and
|
|
221
|
+
summary: "The calling plugin declares its UI, API, scopes, permissions, events and jobs. 400 INVALID_SCHEDULE when a job's cron doesn't parse"
|
|
218
222
|
}).input(PluginManifest).output(z.object({ ok: z.literal(true) })),
|
|
219
223
|
list: base.route({
|
|
220
224
|
method: "GET",
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erxes/core-contract",
|
|
3
|
-
"version": "0.1.0-v2.
|
|
3
|
+
"version": "0.1.0-v2.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "erxes core API contract (/core/v1) and event schemas, shared by core and plugins",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"./organizations": "./dist/organizations.js",
|
|
38
38
|
"./payments": "./dist/payments.js",
|
|
39
39
|
"./platform": "./dist/platform.js",
|
|
40
|
+
"./pluginJobs": "./dist/pluginJobs.js",
|
|
40
41
|
"./plugins": "./dist/plugins.js",
|
|
41
42
|
"./products": "./dist/products.js",
|
|
42
43
|
"./roles": "./dist/roles.js",
|