swoop-common 1.0.13 → 1.0.15

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 (82) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/dist/api/consts.d.ts +0 -1
  4. package/dist/api/consts.js +0 -2
  5. package/dist/components/SchemaValidator.d.ts +0 -3
  6. package/dist/components/SchemaValidator.js +0 -6
  7. package/dist/components/StyledFormView.d.ts +0 -34
  8. package/dist/components/StyledFormView.js +0 -12
  9. package/dist/default_registration/fields_base.d.ts +0 -1
  10. package/dist/default_registration/fields_base.js +0 -129
  11. package/dist/hooks/errors.d.ts +0 -6
  12. package/dist/hooks/errors.js +0 -17
  13. package/dist/index.d.ts +0 -10
  14. package/dist/index.js +0 -9
  15. package/dist/prebuild/generated/import_generated.d.ts +0 -15
  16. package/dist/prebuild/generated/import_generated.js +0 -18
  17. package/dist/prebuild/import.d.ts +0 -1
  18. package/dist/prebuild/import.js +0 -32
  19. package/dist/registry/components.d.ts +0 -13
  20. package/dist/registry/components.js +0 -49
  21. package/dist/registry/fields.d.ts +0 -10
  22. package/dist/registry/fields.js +0 -19
  23. package/dist/registry/types.d.ts +0 -5
  24. package/dist/registry/types.js +0 -5
  25. package/dist/renderers/Address.d.ts +0 -1
  26. package/dist/renderers/Address.js +0 -67
  27. package/dist/renderers/ComponentPicker.d.ts +0 -19
  28. package/dist/renderers/ComponentPicker.js +0 -68
  29. package/dist/renderers/Debug.d.ts +0 -1
  30. package/dist/renderers/Debug.js +0 -13
  31. package/dist/renderers/Example.d.ts +0 -1
  32. package/dist/renderers/Example.js +0 -31
  33. package/dist/renderers/Image/ImageForm.d.ts +0 -10
  34. package/dist/renderers/Image/ImageForm.js +0 -78
  35. package/dist/renderers/Image/ImagePresentation.d.ts +0 -6
  36. package/dist/renderers/Image/ImagePresentation.js +0 -62
  37. package/dist/renderers/StagedText.d.ts +0 -1
  38. package/dist/renderers/StagedText.js +0 -20
  39. package/dist/renderers/TemplatePicker.d.ts +0 -1
  40. package/dist/renderers/TemplatePicker.js +0 -55
  41. package/dist/renderers/address/AddressForm.d.ts +0 -1
  42. package/dist/renderers/address/AddressForm.js +0 -46
  43. package/dist/renderers/address/AddressPresentation.d.ts +0 -1
  44. package/dist/renderers/address/AddressPresentation.js +0 -34
  45. package/dist/renderers/textfield/MultilineForm.d.ts +0 -1
  46. package/dist/renderers/textfield/MultilineForm.js +0 -21
  47. package/dist/renderers/textfield/MultilinePresentation.d.ts +0 -1
  48. package/dist/renderers/textfield/MultilinePresentation.js +0 -13
  49. package/dist/schema/formBuilders/formBuilderJsonSchema.d.ts +0 -11
  50. package/dist/schema/formBuilders/formBuilderJsonSchema.js +0 -178
  51. package/dist/schema/formBuilders/formBuilderUiSchema.d.ts +0 -2
  52. package/dist/schema/formBuilders/formBuilderUiSchema.js +0 -208
  53. package/dist/schema/formSchemaTypes.d.ts +0 -15
  54. package/dist/schema/formSchemaTypes.js +0 -6
  55. package/dist/schema/generate/formSchemaGenerate.d.ts +0 -3
  56. package/dist/schema/generate/formSchemaGenerate.js +0 -19
  57. package/dist/schema/generate/jsonSchemaGenerate.d.ts +0 -3
  58. package/dist/schema/generate/jsonSchemaGenerate.js +0 -150
  59. package/dist/schema/generate/jsonSchemaGeneratewip.d.ts +0 -4
  60. package/dist/schema/generate/jsonSchemaGeneratewip.js +0 -59
  61. package/dist/schema/generate/uiSchemaGenerate.d.ts +0 -3
  62. package/dist/schema/generate/uiSchemaGenerate.js +0 -33
  63. package/dist/schema/schema.d.ts +0 -48
  64. package/dist/schema/schema.js +0 -1
  65. package/dist/schema/template/constraint.d.ts +0 -17
  66. package/dist/schema/template/constraint.js +0 -119
  67. package/dist/schema/template/type.d.ts +0 -94
  68. package/dist/schema/template/type.js +0 -1
  69. package/dist/schema/util.d.ts +0 -1
  70. package/dist/schema/util.js +0 -22
  71. package/dist/test.d.ts +0 -6
  72. package/dist/test.js +0 -5
  73. package/dist/types/address.d.ts +0 -10
  74. package/dist/types/address.js +0 -1
  75. package/dist/types/jsonSchema.d.ts +0 -4
  76. package/dist/types/jsonSchema.js +0 -1
  77. package/dist/types/util.d.ts +0 -1
  78. package/dist/types/util.js +0 -1
  79. package/dist/util/xtype.d.ts +0 -3
  80. package/dist/util/xtype.js +0 -18
  81. package/dist/validation/schemaValidator.d.ts +0 -4
  82. package/dist/validation/schemaValidator.js +0 -6
@@ -1,119 +0,0 @@
1
- export const CONSTRAINT_DEFINITIONS = {
2
- MustHaveOneOf: {
3
- type: "MustHaveOneOf",
4
- name: "Must Have One Of",
5
- description: "At least one of the specified templates must be present",
6
- schema: {
7
- type: "object",
8
- properties: {
9
- templateIds: {
10
- type: "array",
11
- items: {
12
- type: "string",
13
- },
14
- minItems: 1,
15
- },
16
- },
17
- required: ["templateIds"],
18
- },
19
- uiSchema: {
20
- type: "VerticalLayout",
21
- elements: [
22
- {
23
- type: "Control",
24
- scope: "#/properties/templateIds",
25
- label: "Select Templates",
26
- },
27
- ],
28
- },
29
- },
30
- MustHaveAllOf: {
31
- type: "MustHaveAllOf",
32
- name: "Must Have All Of",
33
- description: "All of the specified templates must be present",
34
- schema: {
35
- type: "object",
36
- properties: {
37
- templateIds: {
38
- type: "array",
39
- items: {
40
- type: "string",
41
- },
42
- minItems: 1,
43
- },
44
- },
45
- required: ["templateIds"],
46
- },
47
- uiSchema: {
48
- type: "VerticalLayout",
49
- elements: [
50
- {
51
- type: "Control",
52
- scope: "#/properties/templateIds",
53
- label: "Select Templates",
54
- },
55
- ],
56
- },
57
- },
58
- MustNotHave: {
59
- type: "MustNotHave",
60
- name: "Must Not Have",
61
- description: "None of the specified templates can be present",
62
- schema: {
63
- type: "object",
64
- properties: {
65
- templateIds: {
66
- type: "array",
67
- items: {
68
- type: "string",
69
- },
70
- minItems: 1,
71
- },
72
- },
73
- required: ["templateIds"],
74
- },
75
- uiSchema: {
76
- type: "VerticalLayout",
77
- elements: [
78
- {
79
- type: "Control",
80
- scope: "#/properties/templateIds",
81
- label: "Select Templates",
82
- },
83
- ],
84
- },
85
- },
86
- Custom: {
87
- type: "Custom",
88
- name: "Custom Constraint",
89
- description: "Define a custom constraint with arbitrary fields",
90
- schema: {
91
- type: "object",
92
- properties: {
93
- name: {
94
- type: "string",
95
- },
96
- parameters: {
97
- type: "object",
98
- properties: {},
99
- },
100
- },
101
- required: ["name"],
102
- },
103
- uiSchema: {
104
- type: "VerticalLayout",
105
- elements: [
106
- {
107
- type: "Control",
108
- scope: "#/properties/name",
109
- label: "Constraint Name",
110
- },
111
- {
112
- type: "Control",
113
- scope: "#/properties/parameters",
114
- label: "Parameters",
115
- },
116
- ],
117
- },
118
- },
119
- };
@@ -1,94 +0,0 @@
1
- export interface FormBuilderSchema {
2
- $schema: string;
3
- type: "object";
4
- properties: {
5
- name: SchemaStringProperty;
6
- formFields: RefArrayProperty;
7
- ibFormFields: RefArrayProperty;
8
- constraints: ConstraintArrayProperty;
9
- };
10
- required: string[];
11
- $defs: {
12
- fieldDefinition: DynamicFieldDefinition;
13
- arrayItemDefinition: DynamicFieldDefinition;
14
- };
15
- }
16
- export interface SchemaStringProperty {
17
- type: "string";
18
- minLength: number;
19
- description: string;
20
- }
21
- export interface RefArrayProperty {
22
- type: "array";
23
- items: {
24
- $ref: string;
25
- };
26
- }
27
- export interface ConstraintArrayProperty {
28
- type: "array";
29
- items: ConstraintItem;
30
- }
31
- export interface ConstraintItem {
32
- type: "object";
33
- properties: {
34
- type: {
35
- type: "string";
36
- enum: string[];
37
- title: string;
38
- };
39
- [key: string]: any;
40
- };
41
- required: string[];
42
- dependencies: {
43
- type: {
44
- oneOf: Array<{
45
- properties: {
46
- type: {
47
- const: string;
48
- };
49
- [key: string]: any;
50
- };
51
- required: string[];
52
- }>;
53
- };
54
- };
55
- }
56
- export interface DynamicFieldDefinition {
57
- type: "object";
58
- properties: {
59
- fieldType: {
60
- oneOf: Array<{
61
- const: string;
62
- title: string;
63
- }>;
64
- };
65
- name?: {
66
- type: "string";
67
- minLength: number;
68
- description?: string;
69
- };
70
- description?: {
71
- type: "string";
72
- };
73
- required?: {
74
- type: "boolean";
75
- default: boolean;
76
- };
77
- [key: string]: any;
78
- };
79
- required: string[];
80
- dependencies: {
81
- fieldType: {
82
- oneOf: Array<{
83
- properties: {
84
- fieldType: {
85
- const?: string;
86
- enum?: string[];
87
- };
88
- [key: string]: any;
89
- };
90
- required?: string[];
91
- }>;
92
- };
93
- };
94
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function generateFieldId(name: string): string;
@@ -1,22 +0,0 @@
1
- // Helper function to generate field ID from name
2
- export function generateFieldId(name) {
3
- if (!name)
4
- return `field_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
5
- return toCamelCase(name);
6
- }
7
- // ??
8
- const toCamelCase = (str) => {
9
- if (!str || typeof str !== "string") {
10
- return `field_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
11
- }
12
- return (str
13
- .replace(/\s(.)/g, function ($1) {
14
- return $1.toUpperCase();
15
- })
16
- .replace(/\s/g, "")
17
- .replace(/^(.)/, function ($1) {
18
- return $1.toLowerCase();
19
- })
20
- .replace(/[^a-zA-Z0-9_]/g, "") ||
21
- `field_${Date.now()}_${Math.floor(Math.random() * 1000)}`);
22
- };
package/dist/test.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- text: string;
4
- }
5
- export declare const StyledSchema: React.FC<Props>;
6
- export {};
package/dist/test.js DELETED
@@ -1,5 +0,0 @@
1
- import { Typography } from "@mui/material";
2
- import React from "react";
3
- export const StyledSchema = ({ text }) => {
4
- return React.createElement(Typography, { variant: "h1" }, text);
5
- };
@@ -1,10 +0,0 @@
1
- export type Address = UKAddress;
2
- interface UKAddress {
3
- line1: string;
4
- line2?: string;
5
- city: string;
6
- county?: string;
7
- postcode: string;
8
- number?: number;
9
- }
10
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { JsonSchema } from "@jsonforms/core";
2
- export type JsonSchemaWithXType = JsonSchema & {
3
- "x-type"?: string;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export type Updator<T extends object> = <Field extends keyof T>(field: Field, value: T[Field]) => void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import { JsonSchema, RankedTester } from "@jsonforms/core";
2
- export declare const getXType: (schema: JsonSchema) => string | undefined;
3
- export declare const isXType: (type: string) => RankedTester;
@@ -1,18 +0,0 @@
1
- import { resolveSchema } from "@jsonforms/core";
2
- export const getXType = (schema) => {
3
- let typed = schema;
4
- if (!typed)
5
- return undefined;
6
- return typed["x-type"];
7
- };
8
- export const isXType = (type) => {
9
- return (uischema, schema, ctx) => {
10
- const ui = uischema;
11
- if (!ui.scope)
12
- return -1;
13
- const scoped = resolveSchema(schema, ui.scope, schema);
14
- if (getXType(scoped) === type)
15
- return 10;
16
- return -1;
17
- };
18
- };
@@ -1,4 +0,0 @@
1
- import { JSONSchemaType } from "../schema/schema";
2
- export declare const isValidAgainstSchema: (schema: JSONSchemaType, data: any) => data is {
3
- [x: string]: {};
4
- };
@@ -1,6 +0,0 @@
1
- import Ajv from "ajv";
2
- const ajv = new Ajv();
3
- export const isValidAgainstSchema = (schema, data) => {
4
- const validate = ajv.compile(schema);
5
- return validate(data);
6
- };