@dyrected/core 2.5.29 → 2.5.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,16 +1,6 @@
1
- import { D as DyrectedConfig, F as Field, C as CollectionConfig, P as Prettify, I as InferDocShape, S as SystemDocFields, A as AuthDocFields, U as UploadDocFields, G as GlobalConfig } from './index-Bp7PDOYG.cjs';
2
- export { a as AccessFunction, b as AdminConfig, c as AuthenticatedUser, B as BaseDocument, d as Block, e as CollectionAfterChangeHook, f as CollectionAfterDeleteHook, g as CollectionAfterReadHook, h as CollectionBeforeChangeHook, i as CollectionBeforeDeleteHook, j as CollectionBeforeReadHook, k as DatabaseAdapter, l as DynamicOptionItem, m as DynamicOptionsConfig, n as DynamicOptionsResolver, o as DynamicOptionsResolverArgs, p as FieldAfterReadHook, q as FieldBeforeChangeHook, r as FieldHook, s as FieldType, t as FileData, u as GlobalAfterChangeHook, v as GlobalAfterReadHook, w as GlobalBeforeChangeHook, x as GlobalBeforeReadHook, H as HookFunction, y as HookRequestContext, z as ImageService, E as PaginatedResult, R as ReadonlyDatabaseAdapter, J as StorageAdapter, K as UploadConfig } from './index-Bp7PDOYG.cjs';
3
-
4
- interface SetupPromptConfig {
5
- siteName?: string;
6
- siteId?: string;
7
- apiKey?: string;
8
- baseUrl?: string;
9
- isSelfHosted?: boolean;
10
- existingSite?: boolean;
11
- }
12
- declare function generateFreshSetupPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
13
- declare function generateAIPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
1
+ import { D as DyrectedConfig, F as Field, W as WorkflowConfig, A as AuthenticatedUser, a as WorkflowTransition, L as LifecycleEventName, b as LifecycleEvent, C as CollectionConfig, B as BaseDocument, H as HookRequestContext, P as Prettify, I as InferDocShape, S as SystemDocFields, c as AuthDocFields, U as UploadDocFields, G as GlobalConfig } from './index-CdQwnbfh.cjs';
2
+ export { d as AccessFunction, e as AdminConfig, f as AdminDashboardComponentSlots, g as AdminIconName, h as Block, i as CollectionAfterChangeHook, j as CollectionAfterDeleteHook, k as CollectionAfterReadHook, l as CollectionAfterTransitionHook, m as CollectionBeforeChangeHook, n as CollectionBeforeDeleteHook, o as CollectionBeforeReadHook, p as CollectionBeforeTransitionHook, q as CollectionListComponentSlots, r as DatabaseAdapter, s as DynamicOptionItem, t as DynamicOptionsConfig, u as DynamicOptionsResolver, v as DynamicOptionsResolverArgs, w as FieldAfterReadHook, x as FieldBeforeChangeHook, y as FieldHook, z as FieldType, E as FileData, J as GlobalAfterChangeHook, K as GlobalAfterReadHook, M as GlobalBeforeChangeHook, N as GlobalBeforeReadHook, O as HookFunction, Q as ImageService, R as LIFECYCLE_EVENT_NAMES, T as LifecycleEventHandler, V as PaginatedResult, X as ReadonlyDatabaseAdapter, Y as StorageAdapter, Z as UploadConfig, _ as WorkflowMetadata, $ as WorkflowRole, a0 as WorkflowState, a1 as WorkflowTransitionContext } from './index-CdQwnbfh.cjs';
3
+ import 'lucide-react';
14
4
 
15
5
  /**
16
6
  * Normalizes the Dyrected configuration by injecting system fields
@@ -128,6 +118,64 @@ declare function executeFieldBeforeChange(fields: Field[], data: Record<string,
128
118
  */
129
119
  declare function executeFieldAfterRead(fields: Field[], doc: Record<string, unknown>, user: unknown, db?: unknown): Promise<Record<string, unknown>>;
130
120
 
121
+ /**
122
+ * Generate an OpenAPI 3.0 specification based on the Dyrected configuration.
123
+ */
124
+ declare function generateOpenApi(config: DyrectedConfig): any;
125
+
126
+ declare const WORKFLOW_HISTORY_COLLECTION = "__workflow_history";
127
+ declare const LIFECYCLE_EVENTS_COLLECTION = "__lifecycle_events";
128
+ declare function publishingWorkflow(): WorkflowConfig;
129
+ declare function workflowCapabilities(workflow: WorkflowConfig, user?: AuthenticatedUser): Set<string>;
130
+ declare function canViewWorkflowDraft(workflow: WorkflowConfig, user?: AuthenticatedUser): boolean;
131
+ declare function availableWorkflowTransitions(workflow: WorkflowConfig, state: string, user?: AuthenticatedUser): WorkflowTransition[];
132
+ declare function initializeWorkflowDocument(data: Record<string, unknown>, workflow: WorkflowConfig): {
133
+ __workflow: {
134
+ state: string;
135
+ revision: number;
136
+ };
137
+ };
138
+ declare function materializeWorkflowDocument(doc: BaseDocument, workflow: WorkflowConfig, user?: AuthenticatedUser): BaseDocument | null;
139
+ declare function createLifecycleEvent(args: {
140
+ name: LifecycleEventName;
141
+ collection: string;
142
+ documentId: string;
143
+ actorId?: string;
144
+ payload: Record<string, unknown>;
145
+ }): LifecycleEvent;
146
+ declare function dispatchLifecycleEvent(config: DyrectedConfig, event: LifecycleEvent): Promise<void>;
147
+ declare function dispatchPendingLifecycleEvents(config: DyrectedConfig, limit?: number): Promise<number>;
148
+ declare function saveWorkflowDraft(args: {
149
+ config: DyrectedConfig;
150
+ collection: CollectionConfig;
151
+ id: string;
152
+ originalDoc: BaseDocument;
153
+ data: Record<string, unknown>;
154
+ user?: AuthenticatedUser;
155
+ }): Promise<{
156
+ doc: BaseDocument;
157
+ event: LifecycleEvent;
158
+ }>;
159
+ declare function createWorkflowDocument(args: {
160
+ config: DyrectedConfig;
161
+ collection: CollectionConfig;
162
+ data: Record<string, unknown>;
163
+ user?: AuthenticatedUser;
164
+ }): Promise<{
165
+ doc: BaseDocument;
166
+ event: LifecycleEvent;
167
+ }>;
168
+ declare function transitionWorkflow(args: {
169
+ config: DyrectedConfig;
170
+ collection: CollectionConfig;
171
+ id: string;
172
+ transitionName: string;
173
+ expectedRevision?: number;
174
+ comment?: string;
175
+ user?: AuthenticatedUser;
176
+ req: HookRequestContext;
177
+ }): Promise<BaseDocument>;
178
+
131
179
  /**
132
180
  * Define a collection. When called without an explicit type argument, TypeScript
133
181
  * automatically infers the document shape from the `fields` array you provide —
@@ -159,7 +207,7 @@ declare function executeFieldAfterRead(fields: Field[], doc: Record<string, unkn
159
207
  */
160
208
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
161
209
  id: string;
162
- } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, 'fields' | 'auth'> & {
210
+ } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, "fields" | "auth"> & {
163
211
  fields: TFields;
164
212
  auth: true;
165
213
  }): CollectionConfig<Prettify<{
@@ -167,7 +215,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
167
215
  } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>;
168
216
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
169
217
  id: string;
170
- } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, 'fields' | 'upload'> & {
218
+ } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, "fields" | "upload"> & {
171
219
  fields: TFields;
172
220
  upload: true;
173
221
  }): CollectionConfig<Prettify<{
@@ -175,7 +223,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
175
223
  } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>;
176
224
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
177
225
  id: string;
178
- } & InferDocShape<TFields> & SystemDocFields>>, 'fields'> & {
226
+ } & InferDocShape<TFields> & SystemDocFields>>, "fields"> & {
179
227
  fields: TFields;
180
228
  }): CollectionConfig<Prettify<{
181
229
  id: string;
@@ -206,7 +254,7 @@ declare function defineCollection<TDoc extends object>(config: CollectionConfig<
206
254
  * export const Settings = defineGlobal<SiteSettings>({ ... })
207
255
  * ```
208
256
  */
209
- declare function defineGlobal<const TFields extends Field[]>(config: Omit<GlobalConfig<Prettify<InferDocShape<TFields>>>, 'fields'> & {
257
+ declare function defineGlobal<const TFields extends Field[]>(config: Omit<GlobalConfig<Prettify<InferDocShape<TFields>>>, "fields"> & {
210
258
  fields: TFields;
211
259
  }): GlobalConfig<Prettify<InferDocShape<TFields>>>;
212
260
  declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>): GlobalConfig<TDoc>;
@@ -219,4 +267,4 @@ declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>):
219
267
  */
220
268
  declare function defineConfig(config: DyrectedConfig): DyrectedConfig;
221
269
 
222
- export { AuthDocFields, CollectionConfig, DyrectedConfig, Field, GlobalConfig, InferDocShape, Prettify, type SetupPromptConfig, type SortClause, type SortDirection, type SqlWhereResult, SystemDocFields, UploadDocFields, type WhereClause, type WhereOperator, type WhereOperatorName, defineCollection, defineConfig, defineGlobal, executeFieldAfterRead, executeFieldBeforeChange, generateAIPrompt, generateFreshSetupPrompt, normalizeConfig, parseMongoWhere, parseSort, parseSqlWhere, runCollectionHooks };
270
+ export { AuthDocFields, AuthenticatedUser, BaseDocument, CollectionConfig, DyrectedConfig, Field, GlobalConfig, HookRequestContext, InferDocShape, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, Prettify, type SortClause, type SortDirection, type SqlWhereResult, SystemDocFields, UploadDocFields, WORKFLOW_HISTORY_COLLECTION, type WhereClause, type WhereOperator, type WhereOperatorName, WorkflowConfig, WorkflowTransition, availableWorkflowTransitions, canViewWorkflowDraft, createLifecycleEvent, createWorkflowDocument, defineCollection, defineConfig, defineGlobal, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, executeFieldAfterRead, executeFieldBeforeChange, generateOpenApi, initializeWorkflowDocument, materializeWorkflowDocument, normalizeConfig, parseMongoWhere, parseSort, parseSqlWhere, publishingWorkflow, runCollectionHooks, saveWorkflowDraft, transitionWorkflow, workflowCapabilities };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,6 @@
1
- import { D as DyrectedConfig, F as Field, C as CollectionConfig, P as Prettify, I as InferDocShape, S as SystemDocFields, A as AuthDocFields, U as UploadDocFields, G as GlobalConfig } from './index-Bp7PDOYG.js';
2
- export { a as AccessFunction, b as AdminConfig, c as AuthenticatedUser, B as BaseDocument, d as Block, e as CollectionAfterChangeHook, f as CollectionAfterDeleteHook, g as CollectionAfterReadHook, h as CollectionBeforeChangeHook, i as CollectionBeforeDeleteHook, j as CollectionBeforeReadHook, k as DatabaseAdapter, l as DynamicOptionItem, m as DynamicOptionsConfig, n as DynamicOptionsResolver, o as DynamicOptionsResolverArgs, p as FieldAfterReadHook, q as FieldBeforeChangeHook, r as FieldHook, s as FieldType, t as FileData, u as GlobalAfterChangeHook, v as GlobalAfterReadHook, w as GlobalBeforeChangeHook, x as GlobalBeforeReadHook, H as HookFunction, y as HookRequestContext, z as ImageService, E as PaginatedResult, R as ReadonlyDatabaseAdapter, J as StorageAdapter, K as UploadConfig } from './index-Bp7PDOYG.js';
3
-
4
- interface SetupPromptConfig {
5
- siteName?: string;
6
- siteId?: string;
7
- apiKey?: string;
8
- baseUrl?: string;
9
- isSelfHosted?: boolean;
10
- existingSite?: boolean;
11
- }
12
- declare function generateFreshSetupPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
13
- declare function generateAIPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
1
+ import { D as DyrectedConfig, F as Field, W as WorkflowConfig, A as AuthenticatedUser, a as WorkflowTransition, L as LifecycleEventName, b as LifecycleEvent, C as CollectionConfig, B as BaseDocument, H as HookRequestContext, P as Prettify, I as InferDocShape, S as SystemDocFields, c as AuthDocFields, U as UploadDocFields, G as GlobalConfig } from './index-CdQwnbfh.js';
2
+ export { d as AccessFunction, e as AdminConfig, f as AdminDashboardComponentSlots, g as AdminIconName, h as Block, i as CollectionAfterChangeHook, j as CollectionAfterDeleteHook, k as CollectionAfterReadHook, l as CollectionAfterTransitionHook, m as CollectionBeforeChangeHook, n as CollectionBeforeDeleteHook, o as CollectionBeforeReadHook, p as CollectionBeforeTransitionHook, q as CollectionListComponentSlots, r as DatabaseAdapter, s as DynamicOptionItem, t as DynamicOptionsConfig, u as DynamicOptionsResolver, v as DynamicOptionsResolverArgs, w as FieldAfterReadHook, x as FieldBeforeChangeHook, y as FieldHook, z as FieldType, E as FileData, J as GlobalAfterChangeHook, K as GlobalAfterReadHook, M as GlobalBeforeChangeHook, N as GlobalBeforeReadHook, O as HookFunction, Q as ImageService, R as LIFECYCLE_EVENT_NAMES, T as LifecycleEventHandler, V as PaginatedResult, X as ReadonlyDatabaseAdapter, Y as StorageAdapter, Z as UploadConfig, _ as WorkflowMetadata, $ as WorkflowRole, a0 as WorkflowState, a1 as WorkflowTransitionContext } from './index-CdQwnbfh.js';
3
+ import 'lucide-react';
14
4
 
15
5
  /**
16
6
  * Normalizes the Dyrected configuration by injecting system fields
@@ -128,6 +118,64 @@ declare function executeFieldBeforeChange(fields: Field[], data: Record<string,
128
118
  */
129
119
  declare function executeFieldAfterRead(fields: Field[], doc: Record<string, unknown>, user: unknown, db?: unknown): Promise<Record<string, unknown>>;
130
120
 
121
+ /**
122
+ * Generate an OpenAPI 3.0 specification based on the Dyrected configuration.
123
+ */
124
+ declare function generateOpenApi(config: DyrectedConfig): any;
125
+
126
+ declare const WORKFLOW_HISTORY_COLLECTION = "__workflow_history";
127
+ declare const LIFECYCLE_EVENTS_COLLECTION = "__lifecycle_events";
128
+ declare function publishingWorkflow(): WorkflowConfig;
129
+ declare function workflowCapabilities(workflow: WorkflowConfig, user?: AuthenticatedUser): Set<string>;
130
+ declare function canViewWorkflowDraft(workflow: WorkflowConfig, user?: AuthenticatedUser): boolean;
131
+ declare function availableWorkflowTransitions(workflow: WorkflowConfig, state: string, user?: AuthenticatedUser): WorkflowTransition[];
132
+ declare function initializeWorkflowDocument(data: Record<string, unknown>, workflow: WorkflowConfig): {
133
+ __workflow: {
134
+ state: string;
135
+ revision: number;
136
+ };
137
+ };
138
+ declare function materializeWorkflowDocument(doc: BaseDocument, workflow: WorkflowConfig, user?: AuthenticatedUser): BaseDocument | null;
139
+ declare function createLifecycleEvent(args: {
140
+ name: LifecycleEventName;
141
+ collection: string;
142
+ documentId: string;
143
+ actorId?: string;
144
+ payload: Record<string, unknown>;
145
+ }): LifecycleEvent;
146
+ declare function dispatchLifecycleEvent(config: DyrectedConfig, event: LifecycleEvent): Promise<void>;
147
+ declare function dispatchPendingLifecycleEvents(config: DyrectedConfig, limit?: number): Promise<number>;
148
+ declare function saveWorkflowDraft(args: {
149
+ config: DyrectedConfig;
150
+ collection: CollectionConfig;
151
+ id: string;
152
+ originalDoc: BaseDocument;
153
+ data: Record<string, unknown>;
154
+ user?: AuthenticatedUser;
155
+ }): Promise<{
156
+ doc: BaseDocument;
157
+ event: LifecycleEvent;
158
+ }>;
159
+ declare function createWorkflowDocument(args: {
160
+ config: DyrectedConfig;
161
+ collection: CollectionConfig;
162
+ data: Record<string, unknown>;
163
+ user?: AuthenticatedUser;
164
+ }): Promise<{
165
+ doc: BaseDocument;
166
+ event: LifecycleEvent;
167
+ }>;
168
+ declare function transitionWorkflow(args: {
169
+ config: DyrectedConfig;
170
+ collection: CollectionConfig;
171
+ id: string;
172
+ transitionName: string;
173
+ expectedRevision?: number;
174
+ comment?: string;
175
+ user?: AuthenticatedUser;
176
+ req: HookRequestContext;
177
+ }): Promise<BaseDocument>;
178
+
131
179
  /**
132
180
  * Define a collection. When called without an explicit type argument, TypeScript
133
181
  * automatically infers the document shape from the `fields` array you provide —
@@ -159,7 +207,7 @@ declare function executeFieldAfterRead(fields: Field[], doc: Record<string, unkn
159
207
  */
160
208
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
161
209
  id: string;
162
- } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, 'fields' | 'auth'> & {
210
+ } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, "fields" | "auth"> & {
163
211
  fields: TFields;
164
212
  auth: true;
165
213
  }): CollectionConfig<Prettify<{
@@ -167,7 +215,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
167
215
  } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>;
168
216
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
169
217
  id: string;
170
- } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, 'fields' | 'upload'> & {
218
+ } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, "fields" | "upload"> & {
171
219
  fields: TFields;
172
220
  upload: true;
173
221
  }): CollectionConfig<Prettify<{
@@ -175,7 +223,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
175
223
  } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>;
176
224
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
177
225
  id: string;
178
- } & InferDocShape<TFields> & SystemDocFields>>, 'fields'> & {
226
+ } & InferDocShape<TFields> & SystemDocFields>>, "fields"> & {
179
227
  fields: TFields;
180
228
  }): CollectionConfig<Prettify<{
181
229
  id: string;
@@ -206,7 +254,7 @@ declare function defineCollection<TDoc extends object>(config: CollectionConfig<
206
254
  * export const Settings = defineGlobal<SiteSettings>({ ... })
207
255
  * ```
208
256
  */
209
- declare function defineGlobal<const TFields extends Field[]>(config: Omit<GlobalConfig<Prettify<InferDocShape<TFields>>>, 'fields'> & {
257
+ declare function defineGlobal<const TFields extends Field[]>(config: Omit<GlobalConfig<Prettify<InferDocShape<TFields>>>, "fields"> & {
210
258
  fields: TFields;
211
259
  }): GlobalConfig<Prettify<InferDocShape<TFields>>>;
212
260
  declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>): GlobalConfig<TDoc>;
@@ -219,4 +267,4 @@ declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>):
219
267
  */
220
268
  declare function defineConfig(config: DyrectedConfig): DyrectedConfig;
221
269
 
222
- export { AuthDocFields, CollectionConfig, DyrectedConfig, Field, GlobalConfig, InferDocShape, Prettify, type SetupPromptConfig, type SortClause, type SortDirection, type SqlWhereResult, SystemDocFields, UploadDocFields, type WhereClause, type WhereOperator, type WhereOperatorName, defineCollection, defineConfig, defineGlobal, executeFieldAfterRead, executeFieldBeforeChange, generateAIPrompt, generateFreshSetupPrompt, normalizeConfig, parseMongoWhere, parseSort, parseSqlWhere, runCollectionHooks };
270
+ export { AuthDocFields, AuthenticatedUser, BaseDocument, CollectionConfig, DyrectedConfig, Field, GlobalConfig, HookRequestContext, InferDocShape, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, Prettify, type SortClause, type SortDirection, type SqlWhereResult, SystemDocFields, UploadDocFields, WORKFLOW_HISTORY_COLLECTION, type WhereClause, type WhereOperator, type WhereOperatorName, WorkflowConfig, WorkflowTransition, availableWorkflowTransitions, canViewWorkflowDraft, createLifecycleEvent, createWorkflowDocument, defineCollection, defineConfig, defineGlobal, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, executeFieldAfterRead, executeFieldBeforeChange, generateOpenApi, initializeWorkflowDocument, materializeWorkflowDocument, normalizeConfig, parseMongoWhere, parseSort, parseSqlWhere, publishingWorkflow, runCollectionHooks, saveWorkflowDraft, transitionWorkflow, workflowCapabilities };