@tsed/schema-formio 6.114.17 → 6.115.1
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/lib/cjs/components/anyToComponent.js +1 -1
- package/lib/cjs/components/anyToComponent.js.map +1 -1
- package/lib/cjs/utils/getFormioSchema.js.map +1 -1
- package/lib/esm/components/anyToComponent.js +1 -1
- package/lib/esm/components/anyToComponent.js.map +1 -1
- package/lib/esm/utils/getFormioSchema.js.map +1 -1
- package/lib/types/utils/getFormioSchema.d.ts +1 -1
- package/package.json +8 -8
|
@@ -5,7 +5,7 @@ const FormioMappersContainer_1 = require("../registries/FormioMappersContainer")
|
|
|
5
5
|
const getRef_1 = require("../utils/getRef");
|
|
6
6
|
function anyToComponent(schema, options) {
|
|
7
7
|
schema = (0, getRef_1.getRef)(schema, options);
|
|
8
|
-
switch (schema
|
|
8
|
+
switch (schema?.type) {
|
|
9
9
|
case "object":
|
|
10
10
|
if (!schema.properties && !schema.$ref) {
|
|
11
11
|
return (0, FormioMappersContainer_1.execMapper)("map", schema, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anyToComponent.js","sourceRoot":"","sources":["../../../src/components/anyToComponent.ts"],"names":[],"mappings":";;;AAAA,iFAAsF;AACtF,4CAAuC;AAEvC,SAAgB,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,MAAM,GAAG,IAAA,eAAM,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"anyToComponent.js","sourceRoot":"","sources":["../../../src/components/anyToComponent.ts"],"names":[],"mappings":";;;AAAA,iFAAsF;AACtF,4CAAuC;AAEvC,SAAgB,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,MAAM,GAAG,IAAA,eAAM,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,QAAQ,MAAM,EAAE,IAAI,EAAE;QACpB,KAAK,QAAQ;YACX,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBACtC,OAAO,IAAA,mCAAU,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aAC3C;YAED,OAAO,IAAA,mCAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,IAAA,mCAAU,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9C,KAAK,QAAQ;YACX,OAAO,IAAA,mCAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,SAAS;YACZ,OAAO,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,IAAA,mCAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAChD;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAtBD,wCAsBC;AAED,IAAA,6CAAoB,EAAC,KAAK,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\nimport {getRef} from \"../utils/getRef\";\n\nexport function anyToComponent(schema: any, options: any) {\n schema = getRef(schema, options);\n\n switch (schema?.type) {\n case \"object\":\n if (!schema.properties && !schema.$ref) {\n return execMapper(\"map\", schema, options);\n }\n\n return execMapper(\"nested\", schema, options);\n case \"array\":\n return execMapper(\"array\", schema, options);\n case \"string\":\n return execMapper(\"string\", schema, options);\n case \"boolean\":\n return execMapper(\"boolean\", schema, options);\n case \"integer\":\n case \"number\":\n return execMapper(\"number\", schema, options);\n }\n\n return {};\n}\n\nregisterFormioMapper(\"any\", anyToComponent);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFormioSchema.js","sourceRoot":"","sources":["../../../src/utils/getForm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,CAAC,KAAK,CAAC,GAAG,CAAM,aAAa,EAAE,EAAE,CAAC;QAC3C,IAAI,EAAE,WAAW;QACjB,WAAW;QACX,UAAU;KACX,CAAC;IAEF,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,IAA6B,CAAC;AACvC,CAAC;AAtCD,0CAsCC","sourcesContent":["import {isString, Type} from \"@tsed/core\";\nimport {getJsonSchema, JsonEntityStore, JsonSchemaOptions} from \"@tsed/schema\";\nimport {FormioForm} from \"@tsed/formio-types\";\nimport {execMapper} from \"../registries/FormioMappersContainer\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\nimport {paramCase} from \"change-case\";\nimport \"../components/anyToComponent\";\nimport \"../components/arrayToComponent\";\nimport \"../components/booleanToComponent\";\nimport \"../components/dateToComponent\";\nimport \"../components/defaultToComponent\";\nimport \"../components/enumToComponent\";\nimport \"../components/mapToComponent\";\nimport \"../components/nestedToComponent\";\nimport \"../components/numberToComponent\";\nimport \"../components/objectToEditGrid\";\nimport \"../components/panelToComponent\";\nimport \"../components/propertiesToComponents\";\nimport \"../components/stringToComponent\";\n\nexport async function getFormioSchema(\n model: string | any | undefined,\n options: JsonSchemaOptions = {}\n): Promise<Omit<FormioForm, \"
|
|
1
|
+
{"version":3,"file":"getFormioSchema.js","sourceRoot":"","sources":["../../../src/utils/getFormioSchema.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,yCAA+E;AAE/E,iFAAgE;AAChE,iEAA4D;AAC5D,6CAAsC;AACtC,wCAAsC;AACtC,0CAAwC;AACxC,4CAA0C;AAC1C,yCAAuC;AACvC,4CAA0C;AAC1C,yCAAuC;AACvC,wCAAsC;AACtC,2CAAyC;AACzC,2CAAyC;AACzC,0CAAwC;AACxC,0CAAwC;AACxC,gDAA8C;AAC9C,2CAAyC;A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AC;AAtCD,0CAsCC","sourcesContent":["import {isString, Type} from \"@tsed/core\";\nimport {getJsonSchema, JsonEntityStore, JsonSchemaOptions} from \"@tsed/schema\";\nimport {FormioForm} from \"@tsed/formio-types\";\nimport {execMapper} from \"../registries/FormioMappersContainer\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\nimport {paramCase} from \"change-case\";\nimport \"../components/anyToComponent\";\nimport \"../components/arrayToComponent\";\nimport \"../components/booleanToComponent\";\nimport \"../components/dateToComponent\";\nimport \"../components/defaultToComponent\";\nimport \"../components/enumToComponent\";\nimport \"../components/mapToComponent\";\nimport \"../components/nestedToComponent\";\nimport \"../components/numberToComponent\";\nimport \"../components/objectToEditGrid\";\nimport \"../components/panelToComponent\";\nimport \"../components/propertiesToComponents\";\nimport \"../components/stringToComponent\";\n\nexport async function getFormioSchema(\n model: string | any | undefined,\n options: JsonSchemaOptions = {}\n): Promise<Omit<FormioForm, \"_id\" | \"deleted\" | \"owner\"> | undefined> {\n if (!model) {\n return undefined;\n }\n\n if (isString(model)) {\n return getFormioSchema(FormsContainer.get(model) as Type<any>, options);\n }\n\n const entity = JsonEntityStore.from(model);\n const schema = getJsonSchema(entity, {\n ...options,\n customKeys: true\n });\n\n const name = entity.schema.getName();\n const machineName = paramCase(name);\n const resolvers: Promise<any>[] = [];\n const components = execMapper(\"properties\", schema, {...options, definitions: schema.definitions, resolvers});\n const form = {\n title: name,\n type: \"form\",\n display: \"form\",\n tags: [],\n access: [],\n submissionAccess: [],\n ...entity.store.get<any>(\"formio:form\", {}),\n name: machineName,\n machineName,\n components\n };\n\n await Promise.all(resolvers.map((resolver: any) => resolver(form, options)));\n\n return form as unknown as FormioForm;\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { execMapper, registerFormioMapper } from "../registries/FormioMappersCon
|
|
|
2
2
|
import { getRef } from "../utils/getRef.js";
|
|
3
3
|
export function anyToComponent(schema, options) {
|
|
4
4
|
schema = getRef(schema, options);
|
|
5
|
-
switch (schema
|
|
5
|
+
switch (schema?.type) {
|
|
6
6
|
case "object":
|
|
7
7
|
if (!schema.properties && !schema.$ref) {
|
|
8
8
|
return execMapper("map", schema, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anyToComponent.js","sourceRoot":"","sources":["../../../src/components/anyToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,MAAM,UAAU,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"anyToComponent.js","sourceRoot":"","sources":["../../../src/components/anyToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,MAAM,UAAU,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,QAAQ,MAAM,EAAE,IAAI,EAAE;QACpB,KAAK,QAAQ;YACX,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBACtC,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aAC3C;YAED,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9C,KAAK,QAAQ;YACX,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,SAAS;YACZ,OAAO,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAChD;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\nimport {getRef} from \"../utils/getRef\";\n\nexport function anyToComponent(schema: any, options: any) {\n schema = getRef(schema, options);\n\n switch (schema?.type) {\n case \"object\":\n if (!schema.properties && !schema.$ref) {\n return execMapper(\"map\", schema, options);\n }\n\n return execMapper(\"nested\", schema, options);\n case \"array\":\n return execMapper(\"array\", schema, options);\n case \"string\":\n return execMapper(\"string\", schema, options);\n case \"boolean\":\n return execMapper(\"boolean\", schema, options);\n case \"integer\":\n case \"number\":\n return execMapper(\"number\", schema, options);\n }\n\n return {};\n}\n\nregisterFormioMapper(\"any\", anyToComponent);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFormioSchema.js","sourceRoot":"","sources":["../../../src/utils/getFormioSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAO,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AACvC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AACvC,OAAO,8BAA8B,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CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,IAA6B,CAAC;AACvC,CAAC","sourcesContent":["import {isString, Type} from \"@tsed/core\";\nimport {getJsonSchema, JsonEntityStore, JsonSchemaOptions} from \"@tsed/schema\";\nimport {FormioForm} from \"@tsed/formio-types\";\nimport {execMapper} from \"../registries/FormioMappersContainer\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\nimport {paramCase} from \"change-case\";\nimport \"../components/anyToComponent\";\nimport \"../components/arrayToComponent\";\nimport \"../components/booleanToComponent\";\nimport \"../components/dateToComponent\";\nimport \"../components/defaultToComponent\";\nimport \"../components/enumToComponent\";\nimport \"../components/mapToComponent\";\nimport \"../components/nestedToComponent\";\nimport \"../components/numberToComponent\";\nimport \"../components/objectToEditGrid\";\nimport \"../components/panelToComponent\";\nimport \"../components/propertiesToComponents\";\nimport \"../components/stringToComponent\";\n\nexport async function getFormioSchema(\n model: string | any | undefined,\n options: JsonSchemaOptions = {}\n): Promise<Omit<FormioForm, \"
|
|
1
|
+
{"version":3,"file":"getFormioSchema.js","sourceRoot":"","sources":["../../../src/utils/getFormioSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAO,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AACvC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AACvC,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O,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,IAA6B,CAAC;AACvC,CAAC","sourcesContent":["import {isString, Type} from \"@tsed/core\";\nimport {getJsonSchema, JsonEntityStore, JsonSchemaOptions} from \"@tsed/schema\";\nimport {FormioForm} from \"@tsed/formio-types\";\nimport {execMapper} from \"../registries/FormioMappersContainer\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\nimport {paramCase} from \"change-case\";\nimport \"../components/anyToComponent\";\nimport \"../components/arrayToComponent\";\nimport \"../components/booleanToComponent\";\nimport \"../components/dateToComponent\";\nimport \"../components/defaultToComponent\";\nimport \"../components/enumToComponent\";\nimport \"../components/mapToComponent\";\nimport \"../components/nestedToComponent\";\nimport \"../components/numberToComponent\";\nimport \"../components/objectToEditGrid\";\nimport \"../components/panelToComponent\";\nimport \"../components/propertiesToComponents\";\nimport \"../components/stringToComponent\";\n\nexport async function getFormioSchema(\n model: string | any | undefined,\n options: JsonSchemaOptions = {}\n): Promise<Omit<FormioForm, \"_id\" | \"deleted\" | \"owner\"> | undefined> {\n if (!model) {\n return undefined;\n }\n\n if (isString(model)) {\n return getFormioSchema(FormsContainer.get(model) as Type<any>, options);\n }\n\n const entity = JsonEntityStore.from(model);\n const schema = getJsonSchema(entity, {\n ...options,\n customKeys: true\n });\n\n const name = entity.schema.getName();\n const machineName = paramCase(name);\n const resolvers: Promise<any>[] = [];\n const components = execMapper(\"properties\", schema, {...options, definitions: schema.definitions, resolvers});\n const form = {\n title: name,\n type: \"form\",\n display: \"form\",\n tags: [],\n access: [],\n submissionAccess: [],\n ...entity.store.get<any>(\"formio:form\", {}),\n name: machineName,\n machineName,\n components\n };\n\n await Promise.all(resolvers.map((resolver: any) => resolver(form, options)));\n\n return form as unknown as FormioForm;\n}\n"]}
|
|
@@ -13,4 +13,4 @@ import "../components/objectToEditGrid";
|
|
|
13
13
|
import "../components/panelToComponent";
|
|
14
14
|
import "../components/propertiesToComponents";
|
|
15
15
|
import "../components/stringToComponent";
|
|
16
|
-
export declare function getFormioSchema(model: string | any | undefined, options?: JsonSchemaOptions): Promise<Omit<FormioForm, "
|
|
16
|
+
export declare function getFormioSchema(model: string | any | undefined, options?: JsonSchemaOptions): Promise<Omit<FormioForm, "_id" | "deleted" | "owner"> | undefined>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema-formio",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.115.1",
|
|
4
4
|
"description": "Transform Ts.ED Schema & JsonSchema to a valid Formio schema",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"tsed"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tsed/formio-types": "6.
|
|
36
|
+
"@tsed/formio-types": "6.115.1",
|
|
37
37
|
"change-case": "4.1.2",
|
|
38
38
|
"tslib": "2.4.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tsed/core": "6.
|
|
42
|
-
"@tsed/openspec": "6.
|
|
43
|
-
"@tsed/schema": "6.
|
|
41
|
+
"@tsed/core": "6.115.1",
|
|
42
|
+
"@tsed/openspec": "6.115.1",
|
|
43
|
+
"@tsed/schema": "6.115.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@tsed/core": "^6.
|
|
47
|
-
"@tsed/openspec": "^6.
|
|
48
|
-
"@tsed/schema": "^6.
|
|
46
|
+
"@tsed/core": "^6.115.1",
|
|
47
|
+
"@tsed/openspec": "^6.115.1",
|
|
48
|
+
"@tsed/schema": "^6.115.1",
|
|
49
49
|
"formiojs": ">=4.0.0",
|
|
50
50
|
"lodash": ">=4.0.0",
|
|
51
51
|
"moment": ">=2.0.0"
|