@erxes/core-contract 0.1.0-v2.6 → 0.1.0-v2.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/dist/client.d.ts +578 -10
- package/dist/companies.d.ts +70 -0
- package/dist/companies.js +3 -1
- package/dist/contract/routes.json.js +16 -0
- package/dist/customers.d.ts +77 -0
- package/dist/customers.js +3 -2
- package/dist/db/src/enums.d.ts +5 -0
- package/dist/db/src/enums.js +41 -3
- package/dist/db/src/schema/fields.js +16 -2
- package/dist/db/src/schema/views.js +5 -3
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +9 -0
- package/dist/fields.d.ts +226 -0
- package/dist/fields.js +16 -9
- package/dist/index.d.ts +558 -14
- package/dist/index.js +6 -4
- package/dist/pluginFields.d.ts +158 -0
- package/dist/pluginFields.js +65 -0
- package/dist/pluginJobs.d.ts +28 -0
- package/dist/pluginJobs.js +36 -0
- package/dist/plugins.d.ts +82 -6
- package/dist/plugins.js +10 -25
- package/dist/views.d.ts +149 -12
- package/dist/views.js +37 -11
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONDITION_OPERATORS } from "./db/src/enums.js";
|
|
1
|
+
import { CONDITION_OPERATORS, PLUGIN_SCOPES } from "./db/src/enums.js";
|
|
2
2
|
import { Activity, ActivityInput, ActivityTarget, CORE_ACTIVITY_TYPES, Note, NoteInput, NoteVersion, TimelineKind, TimelineTarget, activitiesContract } from "./activities.js";
|
|
3
3
|
import { Automation, AutomationFieldPath, DryRunStep, automationsContract } from "./automations.js";
|
|
4
4
|
import { AuditEntry, AuditStream, auditContract } from "./audit.js";
|
|
@@ -13,7 +13,7 @@ import { FileInfo, FileSettings, UploadTarget, filesContract } from "./files.js"
|
|
|
13
13
|
import { CORE_NOTIFICATION_KINDS, Notification, NotificationGroupSetting, NotificationInput, NotificationSettings, notificationsContract } from "./notifications.js";
|
|
14
14
|
import { Organization, OrganizationRegion, organizationsContract } from "./organizations.js";
|
|
15
15
|
import { GatewayConfig, Invoice, InvoiceLine, InvoiceLineInput, InvoiceMetadata, PaymentGateway, PluginPaymentSettings, Refund, paymentsContract } from "./payments.js";
|
|
16
|
-
import { LiveTopic,
|
|
16
|
+
import { LiveTopic, Plugin, PluginInstallation, PluginManifest, PluginName, PluginScope, TokenResponse, pluginsContract } from "./plugins.js";
|
|
17
17
|
import { Product, ProductCategory, ProductStatus, productCategoriesContract, productsContract } from "./products.js";
|
|
18
18
|
import { CORE_PERMISSIONS, ManifestPermissionSet, OWNER_ONLY_PERMISSIONS, PermissionAction, PermissionInfo, PermissionSet, Role, rolesContract } from "./roles.js";
|
|
19
19
|
import { Tag, tagsContract } from "./tags.js";
|
|
@@ -21,7 +21,7 @@ import { TrashItem, trashContract } from "./trash.js";
|
|
|
21
21
|
import { DateOnly, User, UserLinks, UserStatus, usersContract } from "./users.js";
|
|
22
22
|
import { CORE_EVENT_TYPES, EventPattern, EventTypeInfo, Webhook, WebhookDelivery, webhooksContract } from "./webhooks.js";
|
|
23
23
|
import { EntitlementStatus, OrganizationStatus, PluginAccess, PluginPlan, PluginTier, SaasWorkspace, SubscriptionInfo, saasContract } from "./saas.js";
|
|
24
|
-
import { FilterField, RecordFilter, View, ViewRecordType, ViewSort, viewsContract } from "./views.js";
|
|
24
|
+
import { FilterField, PluginViewType, RecordFilter, VIEW_MATCHES_MAX, View, ViewListType, ViewRecordType, ViewSort, viewsContract } from "./views.js";
|
|
25
25
|
import { Export, ExportQuery, Import, ImportOptions, ImportRow, ImportStatus, TransferColumn, TransferRecordType, transferContract } from "./transfer.js";
|
|
26
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";
|
|
@@ -30,6 +30,8 @@ import { ContentType, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue,
|
|
|
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 { JobName, PluginJobDelivery, PluginJobs } from "./pluginJobs.js";
|
|
34
|
+
import { PLUGIN_FIELDS_MAX, PLUGIN_VALUES_MAX, PluginField, PluginFields, pluginFieldsContract } from "./pluginFields.js";
|
|
33
35
|
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
36
|
// src/index.ts
|
|
35
37
|
/** The whole core API. Core implements it; plugins call it with a typed client. */
|
|
@@ -63,4 +65,4 @@ const coreContract = {
|
|
|
63
65
|
views: viewsContract,
|
|
64
66
|
webhooks: webhooksContract
|
|
65
67
|
};
|
|
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 };
|
|
68
|
+
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_FIELDS_MAX, PLUGIN_SCOPES, PLUGIN_VALUES_MAX, PageInfo, PaymentGateway, PaymentGatewayKind, PermissionAction, PermissionInfo, PermissionSet, PersonRef, PhoneNumber, Plugin, PluginAccess, PluginField, PluginFields, PluginInstallation, PluginJobDelivery, PluginJobs, PluginManifest, PluginName, PluginPaymentSettings, PluginPlan, PluginScope, PluginTier, PluginViewType, 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_MATCHES_MAX, View, ViewListType, 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, pluginFieldsContract, pluginsContract, productCategoriesContract, productsContract, rolesContract, saasContract, tagsContract, transferContract, trashContract, usersContract, viewsContract, webhooksContract };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The most fields one plugin declares on core records. */
|
|
3
|
+
export declare const PLUGIN_FIELDS_MAX = 20;
|
|
4
|
+
/** The most values one `fields.setPluginValues` call writes. */
|
|
5
|
+
export declare const PLUGIN_VALUES_MAX = 500;
|
|
6
|
+
/**
|
|
7
|
+
* A field a plugin keeps on customers or companies (a rollup: `total_spent`, `last_order_at`).
|
|
8
|
+
* Core stores it as a custom field members filter, sort and save views by, and shows read-only;
|
|
9
|
+
* the plugin writes its values with `fields.setPluginValues`. Select types need `options`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PluginField: z.ZodObject<{
|
|
12
|
+
code: z.ZodString;
|
|
13
|
+
contentType: z.ZodEnum<{
|
|
14
|
+
company: "company";
|
|
15
|
+
customer: "customer";
|
|
16
|
+
}>;
|
|
17
|
+
label: z.ZodString;
|
|
18
|
+
type: z.ZodEnum<{
|
|
19
|
+
date: "date";
|
|
20
|
+
multiselect: "multiselect";
|
|
21
|
+
number: "number";
|
|
22
|
+
select: "select";
|
|
23
|
+
text: "text";
|
|
24
|
+
}>;
|
|
25
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
description: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
/**
|
|
29
|
+
* The manifest's `fields`, each code and label once per record type, at most 20. Each
|
|
30
|
+
* organisation that has the plugin gets them as read-only custom fields, listed under the
|
|
31
|
+
* plugin's title; a field left out is archived (values kept) until it comes back, and a changed
|
|
32
|
+
* `type` clears its values. The plugin writes values with `fields.setPluginValues` (scope
|
|
33
|
+
* `fields:write`).
|
|
34
|
+
*/
|
|
35
|
+
export declare const PluginFields: z.ZodArray<z.ZodObject<{
|
|
36
|
+
code: z.ZodString;
|
|
37
|
+
contentType: z.ZodEnum<{
|
|
38
|
+
company: "company";
|
|
39
|
+
customer: "customer";
|
|
40
|
+
}>;
|
|
41
|
+
label: z.ZodString;
|
|
42
|
+
type: z.ZodEnum<{
|
|
43
|
+
date: "date";
|
|
44
|
+
multiselect: "multiselect";
|
|
45
|
+
number: "number";
|
|
46
|
+
select: "select";
|
|
47
|
+
text: "text";
|
|
48
|
+
}>;
|
|
49
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
description: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
/** The procedures of `fieldsContract` for plugins that keep fields on core's records. */
|
|
53
|
+
export declare const pluginFieldsContract: {
|
|
54
|
+
setPluginValues: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
55
|
+
contentType: z.ZodEnum<{
|
|
56
|
+
company: "company";
|
|
57
|
+
customer: "customer";
|
|
58
|
+
}>;
|
|
59
|
+
values: z.ZodArray<z.ZodObject<{
|
|
60
|
+
recordId: z.ZodString;
|
|
61
|
+
code: z.ZodString;
|
|
62
|
+
value: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
written: z.ZodInt;
|
|
66
|
+
skipped: z.ZodArray<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
68
|
+
UNAUTHORIZED: {
|
|
69
|
+
status: number;
|
|
70
|
+
};
|
|
71
|
+
NOT_ALLOWED: {
|
|
72
|
+
status: number;
|
|
73
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
permission: z.ZodString;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
};
|
|
77
|
+
PLUGIN_ONLY: {
|
|
78
|
+
status: number;
|
|
79
|
+
};
|
|
80
|
+
MEMBERS_ONLY: {
|
|
81
|
+
status: number;
|
|
82
|
+
};
|
|
83
|
+
ORG_REQUIRED: {
|
|
84
|
+
status: number;
|
|
85
|
+
};
|
|
86
|
+
SCOPE_REQUIRED: {
|
|
87
|
+
status: number;
|
|
88
|
+
};
|
|
89
|
+
SERVICE_TOKEN_REQUIRED: {
|
|
90
|
+
status: number;
|
|
91
|
+
};
|
|
92
|
+
ORGANIZATION_DISABLED: {
|
|
93
|
+
status: number;
|
|
94
|
+
data: z.ZodObject<{
|
|
95
|
+
manageUrl: z.ZodNullable<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
};
|
|
98
|
+
NOT_IN_PLAN: {
|
|
99
|
+
status: number;
|
|
100
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
manageUrl: z.ZodNullable<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
};
|
|
104
|
+
READ_ONLY: {
|
|
105
|
+
status: number;
|
|
106
|
+
};
|
|
107
|
+
TOO_MANY_REQUESTS: {
|
|
108
|
+
status: number;
|
|
109
|
+
};
|
|
110
|
+
INVALID_INPUT: {
|
|
111
|
+
status: number;
|
|
112
|
+
data: z.ZodObject<{
|
|
113
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
114
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
115
|
+
message: z.ZodString;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
};
|
|
119
|
+
NOT_FOUND: {
|
|
120
|
+
status: number;
|
|
121
|
+
};
|
|
122
|
+
TAKEN: {
|
|
123
|
+
status: number;
|
|
124
|
+
data: z.ZodObject<{
|
|
125
|
+
field: z.ZodString;
|
|
126
|
+
id: z.ZodOptional<z.ZodString>;
|
|
127
|
+
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
};
|
|
130
|
+
INVALID_CURSOR: {
|
|
131
|
+
status: number;
|
|
132
|
+
};
|
|
133
|
+
INVALID_REFERENCE: {
|
|
134
|
+
status: number;
|
|
135
|
+
data: z.ZodObject<{
|
|
136
|
+
field: z.ZodString;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
};
|
|
139
|
+
INVALID_FILTER: {
|
|
140
|
+
status: number;
|
|
141
|
+
};
|
|
142
|
+
FILTER_TOO_SLOW: {
|
|
143
|
+
status: number;
|
|
144
|
+
};
|
|
145
|
+
INVALID_FIELD: {
|
|
146
|
+
status: number;
|
|
147
|
+
data: z.ZodObject<{
|
|
148
|
+
fieldId: z.ZodString;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
};
|
|
151
|
+
INVALID_FIELD_VALUE: {
|
|
152
|
+
status: number;
|
|
153
|
+
data: z.ZodObject<{
|
|
154
|
+
fieldId: z.ZodString;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
};
|
|
157
|
+
}>, Record<never, never>>;
|
|
158
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CONTENT_TYPES, PLUGIN_FIELD_TYPES } from "./db/src/enums.js";
|
|
2
|
+
import { Id } from "./common.js";
|
|
3
|
+
import { COMMON_ERRORS, ERRORS } from "./errors.js";
|
|
4
|
+
import { oc } from "@orpc/contract";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
// src/pluginFields.ts
|
|
7
|
+
/** The most fields one plugin declares on core records. */
|
|
8
|
+
const PLUGIN_FIELDS_MAX = 20;
|
|
9
|
+
/** The most values one `fields.setPluginValues` call writes. */
|
|
10
|
+
const PLUGIN_VALUES_MAX = 500;
|
|
11
|
+
/**
|
|
12
|
+
* A field a plugin keeps on customers or companies (a rollup: `total_spent`, `last_order_at`).
|
|
13
|
+
* Core stores it as a custom field members filter, sort and save views by, and shows read-only;
|
|
14
|
+
* the plugin writes its values with `fields.setPluginValues`. Select types need `options`.
|
|
15
|
+
*/
|
|
16
|
+
const PluginField = z.object({
|
|
17
|
+
code: z.string().regex(/^[a-z][a-z0-9_]{0,49}$/, "lower case letters, digits and _ (starting with a letter)"),
|
|
18
|
+
contentType: z.enum(CONTENT_TYPES),
|
|
19
|
+
label: z.string().trim().min(1).max(100),
|
|
20
|
+
type: z.enum(PLUGIN_FIELD_TYPES),
|
|
21
|
+
options: z.array(z.string().trim().min(1).max(200)).max(100).optional(),
|
|
22
|
+
description: z.string().trim().max(1e3).optional()
|
|
23
|
+
}).refine((field) => field.type !== "select" && field.type !== "multiselect" || !!field.options?.length, {
|
|
24
|
+
path: ["options"],
|
|
25
|
+
error: "select fields need options"
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* The manifest's `fields`, each code and label once per record type, at most 20. Each
|
|
29
|
+
* organisation that has the plugin gets them as read-only custom fields, listed under the
|
|
30
|
+
* plugin's title; a field left out is archived (values kept) until it comes back, and a changed
|
|
31
|
+
* `type` clears its values. The plugin writes values with `fields.setPluginValues` (scope
|
|
32
|
+
* `fields:write`).
|
|
33
|
+
*/
|
|
34
|
+
const PluginFields = z.array(PluginField).max(20).refine((list) => new Set(list.map((field) => `${field.contentType}:${field.code}`)).size === list.length && new Set(list.map((field) => `${field.contentType}:${field.label.toLowerCase()}`)).size === list.length, "each code and label once per record type");
|
|
35
|
+
/** A value of a plugin's field on one record: a number, a date (`YYYY-MM-DD`), text, option(s); null clears it. */
|
|
36
|
+
const PluginValue = z.object({
|
|
37
|
+
recordId: Id,
|
|
38
|
+
/** The field's `code` in the plugin's manifest. */
|
|
39
|
+
code: z.string().min(1).max(50),
|
|
40
|
+
value: z.union([
|
|
41
|
+
z.number(),
|
|
42
|
+
z.string().max(1e4),
|
|
43
|
+
z.array(z.string().max(200)).max(100)
|
|
44
|
+
]).nullable()
|
|
45
|
+
});
|
|
46
|
+
const { INVALID_FIELD, INVALID_FIELD_VALUE } = ERRORS;
|
|
47
|
+
/** The procedures of `fieldsContract` for plugins that keep fields on core's records. */
|
|
48
|
+
const pluginFieldsContract = { setPluginValues: oc.errors({
|
|
49
|
+
...COMMON_ERRORS,
|
|
50
|
+
INVALID_FIELD,
|
|
51
|
+
INVALID_FIELD_VALUE
|
|
52
|
+
}).route({
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/fields/plugin-values",
|
|
55
|
+
summary: "Write values of the calling plugin's own fields (by manifest `code`), up to 500; null clears one. Quiet: no timeline entry, event, audit row or notification. Records not found are skipped. 400 INVALID_FIELD for a code the manifest doesn't declare, INVALID_FIELD_VALUE for a value that doesn't fit"
|
|
56
|
+
}).input(z.object({
|
|
57
|
+
contentType: z.enum(CONTENT_TYPES),
|
|
58
|
+
values: z.array(PluginValue).min(1).max(500)
|
|
59
|
+
})).output(z.object({
|
|
60
|
+
/** Values written or cleared. */
|
|
61
|
+
written: z.int(),
|
|
62
|
+
/** Ids of records that don't exist here (deleted, or never this organisation's). */
|
|
63
|
+
skipped: z.array(Id)
|
|
64
|
+
})) };
|
|
65
|
+
export { PLUGIN_FIELDS_MAX, PLUGIN_VALUES_MAX, PluginField, PluginFields, pluginFieldsContract };
|
|
@@ -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
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
import { PLUGIN_SCOPES } from "./db/src/enums.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
/** A plugin's name: its namespace everywhere (`hr` → `hr.leave.requested`, `/hr/*`). */
|
|
3
4
|
export declare const PluginName: z.ZodString;
|
|
4
|
-
/**
|
|
5
|
-
* What a plugin may do in core, granted per organisation when it is
|
|
6
|
-
* installed. A plugin only ever gets the scopes it asked for in its manifest.
|
|
7
|
-
*/
|
|
8
|
-
export declare const PLUGIN_SCOPES: readonly ['activities:write', 'customers:read', 'customers:write', 'audit:write', 'emails:write', 'events:read', 'events:write', 'files:read', 'files:write', 'live:write', 'notifications:write', 'payments:read', 'payments:write', 'products:read', 'products:write', 'users:read'];
|
|
9
5
|
export declare const PluginScope: z.ZodEnum<{
|
|
10
6
|
"activities:write": "activities:write";
|
|
11
7
|
"audit:write": "audit:write";
|
|
@@ -14,6 +10,7 @@ export declare const PluginScope: z.ZodEnum<{
|
|
|
14
10
|
"emails:write": "emails:write";
|
|
15
11
|
"events:read": "events:read";
|
|
16
12
|
"events:write": "events:write";
|
|
13
|
+
"fields:write": "fields:write";
|
|
17
14
|
"files:read": "files:read";
|
|
18
15
|
"files:write": "files:write";
|
|
19
16
|
"live:write": "live:write";
|
|
@@ -23,6 +20,7 @@ export declare const PluginScope: z.ZodEnum<{
|
|
|
23
20
|
"products:read": "products:read";
|
|
24
21
|
"products:write": "products:write";
|
|
25
22
|
"users:read": "users:read";
|
|
23
|
+
"views:read": "views:read";
|
|
26
24
|
}>;
|
|
27
25
|
export type PluginScope = z.infer<typeof PluginScope>;
|
|
28
26
|
/** Live update topic: `leave-requests`, `leave:abc123`. */
|
|
@@ -53,6 +51,7 @@ export declare const PluginManifest: z.ZodObject<{
|
|
|
53
51
|
"emails:write": "emails:write";
|
|
54
52
|
"events:read": "events:read";
|
|
55
53
|
"events:write": "events:write";
|
|
54
|
+
"fields:write": "fields:write";
|
|
56
55
|
"files:read": "files:read";
|
|
57
56
|
"files:write": "files:write";
|
|
58
57
|
"live:write": "live:write";
|
|
@@ -62,6 +61,7 @@ export declare const PluginManifest: z.ZodObject<{
|
|
|
62
61
|
"products:read": "products:read";
|
|
63
62
|
"products:write": "products:write";
|
|
64
63
|
"users:read": "users:read";
|
|
64
|
+
"views:read": "views:read";
|
|
65
65
|
}>>>;
|
|
66
66
|
permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
67
|
action: z.ZodString;
|
|
@@ -128,6 +128,32 @@ 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>>>;
|
|
140
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
141
|
+
code: z.ZodString;
|
|
142
|
+
contentType: z.ZodEnum<{
|
|
143
|
+
company: "company";
|
|
144
|
+
customer: "customer";
|
|
145
|
+
}>;
|
|
146
|
+
label: z.ZodString;
|
|
147
|
+
type: z.ZodEnum<{
|
|
148
|
+
date: "date";
|
|
149
|
+
multiselect: "multiselect";
|
|
150
|
+
number: "number";
|
|
151
|
+
select: "select";
|
|
152
|
+
text: "text";
|
|
153
|
+
}>;
|
|
154
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
155
|
+
description: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$strip>>>;
|
|
131
157
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
132
158
|
type: z.ZodString;
|
|
133
159
|
label: z.ZodString;
|
|
@@ -290,6 +316,9 @@ export declare const pluginsContract: {
|
|
|
290
316
|
INVALID_CLIENT: {
|
|
291
317
|
status: number;
|
|
292
318
|
};
|
|
319
|
+
INVALID_SCHEDULE: {
|
|
320
|
+
status: number;
|
|
321
|
+
};
|
|
293
322
|
LIMIT_EXCEEDED: {
|
|
294
323
|
status: number;
|
|
295
324
|
};
|
|
@@ -335,6 +364,7 @@ export declare const pluginsContract: {
|
|
|
335
364
|
"emails:write": "emails:write";
|
|
336
365
|
"events:read": "events:read";
|
|
337
366
|
"events:write": "events:write";
|
|
367
|
+
"fields:write": "fields:write";
|
|
338
368
|
"files:read": "files:read";
|
|
339
369
|
"files:write": "files:write";
|
|
340
370
|
"live:write": "live:write";
|
|
@@ -344,6 +374,7 @@ export declare const pluginsContract: {
|
|
|
344
374
|
"products:read": "products:read";
|
|
345
375
|
"products:write": "products:write";
|
|
346
376
|
"users:read": "users:read";
|
|
377
|
+
"views:read": "views:read";
|
|
347
378
|
}>>>;
|
|
348
379
|
permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
349
380
|
action: z.ZodString;
|
|
@@ -410,6 +441,32 @@ export declare const pluginsContract: {
|
|
|
410
441
|
color: z.ZodOptional<z.ZodString>;
|
|
411
442
|
}, z.core.$strip>>>;
|
|
412
443
|
subscriptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
444
|
+
jobs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
445
|
+
name: z.ZodString;
|
|
446
|
+
cron: z.ZodOptional<z.ZodString>;
|
|
447
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
448
|
+
attempts: z.ZodInt;
|
|
449
|
+
delay: z.ZodInt;
|
|
450
|
+
maxDelay: z.ZodInt;
|
|
451
|
+
}, z.core.$strip>>;
|
|
452
|
+
}, z.core.$strip>>>;
|
|
453
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
454
|
+
code: z.ZodString;
|
|
455
|
+
contentType: z.ZodEnum<{
|
|
456
|
+
company: "company";
|
|
457
|
+
customer: "customer";
|
|
458
|
+
}>;
|
|
459
|
+
label: z.ZodString;
|
|
460
|
+
type: z.ZodEnum<{
|
|
461
|
+
date: "date";
|
|
462
|
+
multiselect: "multiselect";
|
|
463
|
+
number: "number";
|
|
464
|
+
select: "select";
|
|
465
|
+
text: "text";
|
|
466
|
+
}>;
|
|
467
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
468
|
+
description: z.ZodOptional<z.ZodString>;
|
|
469
|
+
}, z.core.$strip>>>;
|
|
413
470
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
414
471
|
type: z.ZodString;
|
|
415
472
|
label: z.ZodString;
|
|
@@ -508,6 +565,9 @@ export declare const pluginsContract: {
|
|
|
508
565
|
INVALID_CLIENT: {
|
|
509
566
|
status: number;
|
|
510
567
|
};
|
|
568
|
+
INVALID_SCHEDULE: {
|
|
569
|
+
status: number;
|
|
570
|
+
};
|
|
511
571
|
LIMIT_EXCEEDED: {
|
|
512
572
|
status: number;
|
|
513
573
|
};
|
|
@@ -648,6 +708,9 @@ export declare const pluginsContract: {
|
|
|
648
708
|
INVALID_CLIENT: {
|
|
649
709
|
status: number;
|
|
650
710
|
};
|
|
711
|
+
INVALID_SCHEDULE: {
|
|
712
|
+
status: number;
|
|
713
|
+
};
|
|
651
714
|
LIMIT_EXCEEDED: {
|
|
652
715
|
status: number;
|
|
653
716
|
};
|
|
@@ -788,6 +851,9 @@ export declare const pluginsContract: {
|
|
|
788
851
|
INVALID_CLIENT: {
|
|
789
852
|
status: number;
|
|
790
853
|
};
|
|
854
|
+
INVALID_SCHEDULE: {
|
|
855
|
+
status: number;
|
|
856
|
+
};
|
|
791
857
|
LIMIT_EXCEEDED: {
|
|
792
858
|
status: number;
|
|
793
859
|
};
|
|
@@ -928,6 +994,9 @@ export declare const pluginsContract: {
|
|
|
928
994
|
INVALID_CLIENT: {
|
|
929
995
|
status: number;
|
|
930
996
|
};
|
|
997
|
+
INVALID_SCHEDULE: {
|
|
998
|
+
status: number;
|
|
999
|
+
};
|
|
931
1000
|
LIMIT_EXCEEDED: {
|
|
932
1001
|
status: number;
|
|
933
1002
|
};
|
|
@@ -1040,6 +1109,9 @@ export declare const pluginsContract: {
|
|
|
1040
1109
|
INVALID_CLIENT: {
|
|
1041
1110
|
status: number;
|
|
1042
1111
|
};
|
|
1112
|
+
INVALID_SCHEDULE: {
|
|
1113
|
+
status: number;
|
|
1114
|
+
};
|
|
1043
1115
|
LIMIT_EXCEEDED: {
|
|
1044
1116
|
status: number;
|
|
1045
1117
|
};
|
|
@@ -1151,6 +1223,9 @@ export declare const pluginsContract: {
|
|
|
1151
1223
|
INVALID_CLIENT: {
|
|
1152
1224
|
status: number;
|
|
1153
1225
|
};
|
|
1226
|
+
INVALID_SCHEDULE: {
|
|
1227
|
+
status: number;
|
|
1228
|
+
};
|
|
1154
1229
|
LIMIT_EXCEEDED: {
|
|
1155
1230
|
status: number;
|
|
1156
1231
|
};
|
|
@@ -1170,4 +1245,5 @@ export declare const pluginsContract: {
|
|
|
1170
1245
|
}, z.core.$strip>;
|
|
1171
1246
|
};
|
|
1172
1247
|
}>, Record<never, never>>;
|
|
1173
|
-
};
|
|
1248
|
+
};
|
|
1249
|
+
export { PLUGIN_SCOPES };
|
package/dist/plugins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AUTOMATION_SUBJECTS, CONTENT_TYPES } from "./db/src/enums.js";
|
|
1
|
+
import { AUTOMATION_SUBJECTS, CONTENT_TYPES, PLUGIN_SCOPES } from "./db/src/enums.js";
|
|
2
2
|
import { pluginInstallations, plugins } from "./db/src/schema/plugins.js";
|
|
3
3
|
import "./db/src/schema/index.js";
|
|
4
4
|
import { COMMON_ERRORS, ERRORS } from "./errors.js";
|
|
@@ -7,6 +7,8 @@ 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 { PluginFields } from "./pluginFields.js";
|
|
11
|
+
import { PluginJobs } from "./pluginJobs.js";
|
|
10
12
|
import { ManifestPermissionSet } from "./roles.js";
|
|
11
13
|
import { oc } from "@orpc/contract";
|
|
12
14
|
import { z } from "zod";
|
|
@@ -14,28 +16,6 @@ import { createSelectSchema } from "drizzle-zod";
|
|
|
14
16
|
// src/plugins.ts
|
|
15
17
|
/** A plugin's name: its namespace everywhere (`hr` → `hr.leave.requested`, `/hr/*`). */
|
|
16
18
|
const PluginName = z.string().trim().regex(/^[a-z][a-z0-9_]{0,39}$/, "lower case letters, digits and _ (starting with a letter)").refine((name) => name !== "core", "reserved");
|
|
17
|
-
/**
|
|
18
|
-
* What a plugin may do in core, granted per organisation when it is
|
|
19
|
-
* installed. A plugin only ever gets the scopes it asked for in its manifest.
|
|
20
|
-
*/
|
|
21
|
-
const PLUGIN_SCOPES = [
|
|
22
|
-
"activities:write",
|
|
23
|
-
"customers:read",
|
|
24
|
-
"customers:write",
|
|
25
|
-
"audit:write",
|
|
26
|
-
"emails:write",
|
|
27
|
-
"events:read",
|
|
28
|
-
"events:write",
|
|
29
|
-
"files:read",
|
|
30
|
-
"files:write",
|
|
31
|
-
"live:write",
|
|
32
|
-
"notifications:write",
|
|
33
|
-
"payments:read",
|
|
34
|
-
"payments:write",
|
|
35
|
-
"products:read",
|
|
36
|
-
"products:write",
|
|
37
|
-
"users:read"
|
|
38
|
-
];
|
|
39
19
|
const PluginScope = z.enum(PLUGIN_SCOPES);
|
|
40
20
|
/** Live update topic: `leave-requests`, `leave:abc123`. */
|
|
41
21
|
const LiveTopic = z.string().trim().regex(/^[a-z0-9][a-z0-9._:-]{0,99}$/, "lower case letters, digits and . _ : -");
|
|
@@ -135,6 +115,10 @@ const PluginManifest = z.object({
|
|
|
135
115
|
* other plugins' events need `events:read`. Its own events are not sent back.
|
|
136
116
|
*/
|
|
137
117
|
subscriptions: z.array(EventPattern).max(100).optional(),
|
|
118
|
+
/** Background work at its API (`PluginJobs`): core POSTs each job to `<api.url>/jobs/<name>`. */
|
|
119
|
+
jobs: PluginJobs.optional(),
|
|
120
|
+
/** Fields it keeps on customers and companies (`PluginFields`): read-only custom fields to members. */
|
|
121
|
+
fields: PluginFields.optional(),
|
|
138
122
|
/**
|
|
139
123
|
* Events it publishes: triggers for automations. `subject`: what its events
|
|
140
124
|
* are about (published with `subject`), so automations started by it can
|
|
@@ -187,13 +171,14 @@ const TokenResponse = z.object({
|
|
|
187
171
|
* plugin UIs (a member's short-lived session for one plugin's API), and live
|
|
188
172
|
* signals to plugin UIs.
|
|
189
173
|
*/
|
|
190
|
-
const { CROSS_SITE, DUPLICATE_PERMISSION_SET, INVALID_CLIENT, LIMIT_EXCEEDED, NAMESPACE_REQUIRED, NOT_INSTALLED, PLUGIN_NOT_FOUND, UNKNOWN_PERMISSION } = ERRORS;
|
|
174
|
+
const { CROSS_SITE, DUPLICATE_PERMISSION_SET, INVALID_CLIENT, INVALID_SCHEDULE, LIMIT_EXCEEDED, NAMESPACE_REQUIRED, NOT_INSTALLED, PLUGIN_NOT_FOUND, UNKNOWN_PERMISSION } = ERRORS;
|
|
191
175
|
/** What these procedures answer with besides the common errors. */
|
|
192
176
|
const base = oc.errors({
|
|
193
177
|
...COMMON_ERRORS,
|
|
194
178
|
CROSS_SITE,
|
|
195
179
|
DUPLICATE_PERMISSION_SET,
|
|
196
180
|
INVALID_CLIENT,
|
|
181
|
+
INVALID_SCHEDULE,
|
|
197
182
|
LIMIT_EXCEEDED,
|
|
198
183
|
NAMESPACE_REQUIRED,
|
|
199
184
|
NOT_INSTALLED,
|
|
@@ -214,7 +199,7 @@ const pluginsContract = {
|
|
|
214
199
|
registerManifest: base.route({
|
|
215
200
|
method: "PUT",
|
|
216
201
|
path: "/plugins/manifest",
|
|
217
|
-
summary: "The calling plugin declares its UI, API, scopes, permissions and
|
|
202
|
+
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
203
|
}).input(PluginManifest).output(z.object({ ok: z.literal(true) })),
|
|
219
204
|
list: base.route({
|
|
220
205
|
method: "GET",
|