@defra/forms-model 3.0.386 → 3.0.388
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/module/common/pagination/index.js +10 -0
- package/dist/module/common/pagination/index.js.map +1 -0
- package/dist/module/common/pagination/types.js +2 -0
- package/dist/module/common/pagination/types.js.map +1 -0
- package/dist/module/index.js +3 -2
- package/dist/module/index.js.map +1 -1
- package/dist/types/common/pagination/index.d.ts +7 -0
- package/dist/types/common/pagination/index.d.ts.map +1 -0
- package/dist/types/common/pagination/types.d.ts +49 -0
- package/dist/types/common/pagination/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common/pagination/index.ts +12 -0
- package/src/common/pagination/types.ts +57 -0
- package/src/index.ts +5 -2
@@ -0,0 +1,10 @@
|
|
1
|
+
import Joi from 'joi';
|
2
|
+
/**
|
3
|
+
* Joi schema for `PaginationOptions` interface
|
4
|
+
* @see {@link PaginationOptions}
|
5
|
+
*/
|
6
|
+
export const paginationOptionsSchema = Joi.object({
|
7
|
+
page: Joi.number().positive().integer().default(1).min(1),
|
8
|
+
perPage: Joi.number().positive().integer().default(24).min(1).max(200)
|
9
|
+
}).optional();
|
10
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","names":["Joi","paginationOptionsSchema","object","page","number","positive","integer","default","min","perPage","max","optional"],"sources":["../../../../src/common/pagination/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { type PaginationOptions } from '~/src/common/pagination/types.js'\n\n/**\n * Joi schema for `PaginationOptions` interface\n * @see {@link PaginationOptions}\n */\nexport const paginationOptionsSchema = Joi.object<PaginationOptions>({\n page: Joi.number().positive().integer().default(1).min(1),\n perPage: Joi.number().positive().integer().default(24).min(1).max(200)\n}).optional()\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAIrB;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGD,GAAG,CAACE,MAAM,CAAoB;EACnEC,IAAI,EAAEH,GAAG,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACzDC,OAAO,EAAET,GAAG,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,CAACC,OAAO,CAAC,EAAE,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACE,GAAG,CAAC,GAAG;AACvE,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/common/pagination/types.ts"],"sourcesContent":["/**\n * Result of pagination containing page information\n */\nexport interface PaginationResult {\n /**\n * The current page number.\n */\n page: number\n\n /**\n * The number of items per page.\n */\n perPage: number\n\n /**\n * The total number of items available.\n */\n totalItems: number\n\n /**\n * The total number of pages available.\n */\n totalPages: number\n}\n\n/**\n * Options for paginating results\n * Allows partial specification of page and perPage from PaginationResult\n */\nexport type PaginationOptions = Required<\n Pick<PaginationResult, 'page' | 'perPage'>\n>\n\n/**\n * Metadata containing optional pagination information\n */\nexport interface Meta {\n /**\n * The pagination details\n */\n pagination?: PaginationResult\n}\n\n/**\n * Standard response wrapper for query results with metadata\n */\nexport interface QueryResult<Model> {\n /**\n * The array of data items\n */\n data: Model[]\n\n /**\n * The metadata about the result\n */\n meta: Meta\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/module/index.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
export * from "./common/pagination/index.js";
|
2
|
+
export * from "./components/index.js";
|
3
|
+
export * from "./conditions/index.js";
|
1
4
|
export * from "./form/form-definition/index.js";
|
2
5
|
export * from "./form/form-metadata/index.js";
|
3
6
|
export * from "./form/form-submission/index.js";
|
4
7
|
export * from "./form/utils/index.js";
|
5
|
-
export * from "./components/index.js";
|
6
|
-
export * from "./conditions/index.js";
|
7
8
|
export * from "./pages/index.js";
|
8
9
|
export * from "./utils/helpers.js";
|
9
10
|
export * from "./utils/markdown.js";
|
package/dist/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/common/pagination/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/form/form-definition/index.js'\nexport * from '~/src/form/form-metadata/index.js'\nexport * from '~/src/form/form-submission/index.js'\nexport * from '~/src/form/utils/index.js'\nexport * from '~/src/pages/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/utils/markdown.js'\n\nexport type * from '~/src/common/pagination/types.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/form/form-definition/types.js'\nexport type * from '~/src/form/form-metadata/types.js'\nexport type * from '~/src/form/form-submission/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import Joi from 'joi';
|
2
|
+
/**
|
3
|
+
* Joi schema for `PaginationOptions` interface
|
4
|
+
* @see {@link PaginationOptions}
|
5
|
+
*/
|
6
|
+
export declare const paginationOptionsSchema: Joi.ObjectSchema<Required<Pick<import("../../common/pagination/types.js").PaginationResult, "page" | "perPage">>>;
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/pagination/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAIrB;;;GAGG;AACH,eAAO,MAAM,uBAAuB,mHAGvB,CAAA"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/**
|
2
|
+
* Result of pagination containing page information
|
3
|
+
*/
|
4
|
+
export interface PaginationResult {
|
5
|
+
/**
|
6
|
+
* The current page number.
|
7
|
+
*/
|
8
|
+
page: number;
|
9
|
+
/**
|
10
|
+
* The number of items per page.
|
11
|
+
*/
|
12
|
+
perPage: number;
|
13
|
+
/**
|
14
|
+
* The total number of items available.
|
15
|
+
*/
|
16
|
+
totalItems: number;
|
17
|
+
/**
|
18
|
+
* The total number of pages available.
|
19
|
+
*/
|
20
|
+
totalPages: number;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Options for paginating results
|
24
|
+
* Allows partial specification of page and perPage from PaginationResult
|
25
|
+
*/
|
26
|
+
export type PaginationOptions = Required<Pick<PaginationResult, 'page' | 'perPage'>>;
|
27
|
+
/**
|
28
|
+
* Metadata containing optional pagination information
|
29
|
+
*/
|
30
|
+
export interface Meta {
|
31
|
+
/**
|
32
|
+
* The pagination details
|
33
|
+
*/
|
34
|
+
pagination?: PaginationResult;
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Standard response wrapper for query results with metadata
|
38
|
+
*/
|
39
|
+
export interface QueryResult<Model> {
|
40
|
+
/**
|
41
|
+
* The array of data items
|
42
|
+
*/
|
43
|
+
data: Model[];
|
44
|
+
/**
|
45
|
+
* The metadata about the result
|
46
|
+
*/
|
47
|
+
meta: Meta;
|
48
|
+
}
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/pagination/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CACtC,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAC3C,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,KAAK;IAChC;;OAEG;IACH,IAAI,EAAE,KAAK,EAAE,CAAA;IAEb;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;CACX"}
|
package/dist/types/index.d.ts
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
+
export * from './common/pagination/index.js';
|
2
|
+
export * from './components/index.js';
|
3
|
+
export * from './conditions/index.js';
|
1
4
|
export * from './form/form-definition/index.js';
|
2
5
|
export * from './form/form-metadata/index.js';
|
3
6
|
export * from './form/form-submission/index.js';
|
4
7
|
export * from './form/utils/index.js';
|
5
|
-
export * from './components/index.js';
|
6
|
-
export * from './conditions/index.js';
|
7
8
|
export * from './pages/index.js';
|
8
9
|
export * from './utils/helpers.js';
|
9
10
|
export * from './utils/markdown.js';
|
11
|
+
export type * from './common/pagination/types.js';
|
10
12
|
export type * from './components/types.js';
|
11
13
|
export type * from './conditions/types.js';
|
12
14
|
export type * from './form/form-definition/types.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AAEvC,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qCAAqC,CAAA;AACxD,mBAAmB,mCAAmC,CAAA;AACtD,mBAAmB,qCAAqC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@defra/forms-model",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.388",
|
4
4
|
"description": "A hapi plugin providing the model for Defra forms",
|
5
5
|
"homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
|
6
6
|
"repository": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"test:watch": "jest --color --watch"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"marked": "^15.0.
|
24
|
+
"marked": "^15.0.3",
|
25
25
|
"slug": "^10.0.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import Joi from 'joi'
|
2
|
+
|
3
|
+
import { type PaginationOptions } from '~/src/common/pagination/types.js'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Joi schema for `PaginationOptions` interface
|
7
|
+
* @see {@link PaginationOptions}
|
8
|
+
*/
|
9
|
+
export const paginationOptionsSchema = Joi.object<PaginationOptions>({
|
10
|
+
page: Joi.number().positive().integer().default(1).min(1),
|
11
|
+
perPage: Joi.number().positive().integer().default(24).min(1).max(200)
|
12
|
+
}).optional()
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/**
|
2
|
+
* Result of pagination containing page information
|
3
|
+
*/
|
4
|
+
export interface PaginationResult {
|
5
|
+
/**
|
6
|
+
* The current page number.
|
7
|
+
*/
|
8
|
+
page: number
|
9
|
+
|
10
|
+
/**
|
11
|
+
* The number of items per page.
|
12
|
+
*/
|
13
|
+
perPage: number
|
14
|
+
|
15
|
+
/**
|
16
|
+
* The total number of items available.
|
17
|
+
*/
|
18
|
+
totalItems: number
|
19
|
+
|
20
|
+
/**
|
21
|
+
* The total number of pages available.
|
22
|
+
*/
|
23
|
+
totalPages: number
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Options for paginating results
|
28
|
+
* Allows partial specification of page and perPage from PaginationResult
|
29
|
+
*/
|
30
|
+
export type PaginationOptions = Required<
|
31
|
+
Pick<PaginationResult, 'page' | 'perPage'>
|
32
|
+
>
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Metadata containing optional pagination information
|
36
|
+
*/
|
37
|
+
export interface Meta {
|
38
|
+
/**
|
39
|
+
* The pagination details
|
40
|
+
*/
|
41
|
+
pagination?: PaginationResult
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Standard response wrapper for query results with metadata
|
46
|
+
*/
|
47
|
+
export interface QueryResult<Model> {
|
48
|
+
/**
|
49
|
+
* The array of data items
|
50
|
+
*/
|
51
|
+
data: Model[]
|
52
|
+
|
53
|
+
/**
|
54
|
+
* The metadata about the result
|
55
|
+
*/
|
56
|
+
meta: Meta
|
57
|
+
}
|
package/src/index.ts
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
export * from '~/src/common/pagination/index.js'
|
2
|
+
export * from '~/src/components/index.js'
|
3
|
+
export * from '~/src/conditions/index.js'
|
1
4
|
export * from '~/src/form/form-definition/index.js'
|
2
5
|
export * from '~/src/form/form-metadata/index.js'
|
3
6
|
export * from '~/src/form/form-submission/index.js'
|
4
7
|
export * from '~/src/form/utils/index.js'
|
5
|
-
export * from '~/src/components/index.js'
|
6
|
-
export * from '~/src/conditions/index.js'
|
7
8
|
export * from '~/src/pages/index.js'
|
8
9
|
export * from '~/src/utils/helpers.js'
|
9
10
|
export * from '~/src/utils/markdown.js'
|
11
|
+
|
12
|
+
export type * from '~/src/common/pagination/types.js'
|
10
13
|
export type * from '~/src/components/types.js'
|
11
14
|
export type * from '~/src/conditions/types.js'
|
12
15
|
export type * from '~/src/form/form-definition/types.js'
|