@superblocksteam/util 1.99.99-next.2 → 2.0.0-SNAPSHOT.03dcbbce5278af46

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 (106) hide show
  1. package/dist/api-files/{api.d.mts → api.d.ts} +4 -3
  2. package/dist/api-files/api.d.ts.map +1 -0
  3. package/dist/api-files/{api.mjs → api.js} +5 -5
  4. package/dist/api-files/api.js.map +1 -0
  5. package/dist/api-files/constants.d.ts.map +1 -1
  6. package/dist/api-files/constants.js +2 -5
  7. package/dist/api-files/constants.js.map +1 -1
  8. package/dist/api-files/index.d.ts +1 -6
  9. package/dist/api-files/index.d.ts.map +1 -1
  10. package/dist/api-files/index.js +1 -12
  11. package/dist/api-files/index.js.map +1 -1
  12. package/dist/api-files/types.d.ts +13 -15
  13. package/dist/api-files/types.d.ts.map +1 -1
  14. package/dist/api-files/types.js +3 -9
  15. package/dist/api-files/types.js.map +1 -1
  16. package/dist/constants.d.ts +1 -2
  17. package/dist/constants.d.ts.map +1 -1
  18. package/dist/constants.js +8 -29
  19. package/dist/constants.js.map +1 -1
  20. package/dist/events.d.ts +0 -4
  21. package/dist/events.d.ts.map +1 -1
  22. package/dist/events.js +2 -9
  23. package/dist/events.js.map +1 -1
  24. package/dist/file-uploader.d.ts.map +1 -1
  25. package/dist/file-uploader.js +27 -18
  26. package/dist/file-uploader.js.map +1 -1
  27. package/dist/file-uploader.test.d.ts +2 -0
  28. package/dist/file-uploader.test.d.ts.map +1 -0
  29. package/dist/file-uploader.test.js +42 -0
  30. package/dist/file-uploader.test.js.map +1 -0
  31. package/dist/identifiers.js +3 -8
  32. package/dist/identifiers.js.map +1 -1
  33. package/dist/index.d.ts +1 -3
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +13 -31
  36. package/dist/index.js.map +1 -1
  37. package/dist/localGitRepoState.js +1 -2
  38. package/dist/login.d.ts +6 -0
  39. package/dist/login.d.ts.map +1 -1
  40. package/dist/login.js +38 -54
  41. package/dist/login.js.map +1 -1
  42. package/dist/login.test.d.ts +2 -0
  43. package/dist/login.test.d.ts.map +1 -0
  44. package/dist/login.test.js +64 -0
  45. package/dist/login.test.js.map +1 -0
  46. package/dist/mask-unix-signals.d.ts +2 -1
  47. package/dist/mask-unix-signals.d.ts.map +1 -1
  48. package/dist/mask-unix-signals.js +1 -4
  49. package/dist/mask-unix-signals.js.map +1 -1
  50. package/dist/resource-configs.d.ts +17 -20
  51. package/dist/resource-configs.d.ts.map +1 -1
  52. package/dist/resource-configs.js +54 -99
  53. package/dist/resource-configs.js.map +1 -1
  54. package/dist/token-manager.d.ts +22 -0
  55. package/dist/token-manager.d.ts.map +1 -0
  56. package/dist/token-manager.js +2 -0
  57. package/dist/token-manager.js.map +1 -0
  58. package/dist/unreachable.js +1 -4
  59. package/dist/unreachable.js.map +1 -1
  60. package/package.json +52 -29
  61. package/.prettierrc +0 -18
  62. package/dist/api-files/api.d.mts.map +0 -1
  63. package/dist/api-files/api.mjs.map +0 -1
  64. package/dist/component-configs.d.ts +0 -6
  65. package/dist/component-configs.d.ts.map +0 -1
  66. package/dist/component-configs.js +0 -178
  67. package/dist/component-configs.js.map +0 -1
  68. package/dist/data-types.d.ts +0 -10
  69. package/dist/data-types.d.ts.map +0 -1
  70. package/dist/data-types.js +0 -32
  71. package/dist/data-types.js.map +0 -1
  72. package/dist/generate-component-types.d.ts +0 -3
  73. package/dist/generate-component-types.d.ts.map +0 -1
  74. package/dist/generate-component-types.js +0 -45
  75. package/dist/generate-component-types.js.map +0 -1
  76. package/dist/types.d.ts +0 -105
  77. package/dist/types.d.ts.map +0 -1
  78. package/dist/types.js +0 -3
  79. package/dist/types.js.map +0 -1
  80. package/dist/validation.d.ts +0 -5
  81. package/dist/validation.d.ts.map +0 -1
  82. package/dist/validation.js +0 -152
  83. package/dist/validation.js.map +0 -1
  84. package/eslint.config.js +0 -83
  85. package/src/api-files/api.mts +0 -504
  86. package/src/api-files/constants.ts +0 -6
  87. package/src/api-files/index.ts +0 -15
  88. package/src/api-files/types.ts +0 -134
  89. package/src/component-configs.ts +0 -161
  90. package/src/constants.ts +0 -48
  91. package/src/data-types.ts +0 -39
  92. package/src/events.ts +0 -12
  93. package/src/file-uploader.ts +0 -28
  94. package/src/generate-component-types.ts +0 -53
  95. package/src/identifiers.ts +0 -70
  96. package/src/index.ts +0 -15
  97. package/src/localGitRepoState.ts +0 -20
  98. package/src/login.ts +0 -66
  99. package/src/mask-unix-signals.ts +0 -86
  100. package/src/resource-configs.ts +0 -293
  101. package/src/types.ts +0 -137
  102. package/src/unreachable.ts +0 -5
  103. package/src/validation.ts +0 -155
  104. package/tsconfig.json +0 -20
  105. package/tsconfig.tsbuildinfo +0 -1
  106. package/tsup.config.ts +0 -8
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-configs.js","sourceRoot":"","sources":["../src/component-configs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,kDAyEC;AAxJD,2DAA8C;AAC9C,sDAAyB;AACzB,0DAA6B;AAC7B,gDAAkC;AAClC,6CAA+B;AAC/B,sDAAwC;AACxC,iDAAwD;AACxD,+EAA2E;AAC3E,mDAA2D;AAE3D,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,6BAAQ,CAAC,CAAC;AAE/C,KAAK,UAAU,iBAAiB,CAC9B,aAAqB,EACrB,SAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACtD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE;gBACzC,OAAO;gBACP,mBAAI,CAAC,OAAO,CAAC,aAAa,CAAC;gBAC3B,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,WAAW;gBACX,UAAU;gBACV,QAAQ;gBACR,mBAAmB;gBACnB,MAAM;gBACN,oBAAoB;g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AC/C,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,OAAO;QACL,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC;AAEM,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAU,EAAE;IACzD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,QAAkB,CAAC;AAC5B,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
@@ -1,10 +0,0 @@
1
- export declare const supportedDataTypes: readonly ["string", "number", "boolean", "any"];
2
- export type DataType = (typeof supportedDataTypes)[number];
3
- interface TypeInfo {
4
- tsType: string;
5
- prompt: string;
6
- }
7
- export declare const dataTypeDefinions: Record<DataType, TypeInfo>;
8
- export declare function isValidDataType(input: string): input is DataType;
9
- export {};
10
- //# sourceMappingURL=data-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types.d.ts","sourceRoot":"","sources":["../src/data-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,iDAKrB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,UAAU,QAAQ;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAiBxD,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAKhE"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dataTypeDefinions = exports.supportedDataTypes = void 0;
4
- exports.isValidDataType = isValidDataType;
5
- exports.supportedDataTypes = [
6
- "string",
7
- "number",
8
- "boolean",
9
- "any",
10
- ];
11
- exports.dataTypeDefinions = {
12
- string: {
13
- tsType: "string",
14
- prompt: "string",
15
- },
16
- number: {
17
- tsType: "number",
18
- prompt: "number",
19
- },
20
- boolean: {
21
- tsType: "boolean",
22
- prompt: "boolean",
23
- },
24
- any: {
25
- tsType: "any",
26
- prompt: "any (raw js expression)",
27
- },
28
- };
29
- function isValidDataType(input) {
30
- return Object.prototype.hasOwnProperty.call(exports.dataTypeDefinions, input);
31
- }
32
- //# sourceMappingURL=data-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types.js","sourceRoot":"","sources":["../src/data-types.ts"],"names":[],"mappings":";;;AAiCA,0CAKC;AAtCY,QAAA,kBAAkB,GAAG;IAChC,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,KAAK;CACG,CAAC;AASE,QAAA,iBAAiB,GAA+B;IAC3D,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;KAClB;IACD,GAAG,EAAE;QACH,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,yBAAyB;KAClC;CACF,CAAC;AAEF,SAAgB,eAAe,CAAC,KAAa;IAC3C,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CACzC,yBAAiB,EACjB,KAAiB,CAClB,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ComponentConfig } from "./types.js";
2
- export declare function generateComponentTypesFile(config: ComponentConfig): string;
3
- //# sourceMappingURL=generate-component-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-component-types.d.ts","sourceRoot":"","sources":["../src/generate-component-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAwBlD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,eAAe,UA2BjE"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateComponentTypesFile = generateComponentTypesFile;
4
- const data_types_js_1 = require("./data-types.js");
5
- const indent = (str, spaces) => {
6
- const spacesString = " ".repeat(spaces);
7
- return str
8
- .split("\n")
9
- .map((line) => `${spacesString}${line}`)
10
- .join("\n");
11
- };
12
- function renderInputTypeAsTS(name, type, trailingChars, indentSpaces) {
13
- let { tsType } = data_types_js_1.dataTypeDefinions[type];
14
- if (["number", "string"].includes(type)) {
15
- tsType += " | null";
16
- }
17
- return indent(`${name}: ${tsType}${trailingChars}`, indentSpaces);
18
- }
19
- function generateComponentTypesFile(config) {
20
- const properties = config.properties ?? [];
21
- const eventHandlers = config.events ?? [];
22
- return `// GENERATED CODE -- DO NOT EDIT!
23
- //
24
- // This file is automatically generated by the Superblocks CLI
25
- // Use the \`superblocks components watch\` command to regenerate this file from its source in config.ts
26
-
27
- // All properties of your component are defined here.
28
- // These are the properties which are surfaced in the Superblocks properties panel
29
- // and can be referenced throughout your Superblocks Application
30
- export type Props = {
31
- ${properties
32
- .map((v) => renderInputTypeAsTS(v.path, v.dataType, ";", 2) + "\n")
33
- .join("")}};
34
-
35
- export type EventTriggers = {
36
- // Call the subsequent function(s) to trigger event(s) in Superblocks from your component.
37
- // These events can be wired up to event handlers in your Superblocks App
38
- ${eventHandlers.length === 0
39
- ? " // Note: no event handlers defined\n"
40
- : eventHandlers
41
- .map((v) => indent(v.path, 2) + ": () => void;" + "\n")
42
- .join("")}};
43
- `;
44
- }
45
- //# sourceMappingURL=generate-component-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-component-types.js","sourceRoot":"","sources":["../src/generate-component-types.ts"],"names":[],"mappings":";;AAyB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,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC;aAC3D,IAAI,CAAC,EAAE,CAChB;CACC,CAAC;AACF,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,105 +0,0 @@
1
- import type { DataType } from "./data-types.js";
2
- import type { UUID } from "node:crypto";
3
- interface PropertiesPanelDisplay<T extends DataType> {
4
- /**
5
- * Determines what form item type is shown in the Superblocks properties panel.
6
- *
7
- * Only booleans are allowed to use the "switch" control
8
- */
9
- controlType: T extends "boolean" ? "text" | "js-expr" | "switch" : "text" | "js-expr";
10
- /**
11
- * Determines form item label in the Superblocks properties panel.
12
- */
13
- label: string;
14
- /**
15
- * Placeholder text appears as gray text in the properties panel. This only applies
16
- * to text-like inputs.
17
- */
18
- placeholder?: string;
19
- /**
20
- * This shows up in the popover as a user types into the properties panel.
21
- * This is a documentation field that helps users understand what type of data is accepted
22
- * by this property. You should give a specific example, not a generic type
23
- *
24
- * @example {
25
- * label: "My Label",
26
- * value: "myValue"
27
- * }
28
- */
29
- exampleData?: string;
30
- /**
31
- * This shows up in the popover as a user types into the properties panel.
32
- * This is a documentation field that helps users understand what type of data is accepted
33
- * by this property. Typescript notation is recommended.
34
- *
35
- * @example "Array<{ label: string; value: string; }>"
36
- */
37
- expectedType?: string;
38
- /**
39
- * The default value should match the dataType of the property.
40
- */
41
- defaultValue?: T;
42
- /**
43
- * The default value to use when adding a property.
44
- */
45
- defaultOnAdd?: T;
46
- }
47
- export interface PropertyForData<T extends DataType> {
48
- path: string;
49
- dataType: T;
50
- /**
51
- * The presence of this object determines whether or not this property
52
- * shows up in the Superblocks properties panel.
53
- **/
54
- propertiesPanelDisplay?: PropertiesPanelDisplay<T>;
55
- /**
56
- * A description of this property. This is used in the Superblocks properties panel
57
- * as well as in the custom component's autocomplete.
58
- **/
59
- description?: string;
60
- /**
61
- * By default, all your properties are readable from anywhere in Superblocks using dot notation
62
- * (e.g. `myComponent.myProperty`). If you want to hide a property from the outside world,
63
- * set this to false
64
- * @default true
65
- */
66
- isExternallyReadable?: boolean;
67
- /**
68
- * By default, all properties can have be used with Set Component Property and Reset Component to Default.
69
- * @default true
70
- **/
71
- isExternallySettable?: boolean;
72
- }
73
- export type Property = PropertyForData<"string"> | PropertyForData<"number"> | PropertyForData<"boolean"> | PropertyForData<"any">;
74
- export interface ComponentConfig {
75
- id: UUID;
76
- /**
77
- * @example: "myComponent"
78
- */
79
- name: string;
80
- /**
81
- * @example "My Component"
82
- */
83
- displayName: string;
84
- /**
85
- * @example "components/myComponent/component.tsx"
86
- */
87
- componentPath: string;
88
- properties: Array<PropertyForData<"string"> | PropertyForData<"number"> | PropertyForData<"boolean"> | PropertyForData<"any">>;
89
- /**
90
- * @example [{
91
- * label: "On Click",
92
- * path: "onClick",
93
- * }]
94
- */
95
- events: Array<{
96
- label: string;
97
- path: string;
98
- }>;
99
- gridDimensions?: {
100
- initialColumns: number;
101
- initialRows: number;
102
- };
103
- }
104
- export {};
105
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,UAAU,sBAAsB,CAAC,CAAC,SAAS,QAAQ;IACjD;;;;OAIG;IACH,WAAW,EAAE,CAAC,SAAS,SAAS,GAC5B,MAAM,GAAG,SAAS,GAAG,QAAQ,GAC7B,MAAM,GAAG,SAAS,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAA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URL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- export declare function validateCustomComponents(data: any): {
2
- valid: boolean;
3
- message?: string;
4
- };
5
- //# sourceMappingURL=validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AA4IA,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,GAAG;IACnD,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAWA"}
@@ -1,152 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateCustomComponents = validateCustomComponents;
7
- const ajv_1 = __importDefault(require("ajv"));
8
- const better_ajv_errors_1 = __importDefault(require("better-ajv-errors"));
9
- const identifiers_js_1 = require("./identifiers.js");
10
- const ajv = new ajv_1.default();
11
- ajv.addKeyword({
12
- keyword: "stringFormat",
13
- compile: (schema) => {
14
- let validateFunc;
15
- // schema is the value assigned to stringFormat in the schema
16
- if (schema === "identifier") {
17
- validateFunc = (data) => {
18
- if (typeof data != "string")
19
- return false;
20
- if (!(0, identifiers_js_1.isValidIdentifier)(data)) {
21
- validateFunc.errors = [
22
- {
23
- keyword: "format",
24
- message: "must be a valid identifier starting with a-z or underscore and containing only a-z, 0-9, and underscores",
25
- },
26
- ];
27
- return false;
28
- }
29
- if ((0, identifiers_js_1.isReservedPropertyName)(data)) {
30
- validateFunc.errors = [
31
- {
32
- keyword: "format",
33
- message: "must not match a reserved property path (see https://docs.superblocks.com/applications/custom-components/faq#what-is-a-reserved-property)",
34
- },
35
- ];
36
- return false;
37
- }
38
- return true;
39
- };
40
- }
41
- else {
42
- throw new Error(`Unknown stringFormat: ${schema}`);
43
- }
44
- return validateFunc;
45
- },
46
- errors: true,
47
- });
48
- const componentSchema = {
49
- type: "object",
50
- properties: {
51
- id: { type: "string" },
52
- name: { type: "string" },
53
- displayName: { type: "string" },
54
- componentPath: { type: "string" },
55
- properties: {
56
- type: "array",
57
- items: {
58
- $ref: "#/definitions/Property",
59
- },
60
- },
61
- events: {
62
- type: "array",
63
- items: {
64
- $ref: "#/definitions/EventHandler",
65
- },
66
- },
67
- gridDimensions: {
68
- type: "object",
69
- properties: {
70
- initialColumns: { type: "number" },
71
- initialRows: { type: "number" },
72
- },
73
- additionalProperties: false,
74
- required: ["initialColumns", "initialRows"],
75
- },
76
- },
77
- required: [
78
- "id",
79
- "name",
80
- "displayName",
81
- "componentPath",
82
- "properties",
83
- "events",
84
- ],
85
- additionalProperties: false,
86
- definitions: {
87
- Property: {
88
- properties: {
89
- path: { $ref: "#/definitions/Identifier" },
90
- dataType: { enum: ["number", "boolean", "string", "any"] },
91
- propertiesPanelDisplay: {
92
- type: "object",
93
- properties: {
94
- label: { type: "string" },
95
- controlType: { enum: ["text", "js-expr", "switch"] },
96
- defaultValue: {
97
- oneOf: [
98
- {
99
- type: "string",
100
- },
101
- {
102
- type: "boolean",
103
- },
104
- {
105
- type: "number",
106
- },
107
- ],
108
- },
109
- placeholder: { type: "string" },
110
- exampleData: { type: "string" },
111
- expectedType: { type: "string" },
112
- },
113
- required: ["controlType", "label"],
114
- additionalProperties: false,
115
- },
116
- description: { type: "string" },
117
- isExternallySettable: { type: "boolean" },
118
- isExternallyReadable: { type: "boolean" },
119
- },
120
- type: "object",
121
- additionalProperties: false,
122
- required: ["path", "dataType"],
123
- },
124
- EventHandler: {
125
- properties: {
126
- label: { type: "string" },
127
- path: { $ref: "#/definitions/Identifier" },
128
- },
129
- type: "object",
130
- additionalProperties: false,
131
- required: ["label", "path"],
132
- },
133
- Identifier: {
134
- type: "string",
135
- stringFormat: "identifier",
136
- },
137
- },
138
- };
139
- const validate = ajv.compile(componentSchema);
140
- function validateCustomComponents(data) {
141
- const valid = validate(data);
142
- if (!valid) {
143
- return {
144
- valid: false,
145
- message: (0, better_ajv_errors_1.default)(componentSchema, data, validate.errors, {
146
- indent: 2,
147
- }),
148
- };
149
- }
150
- return { valid: true };
151
- }
152
- //# sourceMappingURL=validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":";;;;;AA4IA,4DAcC;AA1JD,8CAAsB;AACtB,0EAAgD;AAChD,qDAA6E;AAI7E,MAAM,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC;AAEtB,GAAG,CAAC,UAAU,CAAC;IACb,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,CAAC,MAAW,EAAE,EAAE;QACvB,IAAI,YAAkC,CAAC;QACvC,6DAA6D;QAC7D,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;YAC5B,YAAY,GAAG,CAAC,IAAS,EAAE,EAAE;gBAC3B,IAAI,OAAO,IAAI,IAAI,QAAQ;oBAAE,OAAO,KAAK,CAAC;gBAC1C,IAAI,CAAC,IAAA,kCAAiB,EAAC,IAAI,CAAC,EAAE,CAAC;oBAC7B,YAAY,CAAC,MAAM,GAAG;wBACpB;4BACE,OAAO,EAAE,QAAQ;4BACjB,OAAO,EACL,0GAA0G;yBAC7G;qBACF,CAAC;oBACF,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,IAAI,IAAA,uCAAsB,EAAC,IAAI,CAAC,EAAE,CAAC;oBACjC,YAAY,CAAC,MAAM,GAAG;wBACpB;4BACE,OAAO,EAAE,QAAQ;4BACjB,OAAO,EACL,2IAA2I;yBAC9I;qBACF,CAAC;oBACF,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC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QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,IAAA,2BAAe,EAAC,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAa,EAAE;gBACtE,MAAM,EAAE,CAAC;aACV,CAAC;SACH,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
package/eslint.config.js DELETED
@@ -1,83 +0,0 @@
1
- const js = require("@eslint/js");
2
- const importPlugin = require("eslint-plugin-import");
3
- const prettier = require("eslint-plugin-prettier");
4
- const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
5
- const unicorn = require("eslint-plugin-unicorn");
6
- const globals = require("globals");
7
- const tseslint = require("typescript-eslint");
8
-
9
- const config = [
10
- {
11
- ignores: [
12
- "**/public/*",
13
- "**/build/*",
14
- "**/node_modules/*",
15
- "**/dist/*",
16
- "**/assets/",
17
- "**/.*",
18
- "eslint.config.js",
19
- "tsup.config.ts",
20
- ],
21
- },
22
- js.configs.recommended,
23
- ...tseslint.configs.recommended,
24
- { files: ["./*", "src/**"], ...eslintPluginPrettierRecommended },
25
- {
26
- plugins: {
27
- "@typescript-eslint": tseslint.plugin,
28
- prettier,
29
- import: importPlugin,
30
- unicorn,
31
- },
32
- languageOptions: {
33
- ecmaVersion: 2020,
34
- sourceType: "commonjs",
35
- globals: globals.node,
36
- },
37
- rules: {
38
- "@typescript-eslint/explicit-module-boundary-types": "off",
39
- "@typescript-eslint/no-explicit-any": "off",
40
- "@typescript-eslint/no-unused-vars": "error",
41
- "@typescript-eslint/no-var-requires": "off",
42
- "@typescript-eslint/no-import-type-side-effects": "error",
43
- "@typescript-eslint/consistent-type-imports": "error",
44
- "unicorn/no-nested-ternary": "off",
45
- "import/order": [
46
- "error",
47
- {
48
- alphabetize: { order: "asc" },
49
- groups: [
50
- "builtin",
51
- "external",
52
- "internal",
53
- "parent",
54
- "sibling",
55
- "index",
56
- "object",
57
- "type",
58
- ],
59
- },
60
- ],
61
- "import/no-cycle": "error",
62
- "import/extensions": [
63
- "error",
64
- "ignorePackages",
65
- {
66
- ts: "never",
67
- tsx: "never",
68
- },
69
- ],
70
- "no-template-curly-in-string": "off",
71
- "no-useless-escape": "off",
72
- "no-void": ["error", { allowAsStatement: true }],
73
- },
74
- },
75
- {
76
- files: ["**/*.test.ts", "test/**/*.js", "test/helpers/init.js"],
77
- rules: {
78
- "@typescript-eslint/no-unused-expressions": "off",
79
- },
80
- },
81
- ];
82
-
83
- module.exports = config;