@objectstack/spec 1.0.11 → 1.1.0
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 +41 -1
- package/dist/ai/index.d.mts +2 -1
- package/dist/ai/index.d.ts +2 -1
- package/dist/ai/index.js +2047 -1944
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/index.mjs +2047 -1944
- package/dist/ai/index.mjs.map +1 -1
- package/dist/api/index.d.mts +3 -1
- package/dist/api/index.d.ts +3 -1
- package/dist/api/index.js +2599 -2292
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +2587 -2292
- package/dist/api/index.mjs.map +1 -1
- package/dist/automation/index.d.mts +2 -1
- package/dist/automation/index.d.ts +2 -1
- package/dist/automation/index.js +83 -0
- package/dist/automation/index.js.map +1 -1
- package/dist/automation/index.mjs +77 -0
- package/dist/automation/index.mjs.map +1 -1
- package/dist/contracts/index.d.mts +3 -2
- package/dist/contracts/index.d.ts +3 -2
- package/dist/data/index.d.mts +3 -2
- package/dist/data/index.d.ts +3 -2
- package/dist/data/index.js +658 -556
- package/dist/data/index.js.map +1 -1
- package/dist/data/index.mjs +656 -556
- package/dist/data/index.mjs.map +1 -1
- package/dist/{driver.zod-lfi00zVT.d.ts → driver.zod-CfGk9GYh.d.ts} +2164 -11
- package/dist/{driver.zod-BOM_Etco.d.mts → driver.zod-y1cX6R3c.d.mts} +2164 -11
- package/dist/hub/index.d.mts +1 -1
- package/dist/hub/index.d.ts +1 -1
- package/dist/hub/index.js +789 -724
- package/dist/hub/index.js.map +1 -1
- package/dist/hub/index.mjs +789 -724
- package/dist/hub/index.mjs.map +1 -1
- package/dist/{index-C67cfwmW.d.ts → index-B0Hf65bV.d.ts} +13 -5
- package/dist/{index-DLcySG7U.d.ts → index-B5pKM0My.d.ts} +335 -4370
- package/dist/{index-Os7lItRe.d.mts → index-BA022mg2.d.ts} +6178 -129
- package/dist/{index-B5-VbOKg.d.mts → index-BGeLoH2z.d.ts} +4251 -74
- package/dist/{index-CH5zloR3.d.ts → index-BwO__aqV.d.ts} +1 -1
- package/dist/{index-Dp7GFJ8V.d.mts → index-Cia3JPQ8.d.mts} +13 -5
- package/dist/{index-D12rNohm.d.mts → index-CpD1q1FP.d.ts} +35 -18
- package/dist/{index-Os7lItRe.d.ts → index-D5RSFPuB.d.mts} +6178 -129
- package/dist/{index-CU4m6noq.d.mts → index-DGjpaj0X.d.mts} +1 -1
- package/dist/{index-D12rNohm.d.ts → index-Dfn5VXl6.d.mts} +35 -18
- package/dist/{index-l6WIlmOD.d.mts → index-Dgybxlky.d.mts} +177 -158
- package/dist/{index-l6WIlmOD.d.ts → index-Dgybxlky.d.ts} +177 -158
- package/dist/{index-DLcySG7U.d.mts → index-Dpsk8PF4.d.mts} +335 -4370
- package/dist/{index-CyognKSZ.d.ts → index-DrNah5E0.d.ts} +1952 -6990
- package/dist/{index-DE_lJ11p.d.mts → index-OO84R20k.d.mts} +1952 -6990
- package/dist/{index-B5-VbOKg.d.ts → index-upA3Xt04.d.mts} +4251 -74
- package/dist/index.d.mts +8072 -1922
- package/dist/index.d.ts +8072 -1922
- package/dist/index.js +8563 -8249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8563 -8249
- package/dist/index.mjs.map +1 -1
- package/dist/integration/index.d.mts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/kernel/index.d.mts +2 -1
- package/dist/kernel/index.d.ts +2 -1
- package/dist/kernel/index.js +884 -684
- package/dist/kernel/index.js.map +1 -1
- package/dist/kernel/index.mjs +870 -684
- package/dist/kernel/index.mjs.map +1 -1
- package/dist/package-registry.zod-JMcOYNxM.d.mts +21119 -0
- package/dist/package-registry.zod-JMcOYNxM.d.ts +21119 -0
- package/dist/state-machine.zod-B-lFFSxQ.d.mts +285 -0
- package/dist/state-machine.zod-B-lFFSxQ.d.ts +285 -0
- package/dist/system/index.d.mts +2 -1
- package/dist/system/index.d.ts +2 -1
- package/dist/system/index.js +749 -651
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.mjs +749 -651
- package/dist/system/index.mjs.map +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/json-schema/ai/Agent.json +499 -0
- package/json-schema/ai/DevOpsAgent.json +499 -0
- package/json-schema/ai/FeedbackLoop.json +2188 -186
- package/json-schema/ai/Resolution.json +2188 -186
- package/json-schema/api/ApiRoutes.json +4 -0
- package/json-schema/api/CompileManifestResponse.json +40 -10
- package/json-schema/api/DisablePackageRequest.json +18 -0
- package/json-schema/api/DisablePackageResponse.json +1521 -0
- package/json-schema/api/Discovery.json +4 -0
- package/json-schema/api/EnablePackageRequest.json +18 -0
- package/json-schema/api/EnablePackageResponse.json +1521 -0
- package/json-schema/api/GetDiscoveryResponse.json +4 -0
- package/json-schema/api/GetPackageRequest.json +18 -0
- package/json-schema/api/GetPackageResponse.json +1518 -0
- package/json-schema/api/InstallPackageRequest.json +1483 -0
- package/json-schema/api/InstallPackageResponse.json +1521 -0
- package/json-schema/api/ListPackagesRequest.json +42 -0
- package/json-schema/api/ListPackagesResponse.json +1525 -0
- package/json-schema/api/ObjectDefinitionResponse.json +1001 -0
- package/json-schema/api/ObjectStackProtocol.json +86 -1
- package/json-schema/api/RestApiConfig.json +5 -0
- package/json-schema/api/RestServerConfig.json +5 -0
- package/json-schema/api/UninstallPackageRequest.json +18 -0
- package/json-schema/api/UninstallPackageResponse.json +25 -0
- package/json-schema/automation/ActionRef.json +30 -0
- package/json-schema/automation/Event.json +24 -0
- package/json-schema/automation/Flow.json +1 -0
- package/json-schema/automation/FlowNode.json +1 -0
- package/json-schema/automation/FlowNodeAction.json +1 -0
- package/json-schema/automation/GuardRef.json +30 -0
- package/json-schema/automation/StateMachine.json +504 -0
- package/json-schema/automation/StateNode.json +324 -0
- package/json-schema/automation/Transition.json +73 -0
- package/json-schema/data/Object.json +1001 -0
- package/json-schema/data/ObjectExtension.json +2376 -0
- package/json-schema/data/ObjectOwnershipEnum.json +13 -0
- package/json-schema/hub/ComposerResponse.json +40 -10
- package/json-schema/kernel/DisablePackageRequest.json +18 -0
- package/json-schema/kernel/DisablePackageResponse.json +1521 -0
- package/json-schema/kernel/EnablePackageRequest.json +18 -0
- package/json-schema/kernel/EnablePackageResponse.json +1521 -0
- package/json-schema/kernel/EventBusConfig.json +15 -0
- package/json-schema/kernel/EventHandler.json +6 -0
- package/json-schema/kernel/EventPersistence.json +3 -0
- package/json-schema/kernel/EventRoute.json +3 -0
- package/json-schema/kernel/EventWebhookConfig.json +3 -0
- package/json-schema/kernel/GetPackageRequest.json +18 -0
- package/json-schema/kernel/GetPackageResponse.json +1518 -0
- package/json-schema/kernel/InstallPackageRequest.json +1483 -0
- package/json-schema/kernel/InstallPackageResponse.json +1521 -0
- package/json-schema/kernel/InstalledPackage.json +1509 -0
- package/json-schema/kernel/ListPackagesRequest.json +42 -0
- package/json-schema/kernel/ListPackagesResponse.json +1525 -0
- package/json-schema/kernel/Manifest.json +40 -10
- package/json-schema/kernel/PackageStatusEnum.json +16 -0
- package/json-schema/kernel/Plugin.json +5 -0
- package/json-schema/kernel/PluginContext.json +31 -7
- package/json-schema/kernel/PluginLifecycle.json +7 -1
- package/json-schema/kernel/RealTimeNotificationConfig.json +3 -0
- package/json-schema/kernel/UninstallPackageRequest.json +18 -0
- package/json-schema/kernel/UninstallPackageResponse.json +25 -0
- package/json-schema/system/ChangeSet.json +2188 -186
- package/json-schema/system/CreateObjectOperation.json +1001 -0
- package/json-schema/system/MigrationOperation.json +1001 -0
- package/package.json +29 -15
- package/prompts/create-new-project.md +37 -19
- package/dist/{index-I3piy4U4.d.mts → index-BmU_sD1f.d.mts} +8 -8
- package/dist/{index-CkhpsEUw.d.ts → index-BnXuc_HO.d.ts} +8 -8
- package/dist/{index-CIDI-8zR.d.mts → index-C_NTOcet.d.mts} +98 -98
- package/dist/{index-CIDI-8zR.d.ts → index-C_NTOcet.d.ts} +98 -98
package/dist/data/index.mjs
CHANGED
|
@@ -252,7 +252,7 @@ var QuerySchema = BaseQuerySchema.extend({
|
|
|
252
252
|
});
|
|
253
253
|
|
|
254
254
|
// src/data/object.zod.ts
|
|
255
|
-
import { z as
|
|
255
|
+
import { z as z9 } from "zod";
|
|
256
256
|
|
|
257
257
|
// src/data/field.zod.ts
|
|
258
258
|
import { z as z6 } from "zod";
|
|
@@ -835,8 +835,77 @@ var ConditionalValidationSchema = BaseValidationSchema.extend({
|
|
|
835
835
|
otherwise: ValidationRuleSchema.optional().describe("Validation rule to apply when condition is false")
|
|
836
836
|
});
|
|
837
837
|
|
|
838
|
+
// src/automation/state-machine.zod.ts
|
|
839
|
+
import { z as z8 } from "zod";
|
|
840
|
+
var ActionRefSchema = z8.union([
|
|
841
|
+
z8.string().describe("Action Name"),
|
|
842
|
+
z8.object({
|
|
843
|
+
type: z8.string(),
|
|
844
|
+
// e.g., 'xstate.assign', 'log', 'email'
|
|
845
|
+
params: z8.record(z8.string(), z8.any()).optional()
|
|
846
|
+
})
|
|
847
|
+
]);
|
|
848
|
+
var GuardRefSchema = z8.union([
|
|
849
|
+
z8.string().describe('Guard Name (e.g., "isManager", "amountGT1000")'),
|
|
850
|
+
z8.object({
|
|
851
|
+
type: z8.string(),
|
|
852
|
+
params: z8.record(z8.string(), z8.any()).optional()
|
|
853
|
+
})
|
|
854
|
+
]);
|
|
855
|
+
var TransitionSchema = z8.object({
|
|
856
|
+
target: z8.string().optional().describe("Target State ID"),
|
|
857
|
+
cond: GuardRefSchema.optional().describe("Condition (Guard) required to take this path"),
|
|
858
|
+
actions: z8.array(ActionRefSchema).optional().describe("Actions to execute during transition"),
|
|
859
|
+
description: z8.string().optional().describe("Human readable description of this rule")
|
|
860
|
+
});
|
|
861
|
+
var EventSchema = z8.object({
|
|
862
|
+
type: z8.string().describe('Event Type (e.g. "APPROVE", "REJECT", "Submit")'),
|
|
863
|
+
// Payload validation schema could go here if we want deep validation
|
|
864
|
+
schema: z8.record(z8.string(), z8.any()).optional().describe("Expected event payload structure")
|
|
865
|
+
});
|
|
866
|
+
var StateNodeSchema = z8.lazy(() => z8.object({
|
|
867
|
+
/** Type of state */
|
|
868
|
+
type: z8.enum(["atomic", "compound", "parallel", "final", "history"]).default("atomic"),
|
|
869
|
+
/** Entry/Exit Actions */
|
|
870
|
+
entry: z8.array(ActionRefSchema).optional().describe("Actions to run when entering this state"),
|
|
871
|
+
exit: z8.array(ActionRefSchema).optional().describe("Actions to run when leaving this state"),
|
|
872
|
+
/** Transitions (Events) */
|
|
873
|
+
on: z8.record(z8.string(), z8.union([
|
|
874
|
+
z8.string(),
|
|
875
|
+
// Shorthand target
|
|
876
|
+
TransitionSchema,
|
|
877
|
+
z8.array(TransitionSchema)
|
|
878
|
+
])).optional().describe("Map of Event Type -> Transition Definition"),
|
|
879
|
+
/** Always Transitions (Eventless) */
|
|
880
|
+
always: z8.array(TransitionSchema).optional(),
|
|
881
|
+
/** Nesting (Hierarchical States) */
|
|
882
|
+
initial: z8.string().optional().describe("Initial child state (if compound)"),
|
|
883
|
+
states: z8.record(z8.string(), StateNodeSchema).optional(),
|
|
884
|
+
/** Metadata for UI/AI */
|
|
885
|
+
meta: z8.object({
|
|
886
|
+
label: z8.string().optional(),
|
|
887
|
+
description: z8.string().optional(),
|
|
888
|
+
color: z8.string().optional(),
|
|
889
|
+
// For UI diagrams
|
|
890
|
+
// Instructions for AI Agent when in this state
|
|
891
|
+
aiInstructions: z8.string().optional().describe("Specific instructions for AI when in this state")
|
|
892
|
+
}).optional()
|
|
893
|
+
}));
|
|
894
|
+
var StateMachineSchema = z8.object({
|
|
895
|
+
id: SnakeCaseIdentifierSchema.describe("Unique Machine ID"),
|
|
896
|
+
description: z8.string().optional(),
|
|
897
|
+
/** Context (Memory) Schema */
|
|
898
|
+
contextSchema: z8.record(z8.string(), z8.any()).optional().describe("Zod Schema for the machine context/memory"),
|
|
899
|
+
/** Initial State */
|
|
900
|
+
initial: z8.string().describe("Initial State ID"),
|
|
901
|
+
/** State Definitions */
|
|
902
|
+
states: z8.record(z8.string(), StateNodeSchema).describe("State Nodes"),
|
|
903
|
+
/** Global Listeners */
|
|
904
|
+
on: z8.record(z8.string(), z8.union([z8.string(), TransitionSchema, z8.array(TransitionSchema)])).optional()
|
|
905
|
+
});
|
|
906
|
+
|
|
838
907
|
// src/data/object.zod.ts
|
|
839
|
-
var ApiMethod =
|
|
908
|
+
var ApiMethod = z9.enum([
|
|
840
909
|
"get",
|
|
841
910
|
"list",
|
|
842
911
|
// Read
|
|
@@ -861,65 +930,65 @@ var ApiMethod = z8.enum([
|
|
|
861
930
|
"export"
|
|
862
931
|
// Data portability
|
|
863
932
|
]);
|
|
864
|
-
var ObjectCapabilities =
|
|
933
|
+
var ObjectCapabilities = z9.object({
|
|
865
934
|
/** Enable history tracking (Audit Trail) */
|
|
866
|
-
trackHistory:
|
|
935
|
+
trackHistory: z9.boolean().default(false).describe("Enable field history tracking for audit compliance"),
|
|
867
936
|
/** Enable global search indexing */
|
|
868
|
-
searchable:
|
|
937
|
+
searchable: z9.boolean().default(true).describe("Index records for global search"),
|
|
869
938
|
/** Enable REST/GraphQL API access */
|
|
870
|
-
apiEnabled:
|
|
939
|
+
apiEnabled: z9.boolean().default(true).describe("Expose object via automatic APIs"),
|
|
871
940
|
/**
|
|
872
941
|
* API Supported Operations
|
|
873
942
|
* Granular control over API exposure.
|
|
874
943
|
*/
|
|
875
|
-
apiMethods:
|
|
944
|
+
apiMethods: z9.array(ApiMethod).optional().describe("Whitelist of allowed API operations"),
|
|
876
945
|
/** Enable standard attachments/files engine */
|
|
877
|
-
files:
|
|
946
|
+
files: z9.boolean().default(false).describe("Enable file attachments and document management"),
|
|
878
947
|
/** Enable social collaboration (Comments, Mentions, Feeds) */
|
|
879
|
-
feeds:
|
|
948
|
+
feeds: z9.boolean().default(false).describe("Enable social feed, comments, and mentions (Chatter-like)"),
|
|
880
949
|
/** Enable standard Activity suite (Tasks, Calendars, Events) */
|
|
881
|
-
activities:
|
|
950
|
+
activities: z9.boolean().default(false).describe("Enable standard tasks and events tracking"),
|
|
882
951
|
/** Enable Recycle Bin / Soft Delete */
|
|
883
|
-
trash:
|
|
952
|
+
trash: z9.boolean().default(true).describe("Enable soft-delete with restore capability"),
|
|
884
953
|
/** Enable "Recently Viewed" tracking */
|
|
885
|
-
mru:
|
|
954
|
+
mru: z9.boolean().default(true).describe("Track Most Recently Used (MRU) list for users"),
|
|
886
955
|
/** Allow cloning records */
|
|
887
|
-
clone:
|
|
888
|
-
});
|
|
889
|
-
var IndexSchema =
|
|
890
|
-
name:
|
|
891
|
-
fields:
|
|
892
|
-
type:
|
|
893
|
-
unique:
|
|
894
|
-
partial:
|
|
895
|
-
});
|
|
896
|
-
var SearchConfigSchema =
|
|
897
|
-
fields:
|
|
898
|
-
displayFields:
|
|
899
|
-
filters:
|
|
900
|
-
});
|
|
901
|
-
var TenancyConfigSchema =
|
|
902
|
-
enabled:
|
|
903
|
-
strategy:
|
|
904
|
-
tenantField:
|
|
905
|
-
crossTenantAccess:
|
|
906
|
-
});
|
|
907
|
-
var SoftDeleteConfigSchema =
|
|
908
|
-
enabled:
|
|
909
|
-
field:
|
|
910
|
-
cascadeDelete:
|
|
911
|
-
});
|
|
912
|
-
var VersioningConfigSchema =
|
|
913
|
-
enabled:
|
|
914
|
-
strategy:
|
|
915
|
-
retentionDays:
|
|
916
|
-
versionField:
|
|
917
|
-
});
|
|
918
|
-
var PartitioningConfigSchema =
|
|
919
|
-
enabled:
|
|
920
|
-
strategy:
|
|
921
|
-
key:
|
|
922
|
-
interval:
|
|
956
|
+
clone: z9.boolean().default(true).describe("Allow record deep cloning")
|
|
957
|
+
});
|
|
958
|
+
var IndexSchema = z9.object({
|
|
959
|
+
name: z9.string().optional().describe("Index name (auto-generated if not provided)"),
|
|
960
|
+
fields: z9.array(z9.string()).describe("Fields included in the index"),
|
|
961
|
+
type: z9.enum(["btree", "hash", "gin", "gist", "fulltext"]).optional().default("btree").describe("Index algorithm type"),
|
|
962
|
+
unique: z9.boolean().optional().default(false).describe("Whether the index enforces uniqueness"),
|
|
963
|
+
partial: z9.string().optional().describe("Partial index condition (SQL WHERE clause for conditional indexes)")
|
|
964
|
+
});
|
|
965
|
+
var SearchConfigSchema = z9.object({
|
|
966
|
+
fields: z9.array(z9.string()).describe("Fields to index for full-text search weighting"),
|
|
967
|
+
displayFields: z9.array(z9.string()).optional().describe("Fields to display in search result cards"),
|
|
968
|
+
filters: z9.array(z9.string()).optional().describe("Default filters for search results")
|
|
969
|
+
});
|
|
970
|
+
var TenancyConfigSchema = z9.object({
|
|
971
|
+
enabled: z9.boolean().describe("Enable multi-tenancy for this object"),
|
|
972
|
+
strategy: z9.enum(["shared", "isolated", "hybrid"]).describe("Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)"),
|
|
973
|
+
tenantField: z9.string().default("tenant_id").describe("Field name for tenant identifier"),
|
|
974
|
+
crossTenantAccess: z9.boolean().default(false).describe("Allow cross-tenant data access (with explicit permission)")
|
|
975
|
+
});
|
|
976
|
+
var SoftDeleteConfigSchema = z9.object({
|
|
977
|
+
enabled: z9.boolean().describe("Enable soft delete (trash/recycle bin)"),
|
|
978
|
+
field: z9.string().default("deleted_at").describe("Field name for soft delete timestamp"),
|
|
979
|
+
cascadeDelete: z9.boolean().default(false).describe("Cascade soft delete to related records")
|
|
980
|
+
});
|
|
981
|
+
var VersioningConfigSchema = z9.object({
|
|
982
|
+
enabled: z9.boolean().describe("Enable record versioning"),
|
|
983
|
+
strategy: z9.enum(["snapshot", "delta", "event-sourcing"]).describe("Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)"),
|
|
984
|
+
retentionDays: z9.number().min(1).optional().describe("Number of days to retain old versions (undefined = infinite)"),
|
|
985
|
+
versionField: z9.string().default("version").describe("Field name for version number/timestamp")
|
|
986
|
+
});
|
|
987
|
+
var PartitioningConfigSchema = z9.object({
|
|
988
|
+
enabled: z9.boolean().describe("Enable table partitioning"),
|
|
989
|
+
strategy: z9.enum(["range", "hash", "list"]).describe("Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)"),
|
|
990
|
+
key: z9.string().describe("Field name to partition by"),
|
|
991
|
+
interval: z9.string().optional().describe('Partition interval for range strategy (e.g., "1 month", "1 year")')
|
|
923
992
|
}).refine((data) => {
|
|
924
993
|
if (data.strategy === "range" && !data.interval) {
|
|
925
994
|
return false;
|
|
@@ -928,39 +997,39 @@ var PartitioningConfigSchema = z8.object({
|
|
|
928
997
|
}, {
|
|
929
998
|
message: 'interval is required when strategy is "range"'
|
|
930
999
|
});
|
|
931
|
-
var CDCConfigSchema =
|
|
932
|
-
enabled:
|
|
933
|
-
events:
|
|
934
|
-
destination:
|
|
1000
|
+
var CDCConfigSchema = z9.object({
|
|
1001
|
+
enabled: z9.boolean().describe("Enable Change Data Capture"),
|
|
1002
|
+
events: z9.array(z9.enum(["insert", "update", "delete"])).describe("Event types to capture"),
|
|
1003
|
+
destination: z9.string().describe('Destination endpoint (e.g., "kafka://topic", "webhook://url")')
|
|
935
1004
|
});
|
|
936
|
-
var ObjectSchemaBase =
|
|
1005
|
+
var ObjectSchemaBase = z9.object({
|
|
937
1006
|
/**
|
|
938
1007
|
* Identity & Metadata
|
|
939
1008
|
*/
|
|
940
|
-
name:
|
|
941
|
-
label:
|
|
942
|
-
pluralLabel:
|
|
943
|
-
description:
|
|
944
|
-
icon:
|
|
1009
|
+
name: z9.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Machine unique key (snake_case). Immutable."),
|
|
1010
|
+
label: z9.string().optional().describe('Human readable singular label (e.g. "Account")'),
|
|
1011
|
+
pluralLabel: z9.string().optional().describe('Human readable plural label (e.g. "Accounts")'),
|
|
1012
|
+
description: z9.string().optional().describe("Developer documentation / description"),
|
|
1013
|
+
icon: z9.string().optional().describe("Icon name (Lucide/Material) for UI representation"),
|
|
945
1014
|
/**
|
|
946
1015
|
* Taxonomy & Organization
|
|
947
1016
|
*/
|
|
948
|
-
tags:
|
|
949
|
-
active:
|
|
950
|
-
isSystem:
|
|
951
|
-
abstract:
|
|
1017
|
+
tags: z9.array(z9.string()).optional().describe('Categorization tags (e.g. "sales", "system", "reference")'),
|
|
1018
|
+
active: z9.boolean().optional().default(true).describe("Is the object active and usable"),
|
|
1019
|
+
isSystem: z9.boolean().optional().default(false).describe("Is system object (protected from deletion)"),
|
|
1020
|
+
abstract: z9.boolean().optional().default(false).describe("Is abstract base object (cannot be instantiated)"),
|
|
952
1021
|
/**
|
|
953
1022
|
* Storage & Virtualization
|
|
954
1023
|
*/
|
|
955
|
-
datasource:
|
|
956
|
-
tableName:
|
|
1024
|
+
datasource: z9.string().optional().default("default").describe('Target Datasource ID. "default" is the primary DB.'),
|
|
1025
|
+
tableName: z9.string().optional().describe("Physical table/collection name in the target datasource"),
|
|
957
1026
|
/**
|
|
958
1027
|
* Data Model
|
|
959
1028
|
*/
|
|
960
|
-
fields:
|
|
1029
|
+
fields: z9.record(z9.string().regex(/^[a-z_][a-z0-9_]*$/, {
|
|
961
1030
|
message: 'Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")'
|
|
962
1031
|
}), FieldSchema).describe("Field definitions map. Keys must be snake_case identifiers."),
|
|
963
|
-
indexes:
|
|
1032
|
+
indexes: z9.array(IndexSchema).optional().describe("Database performance indexes"),
|
|
964
1033
|
/**
|
|
965
1034
|
* Advanced Data Management
|
|
966
1035
|
*/
|
|
@@ -978,12 +1047,22 @@ var ObjectSchemaBase = z8.object({
|
|
|
978
1047
|
* Logic & Validation (Co-located)
|
|
979
1048
|
* Best Practice: Define rules close to data.
|
|
980
1049
|
*/
|
|
981
|
-
validations:
|
|
1050
|
+
validations: z9.array(ValidationRuleSchema).optional().describe("Object-level validation rules"),
|
|
1051
|
+
/**
|
|
1052
|
+
* State Machine(s)
|
|
1053
|
+
* Supports a single machine (legacy) or a named record of machines.
|
|
1054
|
+
* Multiple machines allow parallel lifecycles (e.g., status + payment_status + approval_status).
|
|
1055
|
+
*
|
|
1056
|
+
* @example Single: stateMachine: { id: 'lifecycle', initial: 'draft', states: {...} }
|
|
1057
|
+
* @example Multiple: stateMachines: { lifecycle: {...}, payment: {...}, approval: {...} }
|
|
1058
|
+
*/
|
|
1059
|
+
stateMachine: StateMachineSchema.optional().describe("Single state machine for record lifecycle (shorthand)"),
|
|
1060
|
+
stateMachines: z9.record(z9.string(), StateMachineSchema).optional().describe("Named state machines for parallel lifecycles (e.g., status, payment, approval)"),
|
|
982
1061
|
/**
|
|
983
1062
|
* Display & UI Hints (Data-Layer)
|
|
984
1063
|
*/
|
|
985
|
-
titleFormat:
|
|
986
|
-
compactLayout:
|
|
1064
|
+
titleFormat: z9.string().optional().describe('Title expression (e.g. "{name} - {code}"). Overrides nameField.'),
|
|
1065
|
+
compactLayout: z9.array(z9.string()).optional().describe("Primary fields for hover/cards/lookups"),
|
|
987
1066
|
/**
|
|
988
1067
|
* Search Engine Config
|
|
989
1068
|
*/
|
|
@@ -996,10 +1075,29 @@ var ObjectSchemaBase = z8.object({
|
|
|
996
1075
|
var ObjectSchema = Object.assign(ObjectSchemaBase, {
|
|
997
1076
|
create: (config) => config
|
|
998
1077
|
});
|
|
1078
|
+
var ObjectOwnershipEnum = z9.enum(["own", "extend"]);
|
|
1079
|
+
var ObjectExtensionSchema = z9.object({
|
|
1080
|
+
/** The target object name (FQN) to extend */
|
|
1081
|
+
extend: z9.string().describe("Target object name (FQN) to extend"),
|
|
1082
|
+
/** Fields to merge into the target object (additive) */
|
|
1083
|
+
fields: z9.record(z9.string(), FieldSchema).optional().describe("Fields to add/override"),
|
|
1084
|
+
/** Override label */
|
|
1085
|
+
label: z9.string().optional(),
|
|
1086
|
+
/** Override plural label */
|
|
1087
|
+
pluralLabel: z9.string().optional(),
|
|
1088
|
+
/** Override description */
|
|
1089
|
+
description: z9.string().optional(),
|
|
1090
|
+
/** Additional validation rules to add */
|
|
1091
|
+
validations: z9.array(ValidationRuleSchema).optional(),
|
|
1092
|
+
/** Additional indexes to add */
|
|
1093
|
+
indexes: z9.array(IndexSchema).optional(),
|
|
1094
|
+
/** Merge priority. Higher number applied later (wins on conflict). Default: 200 */
|
|
1095
|
+
priority: z9.number().int().min(0).max(999).default(200).describe("Merge priority (higher = applied later)")
|
|
1096
|
+
});
|
|
999
1097
|
|
|
1000
1098
|
// src/data/hook.zod.ts
|
|
1001
|
-
import { z as
|
|
1002
|
-
var HookEvent =
|
|
1099
|
+
import { z as z10 } from "zod";
|
|
1100
|
+
var HookEvent = z10.enum([
|
|
1003
1101
|
// Read Operations
|
|
1004
1102
|
"beforeFind",
|
|
1005
1103
|
"afterFind",
|
|
@@ -1022,16 +1120,16 @@ var HookEvent = z9.enum([
|
|
|
1022
1120
|
"beforeDeleteMany",
|
|
1023
1121
|
"afterDeleteMany"
|
|
1024
1122
|
]);
|
|
1025
|
-
var HookSchema =
|
|
1123
|
+
var HookSchema = z10.object({
|
|
1026
1124
|
/**
|
|
1027
1125
|
* Unique identifier for the hook
|
|
1028
1126
|
* Required for debugging and overriding.
|
|
1029
1127
|
*/
|
|
1030
|
-
name:
|
|
1128
|
+
name: z10.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Hook unique name (snake_case)"),
|
|
1031
1129
|
/**
|
|
1032
1130
|
* Human readable label
|
|
1033
1131
|
*/
|
|
1034
|
-
label:
|
|
1132
|
+
label: z10.string().optional().describe("Description of what this hook does"),
|
|
1035
1133
|
/**
|
|
1036
1134
|
* Target Object(s)
|
|
1037
1135
|
* can be:
|
|
@@ -1039,17 +1137,17 @@ var HookSchema = z9.object({
|
|
|
1039
1137
|
* - List of objects: ["account", "contact"]
|
|
1040
1138
|
* - Wildcard: "*" (All objects)
|
|
1041
1139
|
*/
|
|
1042
|
-
object:
|
|
1140
|
+
object: z10.union([z10.string(), z10.array(z10.string())]).describe("Target object(s)"),
|
|
1043
1141
|
/**
|
|
1044
1142
|
* Events to subscribe to
|
|
1045
1143
|
* Combinations of timing (before/after) and action (find/insert/update/delete/etc)
|
|
1046
1144
|
*/
|
|
1047
|
-
events:
|
|
1145
|
+
events: z10.array(HookEvent).describe("Lifecycle events"),
|
|
1048
1146
|
/**
|
|
1049
1147
|
* Handler Logic
|
|
1050
1148
|
* Reference to a registered function in the plugin system OR a direct function (runtime only).
|
|
1051
1149
|
*/
|
|
1052
|
-
handler:
|
|
1150
|
+
handler: z10.union([z10.string(), z10.any()]).optional().describe("Function handler name or direct function"),
|
|
1053
1151
|
/**
|
|
1054
1152
|
* Execution Order
|
|
1055
1153
|
* Lower numbers run first.
|
|
@@ -1057,27 +1155,27 @@ var HookSchema = z9.object({
|
|
|
1057
1155
|
* - App Hooks: 100-999
|
|
1058
1156
|
* - User Hooks: 1000+
|
|
1059
1157
|
*/
|
|
1060
|
-
priority:
|
|
1158
|
+
priority: z10.number().default(100).describe("Execution priority"),
|
|
1061
1159
|
/**
|
|
1062
1160
|
* Async / Background Execution
|
|
1063
1161
|
* If true, the hook runs in the background and does not block the transaction.
|
|
1064
1162
|
* Only applicable for 'after*' events.
|
|
1065
1163
|
* Default: false (Blocking)
|
|
1066
1164
|
*/
|
|
1067
|
-
async:
|
|
1165
|
+
async: z10.boolean().default(false).describe("Run specifically as fire-and-forget"),
|
|
1068
1166
|
/**
|
|
1069
1167
|
* Error Policy
|
|
1070
1168
|
* What to do if the hook throws an exception?
|
|
1071
1169
|
* - abort: Rollback transaction (if blocking)
|
|
1072
1170
|
* - log: Log error and continue
|
|
1073
1171
|
*/
|
|
1074
|
-
onError:
|
|
1172
|
+
onError: z10.enum(["abort", "log"]).default("abort").describe("Error handling strategy")
|
|
1075
1173
|
});
|
|
1076
|
-
var HookContextSchema =
|
|
1174
|
+
var HookContextSchema = z10.object({
|
|
1077
1175
|
/** Tracing ID */
|
|
1078
|
-
id:
|
|
1176
|
+
id: z10.string().optional().describe("Unique execution ID for tracing"),
|
|
1079
1177
|
/** Target Object Name */
|
|
1080
|
-
object:
|
|
1178
|
+
object: z10.string(),
|
|
1081
1179
|
/** Current Lifecycle Event */
|
|
1082
1180
|
event: HookEvent,
|
|
1083
1181
|
/**
|
|
@@ -1091,42 +1189,42 @@ var HookContextSchema = z9.object({
|
|
|
1091
1189
|
* - updateMany: { query: QueryAST, doc: Record, options: DriverOptions }
|
|
1092
1190
|
* - deleteMany: { query: QueryAST, options: DriverOptions }
|
|
1093
1191
|
*/
|
|
1094
|
-
input:
|
|
1192
|
+
input: z10.record(z10.string(), z10.any()).describe("Mutable input parameters"),
|
|
1095
1193
|
/**
|
|
1096
1194
|
* Operation Result (Mutable)
|
|
1097
1195
|
* Available in 'after*' events. Modify this to transform the output.
|
|
1098
1196
|
*/
|
|
1099
|
-
result:
|
|
1197
|
+
result: z10.any().optional().describe("Operation result (After hooks only)"),
|
|
1100
1198
|
/**
|
|
1101
1199
|
* Data Snapshot
|
|
1102
1200
|
* The state of the record BEFORE the operation (for update/delete).
|
|
1103
1201
|
*/
|
|
1104
|
-
previous:
|
|
1202
|
+
previous: z10.record(z10.string(), z10.any()).optional().describe("Record state before operation"),
|
|
1105
1203
|
/**
|
|
1106
1204
|
* Execution Session
|
|
1107
1205
|
* Contains authentication and tenancy information.
|
|
1108
1206
|
*/
|
|
1109
|
-
session:
|
|
1110
|
-
userId:
|
|
1111
|
-
tenantId:
|
|
1112
|
-
roles:
|
|
1113
|
-
accessToken:
|
|
1207
|
+
session: z10.object({
|
|
1208
|
+
userId: z10.string().optional(),
|
|
1209
|
+
tenantId: z10.string().optional(),
|
|
1210
|
+
roles: z10.array(z10.string()).optional(),
|
|
1211
|
+
accessToken: z10.string().optional()
|
|
1114
1212
|
}).optional().describe("Current session context"),
|
|
1115
1213
|
/**
|
|
1116
1214
|
* Transaction Handle
|
|
1117
1215
|
* If the operation is part of a transaction, use this handle for side-effects.
|
|
1118
1216
|
*/
|
|
1119
|
-
transaction:
|
|
1217
|
+
transaction: z10.any().optional().describe("Database transaction handle"),
|
|
1120
1218
|
/**
|
|
1121
1219
|
* Engine Access
|
|
1122
1220
|
* Reference to the ObjectQL engine for performing side effects.
|
|
1123
1221
|
*/
|
|
1124
|
-
ql:
|
|
1222
|
+
ql: z10.any().describe("ObjectQL Engine Reference")
|
|
1125
1223
|
});
|
|
1126
1224
|
|
|
1127
1225
|
// src/data/mapping.zod.ts
|
|
1128
|
-
import { z as
|
|
1129
|
-
var TransformType =
|
|
1226
|
+
import { z as z11 } from "zod";
|
|
1227
|
+
var TransformType = z11.enum([
|
|
1130
1228
|
"none",
|
|
1131
1229
|
// Direct copy
|
|
1132
1230
|
"constant",
|
|
@@ -1142,114 +1240,114 @@ var TransformType = z10.enum([
|
|
|
1142
1240
|
"map"
|
|
1143
1241
|
// Value mapping (e.g. "Active" -> "active")
|
|
1144
1242
|
]);
|
|
1145
|
-
var FieldMappingSchema =
|
|
1243
|
+
var FieldMappingSchema = z11.object({
|
|
1146
1244
|
/** Source Column */
|
|
1147
|
-
source:
|
|
1245
|
+
source: z11.union([z11.string(), z11.array(z11.string())]).describe("Source column header(s)"),
|
|
1148
1246
|
/** Target Field */
|
|
1149
|
-
target:
|
|
1247
|
+
target: z11.union([z11.string(), z11.array(z11.string())]).describe("Target object field(s)"),
|
|
1150
1248
|
/** Transformation */
|
|
1151
1249
|
transform: TransformType.default("none"),
|
|
1152
1250
|
/** Configuration for transform */
|
|
1153
|
-
params:
|
|
1251
|
+
params: z11.object({
|
|
1154
1252
|
// Constant
|
|
1155
|
-
value:
|
|
1253
|
+
value: z11.any().optional(),
|
|
1156
1254
|
// Lookup
|
|
1157
|
-
object:
|
|
1255
|
+
object: z11.string().optional(),
|
|
1158
1256
|
// Lookup Object
|
|
1159
|
-
fromField:
|
|
1257
|
+
fromField: z11.string().optional(),
|
|
1160
1258
|
// Match on (e.g. "name")
|
|
1161
|
-
toField:
|
|
1259
|
+
toField: z11.string().optional(),
|
|
1162
1260
|
// Value to take (e.g. "_id")
|
|
1163
|
-
autoCreate:
|
|
1261
|
+
autoCreate: z11.boolean().optional(),
|
|
1164
1262
|
// Create if missing
|
|
1165
1263
|
// Map
|
|
1166
|
-
valueMap:
|
|
1264
|
+
valueMap: z11.record(z11.string(), z11.any()).optional(),
|
|
1167
1265
|
// { "Open": "draft" }
|
|
1168
1266
|
// Split/Join
|
|
1169
|
-
separator:
|
|
1267
|
+
separator: z11.string().optional()
|
|
1170
1268
|
}).optional()
|
|
1171
1269
|
});
|
|
1172
|
-
var MappingSchema =
|
|
1270
|
+
var MappingSchema = z11.object({
|
|
1173
1271
|
/** Identity */
|
|
1174
1272
|
name: SnakeCaseIdentifierSchema.describe("Mapping unique name (lowercase snake_case)"),
|
|
1175
|
-
label:
|
|
1273
|
+
label: z11.string().optional(),
|
|
1176
1274
|
/** Scope */
|
|
1177
|
-
sourceFormat:
|
|
1178
|
-
targetObject:
|
|
1275
|
+
sourceFormat: z11.enum(["csv", "json", "xml", "sql"]).default("csv"),
|
|
1276
|
+
targetObject: z11.string().describe("Target Object Name"),
|
|
1179
1277
|
/** Column Mappings */
|
|
1180
|
-
fieldMapping:
|
|
1278
|
+
fieldMapping: z11.array(FieldMappingSchema),
|
|
1181
1279
|
/** Upsert Logic */
|
|
1182
|
-
mode:
|
|
1183
|
-
upsertKey:
|
|
1280
|
+
mode: z11.enum(["insert", "update", "upsert"]).default("insert"),
|
|
1281
|
+
upsertKey: z11.array(z11.string()).optional().describe("Fields to match for upsert (e.g. email)"),
|
|
1184
1282
|
/** Extract Logic (For Export) */
|
|
1185
1283
|
extractQuery: QuerySchema.optional().describe("Query to run for export only"),
|
|
1186
1284
|
/** Error Handling */
|
|
1187
|
-
errorPolicy:
|
|
1188
|
-
batchSize:
|
|
1285
|
+
errorPolicy: z11.enum(["skip", "abort", "retry"]).default("skip"),
|
|
1286
|
+
batchSize: z11.number().default(1e3)
|
|
1189
1287
|
});
|
|
1190
1288
|
|
|
1191
1289
|
// src/data/data-engine.zod.ts
|
|
1192
|
-
import { z as
|
|
1193
|
-
var DataEngineFilterSchema =
|
|
1194
|
-
|
|
1290
|
+
import { z as z12 } from "zod";
|
|
1291
|
+
var DataEngineFilterSchema = z12.union([
|
|
1292
|
+
z12.record(z12.string(), z12.any()),
|
|
1195
1293
|
FilterConditionSchema
|
|
1196
1294
|
]).describe("Data Engine query filter conditions");
|
|
1197
|
-
var DataEngineSortSchema =
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1295
|
+
var DataEngineSortSchema = z12.union([
|
|
1296
|
+
z12.record(z12.string(), z12.enum(["asc", "desc"])),
|
|
1297
|
+
z12.record(z12.string(), z12.union([z12.literal(1), z12.literal(-1)])),
|
|
1298
|
+
z12.array(SortNodeSchema)
|
|
1201
1299
|
]).describe("Sort order definition");
|
|
1202
|
-
var DataEngineQueryOptionsSchema =
|
|
1300
|
+
var DataEngineQueryOptionsSchema = z12.object({
|
|
1203
1301
|
/** Filter conditions (WHERE) */
|
|
1204
1302
|
filter: DataEngineFilterSchema.optional(),
|
|
1205
1303
|
/** Fields to select (SELECT) */
|
|
1206
|
-
select:
|
|
1304
|
+
select: z12.array(z12.string()).optional(),
|
|
1207
1305
|
/** Sort order (ORDER BY) */
|
|
1208
1306
|
sort: DataEngineSortSchema.optional(),
|
|
1209
1307
|
/** Limit number of results (LIMIT) */
|
|
1210
|
-
limit:
|
|
1308
|
+
limit: z12.number().int().min(1).optional(),
|
|
1211
1309
|
/** Skip number of results (OFFSET) */
|
|
1212
|
-
skip:
|
|
1310
|
+
skip: z12.number().int().min(0).optional(),
|
|
1213
1311
|
/**
|
|
1214
1312
|
* Maximum number of results (OData style)
|
|
1215
1313
|
* Takes precedence over limit if both specified
|
|
1216
1314
|
*/
|
|
1217
|
-
top:
|
|
1315
|
+
top: z12.number().int().min(1).optional(),
|
|
1218
1316
|
/**
|
|
1219
1317
|
* Include related records (JOIN/Populate)
|
|
1220
1318
|
* List of relationship field names to expand
|
|
1221
1319
|
*/
|
|
1222
|
-
populate:
|
|
1320
|
+
populate: z12.array(z12.string()).optional()
|
|
1223
1321
|
}).describe("Query options for IDataEngine.find() operations");
|
|
1224
|
-
var DataEngineInsertOptionsSchema =
|
|
1322
|
+
var DataEngineInsertOptionsSchema = z12.object({
|
|
1225
1323
|
/**
|
|
1226
1324
|
* Return the inserted record(s)?
|
|
1227
1325
|
* Some drivers support RETURNING clause for efficiency.
|
|
1228
1326
|
* Default: true
|
|
1229
1327
|
*/
|
|
1230
|
-
returning:
|
|
1328
|
+
returning: z12.boolean().default(true).optional()
|
|
1231
1329
|
}).describe("Options for DataEngine.insert operations");
|
|
1232
|
-
var DataEngineUpdateOptionsSchema =
|
|
1330
|
+
var DataEngineUpdateOptionsSchema = z12.object({
|
|
1233
1331
|
/** Filter conditions to identify records to update */
|
|
1234
1332
|
filter: DataEngineFilterSchema.optional(),
|
|
1235
1333
|
/**
|
|
1236
1334
|
* Perform an upsert?
|
|
1237
1335
|
* If true, insert if not found.
|
|
1238
1336
|
*/
|
|
1239
|
-
upsert:
|
|
1337
|
+
upsert: z12.boolean().default(false).optional(),
|
|
1240
1338
|
/**
|
|
1241
1339
|
* Update multiple records?
|
|
1242
1340
|
* If false, only the first match is updated.
|
|
1243
1341
|
* Default: false
|
|
1244
1342
|
*/
|
|
1245
|
-
multi:
|
|
1343
|
+
multi: z12.boolean().default(false).optional(),
|
|
1246
1344
|
/**
|
|
1247
1345
|
* Return the updated record(s)?
|
|
1248
1346
|
* Default: false (returns update count/status)
|
|
1249
1347
|
*/
|
|
1250
|
-
returning:
|
|
1348
|
+
returning: z12.boolean().default(false).optional()
|
|
1251
1349
|
}).describe("Options for DataEngine.update operations");
|
|
1252
|
-
var DataEngineDeleteOptionsSchema =
|
|
1350
|
+
var DataEngineDeleteOptionsSchema = z12.object({
|
|
1253
1351
|
/** Filter conditions to identify records to delete */
|
|
1254
1352
|
filter: DataEngineFilterSchema.optional(),
|
|
1255
1353
|
/**
|
|
@@ -1257,99 +1355,99 @@ var DataEngineDeleteOptionsSchema = z11.object({
|
|
|
1257
1355
|
* If false, only the first match is deleted.
|
|
1258
1356
|
* Default: false
|
|
1259
1357
|
*/
|
|
1260
|
-
multi:
|
|
1358
|
+
multi: z12.boolean().default(false).optional()
|
|
1261
1359
|
}).describe("Options for DataEngine.delete operations");
|
|
1262
|
-
var DataEngineAggregateOptionsSchema =
|
|
1360
|
+
var DataEngineAggregateOptionsSchema = z12.object({
|
|
1263
1361
|
/** Filter conditions (WHERE) */
|
|
1264
1362
|
filter: DataEngineFilterSchema.optional(),
|
|
1265
1363
|
/** Group By fields */
|
|
1266
|
-
groupBy:
|
|
1364
|
+
groupBy: z12.array(z12.string()).optional(),
|
|
1267
1365
|
/**
|
|
1268
1366
|
* Aggregation definitions
|
|
1269
1367
|
* e.g. [{ field: 'amount', method: 'sum', alias: 'total' }]
|
|
1270
1368
|
*/
|
|
1271
|
-
aggregations:
|
|
1272
|
-
field:
|
|
1273
|
-
method:
|
|
1274
|
-
alias:
|
|
1369
|
+
aggregations: z12.array(z12.object({
|
|
1370
|
+
field: z12.string(),
|
|
1371
|
+
method: z12.enum(["count", "sum", "avg", "min", "max", "count_distinct"]),
|
|
1372
|
+
alias: z12.string().optional()
|
|
1275
1373
|
})).optional()
|
|
1276
1374
|
}).describe("Options for DataEngine.aggregate operations");
|
|
1277
|
-
var DataEngineCountOptionsSchema =
|
|
1375
|
+
var DataEngineCountOptionsSchema = z12.object({
|
|
1278
1376
|
/** Filter conditions */
|
|
1279
1377
|
filter: DataEngineFilterSchema.optional()
|
|
1280
1378
|
}).describe("Options for DataEngine.count operations");
|
|
1281
|
-
var DataEngineContractSchema =
|
|
1282
|
-
find:
|
|
1283
|
-
findOne:
|
|
1284
|
-
insert:
|
|
1285
|
-
update:
|
|
1286
|
-
delete:
|
|
1287
|
-
count:
|
|
1288
|
-
aggregate:
|
|
1379
|
+
var DataEngineContractSchema = z12.object({
|
|
1380
|
+
find: z12.function().args(z12.string(), DataEngineQueryOptionsSchema.optional()).returns(z12.promise(z12.array(z12.any()))),
|
|
1381
|
+
findOne: z12.function().args(z12.string(), DataEngineQueryOptionsSchema.optional()).returns(z12.promise(z12.any())),
|
|
1382
|
+
insert: z12.function().args(z12.string(), z12.union([z12.record(z12.string(), z12.any()), z12.array(z12.record(z12.string(), z12.any()))]), DataEngineInsertOptionsSchema.optional()).returns(z12.promise(z12.any())),
|
|
1383
|
+
update: z12.function().args(z12.string(), z12.record(z12.string(), z12.any()), DataEngineUpdateOptionsSchema.optional()).returns(z12.promise(z12.any())),
|
|
1384
|
+
delete: z12.function().args(z12.string(), DataEngineDeleteOptionsSchema.optional()).returns(z12.promise(z12.any())),
|
|
1385
|
+
count: z12.function().args(z12.string(), DataEngineCountOptionsSchema.optional()).returns(z12.promise(z12.number())),
|
|
1386
|
+
aggregate: z12.function().args(z12.string(), DataEngineAggregateOptionsSchema).returns(z12.promise(z12.array(z12.any())))
|
|
1289
1387
|
}).describe("Standard Data Engine Contract");
|
|
1290
|
-
var DataEngineFindRequestSchema =
|
|
1291
|
-
method:
|
|
1292
|
-
object:
|
|
1388
|
+
var DataEngineFindRequestSchema = z12.object({
|
|
1389
|
+
method: z12.literal("find"),
|
|
1390
|
+
object: z12.string(),
|
|
1293
1391
|
query: DataEngineQueryOptionsSchema.optional()
|
|
1294
1392
|
});
|
|
1295
|
-
var DataEngineFindOneRequestSchema =
|
|
1296
|
-
method:
|
|
1297
|
-
object:
|
|
1393
|
+
var DataEngineFindOneRequestSchema = z12.object({
|
|
1394
|
+
method: z12.literal("findOne"),
|
|
1395
|
+
object: z12.string(),
|
|
1298
1396
|
query: DataEngineQueryOptionsSchema.optional()
|
|
1299
1397
|
});
|
|
1300
|
-
var DataEngineInsertRequestSchema =
|
|
1301
|
-
method:
|
|
1302
|
-
object:
|
|
1303
|
-
data:
|
|
1398
|
+
var DataEngineInsertRequestSchema = z12.object({
|
|
1399
|
+
method: z12.literal("insert"),
|
|
1400
|
+
object: z12.string(),
|
|
1401
|
+
data: z12.union([z12.record(z12.string(), z12.any()), z12.array(z12.record(z12.string(), z12.any()))]),
|
|
1304
1402
|
options: DataEngineInsertOptionsSchema.optional()
|
|
1305
1403
|
});
|
|
1306
|
-
var DataEngineUpdateRequestSchema =
|
|
1307
|
-
method:
|
|
1308
|
-
object:
|
|
1309
|
-
data:
|
|
1310
|
-
id:
|
|
1404
|
+
var DataEngineUpdateRequestSchema = z12.object({
|
|
1405
|
+
method: z12.literal("update"),
|
|
1406
|
+
object: z12.string(),
|
|
1407
|
+
data: z12.record(z12.string(), z12.any()),
|
|
1408
|
+
id: z12.any().optional().describe("ID for single update, or use filter in options"),
|
|
1311
1409
|
options: DataEngineUpdateOptionsSchema.optional()
|
|
1312
1410
|
});
|
|
1313
|
-
var DataEngineDeleteRequestSchema =
|
|
1314
|
-
method:
|
|
1315
|
-
object:
|
|
1316
|
-
id:
|
|
1411
|
+
var DataEngineDeleteRequestSchema = z12.object({
|
|
1412
|
+
method: z12.literal("delete"),
|
|
1413
|
+
object: z12.string(),
|
|
1414
|
+
id: z12.any().optional().describe("ID for single delete, or use filter in options"),
|
|
1317
1415
|
options: DataEngineDeleteOptionsSchema.optional()
|
|
1318
1416
|
});
|
|
1319
|
-
var DataEngineCountRequestSchema =
|
|
1320
|
-
method:
|
|
1321
|
-
object:
|
|
1417
|
+
var DataEngineCountRequestSchema = z12.object({
|
|
1418
|
+
method: z12.literal("count"),
|
|
1419
|
+
object: z12.string(),
|
|
1322
1420
|
query: DataEngineCountOptionsSchema.optional()
|
|
1323
1421
|
});
|
|
1324
|
-
var DataEngineAggregateRequestSchema =
|
|
1325
|
-
method:
|
|
1326
|
-
object:
|
|
1422
|
+
var DataEngineAggregateRequestSchema = z12.object({
|
|
1423
|
+
method: z12.literal("aggregate"),
|
|
1424
|
+
object: z12.string(),
|
|
1327
1425
|
query: DataEngineAggregateOptionsSchema
|
|
1328
1426
|
});
|
|
1329
|
-
var DataEngineExecuteRequestSchema =
|
|
1330
|
-
method:
|
|
1427
|
+
var DataEngineExecuteRequestSchema = z12.object({
|
|
1428
|
+
method: z12.literal("execute"),
|
|
1331
1429
|
/** The abstract command (string SQL, or JSON object) */
|
|
1332
|
-
command:
|
|
1430
|
+
command: z12.any(),
|
|
1333
1431
|
/** Optional options */
|
|
1334
|
-
options:
|
|
1432
|
+
options: z12.record(z12.string(), z12.any()).optional()
|
|
1335
1433
|
});
|
|
1336
|
-
var DataEngineVectorFindRequestSchema =
|
|
1337
|
-
method:
|
|
1338
|
-
object:
|
|
1434
|
+
var DataEngineVectorFindRequestSchema = z12.object({
|
|
1435
|
+
method: z12.literal("vectorFind"),
|
|
1436
|
+
object: z12.string(),
|
|
1339
1437
|
/** The vector embedding to search for */
|
|
1340
|
-
vector:
|
|
1438
|
+
vector: z12.array(z12.number()),
|
|
1341
1439
|
/** Optional pre-filter (Metadata filtering) */
|
|
1342
1440
|
filter: DataEngineFilterSchema.optional(),
|
|
1343
1441
|
/** Fields to select */
|
|
1344
|
-
select:
|
|
1442
|
+
select: z12.array(z12.string()).optional(),
|
|
1345
1443
|
/** Number of results */
|
|
1346
|
-
limit:
|
|
1444
|
+
limit: z12.number().int().default(5).optional(),
|
|
1347
1445
|
/** Minimum similarity score (0-1) or distance threshold */
|
|
1348
|
-
threshold:
|
|
1446
|
+
threshold: z12.number().optional()
|
|
1349
1447
|
});
|
|
1350
|
-
var DataEngineBatchRequestSchema =
|
|
1351
|
-
method:
|
|
1352
|
-
requests:
|
|
1448
|
+
var DataEngineBatchRequestSchema = z12.object({
|
|
1449
|
+
method: z12.literal("batch"),
|
|
1450
|
+
requests: z12.array(z12.discriminatedUnion("method", [
|
|
1353
1451
|
DataEngineFindRequestSchema,
|
|
1354
1452
|
DataEngineFindOneRequestSchema,
|
|
1355
1453
|
DataEngineInsertRequestSchema,
|
|
@@ -1365,9 +1463,9 @@ var DataEngineBatchRequestSchema = z11.object({
|
|
|
1365
1463
|
* - true: All or nothing (Atomic)
|
|
1366
1464
|
* - false: Best effort, continue on error
|
|
1367
1465
|
*/
|
|
1368
|
-
transaction:
|
|
1466
|
+
transaction: z12.boolean().default(true).optional()
|
|
1369
1467
|
});
|
|
1370
|
-
var DataEngineRequestSchema =
|
|
1468
|
+
var DataEngineRequestSchema = z12.discriminatedUnion("method", [
|
|
1371
1469
|
DataEngineFindRequestSchema,
|
|
1372
1470
|
DataEngineFindOneRequestSchema,
|
|
1373
1471
|
DataEngineInsertRequestSchema,
|
|
@@ -1381,67 +1479,67 @@ var DataEngineRequestSchema = z11.discriminatedUnion("method", [
|
|
|
1381
1479
|
]).describe("Virtual ObjectQL Request Protocol");
|
|
1382
1480
|
|
|
1383
1481
|
// src/data/driver.zod.ts
|
|
1384
|
-
import { z as
|
|
1385
|
-
var DriverOptionsSchema =
|
|
1482
|
+
import { z as z13 } from "zod";
|
|
1483
|
+
var DriverOptionsSchema = z13.object({
|
|
1386
1484
|
/**
|
|
1387
1485
|
* Transaction handle/identifier.
|
|
1388
1486
|
* If provided, the operation must run within this transaction.
|
|
1389
1487
|
*/
|
|
1390
|
-
transaction:
|
|
1488
|
+
transaction: z13.any().optional().describe("Transaction handle"),
|
|
1391
1489
|
/**
|
|
1392
1490
|
* Operation timeout in milliseconds.
|
|
1393
1491
|
*/
|
|
1394
|
-
timeout:
|
|
1492
|
+
timeout: z13.number().optional().describe("Timeout in ms"),
|
|
1395
1493
|
/**
|
|
1396
1494
|
* Whether to bypass cache and force a fresh read.
|
|
1397
1495
|
*/
|
|
1398
|
-
skipCache:
|
|
1496
|
+
skipCache: z13.boolean().optional().describe("Bypass cache"),
|
|
1399
1497
|
/**
|
|
1400
1498
|
* Distributed Tracing Context.
|
|
1401
1499
|
* Used for passing OpenTelemetry span context or request IDs for observability.
|
|
1402
1500
|
*/
|
|
1403
|
-
traceContext:
|
|
1501
|
+
traceContext: z13.record(z13.string(), z13.string()).optional().describe("OpenTelemetry context or request ID"),
|
|
1404
1502
|
/**
|
|
1405
1503
|
* Tenant Identifier.
|
|
1406
1504
|
* For multi-tenant databases (row-level security or schema-per-tenant).
|
|
1407
1505
|
*/
|
|
1408
|
-
tenantId:
|
|
1506
|
+
tenantId: z13.string().optional().describe("Tenant Isolation identifier")
|
|
1409
1507
|
});
|
|
1410
|
-
var DriverCapabilitiesSchema =
|
|
1508
|
+
var DriverCapabilitiesSchema = z13.object({
|
|
1411
1509
|
// ============================================================================
|
|
1412
1510
|
// Basic CRUD Operations
|
|
1413
1511
|
// ============================================================================
|
|
1414
1512
|
/**
|
|
1415
1513
|
* Whether the driver supports create operations.
|
|
1416
1514
|
*/
|
|
1417
|
-
create:
|
|
1515
|
+
create: z13.boolean().default(true).describe("Supports CREATE operations"),
|
|
1418
1516
|
/**
|
|
1419
1517
|
* Whether the driver supports read operations.
|
|
1420
1518
|
*/
|
|
1421
|
-
read:
|
|
1519
|
+
read: z13.boolean().default(true).describe("Supports READ operations"),
|
|
1422
1520
|
/**
|
|
1423
1521
|
* Whether the driver supports update operations.
|
|
1424
1522
|
*/
|
|
1425
|
-
update:
|
|
1523
|
+
update: z13.boolean().default(true).describe("Supports UPDATE operations"),
|
|
1426
1524
|
/**
|
|
1427
1525
|
* Whether the driver supports delete operations.
|
|
1428
1526
|
*/
|
|
1429
|
-
delete:
|
|
1527
|
+
delete: z13.boolean().default(true).describe("Supports DELETE operations"),
|
|
1430
1528
|
// ============================================================================
|
|
1431
1529
|
// Bulk Operations
|
|
1432
1530
|
// ============================================================================
|
|
1433
1531
|
/**
|
|
1434
1532
|
* Whether the driver supports bulk create operations.
|
|
1435
1533
|
*/
|
|
1436
|
-
bulkCreate:
|
|
1534
|
+
bulkCreate: z13.boolean().default(false).describe("Supports bulk CREATE operations"),
|
|
1437
1535
|
/**
|
|
1438
1536
|
* Whether the driver supports bulk update operations.
|
|
1439
1537
|
*/
|
|
1440
|
-
bulkUpdate:
|
|
1538
|
+
bulkUpdate: z13.boolean().default(false).describe("Supports bulk UPDATE operations"),
|
|
1441
1539
|
/**
|
|
1442
1540
|
* Whether the driver supports bulk delete operations.
|
|
1443
1541
|
*/
|
|
1444
|
-
bulkDelete:
|
|
1542
|
+
bulkDelete: z13.boolean().default(false).describe("Supports bulk DELETE operations"),
|
|
1445
1543
|
// ============================================================================
|
|
1446
1544
|
// Transaction & Connection Management
|
|
1447
1545
|
// ============================================================================
|
|
@@ -1449,15 +1547,15 @@ var DriverCapabilitiesSchema = z12.object({
|
|
|
1449
1547
|
* Whether the driver supports database transactions.
|
|
1450
1548
|
* If true, beginTransaction, commit, and rollback must be implemented.
|
|
1451
1549
|
*/
|
|
1452
|
-
transactions:
|
|
1550
|
+
transactions: z13.boolean().default(false).describe("Supports ACID transactions"),
|
|
1453
1551
|
/**
|
|
1454
1552
|
* Whether the driver supports savepoints within transactions.
|
|
1455
1553
|
*/
|
|
1456
|
-
savepoints:
|
|
1554
|
+
savepoints: z13.boolean().default(false).describe("Supports transaction savepoints"),
|
|
1457
1555
|
/**
|
|
1458
1556
|
* Supported transaction isolation levels.
|
|
1459
1557
|
*/
|
|
1460
|
-
isolationLevels:
|
|
1558
|
+
isolationLevels: z13.array(z13.enum([
|
|
1461
1559
|
"read-uncommitted",
|
|
1462
1560
|
"read-committed",
|
|
1463
1561
|
"repeatable-read",
|
|
@@ -1472,41 +1570,41 @@ var DriverCapabilitiesSchema = z12.object({
|
|
|
1472
1570
|
*
|
|
1473
1571
|
* Example: Memory driver might not support complex filter conditions.
|
|
1474
1572
|
*/
|
|
1475
|
-
queryFilters:
|
|
1573
|
+
queryFilters: z13.boolean().default(true).describe("Supports WHERE clause filtering"),
|
|
1476
1574
|
/**
|
|
1477
1575
|
* Whether the driver supports aggregation functions (COUNT, SUM, AVG, etc.).
|
|
1478
1576
|
* If false, ObjectQL will compute aggregations in memory.
|
|
1479
1577
|
*/
|
|
1480
|
-
queryAggregations:
|
|
1578
|
+
queryAggregations: z13.boolean().default(false).describe("Supports GROUP BY and aggregation functions"),
|
|
1481
1579
|
/**
|
|
1482
1580
|
* Whether the driver supports ORDER BY sorting.
|
|
1483
1581
|
* If false, ObjectQL will sort results in memory.
|
|
1484
1582
|
*/
|
|
1485
|
-
querySorting:
|
|
1583
|
+
querySorting: z13.boolean().default(true).describe("Supports ORDER BY sorting"),
|
|
1486
1584
|
/**
|
|
1487
1585
|
* Whether the driver supports LIMIT/OFFSET pagination.
|
|
1488
1586
|
* If false, ObjectQL will fetch all records and paginate in memory.
|
|
1489
1587
|
*/
|
|
1490
|
-
queryPagination:
|
|
1588
|
+
queryPagination: z13.boolean().default(true).describe("Supports LIMIT/OFFSET pagination"),
|
|
1491
1589
|
/**
|
|
1492
1590
|
* Whether the driver supports window functions (ROW_NUMBER, RANK, LAG, LEAD, etc.).
|
|
1493
1591
|
* If false, ObjectQL will compute window functions in memory.
|
|
1494
1592
|
*/
|
|
1495
|
-
queryWindowFunctions:
|
|
1593
|
+
queryWindowFunctions: z13.boolean().default(false).describe("Supports window functions with OVER clause"),
|
|
1496
1594
|
/**
|
|
1497
1595
|
* Whether the driver supports subqueries (nested SELECT statements).
|
|
1498
1596
|
* If false, ObjectQL will execute queries separately and combine results.
|
|
1499
1597
|
*/
|
|
1500
|
-
querySubqueries:
|
|
1598
|
+
querySubqueries: z13.boolean().default(false).describe("Supports subqueries"),
|
|
1501
1599
|
/**
|
|
1502
1600
|
* Whether the driver supports Common Table Expressions (WITH clause).
|
|
1503
1601
|
*/
|
|
1504
|
-
queryCTE:
|
|
1602
|
+
queryCTE: z13.boolean().default(false).describe("Supports Common Table Expressions (WITH clause)"),
|
|
1505
1603
|
/**
|
|
1506
1604
|
* Whether the driver supports SQL-style joins.
|
|
1507
1605
|
* If false, ObjectQL will fetch related data separately and join in memory.
|
|
1508
1606
|
*/
|
|
1509
|
-
joins:
|
|
1607
|
+
joins: z13.boolean().default(false).describe("Supports SQL joins"),
|
|
1510
1608
|
// ============================================================================
|
|
1511
1609
|
// Advanced Features
|
|
1512
1610
|
// ============================================================================
|
|
@@ -1514,69 +1612,69 @@ var DriverCapabilitiesSchema = z12.object({
|
|
|
1514
1612
|
* Whether the driver supports full-text search.
|
|
1515
1613
|
* If true, text search queries can be pushed to the database.
|
|
1516
1614
|
*/
|
|
1517
|
-
fullTextSearch:
|
|
1615
|
+
fullTextSearch: z13.boolean().default(false).describe("Supports full-text search"),
|
|
1518
1616
|
/**
|
|
1519
1617
|
* Whether the driver supports JSON querying capabilities.
|
|
1520
1618
|
*/
|
|
1521
|
-
jsonQuery:
|
|
1619
|
+
jsonQuery: z13.boolean().default(false).describe("Supports JSON field querying"),
|
|
1522
1620
|
/**
|
|
1523
1621
|
* Whether the driver supports geospatial queries.
|
|
1524
1622
|
*/
|
|
1525
|
-
geospatialQuery:
|
|
1623
|
+
geospatialQuery: z13.boolean().default(false).describe("Supports geospatial queries"),
|
|
1526
1624
|
/**
|
|
1527
1625
|
* Whether the driver supports streaming large result sets.
|
|
1528
1626
|
*/
|
|
1529
|
-
streaming:
|
|
1627
|
+
streaming: z13.boolean().default(false).describe("Supports result streaming (cursors/iterators)"),
|
|
1530
1628
|
/**
|
|
1531
1629
|
* Whether the driver supports JSON field types.
|
|
1532
1630
|
* If false, JSON data will be serialized as strings.
|
|
1533
1631
|
*/
|
|
1534
|
-
jsonFields:
|
|
1632
|
+
jsonFields: z13.boolean().default(false).describe("Supports JSON field types"),
|
|
1535
1633
|
/**
|
|
1536
1634
|
* Whether the driver supports array field types.
|
|
1537
1635
|
* If false, arrays will be stored as JSON strings or in separate tables.
|
|
1538
1636
|
*/
|
|
1539
|
-
arrayFields:
|
|
1637
|
+
arrayFields: z13.boolean().default(false).describe("Supports array field types"),
|
|
1540
1638
|
/**
|
|
1541
1639
|
* Whether the driver supports vector embeddings and similarity search.
|
|
1542
1640
|
* Required for RAG (Retrieval-Augmented Generation) and AI features.
|
|
1543
1641
|
*/
|
|
1544
|
-
vectorSearch:
|
|
1642
|
+
vectorSearch: z13.boolean().default(false).describe("Supports vector embeddings and similarity search"),
|
|
1545
1643
|
/**
|
|
1546
1644
|
* Whether the driver supports geospatial queries.
|
|
1547
1645
|
* @deprecated Use geospatialQuery instead
|
|
1548
1646
|
*/
|
|
1549
|
-
geoSpatial:
|
|
1647
|
+
geoSpatial: z13.boolean().default(false).describe("Supports geospatial queries (deprecated: use geospatialQuery)"),
|
|
1550
1648
|
// ============================================================================
|
|
1551
1649
|
// Schema Management
|
|
1552
1650
|
// ============================================================================
|
|
1553
1651
|
/**
|
|
1554
1652
|
* Whether the driver supports automatic schema synchronization.
|
|
1555
1653
|
*/
|
|
1556
|
-
schemaSync:
|
|
1654
|
+
schemaSync: z13.boolean().default(false).describe("Supports automatic schema synchronization"),
|
|
1557
1655
|
/**
|
|
1558
1656
|
* Whether the driver supports database migrations.
|
|
1559
1657
|
*/
|
|
1560
|
-
migrations:
|
|
1658
|
+
migrations: z13.boolean().default(false).describe("Supports database migrations"),
|
|
1561
1659
|
/**
|
|
1562
1660
|
* Whether the driver supports index management.
|
|
1563
1661
|
*/
|
|
1564
|
-
indexes:
|
|
1662
|
+
indexes: z13.boolean().default(false).describe("Supports index creation and management"),
|
|
1565
1663
|
// ============================================================================
|
|
1566
1664
|
// Performance & Optimization
|
|
1567
1665
|
// ============================================================================
|
|
1568
1666
|
/**
|
|
1569
1667
|
* Whether the driver supports connection pooling.
|
|
1570
1668
|
*/
|
|
1571
|
-
connectionPooling:
|
|
1669
|
+
connectionPooling: z13.boolean().default(false).describe("Supports connection pooling"),
|
|
1572
1670
|
/**
|
|
1573
1671
|
* Whether the driver supports prepared statements.
|
|
1574
1672
|
*/
|
|
1575
|
-
preparedStatements:
|
|
1673
|
+
preparedStatements: z13.boolean().default(false).describe("Supports prepared statements (SQL injection prevention)"),
|
|
1576
1674
|
/**
|
|
1577
1675
|
* Whether the driver supports query result caching.
|
|
1578
1676
|
*/
|
|
1579
|
-
queryCache:
|
|
1677
|
+
queryCache: z13.boolean().default(false).describe("Supports query result caching")
|
|
1580
1678
|
}).refine((data) => {
|
|
1581
1679
|
if (data.geoSpatial !== void 0 && data.geospatialQuery !== void 0 && data.geoSpatial !== data.geospatialQuery) {
|
|
1582
1680
|
return false;
|
|
@@ -1585,15 +1683,15 @@ var DriverCapabilitiesSchema = z12.object({
|
|
|
1585
1683
|
}, {
|
|
1586
1684
|
message: "Deprecated geoSpatial and geospatialQuery must have the same value if both are provided"
|
|
1587
1685
|
});
|
|
1588
|
-
var DriverInterfaceSchema =
|
|
1686
|
+
var DriverInterfaceSchema = z13.object({
|
|
1589
1687
|
/**
|
|
1590
1688
|
* Driver name (e.g., 'postgresql', 'mongodb', 'rest_api').
|
|
1591
1689
|
*/
|
|
1592
|
-
name:
|
|
1690
|
+
name: z13.string().describe("Driver unique name"),
|
|
1593
1691
|
/**
|
|
1594
1692
|
* Driver version.
|
|
1595
1693
|
*/
|
|
1596
|
-
version:
|
|
1694
|
+
version: z13.string().describe("Driver version"),
|
|
1597
1695
|
/**
|
|
1598
1696
|
* Capabilities descriptor.
|
|
1599
1697
|
*/
|
|
@@ -1604,25 +1702,25 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1604
1702
|
/**
|
|
1605
1703
|
* Initialize connection pool or authenticate.
|
|
1606
1704
|
*/
|
|
1607
|
-
connect:
|
|
1705
|
+
connect: z13.function().args().returns(z13.promise(z13.void())).describe("Establish connection"),
|
|
1608
1706
|
/**
|
|
1609
1707
|
* Close connections and cleanup resources.
|
|
1610
1708
|
*/
|
|
1611
|
-
disconnect:
|
|
1709
|
+
disconnect: z13.function().args().returns(z13.promise(z13.void())).describe("Close connection"),
|
|
1612
1710
|
/**
|
|
1613
1711
|
* Check connection health.
|
|
1614
1712
|
* @returns true if healthy, false otherwise.
|
|
1615
1713
|
*/
|
|
1616
|
-
checkHealth:
|
|
1714
|
+
checkHealth: z13.function().args().returns(z13.promise(z13.boolean())).describe("Health check"),
|
|
1617
1715
|
/**
|
|
1618
1716
|
* Get Connection Pool Statistics.
|
|
1619
1717
|
* Useful for monitoring database load.
|
|
1620
1718
|
*/
|
|
1621
|
-
getPoolStats:
|
|
1622
|
-
total:
|
|
1623
|
-
idle:
|
|
1624
|
-
active:
|
|
1625
|
-
waiting:
|
|
1719
|
+
getPoolStats: z13.function().args().returns(z13.object({
|
|
1720
|
+
total: z13.number(),
|
|
1721
|
+
idle: z13.number(),
|
|
1722
|
+
active: z13.number(),
|
|
1723
|
+
waiting: z13.number()
|
|
1626
1724
|
}).optional()).optional().describe("Get connection pool statistics"),
|
|
1627
1725
|
// ============================================================================
|
|
1628
1726
|
// Raw Execution (Escape Hatch)
|
|
@@ -1643,7 +1741,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1643
1741
|
* // Mongo Driver
|
|
1644
1742
|
* await driver.execute({ aggregate: 'orders', pipeline: [...] });
|
|
1645
1743
|
*/
|
|
1646
|
-
execute:
|
|
1744
|
+
execute: z13.function().args(z13.any(), z13.array(z13.any()).optional(), DriverOptionsSchema.optional()).returns(z13.promise(z13.any())).describe("Execute raw command"),
|
|
1647
1745
|
// ============================================================================
|
|
1648
1746
|
// CRUD Operations
|
|
1649
1747
|
// ============================================================================
|
|
@@ -1665,7 +1763,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1665
1763
|
* @returns Array of records.
|
|
1666
1764
|
* MUST return `id` as string. MUST NOT return implementation details like `_id`.
|
|
1667
1765
|
*/
|
|
1668
|
-
find:
|
|
1766
|
+
find: z13.function().args(z13.string(), QuerySchema, DriverOptionsSchema.optional()).returns(z13.promise(z13.array(z13.record(z13.string(), z13.any())))).describe("Find records"),
|
|
1669
1767
|
/**
|
|
1670
1768
|
* Stream records matching the structured query.
|
|
1671
1769
|
* Optimized for large datasets to avoid memory overflow.
|
|
@@ -1675,7 +1773,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1675
1773
|
* @param options - Driver options.
|
|
1676
1774
|
* @returns AsyncIterable/ReadableStream of records.
|
|
1677
1775
|
*/
|
|
1678
|
-
findStream:
|
|
1776
|
+
findStream: z13.function().args(z13.string(), QuerySchema, DriverOptionsSchema.optional()).returns(z13.any()).describe("Stream records (AsyncIterable)"),
|
|
1679
1777
|
/**
|
|
1680
1778
|
* Find a single record by query.
|
|
1681
1779
|
* Similar to find(), but returns only the first match or null.
|
|
@@ -1686,7 +1784,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1686
1784
|
* @returns The record or null.
|
|
1687
1785
|
* MUST return `id` as string. MUST NOT return implementation details like `_id`.
|
|
1688
1786
|
*/
|
|
1689
|
-
findOne:
|
|
1787
|
+
findOne: z13.function().args(z13.string(), QuerySchema, DriverOptionsSchema.optional()).returns(z13.promise(z13.record(z13.string(), z13.any()).nullable())).describe("Find one record"),
|
|
1690
1788
|
/**
|
|
1691
1789
|
* Create a new record.
|
|
1692
1790
|
*
|
|
@@ -1696,7 +1794,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1696
1794
|
* @returns The created record, including server-generated fields (id, created_at, etc.).
|
|
1697
1795
|
* MUST return `id` as string. MUST NOT return implementation details like `_id`.
|
|
1698
1796
|
*/
|
|
1699
|
-
create:
|
|
1797
|
+
create: z13.function().args(z13.string(), z13.record(z13.string(), z13.any()), DriverOptionsSchema.optional()).returns(z13.promise(z13.record(z13.string(), z13.any()))).describe("Create record"),
|
|
1700
1798
|
/**
|
|
1701
1799
|
* Update an existing record by ID.
|
|
1702
1800
|
*
|
|
@@ -1707,7 +1805,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1707
1805
|
* @returns The updated record.
|
|
1708
1806
|
* MUST return `id` as string. MUST NOT return implementation details like `_id`.
|
|
1709
1807
|
*/
|
|
1710
|
-
update:
|
|
1808
|
+
update: z13.function().args(z13.string(), z13.string().or(z13.number()), z13.record(z13.string(), z13.any()), DriverOptionsSchema.optional()).returns(z13.promise(z13.record(z13.string(), z13.any()))).describe("Update record"),
|
|
1711
1809
|
/**
|
|
1712
1810
|
* Upsert (Update or Insert) a record.
|
|
1713
1811
|
*
|
|
@@ -1717,7 +1815,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1717
1815
|
* @param options - Driver options.
|
|
1718
1816
|
* @returns The created or updated record.
|
|
1719
1817
|
*/
|
|
1720
|
-
upsert:
|
|
1818
|
+
upsert: z13.function().args(z13.string(), z13.record(z13.string(), z13.any()), z13.array(z13.string()).optional(), DriverOptionsSchema.optional()).returns(z13.promise(z13.record(z13.string(), z13.any()))).describe("Upsert record"),
|
|
1721
1819
|
/**
|
|
1722
1820
|
* Delete a record by ID.
|
|
1723
1821
|
*
|
|
@@ -1726,7 +1824,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1726
1824
|
* @param options - Driver options.
|
|
1727
1825
|
* @returns True if deleted, false if not found.
|
|
1728
1826
|
*/
|
|
1729
|
-
delete:
|
|
1827
|
+
delete: z13.function().args(z13.string(), z13.string().or(z13.number()), DriverOptionsSchema.optional()).returns(z13.promise(z13.boolean())).describe("Delete record"),
|
|
1730
1828
|
/**
|
|
1731
1829
|
* Count records matching a query.
|
|
1732
1830
|
*
|
|
@@ -1735,7 +1833,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1735
1833
|
* @param options - Driver options.
|
|
1736
1834
|
* @returns Total count.
|
|
1737
1835
|
*/
|
|
1738
|
-
count:
|
|
1836
|
+
count: z13.function().args(z13.string(), QuerySchema.optional(), DriverOptionsSchema.optional()).returns(z13.promise(z13.number())).describe("Count records"),
|
|
1739
1837
|
// ============================================================================
|
|
1740
1838
|
// Bulk Operations
|
|
1741
1839
|
// ============================================================================
|
|
@@ -1747,7 +1845,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1747
1845
|
* @param dataArray - Array of record data.
|
|
1748
1846
|
* @returns Array of created records.
|
|
1749
1847
|
*/
|
|
1750
|
-
bulkCreate:
|
|
1848
|
+
bulkCreate: z13.function().args(z13.string(), z13.array(z13.record(z13.string(), z13.any())), DriverOptionsSchema.optional()).returns(z13.promise(z13.array(z13.record(z13.string(), z13.any())))),
|
|
1751
1849
|
/**
|
|
1752
1850
|
* Update multiple records in a single batch.
|
|
1753
1851
|
*
|
|
@@ -1755,14 +1853,14 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1755
1853
|
* @param updates - Array of objects containing {id, data}.
|
|
1756
1854
|
* @returns Array of updated records.
|
|
1757
1855
|
*/
|
|
1758
|
-
bulkUpdate:
|
|
1856
|
+
bulkUpdate: z13.function().args(z13.string(), z13.array(z13.object({ id: z13.string().or(z13.number()), data: z13.record(z13.string(), z13.any()) })), DriverOptionsSchema.optional()).returns(z13.promise(z13.array(z13.record(z13.string(), z13.any())))),
|
|
1759
1857
|
/**
|
|
1760
1858
|
* Delete multiple records in a single batch.
|
|
1761
1859
|
*
|
|
1762
1860
|
* @param object - The object name.
|
|
1763
1861
|
* @param ids - Array of record IDs.
|
|
1764
1862
|
*/
|
|
1765
|
-
bulkDelete:
|
|
1863
|
+
bulkDelete: z13.function().args(z13.string(), z13.array(z13.string().or(z13.number())), DriverOptionsSchema.optional()).returns(z13.promise(z13.void())),
|
|
1766
1864
|
/**
|
|
1767
1865
|
* Update multiple records matching a query.
|
|
1768
1866
|
* Direct database push-down. DOES NOT trigger per-record hooks.
|
|
@@ -1772,7 +1870,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1772
1870
|
* @param data - The data to update.
|
|
1773
1871
|
* @returns Count of modified records.
|
|
1774
1872
|
*/
|
|
1775
|
-
updateMany:
|
|
1873
|
+
updateMany: z13.function().args(z13.string(), QuerySchema, z13.record(z13.string(), z13.any()), DriverOptionsSchema.optional()).returns(z13.promise(z13.number())).optional(),
|
|
1776
1874
|
/**
|
|
1777
1875
|
* Delete multiple records matching a query.
|
|
1778
1876
|
* Direct database push-down. DOES NOT trigger per-record hooks.
|
|
@@ -1781,7 +1879,7 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1781
1879
|
* @param query - The filtering criteria.
|
|
1782
1880
|
* @returns Count of deleted records.
|
|
1783
1881
|
*/
|
|
1784
|
-
deleteMany:
|
|
1882
|
+
deleteMany: z13.function().args(z13.string(), QuerySchema, DriverOptionsSchema.optional()).returns(z13.promise(z13.number())).optional(),
|
|
1785
1883
|
// ============================================================================
|
|
1786
1884
|
// Transaction Management
|
|
1787
1885
|
// ============================================================================
|
|
@@ -1790,19 +1888,19 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1790
1888
|
* @param options - Isolation level and other settings.
|
|
1791
1889
|
* @returns A transaction handle to be passed to subsequent operations via `options.transaction`.
|
|
1792
1890
|
*/
|
|
1793
|
-
beginTransaction:
|
|
1794
|
-
isolationLevel:
|
|
1795
|
-
}).optional()).returns(
|
|
1891
|
+
beginTransaction: z13.function().args(z13.object({
|
|
1892
|
+
isolationLevel: z13.enum(["READ UNCOMMITTED", "READ COMMITTED", "REPEATABLE READ", "SERIALIZABLE", "SNAPSHOT"]).optional()
|
|
1893
|
+
}).optional()).returns(z13.promise(z13.any())).describe("Start transaction"),
|
|
1796
1894
|
/**
|
|
1797
1895
|
* Commit the transaction.
|
|
1798
1896
|
* @param transaction - The transaction handle.
|
|
1799
1897
|
*/
|
|
1800
|
-
commit:
|
|
1898
|
+
commit: z13.function().args(z13.any()).returns(z13.promise(z13.void())).describe("Commit transaction"),
|
|
1801
1899
|
/**
|
|
1802
1900
|
* Rollback the transaction.
|
|
1803
1901
|
* @param transaction - The transaction handle.
|
|
1804
1902
|
*/
|
|
1805
|
-
rollback:
|
|
1903
|
+
rollback: z13.function().args(z13.any()).returns(z13.promise(z13.void())).describe("Rollback transaction"),
|
|
1806
1904
|
// ============================================================================
|
|
1807
1905
|
// Schema Management
|
|
1808
1906
|
// ============================================================================
|
|
@@ -1815,14 +1913,14 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1815
1913
|
* @param schema - The full Object Schema (fields, indexes, etc).
|
|
1816
1914
|
* @param options - Driver options.
|
|
1817
1915
|
*/
|
|
1818
|
-
syncSchema:
|
|
1916
|
+
syncSchema: z13.function().args(z13.string(), z13.any(), DriverOptionsSchema.optional()).returns(z13.promise(z13.void())).describe("Sync object schema to DB"),
|
|
1819
1917
|
/**
|
|
1820
1918
|
* Drop the underlying table or collection for an object.
|
|
1821
1919
|
* WARNING: Destructive operation.
|
|
1822
1920
|
*
|
|
1823
1921
|
* @param object - The object name.
|
|
1824
1922
|
*/
|
|
1825
|
-
dropTable:
|
|
1923
|
+
dropTable: z13.function().args(z13.string(), DriverOptionsSchema.optional()).returns(z13.promise(z13.void())),
|
|
1826
1924
|
/**
|
|
1827
1925
|
* Analyze query performance.
|
|
1828
1926
|
* Returns execution plan without executing the query (where possible).
|
|
@@ -1831,25 +1929,25 @@ var DriverInterfaceSchema = z12.object({
|
|
|
1831
1929
|
* @param query - The query to explain.
|
|
1832
1930
|
* @returns The execution plan details.
|
|
1833
1931
|
*/
|
|
1834
|
-
explain:
|
|
1932
|
+
explain: z13.function().args(z13.string(), QuerySchema, DriverOptionsSchema.optional()).returns(z13.promise(z13.any())).optional()
|
|
1835
1933
|
});
|
|
1836
|
-
var PoolConfigSchema =
|
|
1837
|
-
min:
|
|
1838
|
-
max:
|
|
1839
|
-
idleTimeoutMillis:
|
|
1840
|
-
connectionTimeoutMillis:
|
|
1934
|
+
var PoolConfigSchema = z13.object({
|
|
1935
|
+
min: z13.number().min(0).default(2).describe("Minimum number of connections in pool"),
|
|
1936
|
+
max: z13.number().min(1).default(10).describe("Maximum number of connections in pool"),
|
|
1937
|
+
idleTimeoutMillis: z13.number().min(0).default(3e4).describe("Time in ms before idle connection is closed"),
|
|
1938
|
+
connectionTimeoutMillis: z13.number().min(0).default(5e3).describe("Time in ms to wait for available connection")
|
|
1841
1939
|
});
|
|
1842
|
-
var DriverConfigSchema =
|
|
1843
|
-
name:
|
|
1844
|
-
type:
|
|
1940
|
+
var DriverConfigSchema = z13.object({
|
|
1941
|
+
name: z13.string().describe("Driver instance name"),
|
|
1942
|
+
type: z13.enum(["sql", "nosql", "cache", "search", "graph", "timeseries"]).describe("Driver type category"),
|
|
1845
1943
|
capabilities: DriverCapabilitiesSchema.describe("Driver capability flags"),
|
|
1846
|
-
connectionString:
|
|
1944
|
+
connectionString: z13.string().optional().describe("Database connection string (driver-specific format)"),
|
|
1847
1945
|
poolConfig: PoolConfigSchema.optional().describe("Connection pool configuration")
|
|
1848
1946
|
});
|
|
1849
1947
|
|
|
1850
1948
|
// src/data/driver-sql.zod.ts
|
|
1851
|
-
import { z as
|
|
1852
|
-
var SQLDialectSchema =
|
|
1949
|
+
import { z as z14 } from "zod";
|
|
1950
|
+
var SQLDialectSchema = z14.enum([
|
|
1853
1951
|
"postgresql",
|
|
1854
1952
|
"mysql",
|
|
1855
1953
|
"sqlite",
|
|
@@ -1857,21 +1955,21 @@ var SQLDialectSchema = z13.enum([
|
|
|
1857
1955
|
"oracle",
|
|
1858
1956
|
"mariadb"
|
|
1859
1957
|
]);
|
|
1860
|
-
var DataTypeMappingSchema =
|
|
1861
|
-
text:
|
|
1862
|
-
number:
|
|
1863
|
-
boolean:
|
|
1864
|
-
date:
|
|
1865
|
-
datetime:
|
|
1866
|
-
json:
|
|
1867
|
-
uuid:
|
|
1868
|
-
binary:
|
|
1869
|
-
});
|
|
1870
|
-
var SSLConfigSchema =
|
|
1871
|
-
rejectUnauthorized:
|
|
1872
|
-
ca:
|
|
1873
|
-
cert:
|
|
1874
|
-
key:
|
|
1958
|
+
var DataTypeMappingSchema = z14.object({
|
|
1959
|
+
text: z14.string().describe("SQL type for text fields (e.g., VARCHAR, TEXT)"),
|
|
1960
|
+
number: z14.string().describe("SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)"),
|
|
1961
|
+
boolean: z14.string().describe("SQL type for boolean fields (e.g., BOOLEAN, BIT)"),
|
|
1962
|
+
date: z14.string().describe("SQL type for date fields (e.g., DATE)"),
|
|
1963
|
+
datetime: z14.string().describe("SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)"),
|
|
1964
|
+
json: z14.string().optional().describe("SQL type for JSON fields (e.g., JSON, JSONB)"),
|
|
1965
|
+
uuid: z14.string().optional().describe("SQL type for UUID fields (e.g., UUID, CHAR(36))"),
|
|
1966
|
+
binary: z14.string().optional().describe("SQL type for binary fields (e.g., BLOB, BYTEA)")
|
|
1967
|
+
});
|
|
1968
|
+
var SSLConfigSchema = z14.object({
|
|
1969
|
+
rejectUnauthorized: z14.boolean().default(true).describe("Reject connections with invalid certificates"),
|
|
1970
|
+
ca: z14.string().optional().describe("CA certificate file path or content"),
|
|
1971
|
+
cert: z14.string().optional().describe("Client certificate file path or content"),
|
|
1972
|
+
key: z14.string().optional().describe("Client private key file path or content")
|
|
1875
1973
|
}).refine((data) => {
|
|
1876
1974
|
const hasCert = data.cert !== void 0;
|
|
1877
1975
|
const hasKey = data.key !== void 0;
|
|
@@ -1880,10 +1978,10 @@ var SSLConfigSchema = z13.object({
|
|
|
1880
1978
|
message: "Client certificate (cert) and private key (key) must be provided together"
|
|
1881
1979
|
});
|
|
1882
1980
|
var SQLDriverConfigSchema = DriverConfigSchema.extend({
|
|
1883
|
-
type:
|
|
1981
|
+
type: z14.literal("sql").describe('Driver type must be "sql"'),
|
|
1884
1982
|
dialect: SQLDialectSchema.describe("SQL database dialect"),
|
|
1885
1983
|
dataTypeMapping: DataTypeMappingSchema.describe("SQL data type mapping configuration"),
|
|
1886
|
-
ssl:
|
|
1984
|
+
ssl: z14.boolean().default(false).describe("Enable SSL/TLS connection"),
|
|
1887
1985
|
sslConfig: SSLConfigSchema.optional().describe("SSL/TLS configuration (required when ssl is true)")
|
|
1888
1986
|
}).refine((data) => {
|
|
1889
1987
|
if (data.ssl && !data.sslConfig) {
|
|
@@ -1895,8 +1993,8 @@ var SQLDriverConfigSchema = DriverConfigSchema.extend({
|
|
|
1895
1993
|
});
|
|
1896
1994
|
|
|
1897
1995
|
// src/data/driver-nosql.zod.ts
|
|
1898
|
-
import { z as
|
|
1899
|
-
var NoSQLDatabaseTypeSchema =
|
|
1996
|
+
import { z as z15 } from "zod";
|
|
1997
|
+
var NoSQLDatabaseTypeSchema = z15.enum([
|
|
1900
1998
|
"mongodb",
|
|
1901
1999
|
"couchdb",
|
|
1902
2000
|
"dynamodb",
|
|
@@ -1906,7 +2004,7 @@ var NoSQLDatabaseTypeSchema = z14.enum([
|
|
|
1906
2004
|
"neo4j",
|
|
1907
2005
|
"orientdb"
|
|
1908
2006
|
]);
|
|
1909
|
-
var NoSQLOperationTypeSchema =
|
|
2007
|
+
var NoSQLOperationTypeSchema = z15.enum([
|
|
1910
2008
|
"find",
|
|
1911
2009
|
// Query documents/records
|
|
1912
2010
|
"findOne",
|
|
@@ -1930,7 +2028,7 @@ var NoSQLOperationTypeSchema = z14.enum([
|
|
|
1930
2028
|
"dropIndex"
|
|
1931
2029
|
// Drop index
|
|
1932
2030
|
]);
|
|
1933
|
-
var ConsistencyLevelSchema =
|
|
2031
|
+
var ConsistencyLevelSchema = z15.enum([
|
|
1934
2032
|
"all",
|
|
1935
2033
|
"quorum",
|
|
1936
2034
|
"one",
|
|
@@ -1938,7 +2036,7 @@ var ConsistencyLevelSchema = z14.enum([
|
|
|
1938
2036
|
"each_quorum",
|
|
1939
2037
|
"eventual"
|
|
1940
2038
|
]);
|
|
1941
|
-
var NoSQLIndexTypeSchema =
|
|
2039
|
+
var NoSQLIndexTypeSchema = z15.enum([
|
|
1942
2040
|
"single",
|
|
1943
2041
|
// Single field index
|
|
1944
2042
|
"compound",
|
|
@@ -1956,40 +2054,40 @@ var NoSQLIndexTypeSchema = z14.enum([
|
|
|
1956
2054
|
"sparse"
|
|
1957
2055
|
// Sparse index (only indexed documents with field)
|
|
1958
2056
|
]);
|
|
1959
|
-
var ShardingConfigSchema =
|
|
1960
|
-
enabled:
|
|
1961
|
-
shardKey:
|
|
1962
|
-
shardingStrategy:
|
|
1963
|
-
numShards:
|
|
1964
|
-
});
|
|
1965
|
-
var ReplicationConfigSchema =
|
|
1966
|
-
enabled:
|
|
1967
|
-
replicaSetName:
|
|
1968
|
-
replicas:
|
|
1969
|
-
readPreference:
|
|
1970
|
-
writeConcern:
|
|
1971
|
-
});
|
|
1972
|
-
var DocumentSchemaValidationSchema =
|
|
1973
|
-
enabled:
|
|
1974
|
-
validationLevel:
|
|
1975
|
-
validationAction:
|
|
1976
|
-
jsonSchema:
|
|
1977
|
-
});
|
|
1978
|
-
var NoSQLDataTypeMappingSchema =
|
|
1979
|
-
text:
|
|
1980
|
-
number:
|
|
1981
|
-
boolean:
|
|
1982
|
-
date:
|
|
1983
|
-
datetime:
|
|
1984
|
-
json:
|
|
1985
|
-
uuid:
|
|
1986
|
-
binary:
|
|
1987
|
-
array:
|
|
1988
|
-
objectId:
|
|
1989
|
-
geopoint:
|
|
2057
|
+
var ShardingConfigSchema = z15.object({
|
|
2058
|
+
enabled: z15.boolean().default(false).describe("Enable sharding"),
|
|
2059
|
+
shardKey: z15.string().optional().describe("Field to use as shard key"),
|
|
2060
|
+
shardingStrategy: z15.enum(["hash", "range", "zone"]).optional().describe("Sharding strategy"),
|
|
2061
|
+
numShards: z15.number().int().positive().optional().describe("Number of shards")
|
|
2062
|
+
});
|
|
2063
|
+
var ReplicationConfigSchema = z15.object({
|
|
2064
|
+
enabled: z15.boolean().default(false).describe("Enable replication"),
|
|
2065
|
+
replicaSetName: z15.string().optional().describe("Replica set name"),
|
|
2066
|
+
replicas: z15.number().int().positive().optional().describe("Number of replicas"),
|
|
2067
|
+
readPreference: z15.enum(["primary", "primaryPreferred", "secondary", "secondaryPreferred", "nearest"]).optional().describe("Read preference for replica set"),
|
|
2068
|
+
writeConcern: z15.enum(["majority", "acknowledged", "unacknowledged"]).optional().describe("Write concern level")
|
|
2069
|
+
});
|
|
2070
|
+
var DocumentSchemaValidationSchema = z15.object({
|
|
2071
|
+
enabled: z15.boolean().default(false).describe("Enable schema validation"),
|
|
2072
|
+
validationLevel: z15.enum(["strict", "moderate", "off"]).optional().describe("Validation strictness"),
|
|
2073
|
+
validationAction: z15.enum(["error", "warn"]).optional().describe("Action on validation failure"),
|
|
2074
|
+
jsonSchema: z15.record(z15.string(), z15.any()).optional().describe("JSON Schema for validation")
|
|
2075
|
+
});
|
|
2076
|
+
var NoSQLDataTypeMappingSchema = z15.object({
|
|
2077
|
+
text: z15.string().describe("NoSQL type for text fields"),
|
|
2078
|
+
number: z15.string().describe("NoSQL type for number fields"),
|
|
2079
|
+
boolean: z15.string().describe("NoSQL type for boolean fields"),
|
|
2080
|
+
date: z15.string().describe("NoSQL type for date fields"),
|
|
2081
|
+
datetime: z15.string().describe("NoSQL type for datetime fields"),
|
|
2082
|
+
json: z15.string().optional().describe("NoSQL type for JSON/object fields"),
|
|
2083
|
+
uuid: z15.string().optional().describe("NoSQL type for UUID fields"),
|
|
2084
|
+
binary: z15.string().optional().describe("NoSQL type for binary fields"),
|
|
2085
|
+
array: z15.string().optional().describe("NoSQL type for array fields"),
|
|
2086
|
+
objectId: z15.string().optional().describe("NoSQL type for ObjectID fields (MongoDB)"),
|
|
2087
|
+
geopoint: z15.string().optional().describe("NoSQL type for geospatial point fields")
|
|
1990
2088
|
});
|
|
1991
2089
|
var NoSQLDriverConfigSchema = DriverConfigSchema.extend({
|
|
1992
|
-
type:
|
|
2090
|
+
type: z15.literal("nosql").describe('Driver type must be "nosql"'),
|
|
1993
2091
|
databaseType: NoSQLDatabaseTypeSchema.describe("Specific NoSQL database type"),
|
|
1994
2092
|
dataTypeMapping: NoSQLDataTypeMappingSchema.describe("NoSQL data type mapping configuration"),
|
|
1995
2093
|
/**
|
|
@@ -2011,31 +2109,31 @@ var NoSQLDriverConfigSchema = DriverConfigSchema.extend({
|
|
|
2011
2109
|
/**
|
|
2012
2110
|
* AWS Region (for DynamoDB, DocumentDB, etc.)
|
|
2013
2111
|
*/
|
|
2014
|
-
region:
|
|
2112
|
+
region: z15.string().optional().describe("AWS region (for managed NoSQL services)"),
|
|
2015
2113
|
/**
|
|
2016
2114
|
* AWS Access Key ID (for DynamoDB, DocumentDB, etc.)
|
|
2017
2115
|
*/
|
|
2018
|
-
accessKeyId:
|
|
2116
|
+
accessKeyId: z15.string().optional().describe("AWS access key ID"),
|
|
2019
2117
|
/**
|
|
2020
2118
|
* AWS Secret Access Key (for DynamoDB, DocumentDB, etc.)
|
|
2021
2119
|
*/
|
|
2022
|
-
secretAccessKey:
|
|
2120
|
+
secretAccessKey: z15.string().optional().describe("AWS secret access key"),
|
|
2023
2121
|
/**
|
|
2024
2122
|
* Time-to-live (TTL) field name
|
|
2025
2123
|
* Automatically delete documents after a specified time
|
|
2026
2124
|
*/
|
|
2027
|
-
ttlField:
|
|
2125
|
+
ttlField: z15.string().optional().describe("Field name for TTL (auto-deletion)"),
|
|
2028
2126
|
/**
|
|
2029
2127
|
* Maximum document size in bytes
|
|
2030
2128
|
*/
|
|
2031
|
-
maxDocumentSize:
|
|
2129
|
+
maxDocumentSize: z15.number().int().positive().optional().describe("Maximum document size in bytes"),
|
|
2032
2130
|
/**
|
|
2033
2131
|
* Collection/Table name prefix
|
|
2034
2132
|
* Useful for multi-tenancy or environment isolation
|
|
2035
2133
|
*/
|
|
2036
|
-
collectionPrefix:
|
|
2134
|
+
collectionPrefix: z15.string().optional().describe("Prefix for collection/table names")
|
|
2037
2135
|
});
|
|
2038
|
-
var NoSQLQueryOptionsSchema =
|
|
2136
|
+
var NoSQLQueryOptionsSchema = z15.object({
|
|
2039
2137
|
/**
|
|
2040
2138
|
* Consistency level for this query
|
|
2041
2139
|
*/
|
|
@@ -2043,61 +2141,61 @@ var NoSQLQueryOptionsSchema = z14.object({
|
|
|
2043
2141
|
/**
|
|
2044
2142
|
* Read from secondary replicas
|
|
2045
2143
|
*/
|
|
2046
|
-
readFromSecondary:
|
|
2144
|
+
readFromSecondary: z15.boolean().optional().describe("Allow reading from secondary replicas"),
|
|
2047
2145
|
/**
|
|
2048
2146
|
* Projection (fields to include/exclude)
|
|
2049
2147
|
*/
|
|
2050
|
-
projection:
|
|
2148
|
+
projection: z15.record(z15.string(), z15.union([z15.literal(0), z15.literal(1)])).optional().describe("Field projection"),
|
|
2051
2149
|
/**
|
|
2052
2150
|
* Query timeout in milliseconds
|
|
2053
2151
|
*/
|
|
2054
|
-
timeout:
|
|
2152
|
+
timeout: z15.number().int().positive().optional().describe("Query timeout (ms)"),
|
|
2055
2153
|
/**
|
|
2056
2154
|
* Use cursor for large result sets
|
|
2057
2155
|
*/
|
|
2058
|
-
useCursor:
|
|
2156
|
+
useCursor: z15.boolean().optional().describe("Use cursor instead of loading all results"),
|
|
2059
2157
|
/**
|
|
2060
2158
|
* Batch size for cursor iteration
|
|
2061
2159
|
*/
|
|
2062
|
-
batchSize:
|
|
2160
|
+
batchSize: z15.number().int().positive().optional().describe("Cursor batch size"),
|
|
2063
2161
|
/**
|
|
2064
2162
|
* Enable query profiling
|
|
2065
2163
|
*/
|
|
2066
|
-
profile:
|
|
2164
|
+
profile: z15.boolean().optional().describe("Enable query profiling"),
|
|
2067
2165
|
/**
|
|
2068
2166
|
* Use hinted index
|
|
2069
2167
|
*/
|
|
2070
|
-
hint:
|
|
2168
|
+
hint: z15.string().optional().describe("Index hint for query optimization")
|
|
2071
2169
|
});
|
|
2072
|
-
var AggregationStageSchema =
|
|
2170
|
+
var AggregationStageSchema = z15.object({
|
|
2073
2171
|
/**
|
|
2074
2172
|
* Stage operator (e.g., $match, $group, $sort, $project)
|
|
2075
2173
|
*/
|
|
2076
|
-
operator:
|
|
2174
|
+
operator: z15.string().describe("Aggregation operator (e.g., $match, $group, $sort)"),
|
|
2077
2175
|
/**
|
|
2078
2176
|
* Stage parameters/options
|
|
2079
2177
|
*/
|
|
2080
|
-
options:
|
|
2178
|
+
options: z15.record(z15.string(), z15.any()).describe("Stage-specific options")
|
|
2081
2179
|
});
|
|
2082
|
-
var AggregationPipelineSchema =
|
|
2180
|
+
var AggregationPipelineSchema = z15.object({
|
|
2083
2181
|
/**
|
|
2084
2182
|
* Collection/Table to aggregate
|
|
2085
2183
|
*/
|
|
2086
|
-
collection:
|
|
2184
|
+
collection: z15.string().describe("Collection/table name"),
|
|
2087
2185
|
/**
|
|
2088
2186
|
* Pipeline stages
|
|
2089
2187
|
*/
|
|
2090
|
-
stages:
|
|
2188
|
+
stages: z15.array(AggregationStageSchema).describe("Aggregation pipeline stages"),
|
|
2091
2189
|
/**
|
|
2092
2190
|
* Additional options
|
|
2093
2191
|
*/
|
|
2094
2192
|
options: NoSQLQueryOptionsSchema.optional().describe("Query options")
|
|
2095
2193
|
});
|
|
2096
|
-
var NoSQLIndexSchema =
|
|
2194
|
+
var NoSQLIndexSchema = z15.object({
|
|
2097
2195
|
/**
|
|
2098
2196
|
* Index name
|
|
2099
2197
|
*/
|
|
2100
|
-
name:
|
|
2198
|
+
name: z15.string().describe("Index name"),
|
|
2101
2199
|
/**
|
|
2102
2200
|
* Index type
|
|
2103
2201
|
*/
|
|
@@ -2106,53 +2204,53 @@ var NoSQLIndexSchema = z14.object({
|
|
|
2106
2204
|
* Fields to index
|
|
2107
2205
|
* For compound indexes, order matters
|
|
2108
2206
|
*/
|
|
2109
|
-
fields:
|
|
2110
|
-
field:
|
|
2111
|
-
order:
|
|
2207
|
+
fields: z15.array(z15.object({
|
|
2208
|
+
field: z15.string().describe("Field name"),
|
|
2209
|
+
order: z15.enum(["asc", "desc", "text", "2dsphere"]).optional().describe("Index order or type")
|
|
2112
2210
|
})).describe("Fields to index"),
|
|
2113
2211
|
/**
|
|
2114
2212
|
* Unique constraint
|
|
2115
2213
|
*/
|
|
2116
|
-
unique:
|
|
2214
|
+
unique: z15.boolean().default(false).describe("Enforce uniqueness"),
|
|
2117
2215
|
/**
|
|
2118
2216
|
* Sparse index (only index documents with the field)
|
|
2119
2217
|
*/
|
|
2120
|
-
sparse:
|
|
2218
|
+
sparse: z15.boolean().default(false).describe("Sparse index"),
|
|
2121
2219
|
/**
|
|
2122
2220
|
* TTL in seconds (for TTL indexes)
|
|
2123
2221
|
*/
|
|
2124
|
-
expireAfterSeconds:
|
|
2222
|
+
expireAfterSeconds: z15.number().int().positive().optional().describe("TTL in seconds"),
|
|
2125
2223
|
/**
|
|
2126
2224
|
* Partial index filter
|
|
2127
2225
|
*/
|
|
2128
|
-
partialFilterExpression:
|
|
2226
|
+
partialFilterExpression: z15.record(z15.string(), z15.any()).optional().describe("Partial index filter"),
|
|
2129
2227
|
/**
|
|
2130
2228
|
* Background index creation
|
|
2131
2229
|
*/
|
|
2132
|
-
background:
|
|
2230
|
+
background: z15.boolean().default(false).describe("Create index in background")
|
|
2133
2231
|
});
|
|
2134
|
-
var NoSQLTransactionOptionsSchema =
|
|
2232
|
+
var NoSQLTransactionOptionsSchema = z15.object({
|
|
2135
2233
|
/**
|
|
2136
2234
|
* Read concern level
|
|
2137
2235
|
*/
|
|
2138
|
-
readConcern:
|
|
2236
|
+
readConcern: z15.enum(["local", "majority", "linearizable", "snapshot"]).optional().describe("Read concern level"),
|
|
2139
2237
|
/**
|
|
2140
2238
|
* Write concern level
|
|
2141
2239
|
*/
|
|
2142
|
-
writeConcern:
|
|
2240
|
+
writeConcern: z15.enum(["majority", "acknowledged", "unacknowledged"]).optional().describe("Write concern level"),
|
|
2143
2241
|
/**
|
|
2144
2242
|
* Read preference
|
|
2145
2243
|
*/
|
|
2146
|
-
readPreference:
|
|
2244
|
+
readPreference: z15.enum(["primary", "primaryPreferred", "secondary", "secondaryPreferred", "nearest"]).optional().describe("Read preference"),
|
|
2147
2245
|
/**
|
|
2148
2246
|
* Transaction timeout in milliseconds
|
|
2149
2247
|
*/
|
|
2150
|
-
maxCommitTimeMS:
|
|
2248
|
+
maxCommitTimeMS: z15.number().int().positive().optional().describe("Transaction commit timeout (ms)")
|
|
2151
2249
|
});
|
|
2152
2250
|
|
|
2153
2251
|
// src/data/dataset.zod.ts
|
|
2154
|
-
import { z as
|
|
2155
|
-
var DatasetMode =
|
|
2252
|
+
import { z as z16 } from "zod";
|
|
2253
|
+
var DatasetMode = z16.enum([
|
|
2156
2254
|
"insert",
|
|
2157
2255
|
// Try to insert, fail on duplicate
|
|
2158
2256
|
"update",
|
|
@@ -2164,19 +2262,19 @@ var DatasetMode = z15.enum([
|
|
|
2164
2262
|
"ignore"
|
|
2165
2263
|
// Try to insert, silently skip duplicates
|
|
2166
2264
|
]);
|
|
2167
|
-
var DatasetSchema =
|
|
2265
|
+
var DatasetSchema = z16.object({
|
|
2168
2266
|
/**
|
|
2169
2267
|
* Target Object
|
|
2170
2268
|
* The machine name of the object to populate.
|
|
2171
2269
|
*/
|
|
2172
|
-
object:
|
|
2270
|
+
object: z16.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Target Object Name"),
|
|
2173
2271
|
/**
|
|
2174
2272
|
* Idempotency Key (The "Upsert" Key)
|
|
2175
2273
|
* The field used to check if a record already exists.
|
|
2176
2274
|
* Best Practice: Use a natural key like 'code', 'slug', 'username' or 'external_id'.
|
|
2177
2275
|
* Standard: '_id' (internal ID) is rarely used for portable seed data.
|
|
2178
2276
|
*/
|
|
2179
|
-
externalId:
|
|
2277
|
+
externalId: z16.string().default("name").describe("Field match for uniqueness check"),
|
|
2180
2278
|
/**
|
|
2181
2279
|
* Import Strategy
|
|
2182
2280
|
*/
|
|
@@ -2187,182 +2285,182 @@ var DatasetSchema = z15.object({
|
|
|
2187
2285
|
* - 'dev': Only for development/demo
|
|
2188
2286
|
* - 'test': Only for CI/CD tests
|
|
2189
2287
|
*/
|
|
2190
|
-
env:
|
|
2288
|
+
env: z16.array(z16.enum(["prod", "dev", "test"])).default(["prod", "dev", "test"]).describe("Applicable environments"),
|
|
2191
2289
|
/**
|
|
2192
2290
|
* The Payload
|
|
2193
2291
|
* Array of raw JSON objects matching the Object Schema.
|
|
2194
2292
|
*/
|
|
2195
|
-
records:
|
|
2293
|
+
records: z16.array(z16.record(z16.string(), z16.any())).describe("Data records")
|
|
2196
2294
|
});
|
|
2197
2295
|
|
|
2198
2296
|
// src/data/document.zod.ts
|
|
2199
|
-
import { z as
|
|
2200
|
-
var DocumentVersionSchema =
|
|
2297
|
+
import { z as z17 } from "zod";
|
|
2298
|
+
var DocumentVersionSchema = z17.object({
|
|
2201
2299
|
/**
|
|
2202
2300
|
* Sequential version number (increments with each new version)
|
|
2203
2301
|
*/
|
|
2204
|
-
versionNumber:
|
|
2302
|
+
versionNumber: z17.number().describe("Version number"),
|
|
2205
2303
|
/**
|
|
2206
2304
|
* Timestamp when this version was created (Unix milliseconds)
|
|
2207
2305
|
*/
|
|
2208
|
-
createdAt:
|
|
2306
|
+
createdAt: z17.number().describe("Creation timestamp"),
|
|
2209
2307
|
/**
|
|
2210
2308
|
* User ID who created this version
|
|
2211
2309
|
*/
|
|
2212
|
-
createdBy:
|
|
2310
|
+
createdBy: z17.string().describe("Creator user ID"),
|
|
2213
2311
|
/**
|
|
2214
2312
|
* File size in bytes
|
|
2215
2313
|
*/
|
|
2216
|
-
size:
|
|
2314
|
+
size: z17.number().describe("File size in bytes"),
|
|
2217
2315
|
/**
|
|
2218
2316
|
* Checksum/hash of the file content (for integrity verification)
|
|
2219
2317
|
*/
|
|
2220
|
-
checksum:
|
|
2318
|
+
checksum: z17.string().describe("File checksum"),
|
|
2221
2319
|
/**
|
|
2222
2320
|
* URL to download this specific version
|
|
2223
2321
|
*/
|
|
2224
|
-
downloadUrl:
|
|
2322
|
+
downloadUrl: z17.string().url().describe("Download URL"),
|
|
2225
2323
|
/**
|
|
2226
2324
|
* Whether this is the latest version
|
|
2227
2325
|
* @default false
|
|
2228
2326
|
*/
|
|
2229
|
-
isLatest:
|
|
2327
|
+
isLatest: z17.boolean().optional().default(false).describe("Is latest version")
|
|
2230
2328
|
});
|
|
2231
|
-
var DocumentTemplateSchema =
|
|
2329
|
+
var DocumentTemplateSchema = z17.object({
|
|
2232
2330
|
/**
|
|
2233
2331
|
* Unique identifier for the template
|
|
2234
2332
|
*/
|
|
2235
|
-
id:
|
|
2333
|
+
id: z17.string().describe("Template ID"),
|
|
2236
2334
|
/**
|
|
2237
2335
|
* Human-readable name of the template
|
|
2238
2336
|
*/
|
|
2239
|
-
name:
|
|
2337
|
+
name: z17.string().describe("Template name"),
|
|
2240
2338
|
/**
|
|
2241
2339
|
* Optional description of the template's purpose
|
|
2242
2340
|
*/
|
|
2243
|
-
description:
|
|
2341
|
+
description: z17.string().optional().describe("Template description"),
|
|
2244
2342
|
/**
|
|
2245
2343
|
* URL to the template file
|
|
2246
2344
|
*/
|
|
2247
|
-
fileUrl:
|
|
2345
|
+
fileUrl: z17.string().url().describe("Template file URL"),
|
|
2248
2346
|
/**
|
|
2249
2347
|
* MIME type of the template file
|
|
2250
2348
|
*/
|
|
2251
|
-
fileType:
|
|
2349
|
+
fileType: z17.string().describe("File MIME type"),
|
|
2252
2350
|
/**
|
|
2253
2351
|
* List of dynamic placeholders in the template
|
|
2254
2352
|
*/
|
|
2255
|
-
placeholders:
|
|
2353
|
+
placeholders: z17.array(z17.object({
|
|
2256
2354
|
/**
|
|
2257
2355
|
* Placeholder identifier (used in template)
|
|
2258
2356
|
*/
|
|
2259
|
-
key:
|
|
2357
|
+
key: z17.string().describe("Placeholder key"),
|
|
2260
2358
|
/**
|
|
2261
2359
|
* Human-readable label for the placeholder
|
|
2262
2360
|
*/
|
|
2263
|
-
label:
|
|
2361
|
+
label: z17.string().describe("Placeholder label"),
|
|
2264
2362
|
/**
|
|
2265
2363
|
* Data type of the placeholder value
|
|
2266
2364
|
*/
|
|
2267
|
-
type:
|
|
2365
|
+
type: z17.enum(["text", "number", "date", "image"]).describe("Placeholder type"),
|
|
2268
2366
|
/**
|
|
2269
2367
|
* Whether this placeholder must be filled
|
|
2270
2368
|
* @default false
|
|
2271
2369
|
*/
|
|
2272
|
-
required:
|
|
2370
|
+
required: z17.boolean().optional().default(false).describe("Is required")
|
|
2273
2371
|
})).describe("Template placeholders")
|
|
2274
2372
|
});
|
|
2275
|
-
var ESignatureConfigSchema =
|
|
2373
|
+
var ESignatureConfigSchema = z17.object({
|
|
2276
2374
|
/**
|
|
2277
2375
|
* E-signature service provider
|
|
2278
2376
|
*/
|
|
2279
|
-
provider:
|
|
2377
|
+
provider: z17.enum(["docusign", "adobe-sign", "hellosign", "custom"]).describe("E-signature provider"),
|
|
2280
2378
|
/**
|
|
2281
2379
|
* Whether e-signature is enabled for this document
|
|
2282
2380
|
* @default false
|
|
2283
2381
|
*/
|
|
2284
|
-
enabled:
|
|
2382
|
+
enabled: z17.boolean().optional().default(false).describe("E-signature enabled"),
|
|
2285
2383
|
/**
|
|
2286
2384
|
* List of signers in signing order
|
|
2287
2385
|
*/
|
|
2288
|
-
signers:
|
|
2386
|
+
signers: z17.array(z17.object({
|
|
2289
2387
|
/**
|
|
2290
2388
|
* Signer's email address
|
|
2291
2389
|
*/
|
|
2292
|
-
email:
|
|
2390
|
+
email: z17.string().email().describe("Signer email"),
|
|
2293
2391
|
/**
|
|
2294
2392
|
* Signer's full name
|
|
2295
2393
|
*/
|
|
2296
|
-
name:
|
|
2394
|
+
name: z17.string().describe("Signer name"),
|
|
2297
2395
|
/**
|
|
2298
2396
|
* Signer's role in the document
|
|
2299
2397
|
*/
|
|
2300
|
-
role:
|
|
2398
|
+
role: z17.string().describe("Signer role"),
|
|
2301
2399
|
/**
|
|
2302
2400
|
* Signing order (lower numbers sign first)
|
|
2303
2401
|
*/
|
|
2304
|
-
order:
|
|
2402
|
+
order: z17.number().describe("Signing order")
|
|
2305
2403
|
})).describe("Document signers"),
|
|
2306
2404
|
/**
|
|
2307
2405
|
* Days until signature request expires
|
|
2308
2406
|
* @default 30
|
|
2309
2407
|
*/
|
|
2310
|
-
expirationDays:
|
|
2408
|
+
expirationDays: z17.number().optional().default(30).describe("Expiration days"),
|
|
2311
2409
|
/**
|
|
2312
2410
|
* Days between reminder emails
|
|
2313
2411
|
* @default 7
|
|
2314
2412
|
*/
|
|
2315
|
-
reminderDays:
|
|
2413
|
+
reminderDays: z17.number().optional().default(7).describe("Reminder interval days")
|
|
2316
2414
|
});
|
|
2317
|
-
var DocumentSchema =
|
|
2415
|
+
var DocumentSchema = z17.object({
|
|
2318
2416
|
/**
|
|
2319
2417
|
* Unique document identifier
|
|
2320
2418
|
*/
|
|
2321
|
-
id:
|
|
2419
|
+
id: z17.string().describe("Document ID"),
|
|
2322
2420
|
/**
|
|
2323
2421
|
* Document name
|
|
2324
2422
|
*/
|
|
2325
|
-
name:
|
|
2423
|
+
name: z17.string().describe("Document name"),
|
|
2326
2424
|
/**
|
|
2327
2425
|
* Optional document description
|
|
2328
2426
|
*/
|
|
2329
|
-
description:
|
|
2427
|
+
description: z17.string().optional().describe("Document description"),
|
|
2330
2428
|
/**
|
|
2331
2429
|
* MIME type of the document
|
|
2332
2430
|
*/
|
|
2333
|
-
fileType:
|
|
2431
|
+
fileType: z17.string().describe("File MIME type"),
|
|
2334
2432
|
/**
|
|
2335
2433
|
* File size in bytes
|
|
2336
2434
|
*/
|
|
2337
|
-
fileSize:
|
|
2435
|
+
fileSize: z17.number().describe("File size in bytes"),
|
|
2338
2436
|
/**
|
|
2339
2437
|
* Document category for organization
|
|
2340
2438
|
*/
|
|
2341
|
-
category:
|
|
2439
|
+
category: z17.string().optional().describe("Document category"),
|
|
2342
2440
|
/**
|
|
2343
2441
|
* Tags for searchability and organization
|
|
2344
2442
|
*/
|
|
2345
|
-
tags:
|
|
2443
|
+
tags: z17.array(z17.string()).optional().describe("Document tags"),
|
|
2346
2444
|
/**
|
|
2347
2445
|
* Version control configuration
|
|
2348
2446
|
*/
|
|
2349
|
-
versioning:
|
|
2447
|
+
versioning: z17.object({
|
|
2350
2448
|
/**
|
|
2351
2449
|
* Whether versioning is enabled
|
|
2352
2450
|
*/
|
|
2353
|
-
enabled:
|
|
2451
|
+
enabled: z17.boolean().describe("Versioning enabled"),
|
|
2354
2452
|
/**
|
|
2355
2453
|
* List of all document versions
|
|
2356
2454
|
*/
|
|
2357
|
-
versions:
|
|
2455
|
+
versions: z17.array(DocumentVersionSchema).describe("Version history"),
|
|
2358
2456
|
/**
|
|
2359
2457
|
* Current major version number
|
|
2360
2458
|
*/
|
|
2361
|
-
majorVersion:
|
|
2459
|
+
majorVersion: z17.number().describe("Major version"),
|
|
2362
2460
|
/**
|
|
2363
2461
|
* Current minor version number
|
|
2364
2462
|
*/
|
|
2365
|
-
minorVersion:
|
|
2463
|
+
minorVersion: z17.number().describe("Minor version")
|
|
2366
2464
|
}).optional().describe("Version control"),
|
|
2367
2465
|
/**
|
|
2368
2466
|
* Template configuration (if document is generated from template)
|
|
@@ -2375,65 +2473,65 @@ var DocumentSchema = z16.object({
|
|
|
2375
2473
|
/**
|
|
2376
2474
|
* Access control settings
|
|
2377
2475
|
*/
|
|
2378
|
-
access:
|
|
2476
|
+
access: z17.object({
|
|
2379
2477
|
/**
|
|
2380
2478
|
* Whether document is publicly accessible
|
|
2381
2479
|
* @default false
|
|
2382
2480
|
*/
|
|
2383
|
-
isPublic:
|
|
2481
|
+
isPublic: z17.boolean().optional().default(false).describe("Public access"),
|
|
2384
2482
|
/**
|
|
2385
2483
|
* List of user/team IDs with access
|
|
2386
2484
|
*/
|
|
2387
|
-
sharedWith:
|
|
2485
|
+
sharedWith: z17.array(z17.string()).optional().describe("Shared with"),
|
|
2388
2486
|
/**
|
|
2389
2487
|
* Timestamp when access expires (Unix milliseconds)
|
|
2390
2488
|
*/
|
|
2391
|
-
expiresAt:
|
|
2489
|
+
expiresAt: z17.number().optional().describe("Access expiration")
|
|
2392
2490
|
}).optional().describe("Access control"),
|
|
2393
2491
|
/**
|
|
2394
2492
|
* Custom metadata fields
|
|
2395
2493
|
*/
|
|
2396
|
-
metadata:
|
|
2494
|
+
metadata: z17.record(z17.string(), z17.any()).optional().describe("Custom metadata")
|
|
2397
2495
|
});
|
|
2398
2496
|
|
|
2399
2497
|
// src/data/external-lookup.zod.ts
|
|
2400
|
-
import { z as
|
|
2498
|
+
import { z as z19 } from "zod";
|
|
2401
2499
|
|
|
2402
2500
|
// src/shared/mapping.zod.ts
|
|
2403
|
-
import { z as
|
|
2404
|
-
var TransformTypeSchema =
|
|
2405
|
-
|
|
2406
|
-
type:
|
|
2407
|
-
value:
|
|
2501
|
+
import { z as z18 } from "zod";
|
|
2502
|
+
var TransformTypeSchema = z18.discriminatedUnion("type", [
|
|
2503
|
+
z18.object({
|
|
2504
|
+
type: z18.literal("constant"),
|
|
2505
|
+
value: z18.any().describe("Constant value to use")
|
|
2408
2506
|
}).describe("Set a constant value"),
|
|
2409
|
-
|
|
2410
|
-
type:
|
|
2411
|
-
targetType:
|
|
2507
|
+
z18.object({
|
|
2508
|
+
type: z18.literal("cast"),
|
|
2509
|
+
targetType: z18.enum(["string", "number", "boolean", "date"]).describe("Target data type")
|
|
2412
2510
|
}).describe("Cast to a specific data type"),
|
|
2413
|
-
|
|
2414
|
-
type:
|
|
2415
|
-
table:
|
|
2416
|
-
keyField:
|
|
2417
|
-
valueField:
|
|
2511
|
+
z18.object({
|
|
2512
|
+
type: z18.literal("lookup"),
|
|
2513
|
+
table: z18.string().describe("Lookup table name"),
|
|
2514
|
+
keyField: z18.string().describe("Field to match on"),
|
|
2515
|
+
valueField: z18.string().describe("Field to retrieve")
|
|
2418
2516
|
}).describe("Lookup value from another table"),
|
|
2419
|
-
|
|
2420
|
-
type:
|
|
2421
|
-
expression:
|
|
2517
|
+
z18.object({
|
|
2518
|
+
type: z18.literal("javascript"),
|
|
2519
|
+
expression: z18.string().describe('JavaScript expression (e.g., "value.toUpperCase()")')
|
|
2422
2520
|
}).describe("Custom JavaScript transformation"),
|
|
2423
|
-
|
|
2424
|
-
type:
|
|
2425
|
-
mappings:
|
|
2521
|
+
z18.object({
|
|
2522
|
+
type: z18.literal("map"),
|
|
2523
|
+
mappings: z18.record(z18.string(), z18.any()).describe('Value mappings (e.g., {"Active": "active"})')
|
|
2426
2524
|
}).describe("Map values using a dictionary")
|
|
2427
2525
|
]);
|
|
2428
|
-
var FieldMappingSchema2 =
|
|
2526
|
+
var FieldMappingSchema2 = z18.object({
|
|
2429
2527
|
/**
|
|
2430
2528
|
* Source field name
|
|
2431
2529
|
*/
|
|
2432
|
-
source:
|
|
2530
|
+
source: z18.string().describe("Source field name"),
|
|
2433
2531
|
/**
|
|
2434
2532
|
* Target field name (should be snake_case for ObjectStack)
|
|
2435
2533
|
*/
|
|
2436
|
-
target:
|
|
2534
|
+
target: z18.string().describe("Target field name"),
|
|
2437
2535
|
/**
|
|
2438
2536
|
* Transformation to apply
|
|
2439
2537
|
*/
|
|
@@ -2441,58 +2539,58 @@ var FieldMappingSchema2 = z17.object({
|
|
|
2441
2539
|
/**
|
|
2442
2540
|
* Default value if source is null/undefined
|
|
2443
2541
|
*/
|
|
2444
|
-
defaultValue:
|
|
2542
|
+
defaultValue: z18.any().optional().describe("Default if source is null/undefined")
|
|
2445
2543
|
});
|
|
2446
2544
|
|
|
2447
2545
|
// src/data/external-lookup.zod.ts
|
|
2448
|
-
var ExternalDataSourceSchema =
|
|
2546
|
+
var ExternalDataSourceSchema = z19.object({
|
|
2449
2547
|
/**
|
|
2450
2548
|
* Unique identifier for the external data source
|
|
2451
2549
|
*/
|
|
2452
|
-
id:
|
|
2550
|
+
id: z19.string().describe("Data source ID"),
|
|
2453
2551
|
/**
|
|
2454
2552
|
* Human-readable name of the data source
|
|
2455
2553
|
*/
|
|
2456
|
-
name:
|
|
2554
|
+
name: z19.string().describe("Data source name"),
|
|
2457
2555
|
/**
|
|
2458
2556
|
* Protocol type for connecting to the data source
|
|
2459
2557
|
*/
|
|
2460
|
-
type:
|
|
2558
|
+
type: z19.enum(["odata", "rest-api", "graphql", "custom"]).describe("Protocol type"),
|
|
2461
2559
|
/**
|
|
2462
2560
|
* Base URL endpoint for the external system
|
|
2463
2561
|
*/
|
|
2464
|
-
endpoint:
|
|
2562
|
+
endpoint: z19.string().url().describe("API endpoint URL"),
|
|
2465
2563
|
/**
|
|
2466
2564
|
* Authentication configuration
|
|
2467
2565
|
*/
|
|
2468
|
-
authentication:
|
|
2566
|
+
authentication: z19.object({
|
|
2469
2567
|
/**
|
|
2470
2568
|
* Authentication method
|
|
2471
2569
|
*/
|
|
2472
|
-
type:
|
|
2570
|
+
type: z19.enum(["oauth2", "api-key", "basic", "none"]).describe("Auth type"),
|
|
2473
2571
|
/**
|
|
2474
2572
|
* Authentication-specific configuration
|
|
2475
2573
|
* Structure varies based on auth type
|
|
2476
2574
|
*/
|
|
2477
|
-
config:
|
|
2575
|
+
config: z19.record(z19.string(), z19.any()).describe("Auth configuration")
|
|
2478
2576
|
}).describe("Authentication")
|
|
2479
2577
|
});
|
|
2480
2578
|
var ExternalFieldMappingSchema = FieldMappingSchema2.extend({
|
|
2481
2579
|
/**
|
|
2482
2580
|
* Field data type
|
|
2483
2581
|
*/
|
|
2484
|
-
type:
|
|
2582
|
+
type: z19.string().optional().describe("Field type"),
|
|
2485
2583
|
/**
|
|
2486
2584
|
* Whether the field is read-only
|
|
2487
2585
|
* @default true
|
|
2488
2586
|
*/
|
|
2489
|
-
readonly:
|
|
2587
|
+
readonly: z19.boolean().optional().default(true).describe("Read-only field")
|
|
2490
2588
|
});
|
|
2491
|
-
var ExternalLookupSchema =
|
|
2589
|
+
var ExternalLookupSchema = z19.object({
|
|
2492
2590
|
/**
|
|
2493
2591
|
* Name of the field that uses external lookup
|
|
2494
2592
|
*/
|
|
2495
|
-
fieldName:
|
|
2593
|
+
fieldName: z19.string().describe("Field name"),
|
|
2496
2594
|
/**
|
|
2497
2595
|
* External data source configuration
|
|
2498
2596
|
*/
|
|
@@ -2500,137 +2598,137 @@ var ExternalLookupSchema = z18.object({
|
|
|
2500
2598
|
/**
|
|
2501
2599
|
* Query configuration for fetching external data
|
|
2502
2600
|
*/
|
|
2503
|
-
query:
|
|
2601
|
+
query: z19.object({
|
|
2504
2602
|
/**
|
|
2505
2603
|
* API endpoint path (relative to base endpoint)
|
|
2506
2604
|
*/
|
|
2507
|
-
endpoint:
|
|
2605
|
+
endpoint: z19.string().describe("Query endpoint path"),
|
|
2508
2606
|
/**
|
|
2509
2607
|
* HTTP method for the query
|
|
2510
2608
|
* @default 'GET'
|
|
2511
2609
|
*/
|
|
2512
|
-
method:
|
|
2610
|
+
method: z19.enum(["GET", "POST"]).optional().default("GET").describe("HTTP method"),
|
|
2513
2611
|
/**
|
|
2514
2612
|
* Query parameters or request body
|
|
2515
2613
|
*/
|
|
2516
|
-
parameters:
|
|
2614
|
+
parameters: z19.record(z19.string(), z19.any()).optional().describe("Query parameters")
|
|
2517
2615
|
}).describe("Query configuration"),
|
|
2518
2616
|
/**
|
|
2519
2617
|
* Mapping between external and local fields
|
|
2520
2618
|
*/
|
|
2521
|
-
fieldMappings:
|
|
2619
|
+
fieldMappings: z19.array(ExternalFieldMappingSchema).describe("Field mappings"),
|
|
2522
2620
|
/**
|
|
2523
2621
|
* Cache configuration for external data
|
|
2524
2622
|
*/
|
|
2525
|
-
caching:
|
|
2623
|
+
caching: z19.object({
|
|
2526
2624
|
/**
|
|
2527
2625
|
* Whether caching is enabled
|
|
2528
2626
|
* @default true
|
|
2529
2627
|
*/
|
|
2530
|
-
enabled:
|
|
2628
|
+
enabled: z19.boolean().optional().default(true).describe("Cache enabled"),
|
|
2531
2629
|
/**
|
|
2532
2630
|
* Time-to-live in seconds
|
|
2533
2631
|
* @default 300
|
|
2534
2632
|
*/
|
|
2535
|
-
ttl:
|
|
2633
|
+
ttl: z19.number().optional().default(300).describe("Cache TTL (seconds)"),
|
|
2536
2634
|
/**
|
|
2537
2635
|
* Cache eviction strategy
|
|
2538
2636
|
* @default 'ttl'
|
|
2539
2637
|
*/
|
|
2540
|
-
strategy:
|
|
2638
|
+
strategy: z19.enum(["lru", "lfu", "ttl"]).optional().default("ttl").describe("Cache strategy")
|
|
2541
2639
|
}).optional().describe("Caching configuration"),
|
|
2542
2640
|
/**
|
|
2543
2641
|
* Fallback behavior when external system is unavailable
|
|
2544
2642
|
*/
|
|
2545
|
-
fallback:
|
|
2643
|
+
fallback: z19.object({
|
|
2546
2644
|
/**
|
|
2547
2645
|
* Whether fallback is enabled
|
|
2548
2646
|
* @default true
|
|
2549
2647
|
*/
|
|
2550
|
-
enabled:
|
|
2648
|
+
enabled: z19.boolean().optional().default(true).describe("Fallback enabled"),
|
|
2551
2649
|
/**
|
|
2552
2650
|
* Default value to use when external system fails
|
|
2553
2651
|
*/
|
|
2554
|
-
defaultValue:
|
|
2652
|
+
defaultValue: z19.any().optional().describe("Default fallback value"),
|
|
2555
2653
|
/**
|
|
2556
2654
|
* Whether to show error message to user
|
|
2557
2655
|
* @default true
|
|
2558
2656
|
*/
|
|
2559
|
-
showError:
|
|
2657
|
+
showError: z19.boolean().optional().default(true).describe("Show error to user")
|
|
2560
2658
|
}).optional().describe("Fallback configuration"),
|
|
2561
2659
|
/**
|
|
2562
2660
|
* Rate limiting to prevent overwhelming external system
|
|
2563
2661
|
*/
|
|
2564
|
-
rateLimit:
|
|
2662
|
+
rateLimit: z19.object({
|
|
2565
2663
|
/**
|
|
2566
2664
|
* Maximum requests per second
|
|
2567
2665
|
*/
|
|
2568
|
-
requestsPerSecond:
|
|
2666
|
+
requestsPerSecond: z19.number().describe("Requests per second limit"),
|
|
2569
2667
|
/**
|
|
2570
2668
|
* Burst size for handling spikes
|
|
2571
2669
|
*/
|
|
2572
|
-
burstSize:
|
|
2670
|
+
burstSize: z19.number().optional().describe("Burst size")
|
|
2573
2671
|
}).optional().describe("Rate limiting")
|
|
2574
2672
|
});
|
|
2575
2673
|
|
|
2576
2674
|
// src/data/datasource.zod.ts
|
|
2577
|
-
import { z as
|
|
2578
|
-
var DriverType =
|
|
2579
|
-
var DriverDefinitionSchema =
|
|
2580
|
-
id:
|
|
2581
|
-
label:
|
|
2582
|
-
description:
|
|
2583
|
-
icon:
|
|
2675
|
+
import { z as z20 } from "zod";
|
|
2676
|
+
var DriverType = z20.string().describe("Underlying driver identifier");
|
|
2677
|
+
var DriverDefinitionSchema = z20.object({
|
|
2678
|
+
id: z20.string().describe('Unique driver identifier (e.g. "postgres")'),
|
|
2679
|
+
label: z20.string().describe('Display label (e.g. "PostgreSQL")'),
|
|
2680
|
+
description: z20.string().optional(),
|
|
2681
|
+
icon: z20.string().optional(),
|
|
2584
2682
|
/**
|
|
2585
2683
|
* Configuration Schema (JSON Schema)
|
|
2586
2684
|
* Describes the structure of the `config` object needed for this driver.
|
|
2587
2685
|
* Used by the UI to generate the connection form.
|
|
2588
2686
|
*/
|
|
2589
|
-
configSchema:
|
|
2687
|
+
configSchema: z20.record(z20.string(), z20.any()).describe("JSON Schema for connection configuration"),
|
|
2590
2688
|
/**
|
|
2591
2689
|
* Default Capabilities
|
|
2592
2690
|
* What this driver supports out-of-the-box.
|
|
2593
2691
|
*/
|
|
2594
|
-
capabilities:
|
|
2692
|
+
capabilities: z20.lazy(() => DatasourceCapabilities).optional()
|
|
2595
2693
|
});
|
|
2596
|
-
var DatasourceCapabilities =
|
|
2694
|
+
var DatasourceCapabilities = z20.object({
|
|
2597
2695
|
// ============================================================================
|
|
2598
2696
|
// Transaction & Connection Management
|
|
2599
2697
|
// ============================================================================
|
|
2600
2698
|
/** Can handle ACID transactions? */
|
|
2601
|
-
transactions:
|
|
2699
|
+
transactions: z20.boolean().default(false),
|
|
2602
2700
|
// ============================================================================
|
|
2603
2701
|
// Query Operations
|
|
2604
2702
|
// ============================================================================
|
|
2605
2703
|
/** Can execute WHERE clause filters natively? */
|
|
2606
|
-
queryFilters:
|
|
2704
|
+
queryFilters: z20.boolean().default(false),
|
|
2607
2705
|
/** Can perform aggregation (group by, sum, avg)? */
|
|
2608
|
-
queryAggregations:
|
|
2706
|
+
queryAggregations: z20.boolean().default(false),
|
|
2609
2707
|
/** Can perform ORDER BY sorting? */
|
|
2610
|
-
querySorting:
|
|
2708
|
+
querySorting: z20.boolean().default(false),
|
|
2611
2709
|
/** Can perform LIMIT/OFFSET pagination? */
|
|
2612
|
-
queryPagination:
|
|
2710
|
+
queryPagination: z20.boolean().default(false),
|
|
2613
2711
|
/** Can perform window functions? */
|
|
2614
|
-
queryWindowFunctions:
|
|
2712
|
+
queryWindowFunctions: z20.boolean().default(false),
|
|
2615
2713
|
/** Can perform subqueries? */
|
|
2616
|
-
querySubqueries:
|
|
2714
|
+
querySubqueries: z20.boolean().default(false),
|
|
2617
2715
|
/** Can execute SQL-like joins natively? */
|
|
2618
|
-
joins:
|
|
2716
|
+
joins: z20.boolean().default(false),
|
|
2619
2717
|
// ============================================================================
|
|
2620
2718
|
// Advanced Features
|
|
2621
2719
|
// ============================================================================
|
|
2622
2720
|
/** Can perform full-text search? */
|
|
2623
|
-
fullTextSearch:
|
|
2721
|
+
fullTextSearch: z20.boolean().default(false),
|
|
2624
2722
|
/** Is read-only? */
|
|
2625
|
-
readOnly:
|
|
2723
|
+
readOnly: z20.boolean().default(false),
|
|
2626
2724
|
/** Is scheme-less (needs schema inference)? */
|
|
2627
|
-
dynamicSchema:
|
|
2725
|
+
dynamicSchema: z20.boolean().default(false)
|
|
2628
2726
|
});
|
|
2629
|
-
var DatasourceSchema =
|
|
2727
|
+
var DatasourceSchema = z20.object({
|
|
2630
2728
|
/** Machine Name */
|
|
2631
|
-
name:
|
|
2729
|
+
name: z20.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Unique datasource identifier"),
|
|
2632
2730
|
/** Human Label */
|
|
2633
|
-
label:
|
|
2731
|
+
label: z20.string().optional().describe("Display label"),
|
|
2634
2732
|
/** Driver */
|
|
2635
2733
|
driver: DriverType.describe("Underlying driver type"),
|
|
2636
2734
|
/**
|
|
@@ -2638,37 +2736,37 @@ var DatasourceSchema = z19.object({
|
|
|
2638
2736
|
* Specific to the driver (e.g., host, port, user, password, bucket, etc.)
|
|
2639
2737
|
* Stored securely (passwords usually interpolated from ENV).
|
|
2640
2738
|
*/
|
|
2641
|
-
config:
|
|
2739
|
+
config: z20.record(z20.string(), z20.any()).describe("Driver specific configuration"),
|
|
2642
2740
|
/**
|
|
2643
2741
|
* Connection Pool Configuration
|
|
2644
2742
|
* Standard connection pooling settings.
|
|
2645
2743
|
*/
|
|
2646
|
-
pool:
|
|
2647
|
-
min:
|
|
2648
|
-
max:
|
|
2649
|
-
idleTimeoutMillis:
|
|
2650
|
-
connectionTimeoutMillis:
|
|
2744
|
+
pool: z20.object({
|
|
2745
|
+
min: z20.number().default(0).describe("Minimum connections"),
|
|
2746
|
+
max: z20.number().default(10).describe("Maximum connections"),
|
|
2747
|
+
idleTimeoutMillis: z20.number().default(3e4).describe("Idle timeout"),
|
|
2748
|
+
connectionTimeoutMillis: z20.number().default(3e3).describe("Connection establishment timeout")
|
|
2651
2749
|
}).optional().describe("Connection pool settings"),
|
|
2652
2750
|
/**
|
|
2653
2751
|
* Read Replicas
|
|
2654
2752
|
* Optional list of duplicate configurations for read-only operations.
|
|
2655
2753
|
* Useful for scaling read throughput.
|
|
2656
2754
|
*/
|
|
2657
|
-
readReplicas:
|
|
2755
|
+
readReplicas: z20.array(z20.record(z20.string(), z20.any())).optional().describe("Read-only replica configurations"),
|
|
2658
2756
|
/**
|
|
2659
2757
|
* Capability Overrides
|
|
2660
2758
|
* Manually override what the driver claims to support.
|
|
2661
2759
|
*/
|
|
2662
2760
|
capabilities: DatasourceCapabilities.optional().describe("Capability overrides"),
|
|
2663
2761
|
/** Description */
|
|
2664
|
-
description:
|
|
2762
|
+
description: z20.string().optional().describe("Internal description"),
|
|
2665
2763
|
/** Is enabled? */
|
|
2666
|
-
active:
|
|
2764
|
+
active: z20.boolean().default(true).describe("Is datasource enabled")
|
|
2667
2765
|
});
|
|
2668
2766
|
|
|
2669
2767
|
// src/data/analytics.zod.ts
|
|
2670
|
-
import { z as
|
|
2671
|
-
var MetricType =
|
|
2768
|
+
import { z as z21 } from "zod";
|
|
2769
|
+
var MetricType = z21.enum([
|
|
2672
2770
|
"count",
|
|
2673
2771
|
"sum",
|
|
2674
2772
|
"avg",
|
|
@@ -2682,14 +2780,14 @@ var MetricType = z20.enum([
|
|
|
2682
2780
|
"boolean"
|
|
2683
2781
|
// Custom SQL expression returning a boolean
|
|
2684
2782
|
]);
|
|
2685
|
-
var DimensionType =
|
|
2783
|
+
var DimensionType = z21.enum([
|
|
2686
2784
|
"string",
|
|
2687
2785
|
"number",
|
|
2688
2786
|
"boolean",
|
|
2689
2787
|
"time",
|
|
2690
2788
|
"geo"
|
|
2691
2789
|
]);
|
|
2692
|
-
var TimeUpdateInterval =
|
|
2790
|
+
var TimeUpdateInterval = z21.enum([
|
|
2693
2791
|
"second",
|
|
2694
2792
|
"minute",
|
|
2695
2793
|
"hour",
|
|
@@ -2699,78 +2797,78 @@ var TimeUpdateInterval = z20.enum([
|
|
|
2699
2797
|
"quarter",
|
|
2700
2798
|
"year"
|
|
2701
2799
|
]);
|
|
2702
|
-
var MetricSchema =
|
|
2703
|
-
name:
|
|
2704
|
-
label:
|
|
2705
|
-
description:
|
|
2800
|
+
var MetricSchema = z21.object({
|
|
2801
|
+
name: z21.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Unique metric ID"),
|
|
2802
|
+
label: z21.string().describe("Human readable label"),
|
|
2803
|
+
description: z21.string().optional(),
|
|
2706
2804
|
type: MetricType,
|
|
2707
2805
|
/** Source Calculation */
|
|
2708
|
-
sql:
|
|
2806
|
+
sql: z21.string().describe("SQL expression or field reference"),
|
|
2709
2807
|
/** Filtering for this specific metric (e.g. "Revenue from Premium Users") */
|
|
2710
|
-
filters:
|
|
2711
|
-
sql:
|
|
2808
|
+
filters: z21.array(z21.object({
|
|
2809
|
+
sql: z21.string()
|
|
2712
2810
|
})).optional(),
|
|
2713
2811
|
/** Format for display (e.g. "currency", "percent") */
|
|
2714
|
-
format:
|
|
2812
|
+
format: z21.string().optional()
|
|
2715
2813
|
});
|
|
2716
|
-
var DimensionSchema =
|
|
2717
|
-
name:
|
|
2718
|
-
label:
|
|
2719
|
-
description:
|
|
2814
|
+
var DimensionSchema = z21.object({
|
|
2815
|
+
name: z21.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Unique dimension ID"),
|
|
2816
|
+
label: z21.string().describe("Human readable label"),
|
|
2817
|
+
description: z21.string().optional(),
|
|
2720
2818
|
type: DimensionType,
|
|
2721
2819
|
/** Source Column */
|
|
2722
|
-
sql:
|
|
2820
|
+
sql: z21.string().describe("SQL expression or column reference"),
|
|
2723
2821
|
/** For Time Dimensions: Supported Granularities */
|
|
2724
|
-
granularities:
|
|
2822
|
+
granularities: z21.array(TimeUpdateInterval).optional()
|
|
2725
2823
|
});
|
|
2726
|
-
var CubeJoinSchema =
|
|
2727
|
-
name:
|
|
2728
|
-
relationship:
|
|
2729
|
-
sql:
|
|
2824
|
+
var CubeJoinSchema = z21.object({
|
|
2825
|
+
name: z21.string().describe("Target cube name"),
|
|
2826
|
+
relationship: z21.enum(["one_to_one", "one_to_many", "many_to_one"]).default("many_to_one"),
|
|
2827
|
+
sql: z21.string().describe("Join condition (ON clause)")
|
|
2730
2828
|
});
|
|
2731
|
-
var CubeSchema =
|
|
2732
|
-
name:
|
|
2733
|
-
title:
|
|
2734
|
-
description:
|
|
2829
|
+
var CubeSchema = z21.object({
|
|
2830
|
+
name: z21.string().regex(/^[a-z_][a-z0-9_]*$/).describe("Cube name (snake_case)"),
|
|
2831
|
+
title: z21.string().optional(),
|
|
2832
|
+
description: z21.string().optional(),
|
|
2735
2833
|
/** Physical Data Source */
|
|
2736
|
-
sql:
|
|
2834
|
+
sql: z21.string().describe("Base SQL statement or Table Name"),
|
|
2737
2835
|
/** Semantic Definitions */
|
|
2738
|
-
measures:
|
|
2739
|
-
dimensions:
|
|
2836
|
+
measures: z21.record(z21.string(), MetricSchema).describe("Quantitative metrics"),
|
|
2837
|
+
dimensions: z21.record(z21.string(), DimensionSchema).describe("Qualitative attributes"),
|
|
2740
2838
|
/** Relationships */
|
|
2741
|
-
joins:
|
|
2839
|
+
joins: z21.record(z21.string(), CubeJoinSchema).optional(),
|
|
2742
2840
|
/** Pre-aggregations / Caching */
|
|
2743
|
-
refreshKey:
|
|
2744
|
-
every:
|
|
2841
|
+
refreshKey: z21.object({
|
|
2842
|
+
every: z21.string().optional(),
|
|
2745
2843
|
// e.g. "1 hour"
|
|
2746
|
-
sql:
|
|
2844
|
+
sql: z21.string().optional()
|
|
2747
2845
|
// SQL to check for data changes
|
|
2748
2846
|
}).optional(),
|
|
2749
2847
|
/** Access Control */
|
|
2750
|
-
public:
|
|
2751
|
-
});
|
|
2752
|
-
var AnalyticsQuerySchema =
|
|
2753
|
-
measures:
|
|
2754
|
-
dimensions:
|
|
2755
|
-
filters:
|
|
2756
|
-
member:
|
|
2757
|
-
operator:
|
|
2758
|
-
values:
|
|
2848
|
+
public: z21.boolean().default(false)
|
|
2849
|
+
});
|
|
2850
|
+
var AnalyticsQuerySchema = z21.object({
|
|
2851
|
+
measures: z21.array(z21.string()).describe("List of metrics to calculate"),
|
|
2852
|
+
dimensions: z21.array(z21.string()).optional().describe("List of dimensions to group by"),
|
|
2853
|
+
filters: z21.array(z21.object({
|
|
2854
|
+
member: z21.string().describe("Dimension or Measure"),
|
|
2855
|
+
operator: z21.enum(["equals", "notEquals", "contains", "notContains", "gt", "gte", "lt", "lte", "set", "notSet", "inDateRange"]),
|
|
2856
|
+
values: z21.array(z21.string()).optional()
|
|
2759
2857
|
})).optional(),
|
|
2760
|
-
timeDimensions:
|
|
2761
|
-
dimension:
|
|
2858
|
+
timeDimensions: z21.array(z21.object({
|
|
2859
|
+
dimension: z21.string(),
|
|
2762
2860
|
granularity: TimeUpdateInterval.optional(),
|
|
2763
|
-
dateRange:
|
|
2764
|
-
|
|
2861
|
+
dateRange: z21.union([
|
|
2862
|
+
z21.string(),
|
|
2765
2863
|
// "Last 7 days"
|
|
2766
|
-
|
|
2864
|
+
z21.array(z21.string())
|
|
2767
2865
|
// ["2023-01-01", "2023-01-31"]
|
|
2768
2866
|
]).optional()
|
|
2769
2867
|
})).optional(),
|
|
2770
|
-
order:
|
|
2771
|
-
limit:
|
|
2772
|
-
offset:
|
|
2773
|
-
timezone:
|
|
2868
|
+
order: z21.record(z21.string(), z21.enum(["asc", "desc"])).optional(),
|
|
2869
|
+
limit: z21.number().optional(),
|
|
2870
|
+
offset: z21.number().optional(),
|
|
2871
|
+
timezone: z21.string().default("UTC")
|
|
2774
2872
|
});
|
|
2775
2873
|
export {
|
|
2776
2874
|
ALL_OPERATORS,
|
|
@@ -2871,6 +2969,8 @@ export {
|
|
|
2871
2969
|
NoSQLTransactionOptionsSchema,
|
|
2872
2970
|
NormalizedFilterSchema,
|
|
2873
2971
|
ObjectCapabilities,
|
|
2972
|
+
ObjectExtensionSchema,
|
|
2973
|
+
ObjectOwnershipEnum,
|
|
2874
2974
|
ObjectSchema,
|
|
2875
2975
|
PartitioningConfigSchema,
|
|
2876
2976
|
PoolConfigSchema,
|