@objectstack/spec 0.1.0 → 0.1.2
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/README.md +134 -121
- package/dist/ai/agent.zod.d.ts +164 -0
- package/dist/ai/agent.zod.d.ts.map +1 -0
- package/dist/ai/agent.zod.js +51 -0
- package/dist/api/contract.zod.d.ts +1733 -0
- package/dist/api/contract.zod.d.ts.map +1 -0
- package/dist/api/contract.zod.js +138 -0
- package/dist/data/dataset.zod.d.ts +60 -0
- package/dist/data/dataset.zod.d.ts.map +1 -0
- package/dist/data/dataset.zod.js +54 -0
- package/dist/data/field.zod.d.ts +1808 -0
- package/dist/data/field.zod.d.ts.map +1 -0
- package/dist/data/field.zod.js +222 -0
- package/dist/data/flow.zod.d.ts +242 -0
- package/dist/data/flow.zod.d.ts.map +1 -0
- package/dist/data/flow.zod.js +77 -0
- package/dist/data/mapping.zod.d.ts +470 -0
- package/dist/data/mapping.zod.d.ts.map +1 -0
- package/dist/data/mapping.zod.js +65 -0
- package/dist/data/object.zod.d.ts +844 -0
- package/dist/data/object.zod.d.ts.map +1 -0
- package/dist/data/object.zod.js +81 -0
- package/dist/data/permission.zod.d.ts +163 -0
- package/dist/data/permission.zod.d.ts.map +1 -0
- package/dist/data/permission.zod.js +62 -0
- package/dist/data/query.zod.d.ts +438 -0
- package/dist/data/query.zod.d.ts.map +1 -0
- package/dist/data/query.zod.js +147 -0
- package/dist/data/sharing.zod.d.ts +63 -0
- package/dist/data/sharing.zod.d.ts.map +1 -0
- package/dist/data/sharing.zod.js +57 -0
- package/dist/data/trigger.zod.d.ts +354 -0
- package/dist/data/trigger.zod.d.ts.map +1 -0
- package/dist/data/trigger.zod.js +195 -0
- package/dist/data/validation.zod.d.ts +276 -0
- package/dist/data/validation.zod.d.ts.map +1 -0
- package/dist/data/validation.zod.js +105 -0
- package/dist/data/workflow.zod.d.ts +195 -0
- package/dist/data/workflow.zod.d.ts.map +1 -0
- package/dist/data/workflow.zod.js +64 -0
- package/dist/index.d.ts +41 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -5
- package/dist/system/api.zod.d.ts +294 -0
- package/dist/system/api.zod.d.ts.map +1 -0
- package/dist/system/api.zod.js +56 -0
- package/dist/system/constants/index.d.ts +11 -0
- package/dist/system/constants/index.d.ts.map +1 -0
- package/dist/system/constants/index.js +26 -0
- package/dist/system/constants/paths.d.ts +71 -0
- package/dist/system/constants/paths.d.ts.map +1 -0
- package/dist/system/constants/paths.js +65 -0
- package/dist/system/datasource.zod.d.ts +210 -0
- package/dist/system/datasource.zod.d.ts.map +1 -0
- package/dist/system/datasource.zod.js +90 -0
- package/dist/system/discovery.zod.d.ts +174 -0
- package/dist/system/discovery.zod.d.ts.map +1 -0
- package/dist/system/discovery.zod.js +53 -0
- package/dist/system/driver.zod.d.ts +1525 -0
- package/dist/system/driver.zod.d.ts.map +1 -0
- package/dist/system/driver.zod.js +290 -0
- package/dist/system/identity.zod.d.ts +204 -0
- package/dist/system/identity.zod.d.ts.map +1 -0
- package/dist/system/identity.zod.js +68 -0
- package/dist/system/license.zod.d.ts +110 -0
- package/dist/system/license.zod.d.ts.map +1 -0
- package/dist/system/license.zod.js +63 -0
- package/dist/system/manifest.zod.d.ts +397 -0
- package/dist/system/manifest.zod.d.ts.map +1 -0
- package/dist/system/manifest.zod.js +142 -0
- package/dist/system/plugin.zod.d.ts +3516 -0
- package/dist/system/plugin.zod.d.ts.map +1 -0
- package/dist/system/plugin.zod.js +226 -0
- package/dist/system/policy.zod.d.ts +209 -0
- package/dist/system/policy.zod.d.ts.map +1 -0
- package/dist/system/policy.zod.js +54 -0
- package/dist/system/role.zod.d.ts +34 -0
- package/dist/system/role.zod.d.ts.map +1 -0
- package/dist/system/role.zod.js +25 -0
- package/dist/system/territory.zod.d.ts +91 -0
- package/dist/system/territory.zod.d.ts.map +1 -0
- package/dist/system/territory.zod.js +64 -0
- package/dist/system/translation.zod.d.ts +171 -0
- package/dist/system/translation.zod.d.ts.map +1 -0
- package/dist/system/translation.zod.js +34 -0
- package/dist/system/types/index.d.ts +7 -0
- package/dist/system/types/index.d.ts.map +1 -0
- package/dist/system/types/index.js +22 -0
- package/dist/system/types/plugin.d.ts +113 -0
- package/dist/system/types/plugin.d.ts.map +1 -0
- package/dist/system/types/plugin.js +6 -0
- package/dist/system/webhook.zod.d.ts +106 -0
- package/dist/system/webhook.zod.d.ts.map +1 -0
- package/dist/system/webhook.zod.js +56 -0
- package/dist/ui/action.zod.d.ts +155 -0
- package/dist/ui/action.zod.d.ts.map +1 -0
- package/dist/ui/action.zod.js +54 -0
- package/dist/ui/app.zod.d.ts +405 -0
- package/dist/ui/app.zod.d.ts.map +1 -0
- package/dist/ui/app.zod.js +138 -0
- package/dist/ui/dashboard.zod.d.ts +213 -0
- package/dist/ui/dashboard.zod.d.ts.map +1 -0
- package/dist/ui/dashboard.zod.js +72 -0
- package/dist/ui/page.zod.d.ts +187 -0
- package/dist/ui/page.zod.d.ts.map +1 -0
- package/dist/ui/page.zod.js +48 -0
- package/dist/ui/report.zod.d.ts +233 -0
- package/dist/ui/report.zod.d.ts.map +1 -0
- package/dist/ui/report.zod.js +74 -0
- package/dist/ui/theme.zod.d.ts +1221 -0
- package/dist/ui/theme.zod.d.ts.map +1 -0
- package/dist/ui/theme.zod.js +202 -0
- package/dist/ui/view.zod.d.ts +887 -0
- package/dist/ui/view.zod.d.ts.map +1 -0
- package/dist/ui/view.zod.js +83 -0
- package/dist/ui/widget.zod.d.ts +350 -0
- package/dist/ui/widget.zod.d.ts.map +1 -0
- package/dist/ui/widget.zod.js +66 -0
- package/json-schema/AIKnowledge.json +30 -0
- package/json-schema/AIModelConfig.json +41 -0
- package/json-schema/AITool.json +33 -0
- package/json-schema/Action.json +162 -0
- package/json-schema/ActionParam.json +82 -0
- package/json-schema/Address.json +40 -0
- package/json-schema/Agent.json +140 -0
- package/json-schema/AggregationFunction.json +19 -0
- package/json-schema/AggregationNode.json +42 -0
- package/json-schema/Animation.json +56 -0
- package/json-schema/ApiCapabilities.json +28 -0
- package/json-schema/ApiEndpoint.json +162 -0
- package/json-schema/ApiError.json +27 -0
- package/json-schema/ApiMapping.json +28 -0
- package/json-schema/ApiRoutes.json +41 -0
- package/json-schema/App.json +297 -0
- package/json-schema/AppBranding.json +24 -0
- package/json-schema/AsyncValidation.json +70 -0
- package/json-schema/AuditPolicy.json +31 -0
- package/json-schema/AuthProtocol.json +17 -0
- package/json-schema/AuthProvider.json +171 -0
- package/json-schema/BaseResponse.json +63 -0
- package/json-schema/BorderRadius.json +44 -0
- package/json-schema/Breakpoints.json +36 -0
- package/json-schema/BulkRequest.json +29 -0
- package/json-schema/BulkResponse.json +108 -0
- package/json-schema/CalendarConfig.json +28 -0
- package/json-schema/ChartType.json +19 -0
- package/json-schema/ColorPalette.json +83 -0
- package/json-schema/ConditionalValidation.json +793 -0
- package/json-schema/CreateRequest.json +20 -0
- package/json-schema/CrossFieldValidation.json +56 -0
- package/json-schema/CustomValidator.json +57 -0
- package/json-schema/Dashboard.json +117 -0
- package/json-schema/DashboardNavItem.json +42 -0
- package/json-schema/DashboardWidget.json +89 -0
- package/json-schema/Dataset.json +63 -0
- package/json-schema/DatasetMode.json +16 -0
- package/json-schema/Datasource.json +75 -0
- package/json-schema/DatasourceCapabilities.json +36 -0
- package/json-schema/DeleteResponse.json +68 -0
- package/json-schema/Discovery.json +114 -0
- package/json-schema/DriverCapabilities.json +39 -0
- package/json-schema/DriverDefinition.json +66 -0
- package/json-schema/DriverInterface.json +58 -0
- package/json-schema/DriverOptions.json +23 -0
- package/json-schema/DriverType.json +10 -0
- package/json-schema/EmailAlertAction.json +37 -0
- package/json-schema/ExportRequest.json +786 -0
- package/json-schema/Feature.json +51 -0
- package/json-schema/Field.json +290 -0
- package/json-schema/FieldMapping.json +83 -0
- package/json-schema/FieldNode.json +32 -0
- package/json-schema/FieldPermission.json +22 -0
- package/json-schema/FieldType.json +42 -0
- package/json-schema/FieldUpdateAction.json +32 -0
- package/json-schema/FieldWidgetProps.json +327 -0
- package/json-schema/FilterNode.json +52 -0
- package/json-schema/FilterOperator.json +26 -0
- package/json-schema/Flow.json +186 -0
- package/json-schema/FlowEdge.json +37 -0
- package/json-schema/FlowNode.json +65 -0
- package/json-schema/FlowNodeAction.json +24 -0
- package/json-schema/FlowVariable.json +34 -0
- package/json-schema/FormSection.json +42 -0
- package/json-schema/FormView.json +99 -0
- package/json-schema/FormatValidation.json +59 -0
- package/json-schema/GanttConfig.json +32 -0
- package/json-schema/GroupNavItem.json +42 -0
- package/json-schema/HttpMethod.json +16 -0
- package/json-schema/I18nContext.json +12 -0
- package/json-schema/Index.json +30 -0
- package/json-schema/JoinNode.json +455 -0
- package/json-schema/JoinType.json +15 -0
- package/json-schema/KanbanConfig.json +31 -0
- package/json-schema/LDAPConfig.json +39 -0
- package/json-schema/License.json +57 -0
- package/json-schema/ListRecordResponse.json +103 -0
- package/json-schema/ListView.json +153 -0
- package/json-schema/Locale.json +10 -0
- package/json-schema/LocationCoordinates.json +36 -0
- package/json-schema/Logger.json +25 -0
- package/json-schema/LogicOperator.json +14 -0
- package/json-schema/Manifest.json +315 -0
- package/json-schema/Mapping.json +598 -0
- package/json-schema/MenuItem.json +28 -0
- package/json-schema/MetricType.json +14 -0
- package/json-schema/ModificationResult.json +46 -0
- package/json-schema/NavigationItem.json +214 -0
- package/json-schema/NetworkPolicy.json +31 -0
- package/json-schema/OIDCConfig.json +46 -0
- package/json-schema/OWDModel.json +14 -0
- package/json-schema/Object.json +428 -0
- package/json-schema/ObjectCapabilities.json +62 -0
- package/json-schema/ObjectNavItem.json +46 -0
- package/json-schema/ObjectPermission.json +42 -0
- package/json-schema/ObjectQLClient.json +12 -0
- package/json-schema/Page.json +117 -0
- package/json-schema/PageComponent.json +36 -0
- package/json-schema/PageNavItem.json +47 -0
- package/json-schema/PageRegion.json +63 -0
- package/json-schema/PasswordPolicy.json +41 -0
- package/json-schema/PermissionSet.json +96 -0
- package/json-schema/Plan.json +53 -0
- package/json-schema/Plugin.json +20 -0
- package/json-schema/PluginContext.json +91 -0
- package/json-schema/PluginLifecycle.json +11 -0
- package/json-schema/Policy.json +138 -0
- package/json-schema/Query.json +456 -0
- package/json-schema/RateLimit.json +26 -0
- package/json-schema/RecordData.json +11 -0
- package/json-schema/Report.json +219 -0
- package/json-schema/ReportChart.json +45 -0
- package/json-schema/ReportColumn.json +35 -0
- package/json-schema/ReportGrouping.json +38 -0
- package/json-schema/ReportType.json +15 -0
- package/json-schema/Role.json +32 -0
- package/json-schema/Router.json +12 -0
- package/json-schema/SAMLConfig.json +44 -0
- package/json-schema/Scheduler.json +12 -0
- package/json-schema/ScopedStorage.json +12 -0
- package/json-schema/ScriptValidation.json +48 -0
- package/json-schema/SelectOption.json +32 -0
- package/json-schema/SessionPolicy.json +27 -0
- package/json-schema/Shadow.json +44 -0
- package/json-schema/SharingLevel.json +13 -0
- package/json-schema/SharingRule.json +58 -0
- package/json-schema/SharingRuleType.json +15 -0
- package/json-schema/SingleRecordResponse.json +69 -0
- package/json-schema/SortNode.json +26 -0
- package/json-schema/Spacing.json +64 -0
- package/json-schema/StateMachineValidation.json +59 -0
- package/json-schema/SystemAPI.json +12 -0
- package/json-schema/Territory.json +77 -0
- package/json-schema/TerritoryModel.json +34 -0
- package/json-schema/TerritoryType.json +15 -0
- package/json-schema/Theme.json +543 -0
- package/json-schema/ThemeMode.json +14 -0
- package/json-schema/TransformType.json +18 -0
- package/json-schema/TranslationBundle.json +78 -0
- package/json-schema/TranslationData.json +75 -0
- package/json-schema/Trigger.json +73 -0
- package/json-schema/TriggerAction.json +14 -0
- package/json-schema/TriggerContext.json +61 -0
- package/json-schema/TriggerTiming.json +13 -0
- package/json-schema/Typography.json +142 -0
- package/json-schema/UniquenessValidation.json +59 -0
- package/json-schema/UpdateRequest.json +20 -0
- package/json-schema/UrlNavItem.json +51 -0
- package/json-schema/ValidationRule.json +794 -0
- package/json-schema/View.json +500 -0
- package/json-schema/Webhook.json +88 -0
- package/json-schema/WebhookReceiver.json +66 -0
- package/json-schema/WebhookTriggerType.json +16 -0
- package/json-schema/WindowFunction.json +24 -0
- package/json-schema/WindowFunctionNode.json +104 -0
- package/json-schema/WindowSpec.json +65 -0
- package/json-schema/WorkflowAction.json +84 -0
- package/json-schema/WorkflowRule.json +128 -0
- package/json-schema/WorkflowTriggerType.json +16 -0
- package/json-schema/ZIndex.json +44 -0
- package/package.json +34 -20
- package/dist/examples.d.ts +0 -28
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -250
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -8
- package/dist/types/meta/field-type.d.ts +0 -54
- package/dist/types/meta/field-type.d.ts.map +0 -1
- package/dist/types/meta/field-type.js +0 -42
- package/dist/types/meta/index.d.ts +0 -13
- package/dist/types/meta/index.d.ts.map +0 -1
- package/dist/types/meta/index.js +0 -12
- package/dist/types/meta/object-entity.d.ts +0 -246
- package/dist/types/meta/object-entity.d.ts.map +0 -1
- package/dist/types/meta/object-entity.js +0 -9
- package/dist/types/meta/object-field.d.ts +0 -199
- package/dist/types/meta/object-field.d.ts.map +0 -1
- package/dist/types/meta/object-field.js +0 -9
- package/dist/types/meta/object-view.d.ts +0 -430
- package/dist/types/meta/object-view.d.ts.map +0 -1
- package/dist/types/meta/object-view.js +0 -9
- package/src/examples.ts +0 -257
- package/src/index.ts +0 -10
- package/src/types/index.ts +0 -9
- package/src/types/meta/field-type.ts +0 -91
- package/src/types/meta/index.ts +0 -13
- package/src/types/meta/object-entity.ts +0 -265
- package/src/types/meta/object-field.ts +0 -218
- package/src/types/meta/object-view.ts +0 -475
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerritorySchema = exports.TerritoryModelSchema = exports.TerritoryType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Territory Management Protocol
|
|
7
|
+
* Defines a matrix reporting structure that exists parallel to the Role Hierarchy.
|
|
8
|
+
*
|
|
9
|
+
* USE CASE:
|
|
10
|
+
* - Enterprise Sales Teams (Geo-based: "EMEA", "APAC")
|
|
11
|
+
* - Industry Verticals (Industry-based: "Healthcare", "Financial")
|
|
12
|
+
* - Strategic Accounts (Account-based: "Strategic Accounts")
|
|
13
|
+
*
|
|
14
|
+
* DIFFERENCE FROM ROLE:
|
|
15
|
+
* - Role: Hierarchy of PEOPLE (Who reports to whom). Stable. HR-driven.
|
|
16
|
+
* - Territory: Hierarchy of ACCOUNTS/REVENUE (Who owns which market). Flexible. Sales-driven.
|
|
17
|
+
* - One User can be assigned to MANY Territories (Matrix).
|
|
18
|
+
* - One User has only ONE Role (Tree).
|
|
19
|
+
*/
|
|
20
|
+
exports.TerritoryType = zod_1.z.enum([
|
|
21
|
+
'geography', // Region/Country/City
|
|
22
|
+
'industry', // Vertical
|
|
23
|
+
'named_account', // Key Accounts
|
|
24
|
+
'product_line' // Product Specialty
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* Territory Model Schema
|
|
28
|
+
* A container for a version of territory planning.
|
|
29
|
+
* (e.g. "Fiscal Year 2024 Planning" vs "Fiscal Year 2025 Planning")
|
|
30
|
+
*/
|
|
31
|
+
exports.TerritoryModelSchema = zod_1.z.object({
|
|
32
|
+
name: zod_1.z.string().describe('Model Name (e.g. FY24 Planning)'),
|
|
33
|
+
state: zod_1.z.enum(['planning', 'active', 'archived']).default('planning'),
|
|
34
|
+
startDate: zod_1.z.string().optional(),
|
|
35
|
+
endDate: zod_1.z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Territory Node Schema
|
|
39
|
+
* A single node in the territory tree.
|
|
40
|
+
*/
|
|
41
|
+
exports.TerritorySchema = zod_1.z.object({
|
|
42
|
+
/** Identity */
|
|
43
|
+
name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/),
|
|
44
|
+
label: zod_1.z.string().describe('Territory Label (e.g. "West Coast")'),
|
|
45
|
+
/** Structure */
|
|
46
|
+
modelId: zod_1.z.string().describe('Belongs to which Territory Model'),
|
|
47
|
+
parent: zod_1.z.string().optional().describe('Parent Territory'),
|
|
48
|
+
type: exports.TerritoryType.default('geography'),
|
|
49
|
+
/**
|
|
50
|
+
* Assignment Rules (The "Magic")
|
|
51
|
+
* How do accounts automatically fall into this territory?
|
|
52
|
+
* e.g. "BillingCountry = 'US' AND BillingState = 'CA'"
|
|
53
|
+
*/
|
|
54
|
+
assignmentRule: zod_1.z.string().optional().describe('Criteria based assignment rule'),
|
|
55
|
+
/**
|
|
56
|
+
* User Assignment
|
|
57
|
+
* Users assigned to work this territory.
|
|
58
|
+
*/
|
|
59
|
+
assignedUsers: zod_1.z.array(zod_1.z.string()).optional(),
|
|
60
|
+
/** Access Level */
|
|
61
|
+
accountAccess: zod_1.z.enum(['read', 'edit']).default('read'),
|
|
62
|
+
opportunityAccess: zod_1.z.enum(['read', 'edit']).default('read'),
|
|
63
|
+
caseAccess: zod_1.z.enum(['read', 'edit']).default('read'),
|
|
64
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Translation Schema
|
|
4
|
+
* Supports i18n for labels, messages, and options.
|
|
5
|
+
* Example structure:
|
|
6
|
+
* {
|
|
7
|
+
* "en": { "objects": { "account": { "label": "Account" } } },
|
|
8
|
+
* "zh-CN": { "objects": { "account": { "label": "客户" } } }
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export declare const TranslationDataSchema: z.ZodObject<{
|
|
12
|
+
/** Object translations */
|
|
13
|
+
objects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
14
|
+
label: z.ZodString;
|
|
15
|
+
pluralLabel: z.ZodOptional<z.ZodString>;
|
|
16
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
17
|
+
label: z.ZodOptional<z.ZodString>;
|
|
18
|
+
help: z.ZodOptional<z.ZodString>;
|
|
19
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
options?: Record<string, string> | undefined;
|
|
22
|
+
label?: string | undefined;
|
|
23
|
+
help?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
options?: Record<string, string> | undefined;
|
|
26
|
+
label?: string | undefined;
|
|
27
|
+
help?: string | undefined;
|
|
28
|
+
}>>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
label: string;
|
|
31
|
+
fields?: Record<string, {
|
|
32
|
+
options?: Record<string, string> | undefined;
|
|
33
|
+
label?: string | undefined;
|
|
34
|
+
help?: string | undefined;
|
|
35
|
+
}> | undefined;
|
|
36
|
+
pluralLabel?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
label: string;
|
|
39
|
+
fields?: Record<string, {
|
|
40
|
+
options?: Record<string, string> | undefined;
|
|
41
|
+
label?: string | undefined;
|
|
42
|
+
help?: string | undefined;
|
|
43
|
+
}> | undefined;
|
|
44
|
+
pluralLabel?: string | undefined;
|
|
45
|
+
}>>>;
|
|
46
|
+
/** App/Menu translations */
|
|
47
|
+
apps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
48
|
+
label: z.ZodString;
|
|
49
|
+
description: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
label: string;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
label: string;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
}>>>;
|
|
57
|
+
/** UI Messages */
|
|
58
|
+
messages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
objects?: Record<string, {
|
|
61
|
+
label: string;
|
|
62
|
+
fields?: Record<string, {
|
|
63
|
+
options?: Record<string, string> | undefined;
|
|
64
|
+
label?: string | undefined;
|
|
65
|
+
help?: string | undefined;
|
|
66
|
+
}> | undefined;
|
|
67
|
+
pluralLabel?: string | undefined;
|
|
68
|
+
}> | undefined;
|
|
69
|
+
apps?: Record<string, {
|
|
70
|
+
label: string;
|
|
71
|
+
description?: string | undefined;
|
|
72
|
+
}> | undefined;
|
|
73
|
+
messages?: Record<string, string> | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
objects?: Record<string, {
|
|
76
|
+
label: string;
|
|
77
|
+
fields?: Record<string, {
|
|
78
|
+
options?: Record<string, string> | undefined;
|
|
79
|
+
label?: string | undefined;
|
|
80
|
+
help?: string | undefined;
|
|
81
|
+
}> | undefined;
|
|
82
|
+
pluralLabel?: string | undefined;
|
|
83
|
+
}> | undefined;
|
|
84
|
+
apps?: Record<string, {
|
|
85
|
+
label: string;
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
}> | undefined;
|
|
88
|
+
messages?: Record<string, string> | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
export declare const LocaleSchema: z.ZodString;
|
|
91
|
+
export declare const TranslationBundleSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
92
|
+
/** Object translations */
|
|
93
|
+
objects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
94
|
+
label: z.ZodString;
|
|
95
|
+
pluralLabel: z.ZodOptional<z.ZodString>;
|
|
96
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
97
|
+
label: z.ZodOptional<z.ZodString>;
|
|
98
|
+
help: z.ZodOptional<z.ZodString>;
|
|
99
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
options?: Record<string, string> | undefined;
|
|
102
|
+
label?: string | undefined;
|
|
103
|
+
help?: string | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
options?: Record<string, string> | undefined;
|
|
106
|
+
label?: string | undefined;
|
|
107
|
+
help?: string | undefined;
|
|
108
|
+
}>>>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
label: string;
|
|
111
|
+
fields?: Record<string, {
|
|
112
|
+
options?: Record<string, string> | undefined;
|
|
113
|
+
label?: string | undefined;
|
|
114
|
+
help?: string | undefined;
|
|
115
|
+
}> | undefined;
|
|
116
|
+
pluralLabel?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
label: string;
|
|
119
|
+
fields?: Record<string, {
|
|
120
|
+
options?: Record<string, string> | undefined;
|
|
121
|
+
label?: string | undefined;
|
|
122
|
+
help?: string | undefined;
|
|
123
|
+
}> | undefined;
|
|
124
|
+
pluralLabel?: string | undefined;
|
|
125
|
+
}>>>;
|
|
126
|
+
/** App/Menu translations */
|
|
127
|
+
apps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
128
|
+
label: z.ZodString;
|
|
129
|
+
description: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
label: string;
|
|
132
|
+
description?: string | undefined;
|
|
133
|
+
}, {
|
|
134
|
+
label: string;
|
|
135
|
+
description?: string | undefined;
|
|
136
|
+
}>>>;
|
|
137
|
+
/** UI Messages */
|
|
138
|
+
messages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
objects?: Record<string, {
|
|
141
|
+
label: string;
|
|
142
|
+
fields?: Record<string, {
|
|
143
|
+
options?: Record<string, string> | undefined;
|
|
144
|
+
label?: string | undefined;
|
|
145
|
+
help?: string | undefined;
|
|
146
|
+
}> | undefined;
|
|
147
|
+
pluralLabel?: string | undefined;
|
|
148
|
+
}> | undefined;
|
|
149
|
+
apps?: Record<string, {
|
|
150
|
+
label: string;
|
|
151
|
+
description?: string | undefined;
|
|
152
|
+
}> | undefined;
|
|
153
|
+
messages?: Record<string, string> | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
objects?: Record<string, {
|
|
156
|
+
label: string;
|
|
157
|
+
fields?: Record<string, {
|
|
158
|
+
options?: Record<string, string> | undefined;
|
|
159
|
+
label?: string | undefined;
|
|
160
|
+
help?: string | undefined;
|
|
161
|
+
}> | undefined;
|
|
162
|
+
pluralLabel?: string | undefined;
|
|
163
|
+
}> | undefined;
|
|
164
|
+
apps?: Record<string, {
|
|
165
|
+
label: string;
|
|
166
|
+
description?: string | undefined;
|
|
167
|
+
}> | undefined;
|
|
168
|
+
messages?: Record<string, string> | undefined;
|
|
169
|
+
}>>;
|
|
170
|
+
export type TranslationBundle = z.infer<typeof TranslationBundleSchema>;
|
|
171
|
+
//# sourceMappingURL=translation.zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.zod.d.ts","sourceRoot":"","sources":["../../src/system/translation.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;IAChC,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAW1B,4BAA4B;;;;;;;;;;;IAM5B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAElB,CAAC;AAEH,eAAO,MAAM,YAAY,aAAiE,CAAC;AAE3F,eAAO,MAAM,uBAAuB;IAvBlC,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAW1B,4BAA4B;;;;;;;;;;;IAM5B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMgE,CAAC;AAErF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TranslationBundleSchema = exports.LocaleSchema = exports.TranslationDataSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Translation Schema
|
|
7
|
+
* Supports i18n for labels, messages, and options.
|
|
8
|
+
* Example structure:
|
|
9
|
+
* {
|
|
10
|
+
* "en": { "objects": { "account": { "label": "Account" } } },
|
|
11
|
+
* "zh-CN": { "objects": { "account": { "label": "客户" } } }
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
exports.TranslationDataSchema = zod_1.z.object({
|
|
15
|
+
/** Object translations */
|
|
16
|
+
objects: zod_1.z.record(zod_1.z.object({
|
|
17
|
+
label: zod_1.z.string(),
|
|
18
|
+
pluralLabel: zod_1.z.string().optional(),
|
|
19
|
+
fields: zod_1.z.record(zod_1.z.object({
|
|
20
|
+
label: zod_1.z.string().optional(),
|
|
21
|
+
help: zod_1.z.string().optional(),
|
|
22
|
+
options: zod_1.z.record(zod_1.z.string()).optional(), // Option value -> Label map
|
|
23
|
+
})).optional(),
|
|
24
|
+
})).optional(),
|
|
25
|
+
/** App/Menu translations */
|
|
26
|
+
apps: zod_1.z.record(zod_1.z.object({
|
|
27
|
+
label: zod_1.z.string(),
|
|
28
|
+
description: zod_1.z.string().optional(),
|
|
29
|
+
})).optional(),
|
|
30
|
+
/** UI Messages */
|
|
31
|
+
messages: zod_1.z.record(zod_1.z.string()).optional(),
|
|
32
|
+
});
|
|
33
|
+
exports.LocaleSchema = zod_1.z.string().describe('BCP-47 Language Tag (e.g. en-US, zh-CN)');
|
|
34
|
+
exports.TranslationBundleSchema = zod_1.z.record(exports.LocaleSchema, exports.TranslationDataSchema);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/system/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ObjectStack Plugin Runtime Interfaces
|
|
4
|
+
*
|
|
5
|
+
* This package defines the contract that every plugin must implement to be loaded by ObjectOS.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
__exportStar(require("./plugin"), exports);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime interfaces for ObjectStack plugins.
|
|
3
|
+
* These define the contract that every plugin must implement to be loaded by ObjectOS.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Logger interface provided to plugins for structured logging.
|
|
7
|
+
*/
|
|
8
|
+
export interface PluginLogger {
|
|
9
|
+
/** Log an informational message */
|
|
10
|
+
info(message: string, meta?: Record<string, any>): void;
|
|
11
|
+
/** Log a warning message */
|
|
12
|
+
warn(message: string, meta?: Record<string, any>): void;
|
|
13
|
+
/** Log an error message */
|
|
14
|
+
error(message: string, error?: Error, meta?: Record<string, any>): void;
|
|
15
|
+
/** Log a debug message */
|
|
16
|
+
debug(message: string, meta?: Record<string, any>): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ObjectQL Client interface for database operations.
|
|
20
|
+
* Provides a GraphQL-like query interface to the ObjectStack data layer.
|
|
21
|
+
*/
|
|
22
|
+
export interface ObjectQLClient {
|
|
23
|
+
/**
|
|
24
|
+
* Execute a query against the ObjectQL engine.
|
|
25
|
+
* @param query - The ObjectQL query string
|
|
26
|
+
* @param variables - Optional variables for the query
|
|
27
|
+
* @returns Promise resolving to query results
|
|
28
|
+
*/
|
|
29
|
+
query<T = any>(query: string, variables?: Record<string, any>): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Execute a mutation against the ObjectQL engine.
|
|
32
|
+
* @param mutation - The ObjectQL mutation string
|
|
33
|
+
* @param variables - Optional variables for the mutation
|
|
34
|
+
* @returns Promise resolving to mutation results
|
|
35
|
+
*/
|
|
36
|
+
mutate<T = any>(mutation: string, variables?: Record<string, any>): Promise<T>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* ObjectOS Kernel interface.
|
|
40
|
+
* Provides access to core operating system services.
|
|
41
|
+
*/
|
|
42
|
+
export interface ObjectOSKernel {
|
|
43
|
+
/**
|
|
44
|
+
* Get a reference to another installed plugin by its ID.
|
|
45
|
+
* @param pluginId - The unique identifier of the plugin
|
|
46
|
+
* @returns The plugin instance or null if not found
|
|
47
|
+
*/
|
|
48
|
+
getPlugin(pluginId: string): any | null;
|
|
49
|
+
/**
|
|
50
|
+
* Emit an event to the system event bus.
|
|
51
|
+
* @param event - The event name
|
|
52
|
+
* @param data - The event payload
|
|
53
|
+
*/
|
|
54
|
+
emit(event: string, data?: any): void;
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to system events.
|
|
57
|
+
* @param event - The event name to listen for
|
|
58
|
+
* @param handler - Callback function to handle the event
|
|
59
|
+
* @returns Unsubscribe function
|
|
60
|
+
*/
|
|
61
|
+
on(event: string, handler: (data: any) => void): () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Plugin Context provided to plugin lifecycle methods.
|
|
65
|
+
* This context gives plugins access to the ObjectStack runtime environment.
|
|
66
|
+
*/
|
|
67
|
+
export interface PluginContext {
|
|
68
|
+
/**
|
|
69
|
+
* ObjectQL client for database operations.
|
|
70
|
+
* Use this to query and mutate data in the ObjectStack data layer.
|
|
71
|
+
*/
|
|
72
|
+
ql: ObjectQLClient;
|
|
73
|
+
/**
|
|
74
|
+
* ObjectOS kernel for system-level operations.
|
|
75
|
+
* Use this to interact with other plugins and system services.
|
|
76
|
+
*/
|
|
77
|
+
os: ObjectOSKernel;
|
|
78
|
+
/**
|
|
79
|
+
* Logger instance for structured logging.
|
|
80
|
+
* All logs are automatically tagged with the plugin ID.
|
|
81
|
+
*/
|
|
82
|
+
logger: PluginLogger;
|
|
83
|
+
/**
|
|
84
|
+
* The unique identifier of this plugin.
|
|
85
|
+
*/
|
|
86
|
+
pluginId: string;
|
|
87
|
+
/**
|
|
88
|
+
* Plugin configuration values (from manifest or runtime config).
|
|
89
|
+
*/
|
|
90
|
+
config: Record<string, any>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Plugin Lifecycle Interface.
|
|
94
|
+
* Every ObjectStack plugin must default export an object implementing this interface.
|
|
95
|
+
*/
|
|
96
|
+
export interface ObjectStackPlugin {
|
|
97
|
+
/**
|
|
98
|
+
* Called when the plugin is installed for the first time.
|
|
99
|
+
* Use this to run one-time setup tasks (e.g. creating database tables).
|
|
100
|
+
*/
|
|
101
|
+
onInstall?: (context: PluginContext) => Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Called when the plugin is enabled (at startup or manually).
|
|
104
|
+
* Use this to register event listeners, start background tasks, etc.
|
|
105
|
+
*/
|
|
106
|
+
onEnable?: (context: PluginContext) => Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Called when the plugin is disabled (at shutdown or manually).
|
|
109
|
+
* Use this to cleanup resources, stop tasks, remove listeners.
|
|
110
|
+
*/
|
|
111
|
+
onDisable?: (context: PluginContext) => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/system/types/plugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxD,4BAA4B;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxD,2BAA2B;IAC3B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxE,0BAA0B;IAC1B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3E;;;;;OAKG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChF;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;IAExC;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAEtC;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,cAAc,CAAC;IAEnB;;;OAGG;IACH,EAAE,EAAE,cAAc,CAAC;IAEnB;;;OAGG;IACH,MAAM,EAAE,YAAY,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Webhook Trigger Event
|
|
4
|
+
* When should this webhook fire?
|
|
5
|
+
*/
|
|
6
|
+
export declare const WebhookTriggerType: z.ZodEnum<["create", "update", "delete", "undelete", "api"]>;
|
|
7
|
+
/**
|
|
8
|
+
* Webhook Schema
|
|
9
|
+
* outbound Integration: Push data to external URL when events happen.
|
|
10
|
+
*/
|
|
11
|
+
export declare const WebhookSchema: z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
label: z.ZodOptional<z.ZodString>;
|
|
14
|
+
/** Scope */
|
|
15
|
+
object: z.ZodString;
|
|
16
|
+
triggers: z.ZodArray<z.ZodEnum<["create", "update", "delete", "undelete", "api"]>, "many">;
|
|
17
|
+
/** Target */
|
|
18
|
+
url: z.ZodString;
|
|
19
|
+
method: z.ZodDefault<z.ZodEnum<["POST", "PUT", "GET"]>>;
|
|
20
|
+
/** Security */
|
|
21
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
22
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
+
/** Payload Configuration */
|
|
24
|
+
payloadFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
25
|
+
includeSession: z.ZodDefault<z.ZodBoolean>;
|
|
26
|
+
/** Reliability */
|
|
27
|
+
retryCount: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
isActive: z.ZodDefault<z.ZodBoolean>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
object: string;
|
|
31
|
+
url: string;
|
|
32
|
+
name: string;
|
|
33
|
+
method: "GET" | "POST" | "PUT";
|
|
34
|
+
triggers: ("create" | "update" | "delete" | "api" | "undelete")[];
|
|
35
|
+
includeSession: boolean;
|
|
36
|
+
retryCount: number;
|
|
37
|
+
isActive: boolean;
|
|
38
|
+
label?: string | undefined;
|
|
39
|
+
secret?: string | undefined;
|
|
40
|
+
headers?: Record<string, string> | undefined;
|
|
41
|
+
payloadFields?: string[] | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
object: string;
|
|
44
|
+
url: string;
|
|
45
|
+
name: string;
|
|
46
|
+
triggers: ("create" | "update" | "delete" | "api" | "undelete")[];
|
|
47
|
+
label?: string | undefined;
|
|
48
|
+
secret?: string | undefined;
|
|
49
|
+
method?: "GET" | "POST" | "PUT" | undefined;
|
|
50
|
+
headers?: Record<string, string> | undefined;
|
|
51
|
+
payloadFields?: string[] | undefined;
|
|
52
|
+
includeSession?: boolean | undefined;
|
|
53
|
+
retryCount?: number | undefined;
|
|
54
|
+
isActive?: boolean | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Webhook Receiver Schema (Inbound)
|
|
58
|
+
* Handling incoming HTTP hooks from Stripe, Slack, etc.
|
|
59
|
+
*/
|
|
60
|
+
export declare const WebhookReceiverSchema: z.ZodObject<{
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
path: z.ZodString;
|
|
63
|
+
/** Verification */
|
|
64
|
+
verificationType: z.ZodDefault<z.ZodEnum<["none", "header_token", "hmac", "ip_whitelist"]>>;
|
|
65
|
+
verificationParams: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
header: z.ZodOptional<z.ZodString>;
|
|
67
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
68
|
+
ips: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
secret?: string | undefined;
|
|
71
|
+
header?: string | undefined;
|
|
72
|
+
ips?: string[] | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
secret?: string | undefined;
|
|
75
|
+
header?: string | undefined;
|
|
76
|
+
ips?: string[] | undefined;
|
|
77
|
+
}>>;
|
|
78
|
+
/** Action */
|
|
79
|
+
action: z.ZodDefault<z.ZodEnum<["trigger_flow", "script", "upsert_record"]>>;
|
|
80
|
+
target: z.ZodString;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
path: string;
|
|
83
|
+
name: string;
|
|
84
|
+
target: string;
|
|
85
|
+
action: "script" | "trigger_flow" | "upsert_record";
|
|
86
|
+
verificationType: "none" | "header_token" | "hmac" | "ip_whitelist";
|
|
87
|
+
verificationParams?: {
|
|
88
|
+
secret?: string | undefined;
|
|
89
|
+
header?: string | undefined;
|
|
90
|
+
ips?: string[] | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
path: string;
|
|
94
|
+
name: string;
|
|
95
|
+
target: string;
|
|
96
|
+
action?: "script" | "trigger_flow" | "upsert_record" | undefined;
|
|
97
|
+
verificationType?: "none" | "header_token" | "hmac" | "ip_whitelist" | undefined;
|
|
98
|
+
verificationParams?: {
|
|
99
|
+
secret?: string | undefined;
|
|
100
|
+
header?: string | undefined;
|
|
101
|
+
ips?: string[] | undefined;
|
|
102
|
+
} | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
export type Webhook = z.infer<typeof WebhookSchema>;
|
|
105
|
+
export type WebhookReceiver = z.infer<typeof WebhookReceiverSchema>;
|
|
106
|
+
//# sourceMappingURL=webhook.zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.zod.d.ts","sourceRoot":"","sources":["../../src/system/webhook.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,8DAM7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;IAIxB,YAAY;;;IAIZ,aAAa;;;IAIb,eAAe;;;IAIf,4BAA4B;;;IAI5B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGlB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;IAIhC,mBAAmB;;;;;;;;;;;;;;;IAQnB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;EAGb,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookReceiverSchema = exports.WebhookSchema = exports.WebhookTriggerType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Webhook Trigger Event
|
|
7
|
+
* When should this webhook fire?
|
|
8
|
+
*/
|
|
9
|
+
exports.WebhookTriggerType = zod_1.z.enum([
|
|
10
|
+
'create',
|
|
11
|
+
'update',
|
|
12
|
+
'delete',
|
|
13
|
+
'undelete',
|
|
14
|
+
'api' // Manually triggered
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* Webhook Schema
|
|
18
|
+
* outbound Integration: Push data to external URL when events happen.
|
|
19
|
+
*/
|
|
20
|
+
exports.WebhookSchema = zod_1.z.object({
|
|
21
|
+
name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/),
|
|
22
|
+
label: zod_1.z.string().optional(),
|
|
23
|
+
/** Scope */
|
|
24
|
+
object: zod_1.z.string().describe('Object to listen to'),
|
|
25
|
+
triggers: zod_1.z.array(exports.WebhookTriggerType).describe('Events that trigger execution'),
|
|
26
|
+
/** Target */
|
|
27
|
+
url: zod_1.z.string().url().describe('External URL payload'),
|
|
28
|
+
method: zod_1.z.enum(['POST', 'PUT', 'GET']).default('POST'),
|
|
29
|
+
/** Security */
|
|
30
|
+
secret: zod_1.z.string().optional().describe('Signing secret (HMAC)'),
|
|
31
|
+
headers: zod_1.z.record(zod_1.z.string()).optional().describe('Custom headers (Auth)'),
|
|
32
|
+
/** Payload Configuration */
|
|
33
|
+
payloadFields: zod_1.z.array(zod_1.z.string()).optional().describe('Fields to include. Empty = All'),
|
|
34
|
+
includeSession: zod_1.z.boolean().default(false).describe('Include user session info'),
|
|
35
|
+
/** Reliability */
|
|
36
|
+
retryCount: zod_1.z.number().default(3),
|
|
37
|
+
isActive: zod_1.z.boolean().default(true)
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Webhook Receiver Schema (Inbound)
|
|
41
|
+
* Handling incoming HTTP hooks from Stripe, Slack, etc.
|
|
42
|
+
*/
|
|
43
|
+
exports.WebhookReceiverSchema = zod_1.z.object({
|
|
44
|
+
name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/),
|
|
45
|
+
path: zod_1.z.string().describe('URL Path (e.g. /webhooks/stripe)'),
|
|
46
|
+
/** Verification */
|
|
47
|
+
verificationType: zod_1.z.enum(['none', 'header_token', 'hmac', 'ip_whitelist']).default('none'),
|
|
48
|
+
verificationParams: zod_1.z.object({
|
|
49
|
+
header: zod_1.z.string().optional(),
|
|
50
|
+
secret: zod_1.z.string().optional(),
|
|
51
|
+
ips: zod_1.z.array(zod_1.z.string()).optional()
|
|
52
|
+
}).optional(),
|
|
53
|
+
/** Action */
|
|
54
|
+
action: zod_1.z.enum(['trigger_flow', 'script', 'upsert_record']).default('trigger_flow'),
|
|
55
|
+
target: zod_1.z.string().describe('Flow ID or Script name'),
|
|
56
|
+
});
|