@mediusinc/mng-commons-data-api 5.0.0-rc.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.
Files changed (50) hide show
  1. package/README.md +14 -0
  2. package/esm2022/index.mjs +7 -0
  3. package/esm2022/lib/helpers/get-all-params.mjs +186 -0
  4. package/esm2022/lib/models/request-params.model.mjs +2 -0
  5. package/esm2022/lib/types/extract-get-all-params.type.mjs +2 -0
  6. package/esm2022/mediusinc-mng-commons-data-api.mjs +5 -0
  7. package/esm2022/tableview/index.mjs +2 -0
  8. package/esm2022/tableview/mediusinc-mng-commons-data-api-tableview.mjs +5 -0
  9. package/esm2022/tableview/tableview-get-all-params-create.mjs +18 -0
  10. package/fesm2022/mediusinc-mng-commons-data-api-tableview.mjs +25 -0
  11. package/fesm2022/mediusinc-mng-commons-data-api-tableview.mjs.map +1 -0
  12. package/fesm2022/mediusinc-mng-commons-data-api.mjs +195 -0
  13. package/fesm2022/mediusinc-mng-commons-data-api.mjs.map +1 -0
  14. package/index.d.ts +3 -0
  15. package/lib/helpers/get-all-params.d.ts +69 -0
  16. package/lib/models/request-params.model.d.ts +61 -0
  17. package/lib/types/extract-get-all-params.type.d.ts +14 -0
  18. package/openapi/README.mustache +226 -0
  19. package/openapi/api.module.mustache +39 -0
  20. package/openapi/api.service.mustache +253 -0
  21. package/openapi/apiInterface.mustache +47 -0
  22. package/openapi/apis.mustache +12 -0
  23. package/openapi/config.yaml +23 -0
  24. package/openapi/configuration.mustache +128 -0
  25. package/openapi/custom/base-api.service.mustache +14 -0
  26. package/openapi/custom/helpers.mustache +71 -0
  27. package/openapi/custom/modelSchema.mustache +46 -0
  28. package/openapi/custom/schema.mustache +18 -0
  29. package/openapi/encoder.mustache +20 -0
  30. package/openapi/git_push.sh.mustache +57 -0
  31. package/openapi/index.mustache +0 -0
  32. package/openapi/licenseInfo.mustache +11 -0
  33. package/openapi/model.mustache +16 -0
  34. package/openapi/modelAlias.mustache +1 -0
  35. package/openapi/modelEnum.mustache +21 -0
  36. package/openapi/modelGeneric.mustache +14 -0
  37. package/openapi/modelGenericAdditionalProperties.mustache +5 -0
  38. package/openapi/modelGenericEnums.mustache +30 -0
  39. package/openapi/modelOneOf.mustache +14 -0
  40. package/openapi/modelTaggedUnion.mustache +21 -0
  41. package/openapi/models.mustache +5 -0
  42. package/openapi/ng-package.mustache +6 -0
  43. package/openapi/package.mustache +39 -0
  44. package/openapi/param.mustache +69 -0
  45. package/openapi/tsconfig.mustache +28 -0
  46. package/openapi/variables.mustache +9 -0
  47. package/package.json +34 -0
  48. package/tableview/README.md +10 -0
  49. package/tableview/index.d.ts +1 -0
  50. package/tableview/tableview-get-all-params-create.d.ts +15 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Standard parameter styles defined by OpenAPI spec
3
+ */
4
+ export type StandardParamStyle =
5
+ | 'matrix'
6
+ | 'label'
7
+ | 'form'
8
+ | 'simple'
9
+ | 'spaceDelimited'
10
+ | 'pipeDelimited'
11
+ | 'deepObject'
12
+ ;
13
+
14
+ /**
15
+ * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
16
+ */
17
+ export type ParamStyle = StandardParamStyle | string;
18
+
19
+ /**
20
+ * Standard parameter locations defined by OpenAPI spec
21
+ */
22
+ export type ParamLocation = 'query' | 'header' | 'path' | 'cookie';
23
+
24
+ /**
25
+ * Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
26
+ */
27
+ export type StandardDataType =
28
+ | "integer"
29
+ | "number"
30
+ | "boolean"
31
+ | "string"
32
+ | "object"
33
+ | "array"
34
+ ;
35
+
36
+ /**
37
+ * Standard {@link DataType}s plus your own types/classes.
38
+ */
39
+ export type DataType = StandardDataType | string;
40
+
41
+ /**
42
+ * Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
43
+ */
44
+ export type StandardDataFormat =
45
+ | "int32"
46
+ | "int64"
47
+ | "float"
48
+ | "double"
49
+ | "byte"
50
+ | "binary"
51
+ | "date"
52
+ | "date-time"
53
+ | "password"
54
+ ;
55
+
56
+ export type DataFormat = StandardDataFormat | string;
57
+
58
+ /**
59
+ * The parameter to encode.
60
+ */
61
+ export interface Param {
62
+ name: string;
63
+ value: unknown;
64
+ in: ParamLocation;
65
+ style: ParamStyle,
66
+ explode: boolean;
67
+ dataType: DataType;
68
+ dataFormat: DataFormat | undefined;
69
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "emitDecoratorMetadata": true,
4
+ "experimentalDecorators": true,
5
+ "noImplicitAny": false,
6
+ "suppressImplicitAnyIndexErrors": true,
7
+ "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}",
8
+ "module": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}commonjs{{/supportsES6}}",
9
+ "moduleResolution": "node",
10
+ "removeComments": true,
11
+ "sourceMap": true,
12
+ "outDir": "./dist",
13
+ "noLib": false,
14
+ "declaration": true,
15
+ "lib": [ "es6", "dom" ],
16
+ "typeRoots": [
17
+ "node_modules/@types"
18
+ ]
19
+ },
20
+ "exclude": [
21
+ "node_modules",
22
+ "dist"
23
+ ],
24
+ "filesGlob": [
25
+ "./model/*.ts",
26
+ "./api/*.ts"
27
+ ]
28
+ }
@@ -0,0 +1,9 @@
1
+ import { InjectionToken } from '@angular/core';
2
+
3
+ export const BASE_PATH = new InjectionToken<string>('basePath');
4
+ export const COLLECTION_FORMATS = {
5
+ 'csv': ',',
6
+ 'tsv': ' ',
7
+ 'ssv': ' ',
8
+ 'pipes': '|'
9
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@mediusinc/mng-commons-data-api",
3
+ "version": "5.0.0-rc.0",
4
+ "peerDependencies": {
5
+ "@angular/core": "^17.2.0",
6
+ "@mediusinc/mng-commons": "~5.0.0-rc.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "publishConfig": {
12
+ "directory": "dist"
13
+ },
14
+ "sideEffects": false,
15
+ "module": "fesm2022/mediusinc-mng-commons-data-api.mjs",
16
+ "typings": "index.d.ts",
17
+ "exports": {
18
+ "./package.json": {
19
+ "default": "./package.json"
20
+ },
21
+ ".": {
22
+ "types": "./index.d.ts",
23
+ "esm2022": "./esm2022/mediusinc-mng-commons-data-api.mjs",
24
+ "esm": "./esm2022/mediusinc-mng-commons-data-api.mjs",
25
+ "default": "./fesm2022/mediusinc-mng-commons-data-api.mjs"
26
+ },
27
+ "./tableview": {
28
+ "types": "./tableview/index.d.ts",
29
+ "esm2022": "./esm2022/tableview/mediusinc-mng-commons-data-api-tableview.mjs",
30
+ "esm": "./esm2022/tableview/mediusinc-mng-commons-data-api-tableview.mjs",
31
+ "default": "./fesm2022/mediusinc-mng-commons-data-api-tableview.mjs"
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,10 @@
1
+ # @mediusinc/mng-commons-data-api/tableview
2
+
3
+ Secondary entry point of `@mediusinc/mng-commons-data-api`. It can be used by importing from `@mediusinc/mng-commons-data-api/tableview`.
4
+
5
+ ## Dependencies within commons
6
+
7
+ - `@mediusinc/mng-commons-data-api`
8
+ - `@mediusinc/mng-commons/core`
9
+ - `@mediusinc/mng-commons/model`
10
+ - `@mediusinc/mng-commons/tableview/api`
@@ -0,0 +1 @@
1
+ export * from './tableview-get-all-params-create';
@@ -0,0 +1,15 @@
1
+ import { ExtractGetAllParamsFilterType, ExtractGetAllParamsSortType, GetAllParamsDefaultWoFiltersType } from '@mediusinc/mng-commons-data-api';
2
+ import { ServiceClassType } from '@mediusinc/mng-commons/core';
3
+ import { ModelDescriptor, TypeDescriptor } from '@mediusinc/mng-commons/model';
4
+ import { TableviewDataProviderInst, TableviewDescriptorInst, TableviewInputBuilder } from '@mediusinc/mng-commons/tableview/api';
5
+ /**
6
+ * Creates a tableview with a given model, service and sorts and filters extracted from Data API Get All request params, service, and optional build function.
7
+ *
8
+ * @param {ModelDescriptor<Model>} model - The model descriptor.
9
+ * @param {ServiceClassType<Service>} service - The class type of the service.
10
+ * @param {TypeDescriptor<RequestParam>} params - The request param of get all request. Filters and sorts will be taken from here.
11
+ * @param {(builder: TableviewBuilder) => void} [buildFn] - The optional callback function to customize the tableview using the prepared builder.
12
+ *
13
+ * @returns A tableview instance with descriptor, data provider and actions.
14
+ */
15
+ export declare function tableviewWithGetAllParams<Model, Service, RequestParam extends GetAllParamsDefaultWoFiltersType, Sorts = ExtractGetAllParamsSortType<RequestParam>, Filters extends keyof any = ExtractGetAllParamsFilterType<RequestParam>>(model: ModelDescriptor<Model>, service: ServiceClassType<Service>, params: TypeDescriptor<RequestParam>, buildFn?: (builder: TableviewInputBuilder<Model, Service, TableviewDescriptorInst<Model, Sorts, Filters>, TableviewDataProviderInst<Model, Service, Sorts, Filters>, Sorts, Filters>) => void): import("@mediusinc/mng-commons/tableview/api").TableviewInput<Model, Service, Sorts, Filters, TableviewDescriptorInst<Model, Sorts, Filters>, TableviewDataProviderInst<Model, Service, Sorts, Filters, import("@mediusinc/mng-commons/core").ClassOptType<Model>, import("@mediusinc/mng-commons/core").ServiceClassOptType<Service>>>;