@nixxie-cms/core 1.0.3 → 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/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 +171 -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 +349 -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-7559ca2d.esm.js → express-0abbce07.esm.js} +6 -6
- package/dist/{express-455ae20c.cjs.js → express-7ca6f76a.cjs.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 +1387 -30
- package/dist/nixxie-cms-core.esm.js +1361 -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-03e49e4f.esm.js → system-4d2a2648.esm.js} +32 -7
- package/dist/{system-a321642d.cjs.js → system-69e1a285.cjs.js} +32 -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 +5 -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 +91 -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 +185 -7
- package/src/types/config/lists.ts +606 -565
- package/src/types/context.ts +426 -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
|
@@ -11,26 +11,31 @@ import type {
|
|
|
11
11
|
BaseNixxieTypeInfo,
|
|
12
12
|
DatabaseProvider,
|
|
13
13
|
NixxieAiService,
|
|
14
|
+
NixxieApiKeysService,
|
|
14
15
|
NixxieAuditService,
|
|
16
|
+
NixxieBackupService,
|
|
15
17
|
NixxieCacheService,
|
|
16
18
|
NixxieContext,
|
|
17
19
|
NixxieEmailService,
|
|
18
20
|
NixxieHealthService,
|
|
19
21
|
NixxieJobsService,
|
|
22
|
+
NixxieLoggerService,
|
|
20
23
|
NixxieNotificationsService,
|
|
21
24
|
NixxieRateLimitService,
|
|
22
25
|
NixxieSearchService,
|
|
23
26
|
NixxieStorageService,
|
|
27
|
+
NixxieVersioningService,
|
|
24
28
|
NixxieWebhooksService,
|
|
29
|
+
NixxieWorkflowService,
|
|
25
30
|
} from '..'
|
|
26
31
|
import type { SessionStrategy } from '../session'
|
|
27
32
|
import type { MaybePromise } from '../utils'
|
|
28
|
-
import type { FieldAccessControl,
|
|
33
|
+
import type { FieldAccessControl, CollectionAccessControl } from './access-control'
|
|
29
34
|
import type { BaseFields } from './fields'
|
|
30
|
-
import type { FieldHooks,
|
|
35
|
+
import type { FieldHooks, CollectionHooks } from './hooks'
|
|
31
36
|
import type {
|
|
32
37
|
IdFieldConfig,
|
|
33
|
-
|
|
38
|
+
CollectionConfig,
|
|
34
39
|
MaybeItemFunctionWithFilter,
|
|
35
40
|
MaybeSessionFunction,
|
|
36
41
|
} from './lists'
|
|
@@ -46,11 +51,95 @@ type PrismaLogDefinition = {
|
|
|
46
51
|
emit: 'stdout' | 'event'
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
/**
|
|
55
|
+
* A Nixxie plugin — one object that can contribute collections, transform the config,
|
|
56
|
+
* and run setup once the database connects. Register via `config({ plugins: [...] })`.
|
|
57
|
+
*
|
|
58
|
+
* Plugins are applied in array order: collections are merged first (a key conflict with
|
|
59
|
+
* the user's collections or an earlier plugin throws), then `extendConfig` runs, then at
|
|
60
|
+
* boot every plugin's `onConnect` runs (in order) before `db.onConnect`.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* export function myPlugin(): NixxiePlugin {
|
|
64
|
+
* return {
|
|
65
|
+
* name: 'my-plugin',
|
|
66
|
+
* collections: { MyPluginLog: collection({ fields: { ... } }) },
|
|
67
|
+
* extendConfig: config => ({
|
|
68
|
+
* ...config,
|
|
69
|
+
* server: {
|
|
70
|
+
* ...config.server,
|
|
71
|
+
* extendExpressApp: async (app, context) => {
|
|
72
|
+
* await config.server?.extendExpressApp?.(app, context)
|
|
73
|
+
* app.get('/my-plugin/ping', (_, res) => res.send('pong'))
|
|
74
|
+
* },
|
|
75
|
+
* },
|
|
76
|
+
* }),
|
|
77
|
+
* onConnect: async context => { ... },
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
*/
|
|
81
|
+
export type NixxiePlugin<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInfo> = {
|
|
82
|
+
/** Unique name, used in error messages. */
|
|
83
|
+
name: string
|
|
84
|
+
/** Collections contributed by this plugin. A key conflict throws at config build time. */
|
|
85
|
+
collections?: Record<string, CollectionConfig<any>>
|
|
86
|
+
/**
|
|
87
|
+
* Transform the (pre-normalisation) config — register services, wrap hooks, extend
|
|
88
|
+
* the Express app, etc. Must return the new config.
|
|
89
|
+
*/
|
|
90
|
+
extendConfig?: (config: NixxieConfigPre<TypeInfo>) => NixxieConfigPre<TypeInfo>
|
|
91
|
+
/** Run once the database has connected, before the user's `db.onConnect`. */
|
|
92
|
+
onConnect?: (context: NixxieContext<TypeInfo>) => MaybePromise<void>
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Requirements for a single environment variable (see `NixxieConfigPre['env']`). */
|
|
96
|
+
export type NixxieEnvVarSpec = {
|
|
97
|
+
/**
|
|
98
|
+
* Fail at boot when the variable is unset (and no `default` is given).
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
required?: boolean
|
|
102
|
+
/** Regex the value must match (checked when the variable is set). */
|
|
103
|
+
pattern?: RegExp
|
|
104
|
+
/** Applied to `process.env` when the variable is unset. */
|
|
105
|
+
default?: string
|
|
106
|
+
/** Shown in the boot error to explain what the variable is for. */
|
|
107
|
+
description?: string
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Environment validation spec: either a list of required variable names, or a record of
|
|
112
|
+
* per-variable requirements. Validated when the config is built, so a misconfigured
|
|
113
|
+
* deployment fails immediately with one aggregated, readable error instead of a
|
|
114
|
+
* confusing crash later.
|
|
115
|
+
*/
|
|
116
|
+
export type NixxieEnvSpec = readonly string[] | Record<string, NixxieEnvVarSpec>
|
|
117
|
+
|
|
49
118
|
export type NixxieConfigPre<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInfo> = {
|
|
50
119
|
types?: {
|
|
51
120
|
path: string
|
|
52
121
|
}
|
|
53
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Plugins to apply to this config (collections + config transforms + boot hooks).
|
|
125
|
+
* See `NixxiePlugin`.
|
|
126
|
+
*/
|
|
127
|
+
plugins?: NixxiePlugin<TypeInfo>[]
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Environment variables this app needs. Validated at config build time —
|
|
131
|
+
* missing or malformed variables fail the boot with one aggregated error.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* env: ['DATABASE_URL', 'SESSION_SECRET']
|
|
135
|
+
* @example
|
|
136
|
+
* env: {
|
|
137
|
+
* DATABASE_URL: { description: 'Postgres connection string' },
|
|
138
|
+
* SMTP_PORT: { required: false, pattern: /^\d+$/, default: '587' },
|
|
139
|
+
* }
|
|
140
|
+
*/
|
|
141
|
+
env?: NixxieEnvSpec
|
|
142
|
+
|
|
54
143
|
db: {
|
|
55
144
|
provider: DatabaseProvider
|
|
56
145
|
url: string
|
|
@@ -133,7 +222,7 @@ export type NixxieConfigPre<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieType
|
|
|
133
222
|
extendGraphqlSchema?: (schema: GraphQLSchema) => GraphQLSchema
|
|
134
223
|
}
|
|
135
224
|
|
|
136
|
-
|
|
225
|
+
collections: Record<string, CollectionConfig<any>>
|
|
137
226
|
server?: {
|
|
138
227
|
/** Configuration options for the cors middleware. Set to `true` to use Nixxie's defaults */
|
|
139
228
|
cors?: boolean | CorsOptions
|
|
@@ -331,6 +420,90 @@ export type NixxieConfigPre<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieType
|
|
|
331
420
|
*/
|
|
332
421
|
ai?: NixxieAiService
|
|
333
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Content revision history created with `createVersioning()` from
|
|
425
|
+
* `@nixxie-cms/versioning`. Available as `context.services.versioning`.
|
|
426
|
+
* Snapshots item data so changes can be listed, diffed and rolled back.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```ts
|
|
430
|
+
* import { createVersioning } from '@nixxie-cms/versioning'
|
|
431
|
+
* export default config({
|
|
432
|
+
* versioning: createVersioning({ store: 'memory' }),
|
|
433
|
+
* })
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
versioning?: NixxieVersioningService
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Editorial state machine created with `createWorkflow()` from
|
|
440
|
+
* `@nixxie-cms/workflow`. Available as `context.services.workflow`.
|
|
441
|
+
* Enforces allowed transitions (e.g. draft → review → published).
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* import { createWorkflow } from '@nixxie-cms/workflow'
|
|
446
|
+
* export default config({
|
|
447
|
+
* workflow: createWorkflow({
|
|
448
|
+
* name: 'editorial',
|
|
449
|
+
* initial: 'draft',
|
|
450
|
+
* states: ['draft', 'review', 'published'],
|
|
451
|
+
* transitions: [
|
|
452
|
+
* { from: 'draft', to: 'review', name: 'submit' },
|
|
453
|
+
* { from: 'review', to: 'published', name: 'publish' },
|
|
454
|
+
* { from: 'review', to: 'draft', name: 'reject' },
|
|
455
|
+
* ],
|
|
456
|
+
* }),
|
|
457
|
+
* })
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
workflow?: NixxieWorkflowService
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Machine-to-machine API keys created with `createApiKeys()` from
|
|
464
|
+
* `@nixxie-cms/api-keys`. Available as `context.services.apiKeys`.
|
|
465
|
+
* Issues scoped, revocable tokens; only key hashes are stored.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* import { createApiKeys } from '@nixxie-cms/api-keys'
|
|
470
|
+
* export default config({
|
|
471
|
+
* apiKeys: createApiKeys({ store: 'memory', prefix: 'nxk' }),
|
|
472
|
+
* })
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
apiKeys?: NixxieApiKeysService
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Structured logger created with `createLogger()` from `@nixxie-cms/logger`.
|
|
479
|
+
* Available as `context.services.logger`. Level-aware with bound child loggers
|
|
480
|
+
* and pluggable sinks.
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* import { createLogger } from '@nixxie-cms/logger'
|
|
485
|
+
* export default config({
|
|
486
|
+
* logger: createLogger({ level: 'info', pretty: process.env.NODE_ENV !== 'production' }),
|
|
487
|
+
* })
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
logger?: NixxieLoggerService
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Content export / import / seed created with `createBackup()` from
|
|
494
|
+
* `@nixxie-cms/backup`. Available as `context.services.backup`.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* import { createBackup, nixxieDataSource } from '@nixxie-cms/backup'
|
|
499
|
+
* // `getContext()` returns a long-lived context (see createNixxieContext)
|
|
500
|
+
* export default config({
|
|
501
|
+
* backup: createBackup({ source: () => nixxieDataSource(getContext().sudo()) }),
|
|
502
|
+
* })
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
backup?: NixxieBackupService
|
|
506
|
+
|
|
334
507
|
/** Telemetry boolean to disable telemetry for this project */
|
|
335
508
|
telemetry?: boolean
|
|
336
509
|
|
|
@@ -369,7 +542,7 @@ export type NixxieConfig<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInf
|
|
|
369
542
|
lists: {
|
|
370
543
|
[listKey: string]: {
|
|
371
544
|
listKey: string
|
|
372
|
-
} & Required<NixxieConfigPre<TypeInfo>['
|
|
545
|
+
} & Required<NixxieConfigPre<TypeInfo>['collections'][string]>
|
|
373
546
|
}
|
|
374
547
|
server: Omit<Required<NonNullable<NixxieConfigPre<TypeInfo>['server']>>, 'cors' | 'port'> & {
|
|
375
548
|
cors: CorsOptions | null
|
|
@@ -387,14 +560,19 @@ export type NixxieConfig<TypeInfo extends BaseNixxieTypeInfo = BaseNixxieTypeInf
|
|
|
387
560
|
search: NixxieSearchService | undefined
|
|
388
561
|
notifications: NixxieNotificationsService | undefined
|
|
389
562
|
ai: NixxieAiService | undefined
|
|
563
|
+
versioning: NixxieVersioningService | undefined
|
|
564
|
+
workflow: NixxieWorkflowService | undefined
|
|
565
|
+
apiKeys: NixxieApiKeysService | undefined
|
|
566
|
+
logger: NixxieLoggerService | undefined
|
|
567
|
+
backup: NixxieBackupService | undefined
|
|
390
568
|
telemetry: boolean
|
|
391
569
|
ui: NonNullable<Required<NixxieConfigPre<TypeInfo>['ui']>>
|
|
392
570
|
}
|
|
393
571
|
|
|
394
|
-
export type { BaseFields,
|
|
572
|
+
export type { BaseFields, CollectionConfig, MaybeItemFunctionWithFilter, MaybeSessionFunction }
|
|
395
573
|
|
|
396
574
|
export type AdminFileToWrite =
|
|
397
575
|
| { mode: 'write'; src: string; outputPath: string }
|
|
398
576
|
| { mode: 'copy'; inputPath: string; outputPath: string }
|
|
399
577
|
|
|
400
|
-
export type { FieldAccessControl, FieldHooks,
|
|
578
|
+
export type { FieldAccessControl, FieldHooks, CollectionAccessControl, CollectionHooks }
|