@dyrected/core 2.5.30 → 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,18 +1,7 @@
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-DTrpTru7.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-DTrpTru7.cjs';
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
3
  import 'lucide-react';
4
4
 
5
- interface SetupPromptConfig {
6
- siteName?: string;
7
- siteId?: string;
8
- apiKey?: string;
9
- baseUrl?: string;
10
- isSelfHosted?: boolean;
11
- existingSite?: boolean;
12
- }
13
- declare function generateFreshSetupPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
14
- declare function generateAIPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
15
-
16
5
  /**
17
6
  * Normalizes the Dyrected configuration by injecting system fields
18
7
  * (createdAt, updatedAt, createdBy, updatedBy) into every collection and
@@ -129,10 +118,16 @@ declare function executeFieldBeforeChange(fields: Field[], data: Record<string,
129
118
  */
130
119
  declare function executeFieldAfterRead(fields: Field[], doc: Record<string, unknown>, user: unknown, db?: unknown): Promise<Record<string, unknown>>;
131
120
 
121
+ /**
122
+ * Generate an OpenAPI 3.0 specification based on the Dyrected configuration.
123
+ */
124
+ declare function generateOpenApi(config: DyrectedConfig): any;
125
+
132
126
  declare const WORKFLOW_HISTORY_COLLECTION = "__workflow_history";
133
127
  declare const LIFECYCLE_EVENTS_COLLECTION = "__lifecycle_events";
134
128
  declare function publishingWorkflow(): WorkflowConfig;
135
129
  declare function workflowCapabilities(workflow: WorkflowConfig, user?: AuthenticatedUser): Set<string>;
130
+ declare function canViewWorkflowDraft(workflow: WorkflowConfig, user?: AuthenticatedUser): boolean;
136
131
  declare function availableWorkflowTransitions(workflow: WorkflowConfig, state: string, user?: AuthenticatedUser): WorkflowTransition[];
137
132
  declare function initializeWorkflowDocument(data: Record<string, unknown>, workflow: WorkflowConfig): {
138
133
  __workflow: {
@@ -212,7 +207,7 @@ declare function transitionWorkflow(args: {
212
207
  */
213
208
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
214
209
  id: string;
215
- } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, 'fields' | 'auth'> & {
210
+ } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, "fields" | "auth"> & {
216
211
  fields: TFields;
217
212
  auth: true;
218
213
  }): CollectionConfig<Prettify<{
@@ -220,7 +215,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
220
215
  } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>;
221
216
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
222
217
  id: string;
223
- } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, 'fields' | 'upload'> & {
218
+ } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, "fields" | "upload"> & {
224
219
  fields: TFields;
225
220
  upload: true;
226
221
  }): CollectionConfig<Prettify<{
@@ -228,7 +223,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
228
223
  } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>;
229
224
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
230
225
  id: string;
231
- } & InferDocShape<TFields> & SystemDocFields>>, 'fields'> & {
226
+ } & InferDocShape<TFields> & SystemDocFields>>, "fields"> & {
232
227
  fields: TFields;
233
228
  }): CollectionConfig<Prettify<{
234
229
  id: string;
@@ -259,7 +254,7 @@ declare function defineCollection<TDoc extends object>(config: CollectionConfig<
259
254
  * export const Settings = defineGlobal<SiteSettings>({ ... })
260
255
  * ```
261
256
  */
262
- 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"> & {
263
258
  fields: TFields;
264
259
  }): GlobalConfig<Prettify<InferDocShape<TFields>>>;
265
260
  declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>): GlobalConfig<TDoc>;
@@ -272,4 +267,4 @@ declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>):
272
267
  */
273
268
  declare function defineConfig(config: DyrectedConfig): DyrectedConfig;
274
269
 
275
- export { AuthDocFields, AuthenticatedUser, BaseDocument, CollectionConfig, DyrectedConfig, Field, GlobalConfig, HookRequestContext, InferDocShape, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, Prettify, type SetupPromptConfig, type SortClause, type SortDirection, type SqlWhereResult, SystemDocFields, UploadDocFields, WORKFLOW_HISTORY_COLLECTION, type WhereClause, type WhereOperator, type WhereOperatorName, WorkflowConfig, WorkflowTransition, availableWorkflowTransitions, createLifecycleEvent, createWorkflowDocument, defineCollection, defineConfig, defineGlobal, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, executeFieldAfterRead, executeFieldBeforeChange, generateAIPrompt, generateFreshSetupPrompt, initializeWorkflowDocument, materializeWorkflowDocument, normalizeConfig, parseMongoWhere, parseSort, parseSqlWhere, publishingWorkflow, runCollectionHooks, saveWorkflowDraft, transitionWorkflow, workflowCapabilities };
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,18 +1,7 @@
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-DTrpTru7.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-DTrpTru7.js';
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
3
  import 'lucide-react';
4
4
 
5
- interface SetupPromptConfig {
6
- siteName?: string;
7
- siteId?: string;
8
- apiKey?: string;
9
- baseUrl?: string;
10
- isSelfHosted?: boolean;
11
- existingSite?: boolean;
12
- }
13
- declare function generateFreshSetupPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
14
- declare function generateAIPrompt(activeTab: "next" | "nuxt" | "react" | "vue", config: SetupPromptConfig): string;
15
-
16
5
  /**
17
6
  * Normalizes the Dyrected configuration by injecting system fields
18
7
  * (createdAt, updatedAt, createdBy, updatedBy) into every collection and
@@ -129,10 +118,16 @@ declare function executeFieldBeforeChange(fields: Field[], data: Record<string,
129
118
  */
130
119
  declare function executeFieldAfterRead(fields: Field[], doc: Record<string, unknown>, user: unknown, db?: unknown): Promise<Record<string, unknown>>;
131
120
 
121
+ /**
122
+ * Generate an OpenAPI 3.0 specification based on the Dyrected configuration.
123
+ */
124
+ declare function generateOpenApi(config: DyrectedConfig): any;
125
+
132
126
  declare const WORKFLOW_HISTORY_COLLECTION = "__workflow_history";
133
127
  declare const LIFECYCLE_EVENTS_COLLECTION = "__lifecycle_events";
134
128
  declare function publishingWorkflow(): WorkflowConfig;
135
129
  declare function workflowCapabilities(workflow: WorkflowConfig, user?: AuthenticatedUser): Set<string>;
130
+ declare function canViewWorkflowDraft(workflow: WorkflowConfig, user?: AuthenticatedUser): boolean;
136
131
  declare function availableWorkflowTransitions(workflow: WorkflowConfig, state: string, user?: AuthenticatedUser): WorkflowTransition[];
137
132
  declare function initializeWorkflowDocument(data: Record<string, unknown>, workflow: WorkflowConfig): {
138
133
  __workflow: {
@@ -212,7 +207,7 @@ declare function transitionWorkflow(args: {
212
207
  */
213
208
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
214
209
  id: string;
215
- } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, 'fields' | 'auth'> & {
210
+ } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>, "fields" | "auth"> & {
216
211
  fields: TFields;
217
212
  auth: true;
218
213
  }): CollectionConfig<Prettify<{
@@ -220,7 +215,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
220
215
  } & InferDocShape<TFields> & SystemDocFields & AuthDocFields>>;
221
216
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
222
217
  id: string;
223
- } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, 'fields' | 'upload'> & {
218
+ } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>, "fields" | "upload"> & {
224
219
  fields: TFields;
225
220
  upload: true;
226
221
  }): CollectionConfig<Prettify<{
@@ -228,7 +223,7 @@ declare function defineCollection<const TFields extends Field[]>(config: Omit<Co
228
223
  } & InferDocShape<TFields> & SystemDocFields & UploadDocFields>>;
229
224
  declare function defineCollection<const TFields extends Field[]>(config: Omit<CollectionConfig<Prettify<{
230
225
  id: string;
231
- } & InferDocShape<TFields> & SystemDocFields>>, 'fields'> & {
226
+ } & InferDocShape<TFields> & SystemDocFields>>, "fields"> & {
232
227
  fields: TFields;
233
228
  }): CollectionConfig<Prettify<{
234
229
  id: string;
@@ -259,7 +254,7 @@ declare function defineCollection<TDoc extends object>(config: CollectionConfig<
259
254
  * export const Settings = defineGlobal<SiteSettings>({ ... })
260
255
  * ```
261
256
  */
262
- 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"> & {
263
258
  fields: TFields;
264
259
  }): GlobalConfig<Prettify<InferDocShape<TFields>>>;
265
260
  declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>): GlobalConfig<TDoc>;
@@ -272,4 +267,4 @@ declare function defineGlobal<TDoc extends object>(config: GlobalConfig<TDoc>):
272
267
  */
273
268
  declare function defineConfig(config: DyrectedConfig): DyrectedConfig;
274
269
 
275
- export { AuthDocFields, AuthenticatedUser, BaseDocument, CollectionConfig, DyrectedConfig, Field, GlobalConfig, HookRequestContext, InferDocShape, LIFECYCLE_EVENTS_COLLECTION, LifecycleEvent, LifecycleEventName, Prettify, type SetupPromptConfig, type SortClause, type SortDirection, type SqlWhereResult, SystemDocFields, UploadDocFields, WORKFLOW_HISTORY_COLLECTION, type WhereClause, type WhereOperator, type WhereOperatorName, WorkflowConfig, WorkflowTransition, availableWorkflowTransitions, createLifecycleEvent, createWorkflowDocument, defineCollection, defineConfig, defineGlobal, dispatchLifecycleEvent, dispatchPendingLifecycleEvents, executeFieldAfterRead, executeFieldBeforeChange, generateAIPrompt, generateFreshSetupPrompt, initializeWorkflowDocument, materializeWorkflowDocument, normalizeConfig, parseMongoWhere, parseSort, parseSqlWhere, publishingWorkflow, runCollectionHooks, saveWorkflowDraft, transitionWorkflow, workflowCapabilities };
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 };