@nixxie-cms/core 1.0.3 → 2.0.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/CHANGELOG.md +36 -0
- package/CHANGES-1.1.md +134 -0
- package/context/dist/nixxie-cms-core-context.cjs.js +4 -3
- package/context/dist/nixxie-cms-core-context.esm.js +3 -2
- package/dist/declarations/src/access.d.ts +2 -2
- package/dist/declarations/src/access.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/components/Navigation.d.ts +2 -2
- package/dist/declarations/src/admin-ui/components/Navigation.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/context.d.ts +6 -6
- package/dist/declarations/src/admin-ui/context.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/Fields.d.ts +3 -3
- package/dist/declarations/src/admin-ui/utils/Fields.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/filters.d.ts +5 -5
- package/dist/declarations/src/admin-ui/utils/filters.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/useCreateItem.d.ts +3 -3
- package/dist/declarations/src/admin-ui/utils/useCreateItem.d.ts.map +1 -1
- package/dist/declarations/src/admin-ui/utils/utils.d.ts +2 -2
- package/dist/declarations/src/admin-ui/utils/utils.d.ts.map +1 -1
- package/dist/declarations/src/context.d.ts +1 -1
- package/dist/declarations/src/context.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/bigInt/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/bigInt/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/bytes/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/bytes/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/calendarDay/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/calendarDay/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/checkbox/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/checkbox/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/decimal/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/decimal/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/file/index.d.ts +4 -4
- package/dist/declarations/src/fields/types/file/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/float/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/float/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/image/index.d.ts +4 -4
- package/dist/declarations/src/fields/types/image/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/integer/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/integer/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/json/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/json/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/multiselect/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/multiselect/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/multiselect/views/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/password/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/password/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/index.d.ts +8 -8
- package/dist/declarations/src/fields/types/relationship/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/ComboboxMany.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/ComboboxMany.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/ComboboxSingle.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/ComboboxSingle.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/relationship/views/types.d.ts +3 -3
- package/dist/declarations/src/fields/types/relationship/views/types.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/select/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/select/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/text/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/text/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/timestamp/index.d.ts +3 -3
- package/dist/declarations/src/fields/types/timestamp/index.d.ts.map +1 -1
- package/dist/declarations/src/fields/types/virtual/index.d.ts +7 -7
- package/dist/declarations/src/fields/types/virtual/index.d.ts.map +1 -1
- package/dist/declarations/src/helpers.d.ts +249 -13
- package/dist/declarations/src/helpers.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts +9 -4
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/declarations/src/internal-unstable/admin-ui/pages/ListPage/index.d.ts.map +1 -1
- package/dist/declarations/src/lib/admin-meta.d.ts +11 -11
- package/dist/declarations/src/lib/admin-meta.d.ts.map +1 -1
- package/dist/declarations/src/lib/core/access-control.d.ts +18 -18
- package/dist/declarations/src/lib/core/access-control.d.ts.map +1 -1
- package/dist/declarations/src/lib/core/cascade.d.ts +47 -0
- package/dist/declarations/src/lib/core/cascade.d.ts.map +1 -0
- package/dist/declarations/src/lib/core/initialise-lists.d.ts +27 -24
- package/dist/declarations/src/lib/core/initialise-lists.d.ts.map +1 -1
- package/dist/declarations/src/lib/env.d.ts +9 -0
- package/dist/declarations/src/lib/env.d.ts.map +1 -0
- package/dist/declarations/src/lib/system.d.ts +1 -1
- package/dist/declarations/src/lib/system.d.ts.map +1 -1
- package/dist/declarations/src/list-features.d.ts +162 -0
- package/dist/declarations/src/list-features.d.ts.map +1 -0
- package/dist/declarations/src/schema.d.ts +24 -23
- package/dist/declarations/src/schema.d.ts.map +1 -1
- package/dist/declarations/src/session.d.ts +75 -0
- package/dist/declarations/src/session.d.ts.map +1 -1
- package/dist/declarations/src/types/admin-meta.d.ts +11 -11
- package/dist/declarations/src/types/admin-meta.d.ts.map +1 -1
- package/dist/declarations/src/types/config/access-control.d.ts +42 -42
- package/dist/declarations/src/types/config/access-control.d.ts.map +1 -1
- package/dist/declarations/src/types/config/fields.d.ts +19 -19
- package/dist/declarations/src/types/config/fields.d.ts.map +1 -1
- package/dist/declarations/src/types/config/hooks.d.ts +131 -131
- package/dist/declarations/src/types/config/hooks.d.ts.map +1 -1
- package/dist/declarations/src/types/config/index.d.ts +190 -8
- package/dist/declarations/src/types/config/index.d.ts.map +1 -1
- package/dist/declarations/src/types/config/lists.d.ts +146 -108
- package/dist/declarations/src/types/config/lists.d.ts.map +1 -1
- package/dist/declarations/src/types/context.d.ts +507 -47
- package/dist/declarations/src/types/context.d.ts.map +1 -1
- package/dist/declarations/src/types/next-fields.d.ts +28 -28
- package/dist/declarations/src/types/next-fields.d.ts.map +1 -1
- package/dist/declarations/src/types/type-info.d.ts +3 -3
- package/dist/declarations/src/types/type-info.d.ts.map +1 -1
- package/dist/{express-455ae20c.cjs.js → express-84d534c2.cjs.js} +6 -6
- package/dist/{express-7559ca2d.esm.js → express-d0a4ce99.esm.js} +6 -6
- package/dist/{index-15c8f81e.esm.js → index-5d8b0b4e.esm.js} +363 -183
- package/dist/index-6055753b.cjs.js +393 -0
- package/dist/{index-42045902.cjs.js → index-ac29f382.cjs.js} +363 -185
- package/dist/index-f1703b7b.esm.js +386 -0
- package/dist/nixxie-cms-core.cjs.js +1388 -30
- package/dist/nixxie-cms-core.esm.js +1362 -24
- package/dist/{non-null-graphql-add6bb3d.cjs.js → non-null-graphql-4a44c122.cjs.js} +1 -1
- package/dist/{non-null-graphql-a84ed64d.esm.js → non-null-graphql-8c5feaae.esm.js} +1 -1
- package/dist/{resolve-hooks-165a9ce2.cjs.js → resolve-hooks-10a5f84c.cjs.js} +240 -6
- package/dist/{resolve-hooks-6813a045.esm.js → resolve-hooks-9e676794.esm.js} +238 -7
- package/dist/{system-a321642d.cjs.js → system-6b37a5f8.cjs.js} +33 -7
- package/dist/{system-03e49e4f.esm.js → system-e591d821.esm.js} +33 -7
- package/fields/dist/nixxie-cms-core-fields.cjs.js +29 -576
- package/fields/dist/nixxie-cms-core-fields.esm.js +18 -565
- package/fields/types/bytes/dist/nixxie-cms-core-fields-types-bytes.cjs.js +4 -2
- package/fields/types/bytes/dist/nixxie-cms-core-fields-types-bytes.esm.js +4 -2
- package/fields/types/multiselect/views/dist/nixxie-cms-core-fields-types-multiselect-views.cjs.js +1 -6
- package/fields/types/multiselect/views/dist/nixxie-cms-core-fields-types-multiselect-views.esm.js +1 -6
- package/fields/types/password/dist/nixxie-cms-core-fields-types-password.cjs.js +4 -2
- package/fields/types/password/dist/nixxie-cms-core-fields-types-password.esm.js +4 -2
- package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.cjs.js +4 -3
- package/internal-unstable/artifacts/dist/nixxie-cms-core-internal-unstable-artifacts.esm.js +4 -3
- package/package.json +4 -4
- package/scripts/cli/dist/nixxie-cms-core-scripts-cli.cjs.js +4 -3
- package/scripts/cli/dist/nixxie-cms-core-scripts-cli.esm.js +4 -3
- package/scripts/dist/nixxie-cms-core-scripts.cjs.js +4 -3
- package/scripts/dist/nixxie-cms-core-scripts.esm.js +4 -3
- package/session/dist/nixxie-cms-core-session.cjs.js +286 -0
- package/session/dist/nixxie-cms-core-session.esm.js +279 -1
- package/src/access.ts +25 -25
- package/src/admin-ui/admin-meta-graphql.ts +5 -5
- package/src/admin-ui/components/CreateButtonLink.tsx +46 -46
- package/src/admin-ui/components/Navigation.tsx +3 -3
- package/src/admin-ui/context.tsx +6 -6
- package/src/admin-ui/utils/Fields.tsx +241 -241
- package/src/admin-ui/utils/actionData.ts +36 -36
- package/src/admin-ui/utils/filters.ts +148 -148
- package/src/admin-ui/utils/useCreateItem.ts +171 -171
- package/src/admin-ui/utils/utils.tsx +127 -127
- package/src/context.ts +1 -1
- package/src/fields/non-null-graphql.ts +115 -115
- package/src/fields/types/bigInt/index.ts +6 -6
- package/src/fields/types/bytes/index.ts +6 -6
- package/src/fields/types/calendarDay/index.ts +18 -19
- package/src/fields/types/checkbox/index.ts +6 -6
- package/src/fields/types/decimal/index.ts +6 -6
- package/src/fields/types/file/index.ts +8 -8
- package/src/fields/types/float/index.ts +6 -6
- package/src/fields/types/image/index.ts +8 -8
- package/src/fields/types/integer/index.ts +6 -6
- package/src/fields/types/json/index.ts +5 -5
- package/src/fields/types/multiselect/index.ts +7 -7
- package/src/fields/types/multiselect/views/index.tsx +149 -151
- package/src/fields/types/password/index.ts +6 -6
- package/src/fields/types/relationship/index.ts +13 -13
- package/src/fields/types/relationship/views/ComboboxMany.tsx +110 -110
- package/src/fields/types/relationship/views/ComboboxSingle.tsx +115 -115
- package/src/fields/types/relationship/views/ContextualActions.tsx +139 -139
- package/src/fields/types/relationship/views/index.tsx +492 -492
- package/src/fields/types/relationship/views/types.ts +46 -46
- package/src/fields/types/relationship/views/useApolloQuery.ts +185 -185
- package/src/fields/types/relationship/views/useFilter.tsx +109 -109
- package/src/fields/types/select/index.ts +6 -6
- package/src/fields/types/text/index.ts +6 -6
- package/src/fields/types/timestamp/index.ts +23 -21
- package/src/fields/types/virtual/index.ts +11 -11
- package/src/helpers.ts +773 -42
- package/src/index.ts +66 -24
- package/src/internal-unstable/admin-ui/pages/ItemPage/common.tsx +4 -4
- package/src/internal-unstable/admin-ui/pages/ItemPage/index.tsx +5 -5
- package/src/internal-unstable/admin-ui/pages/ListPage/index.tsx +8 -8
- package/src/lib/admin-meta.ts +369 -369
- package/src/lib/context/createContext.ts +6 -0
- package/src/lib/core/access-control.ts +434 -434
- package/src/lib/core/cascade.ts +236 -0
- package/src/lib/core/initialise-lists.ts +49 -33
- package/src/lib/core/mutations/index.ts +7 -0
- package/src/lib/core/mutations/nested-mutation-many-input-resolvers.ts +145 -145
- package/src/lib/core/mutations/nested-mutation-one-input-resolvers.ts +71 -71
- package/src/lib/core/queries/output-field.ts +178 -178
- package/src/lib/env.ts +50 -0
- package/src/lib/id-field.ts +2 -2
- package/src/lib/system.ts +221 -207
- package/src/lib/typescript-schema-printer.ts +227 -227
- package/src/list-features.ts +476 -0
- package/src/schema.ts +92 -22
- package/src/session.ts +225 -0
- package/src/types/admin-meta.ts +218 -218
- package/src/types/config/access-control.ts +186 -186
- package/src/types/config/fields.ts +96 -96
- package/src/types/config/hooks.ts +529 -529
- package/src/types/config/index.ts +206 -7
- package/src/types/config/lists.ts +606 -565
- package/src/types/context.ts +592 -55
- package/src/types/next-fields.ts +31 -31
- package/src/types/type-info.ts +38 -38
- package/src/types/type-tests.ts +21 -21
|
@@ -10,27 +10,33 @@ import type { GraphQLSchema } from 'graphql'
|
|
|
10
10
|
import type {
|
|
11
11
|
BaseNixxieTypeInfo,
|
|
12
12
|
DatabaseProvider,
|
|
13
|
+
NixxieAiRagService,
|
|
13
14
|
NixxieAiService,
|
|
15
|
+
NixxieApiKeysService,
|
|
14
16
|
NixxieAuditService,
|
|
17
|
+
NixxieBackupService,
|
|
15
18
|
NixxieCacheService,
|
|
16
19
|
NixxieContext,
|
|
17
20
|
NixxieEmailService,
|
|
18
21
|
NixxieHealthService,
|
|
19
22
|
NixxieJobsService,
|
|
23
|
+
NixxieLoggerService,
|
|
20
24
|
NixxieNotificationsService,
|
|
21
25
|
NixxieRateLimitService,
|
|
22
26
|
NixxieSearchService,
|
|
23
27
|
NixxieStorageService,
|
|
28
|
+
NixxieVersioningService,
|
|
24
29
|
NixxieWebhooksService,
|
|
30
|
+
NixxieWorkflowService,
|
|
25
31
|
} from '..'
|
|
26
32
|
import type { SessionStrategy } from '../session'
|
|
27
33
|
import type { MaybePromise } from '../utils'
|
|
28
|
-
import type { FieldAccessControl,
|
|
34
|
+
import type { FieldAccessControl, CollectionAccessControl } from './access-control'
|
|
29
35
|
import type { BaseFields } from './fields'
|
|
30
|
-
import type { FieldHooks,
|
|
36
|
+
import type { FieldHooks, CollectionHooks } from './hooks'
|
|
31
37
|
import type {
|
|
32
38
|
IdFieldConfig,
|
|
33
|
-
|
|
39
|
+
CollectionConfig,
|
|
34
40
|
MaybeItemFunctionWithFilter,
|
|
35
41
|
MaybeSessionFunction,
|
|
36
42
|
} from './lists'
|
|
@@ -46,11 +52,95 @@ type PrismaLogDefinition = {
|
|
|
46
52
|
emit: 'stdout' | 'event'
|
|
47
53
|
}
|
|
48
54
|
|
|
55
|
+
/**
|
|
56
|
+
* A Nixxie plugin — one object that can contribute collections, transform the config,
|
|
57
|
+
* and run setup once the database connects. Register via `config({ plugins: [...] })`.
|
|
58
|
+
*
|
|
59
|
+
* Plugins are applied in array order: collections are merged first (a key conflict with
|
|
60
|
+
* the user's collections or an earlier plugin throws), then `extendConfig` runs, then at
|
|
61
|
+
* boot every plugin's `onConnect` runs (in order) before `db.onConnect`.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* export function myPlugin(): NixxiePlugin {
|
|
65
|
+
* return {
|
|
66
|
+
* name: 'my-plugin',
|
|
67
|
+
* collections: { MyPluginLog: collection({ fields: { ... } }) },
|
|
68
|
+
* extendConfig: config => ({
|
|
69
|
+
* ...config,
|
|
70
|
+
* server: {
|
|
71
|
+
* ...config.server,
|
|
72
|
+
* extendExpressApp: async (app, context) => {
|
|
73
|
+
* await config.server?.extendExpressApp?.(app, context)
|
|
74
|
+
* app.get('/my-plugin/ping', (_, res) => res.send('pong'))
|
|
75
|
+
* },
|
|
76
|
+
* },
|
|
77
|
+
* }),
|
|
78
|
+
* onConnect: async context => { ... },
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
*/
|
|
82
|
+
export type NixxiePlugin<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInfo> = {
|
|
83
|
+
/** Unique name, used in error messages. */
|
|
84
|
+
name: string
|
|
85
|
+
/** Collections contributed by this plugin. A key conflict throws at config build time. */
|
|
86
|
+
collections?: Record<string, CollectionConfig<any>>
|
|
87
|
+
/**
|
|
88
|
+
* Transform the (pre-normalisation) config — register services, wrap hooks, extend
|
|
89
|
+
* the Express app, etc. Must return the new config.
|
|
90
|
+
*/
|
|
91
|
+
extendConfig?: (config: NixxieConfigPre<TypeInfo>) => NixxieConfigPre<TypeInfo>
|
|
92
|
+
/** Run once the database has connected, before the user's `db.onConnect`. */
|
|
93
|
+
onConnect?: (context: NixxieContext<TypeInfo>) => MaybePromise<void>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Requirements for a single environment variable (see `NixxieConfigPre['env']`). */
|
|
97
|
+
export type NixxieEnvVarSpec = {
|
|
98
|
+
/**
|
|
99
|
+
* Fail at boot when the variable is unset (and no `default` is given).
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
required?: boolean
|
|
103
|
+
/** Regex the value must match (checked when the variable is set). */
|
|
104
|
+
pattern?: RegExp
|
|
105
|
+
/** Applied to `process.env` when the variable is unset. */
|
|
106
|
+
default?: string
|
|
107
|
+
/** Shown in the boot error to explain what the variable is for. */
|
|
108
|
+
description?: string
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Environment validation spec: either a list of required variable names, or a record of
|
|
113
|
+
* per-variable requirements. Validated when the config is built, so a misconfigured
|
|
114
|
+
* deployment fails immediately with one aggregated, readable error instead of a
|
|
115
|
+
* confusing crash later.
|
|
116
|
+
*/
|
|
117
|
+
export type NixxieEnvSpec = readonly string[] | Record<string, NixxieEnvVarSpec>
|
|
118
|
+
|
|
49
119
|
export type NixxieConfigPre<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInfo> = {
|
|
50
120
|
types?: {
|
|
51
121
|
path: string
|
|
52
122
|
}
|
|
53
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Plugins to apply to this config (collections + config transforms + boot hooks).
|
|
126
|
+
* See `NixxiePlugin`.
|
|
127
|
+
*/
|
|
128
|
+
plugins?: NixxiePlugin<TypeInfo>[]
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Environment variables this app needs. Validated at config build time —
|
|
132
|
+
* missing or malformed variables fail the boot with one aggregated error.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* env: ['DATABASE_URL', 'SESSION_SECRET']
|
|
136
|
+
* @example
|
|
137
|
+
* env: {
|
|
138
|
+
* DATABASE_URL: { description: 'Postgres connection string' },
|
|
139
|
+
* SMTP_PORT: { required: false, pattern: /^\d+$/, default: '587' },
|
|
140
|
+
* }
|
|
141
|
+
*/
|
|
142
|
+
env?: NixxieEnvSpec
|
|
143
|
+
|
|
54
144
|
db: {
|
|
55
145
|
provider: DatabaseProvider
|
|
56
146
|
url: string
|
|
@@ -133,7 +223,7 @@ export type NixxieConfigPre<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieType
|
|
|
133
223
|
extendGraphqlSchema?: (schema: GraphQLSchema) => GraphQLSchema
|
|
134
224
|
}
|
|
135
225
|
|
|
136
|
-
|
|
226
|
+
collections: Record<string, CollectionConfig<any>>
|
|
137
227
|
server?: {
|
|
138
228
|
/** Configuration options for the cors middleware. Set to `true` to use Nixxie's defaults */
|
|
139
229
|
cors?: boolean | CorsOptions
|
|
@@ -331,6 +421,109 @@ export type NixxieConfigPre<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieType
|
|
|
331
421
|
*/
|
|
332
422
|
ai?: NixxieAiService
|
|
333
423
|
|
|
424
|
+
/**
|
|
425
|
+
* Custom RAG assistant created with `createAiRag()` from `@nixxie-cms/ai-rag`.
|
|
426
|
+
* Available as `context.services.aiRag`. Stores a knowledge base, indexes it into
|
|
427
|
+
* embeddings, and answers questions grounded in that content with citations and
|
|
428
|
+
* hallucination guarding. Prefer registering it via `ragPlugin()` so the knowledge-base
|
|
429
|
+
* collections, HTTP routes and scheduled indexing are wired automatically.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```ts
|
|
433
|
+
* import { createAiRag, ragPlugin } from '@nixxie-cms/ai-rag'
|
|
434
|
+
* const aiRag = createAiRag({
|
|
435
|
+
* generation: { provider: 'anthropic', apiKey: process.env.ANTHROPIC_API_KEY! },
|
|
436
|
+
* embedding: { provider: 'openai', apiKey: process.env.OPENAI_API_KEY! },
|
|
437
|
+
* })
|
|
438
|
+
* export default config({ aiRag, plugins: [ragPlugin({ service: aiRag })] })
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
aiRag?: NixxieAiRagService
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Content revision history created with `createVersioning()` from
|
|
445
|
+
* `@nixxie-cms/versioning`. Available as `context.services.versioning`.
|
|
446
|
+
* Snapshots item data so changes can be listed, diffed and rolled back.
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```ts
|
|
450
|
+
* import { createVersioning } from '@nixxie-cms/versioning'
|
|
451
|
+
* export default config({
|
|
452
|
+
* versioning: createVersioning({ store: 'memory' }),
|
|
453
|
+
* })
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
versioning?: NixxieVersioningService
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Editorial state machine created with `createWorkflow()` from
|
|
460
|
+
* `@nixxie-cms/workflow`. Available as `context.services.workflow`.
|
|
461
|
+
* Enforces allowed transitions (e.g. draft → review → published).
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```ts
|
|
465
|
+
* import { createWorkflow } from '@nixxie-cms/workflow'
|
|
466
|
+
* export default config({
|
|
467
|
+
* workflow: createWorkflow({
|
|
468
|
+
* name: 'editorial',
|
|
469
|
+
* initial: 'draft',
|
|
470
|
+
* states: ['draft', 'review', 'published'],
|
|
471
|
+
* transitions: [
|
|
472
|
+
* { from: 'draft', to: 'review', name: 'submit' },
|
|
473
|
+
* { from: 'review', to: 'published', name: 'publish' },
|
|
474
|
+
* { from: 'review', to: 'draft', name: 'reject' },
|
|
475
|
+
* ],
|
|
476
|
+
* }),
|
|
477
|
+
* })
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
workflow?: NixxieWorkflowService
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Machine-to-machine API keys created with `createApiKeys()` from
|
|
484
|
+
* `@nixxie-cms/api-keys`. Available as `context.services.apiKeys`.
|
|
485
|
+
* Issues scoped, revocable tokens; only key hashes are stored.
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* ```ts
|
|
489
|
+
* import { createApiKeys } from '@nixxie-cms/api-keys'
|
|
490
|
+
* export default config({
|
|
491
|
+
* apiKeys: createApiKeys({ store: 'memory', prefix: 'nxk' }),
|
|
492
|
+
* })
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
apiKeys?: NixxieApiKeysService
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Structured logger created with `createLogger()` from `@nixxie-cms/logger`.
|
|
499
|
+
* Available as `context.services.logger`. Level-aware with bound child loggers
|
|
500
|
+
* and pluggable sinks.
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```ts
|
|
504
|
+
* import { createLogger } from '@nixxie-cms/logger'
|
|
505
|
+
* export default config({
|
|
506
|
+
* logger: createLogger({ level: 'info', pretty: process.env.NODE_ENV !== 'production' }),
|
|
507
|
+
* })
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
logger?: NixxieLoggerService
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Content export / import / seed created with `createBackup()` from
|
|
514
|
+
* `@nixxie-cms/backup`. Available as `context.services.backup`.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```ts
|
|
518
|
+
* import { createBackup, nixxieDataSource } from '@nixxie-cms/backup'
|
|
519
|
+
* // `getContext()` returns a long-lived context (see createNixxieContext)
|
|
520
|
+
* export default config({
|
|
521
|
+
* backup: createBackup({ source: () => nixxieDataSource(getContext().sudo()) }),
|
|
522
|
+
* })
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
backup?: NixxieBackupService
|
|
526
|
+
|
|
334
527
|
/** Telemetry boolean to disable telemetry for this project */
|
|
335
528
|
telemetry?: boolean
|
|
336
529
|
|
|
@@ -369,7 +562,7 @@ export type NixxieConfig<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInf
|
|
|
369
562
|
lists: {
|
|
370
563
|
[listKey: string]: {
|
|
371
564
|
listKey: string
|
|
372
|
-
} & Required<NixxieConfigPre<TypeInfo>['
|
|
565
|
+
} & Required<NixxieConfigPre<TypeInfo>['collections'][string]>
|
|
373
566
|
}
|
|
374
567
|
server: Omit<Required<NonNullable<NixxieConfigPre<TypeInfo>['server']>>, 'cors' | 'port'> & {
|
|
375
568
|
cors: CorsOptions | null
|
|
@@ -387,14 +580,20 @@ export type NixxieConfig<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInf
|
|
|
387
580
|
search: NixxieSearchService | undefined
|
|
388
581
|
notifications: NixxieNotificationsService | undefined
|
|
389
582
|
ai: NixxieAiService | undefined
|
|
583
|
+
aiRag: NixxieAiRagService | undefined
|
|
584
|
+
versioning: NixxieVersioningService | undefined
|
|
585
|
+
workflow: NixxieWorkflowService | undefined
|
|
586
|
+
apiKeys: NixxieApiKeysService | undefined
|
|
587
|
+
logger: NixxieLoggerService | undefined
|
|
588
|
+
backup: NixxieBackupService | undefined
|
|
390
589
|
telemetry: boolean
|
|
391
590
|
ui: NonNullable<Required<NixxieConfigPre<TypeInfo>['ui']>>
|
|
392
591
|
}
|
|
393
592
|
|
|
394
|
-
export type { BaseFields,
|
|
593
|
+
export type { BaseFields, CollectionConfig, MaybeItemFunctionWithFilter, MaybeSessionFunction }
|
|
395
594
|
|
|
396
595
|
export type AdminFileToWrite =
|
|
397
596
|
| { mode: 'write'; src: string; outputPath: string }
|
|
398
597
|
| { mode: 'copy'; inputPath: string; outputPath: string }
|
|
399
598
|
|
|
400
|
-
export type { FieldAccessControl, FieldHooks,
|
|
599
|
+
export type { FieldAccessControl, FieldHooks, CollectionAccessControl, CollectionHooks }
|