@superblocksteam/util 0.0.21 → 0.0.22

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.
@@ -0,0 +1,9 @@
1
+ export declare enum ComponentEvent {
2
+ CREATE = "create",
3
+ INIT = "init",
4
+ LOGIN = "login",
5
+ MIGRATE = "migrate",
6
+ PULL = "pull",
7
+ REGISTER = "register",
8
+ UPLOAD = "upload"
9
+ }
package/dist/events.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentEvent = void 0;
4
+ var ComponentEvent;
5
+ (function (ComponentEvent) {
6
+ ComponentEvent["CREATE"] = "create";
7
+ ComponentEvent["INIT"] = "init";
8
+ ComponentEvent["LOGIN"] = "login";
9
+ ComponentEvent["MIGRATE"] = "migrate";
10
+ ComponentEvent["PULL"] = "pull";
11
+ ComponentEvent["REGISTER"] = "register";
12
+ ComponentEvent["UPLOAD"] = "upload";
13
+ })(ComponentEvent || (exports.ComponentEvent = ComponentEvent = {}));
@@ -1 +1,2 @@
1
+ export declare const COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
1
2
  export declare const getBucketeerUrlFromSuperblocksUrl: (superblocksBaseUrl: string) => string;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBucketeerUrlFromSuperblocksUrl = void 0;
3
+ exports.getBucketeerUrlFromSuperblocksUrl = exports.COMPONENT_EVENT_HEADER = void 0;
4
4
  const lodash_1 = require("lodash");
5
+ exports.COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
5
6
  // retrieves bucketeer base URL given the superblocks server base URL
6
7
  const getBucketeerUrlFromSuperblocksUrl = (superblocksBaseUrl) => {
7
8
  // if superblocks base URL is an EE, return bucketeer's dev URL
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./constants";
2
2
  export * from "./component-configs";
3
+ export * from "./events";
3
4
  export * from "./file-uploader";
4
5
  export * from "./login";
5
6
  export * from "./resource-configs";
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./constants"), exports);
5
5
  tslib_1.__exportStar(require("./component-configs"), exports);
6
+ tslib_1.__exportStar(require("./events"), exports);
6
7
  tslib_1.__exportStar(require("./file-uploader"), exports);
7
8
  tslib_1.__exportStar(require("./login"), exports);
8
9
  tslib_1.__exportStar(require("./resource-configs"), exports);
package/dist/types.d.ts CHANGED
@@ -2,25 +2,69 @@
2
2
  import { type UUID } from "node:crypto";
3
3
  import { type DataType } from "./data-types";
4
4
  interface PropertiesPanelDisplay {
5
+ /**
6
+ * Determines what form item type is shown in the Superblocks properties panel.
7
+ */
5
8
  controlType: "text" | "js-expr" | "switch";
9
+ /**
10
+ * Determines form item label in the Superblocks properties panel.
11
+ */
6
12
  label: string;
13
+ /**
14
+ * Placeholder text appears as gray text in the properties panel. This only applies
15
+ * to text-like inputs.
16
+ */
7
17
  placeholder?: string;
18
+ /**
19
+ * This shows up in the popover as a user types into the properties panel.
20
+ * This is a documentation field that helps users understand what type of data is accepted
21
+ * by this property.
22
+ */
8
23
  exampleData?: string;
9
24
  }
10
25
  export interface Property {
11
26
  path: string;
12
27
  dataType: DataType;
28
+ /**
29
+ * The presence of this object determines whether or not this property
30
+ * shows up in the Superblocks properties panel.
31
+ **/
13
32
  propertiesPanelDisplay?: PropertiesPanelDisplay;
33
+ /**
34
+ * A description of this property. This is used in the Superblocks properties panel
35
+ * as well as in the custom component's autocomplete.
36
+ **/
14
37
  description?: string;
38
+ /**
39
+ * By default, all your properties are readable from anywhere in Superblocks using dot notation
40
+ * (e.g. `myComponent.myProperty`). If you want to hide a property from the outside world,
41
+ * set this to false
42
+ * @default true
43
+ */
44
+ isExternallyReadable?: boolean;
45
+ /**
46
+ * By default, all properties can have be used with Set Component Property and Reset Component to Default.
47
+ * @default true
48
+ **/
49
+ isExternallySettable?: boolean;
15
50
  }
16
51
  export interface ComponentConfig {
17
52
  id: UUID;
53
+ /**
54
+ * @example: "myComponent"
55
+ */
18
56
  name: string;
57
+ /**
58
+ * @example "My Component"
59
+ */
19
60
  displayName: string;
61
+ /**
62
+ * @example "components/myComponent/component.tsx"
63
+ */
20
64
  componentPath: string;
21
65
  properties: Property[];
22
66
  /**
23
- * Example: [{
67
+ * @example [{
24
68
  * label: "On Click",
25
69
  * path: "onClick",
26
70
  * }]
@@ -52,6 +52,8 @@ const componentSchema = {
52
52
  additionalProperties: false,
53
53
  },
54
54
  description: { type: "string" },
55
+ isExternallySettable: { type: "boolean" },
56
+ isExternallyReadable: { type: "boolean" },
55
57
  },
56
58
  type: "object",
57
59
  additionalProperties: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/util",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "main": "dist/index.js",
5
5
  "homepage": "https://www.superblocks.com",
6
6
  "scripts": {
package/src/events.ts ADDED
@@ -0,0 +1,9 @@
1
+ export enum ComponentEvent {
2
+ CREATE = "create",
3
+ INIT = "init",
4
+ LOGIN = "login",
5
+ MIGRATE = "migrate",
6
+ PULL = "pull",
7
+ REGISTER = "register",
8
+ UPLOAD = "upload",
9
+ }
@@ -1,5 +1,7 @@
1
1
  import { isEmpty } from "lodash";
2
2
 
3
+ export const COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
4
+
3
5
  // retrieves bucketeer base URL given the superblocks server base URL
4
6
  export const getBucketeerUrlFromSuperblocksUrl = (
5
7
  superblocksBaseUrl: string
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./constants";
2
2
  export * from "./component-configs";
3
+ export * from "./events";
3
4
  export * from "./file-uploader";
4
5
  export * from "./login";
5
6
  export * from "./resource-configs";
package/src/types.ts CHANGED
@@ -2,19 +2,27 @@ import { type UUID } from "node:crypto";
2
2
  import { type DataType } from "./data-types";
3
3
 
4
4
  interface PropertiesPanelDisplay {
5
- // Determines what form item type is shown in the Superblocks properties panel.
5
+ /**
6
+ * Determines what form item type is shown in the Superblocks properties panel.
7
+ */
6
8
  controlType: "text" | "js-expr" | "switch";
7
9
 
8
- // Determines form item label in the Superblocks properties panel.
10
+ /**
11
+ * Determines form item label in the Superblocks properties panel.
12
+ */
9
13
  label: string;
10
14
 
11
- // Placeholder text appears as gray text in the properties panel. This only applies
12
- // to text-like inputs.
15
+ /**
16
+ * Placeholder text appears as gray text in the properties panel. This only applies
17
+ * to text-like inputs.
18
+ */
13
19
  placeholder?: string;
14
20
 
15
- // This shows up in the popover as a user types into the properties panel.
16
- // This is a documentation field that helps users understand what type of data is accepted
17
- // by this property.
21
+ /**
22
+ * This shows up in the popover as a user types into the properties panel.
23
+ * This is a documentation field that helps users understand what type of data is accepted
24
+ * by this property.
25
+ */
18
26
  exampleData?: string;
19
27
  }
20
28
 
@@ -22,31 +30,55 @@ export interface Property {
22
30
  path: string;
23
31
  dataType: DataType;
24
32
 
25
- // The presence of this object determines whether or not this property
26
- // shows up in the Superblocks properties panel.
33
+ /**
34
+ * The presence of this object determines whether or not this property
35
+ * shows up in the Superblocks properties panel.
36
+ **/
27
37
  propertiesPanelDisplay?: PropertiesPanelDisplay;
28
38
 
29
- // A description of this property. This is used in the Superblocks properties panel
30
- // as well as in the custom component's autocomplete.
39
+ /**
40
+ * A description of this property. This is used in the Superblocks properties panel
41
+ * as well as in the custom component's autocomplete.
42
+ **/
31
43
  description?: string;
44
+
45
+ /**
46
+ * By default, all your properties are readable from anywhere in Superblocks using dot notation
47
+ * (e.g. `myComponent.myProperty`). If you want to hide a property from the outside world,
48
+ * set this to false
49
+ * @default true
50
+ */
51
+ isExternallyReadable?: boolean;
52
+
53
+ /**
54
+ * By default, all properties can have be used with Set Component Property and Reset Component to Default.
55
+ * @default true
56
+ **/
57
+ isExternallySettable?: boolean;
32
58
  }
33
59
 
34
60
  export interface ComponentConfig {
35
61
  id: UUID;
36
62
 
37
- // Example: "myComponent"
63
+ /**
64
+ * @example: "myComponent"
65
+ */
38
66
  name: string;
39
67
 
40
- // Example: "My Component"
68
+ /**
69
+ * @example "My Component"
70
+ */
41
71
  displayName: string;
42
72
 
43
- // Example: "components/myComponent/component.tsx"
73
+ /**
74
+ * @example "components/myComponent/component.tsx"
75
+ */
44
76
  componentPath: string;
45
77
 
46
78
  properties: Property[];
47
79
 
48
80
  /**
49
- * Example: [{
81
+ * @example [{
50
82
  * label: "On Click",
51
83
  * path: "onClick",
52
84
  * }]
package/src/validation.ts CHANGED
@@ -50,6 +50,8 @@ const componentSchema: Schema = {
50
50
  additionalProperties: false,
51
51
  },
52
52
  description: { type: "string" },
53
+ isExternallySettable: { type: "boolean" },
54
+ isExternallyReadable: { type: "boolean" },
53
55
  },
54
56
  type: "object",
55
57
  additionalProperties: false,