@kokimoki/app 1.7.0 → 1.7.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/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from "./types/common";
2
2
  export * from "./types/events";
3
3
  export * from "./types/upload";
4
- export * from "./fields";
5
4
  export * from "./kokimoki-client";
6
5
  export * from "./kokimoki-schema";
7
6
  export * from "./kokimoki-store";
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from "./types/common";
2
2
  export * from "./types/events";
3
3
  export * from "./types/upload";
4
- export * from "./fields";
5
4
  export * from "./kokimoki-client";
6
5
  export * from "./kokimoki-schema";
7
6
  export * from "./kokimoki-store";
@@ -24,102 +24,6 @@ interface Upload {
24
24
  tags: string[];
25
25
  }
26
26
 
27
- interface FieldOptions {
28
- label?: string;
29
- }
30
- declare abstract class Field<T> {
31
- readonly options: FieldOptions;
32
- constructor(options: FieldOptions);
33
- abstract get value(): T;
34
- abstract get schema(): any;
35
- }
36
- declare class BooleanField extends Field<boolean> {
37
- value: boolean;
38
- constructor(value: boolean, options?: FieldOptions);
39
- get schema(): {
40
- type: string;
41
- default: boolean;
42
- };
43
- }
44
- declare class ConstField<T extends string> extends Field<string extends T ? never : T> {
45
- value: string extends T ? never : T;
46
- constructor(value: string extends T ? never : T, options?: FieldOptions);
47
- get schema(): {
48
- const: string extends T ? never : T;
49
- };
50
- }
51
- declare class ImageField extends Field<string> {
52
- value: string;
53
- constructor(value: string, options?: FieldOptions);
54
- get schema(): {
55
- type: string;
56
- default: string;
57
- };
58
- }
59
- declare class TextField extends Field<string> {
60
- value: string;
61
- constructor(value: string, options?: FieldOptions);
62
- get schema(): {
63
- type: string;
64
- default: string;
65
- };
66
- }
67
- declare class EnumField<T extends Record<string, string>> extends Field<keyof T> {
68
- enumValues: T;
69
- value: keyof T;
70
- constructor(enumValues: T, value: keyof T, options?: FieldOptions);
71
- get schema(): {
72
- enum: string[];
73
- };
74
- }
75
- declare class IntegerField extends Field<number> {
76
- value: number;
77
- constructor(value: number, options?: FieldOptions);
78
- get schema(): {
79
- type: string;
80
- default: number;
81
- };
82
- }
83
- declare class FloatField extends Field<number> {
84
- value: number;
85
- constructor(value: number, options?: FieldOptions);
86
- get schema(): {
87
- type: string;
88
- default: number;
89
- };
90
- }
91
- declare class FormGroup<T extends Record<string, Field<any>>, O extends Record<string, Field<any>>> extends Field<{
92
- [key in keyof T]: T[key]["value"];
93
- } & Partial<{
94
- [key in keyof O]: O[key]["value"];
95
- }>> {
96
- requiredFields: T;
97
- optionalFields: O;
98
- constructor(requiredFields: T, optionalFields?: O, options?: FieldOptions);
99
- get value(): {
100
- [key in keyof T]: T[key]["value"];
101
- } & Partial<{
102
- [key in keyof O]: O[key]["value"];
103
- }>;
104
- get schema(): {
105
- type: string;
106
- properties: any;
107
- required: string[];
108
- };
109
- }
110
- declare class FormArray<T> extends Field<T[]> {
111
- private factory;
112
- value: Field<T>["value"][];
113
- constructor(factory: () => Field<T>, value: Field<T>["value"][], options?: FieldOptions);
114
- get schema(): {
115
- type: string;
116
- items: any;
117
- default: T[];
118
- };
119
- }
120
- declare class Form<R extends Record<string, Field<any>>, O extends Record<string, Field<any>>> extends FormGroup<R, O> {
121
- }
122
-
123
27
  declare namespace KokimokiSchema {
124
28
  abstract class Generic<T> {
125
29
  abstract get defaultValue(): T;
@@ -453,4 +357,4 @@ declare class RoomSubscription {
453
357
  close(): void;
454
358
  }
455
359
 
456
- export { BooleanField, ConstField, EnumField, Field, type FieldOptions, FloatField, Form, FormArray, FormGroup, ImageField, IntegerField, KokimokiAwareness, KokimokiClient, type KokimokiClientEvents, KokimokiQueue, KokimokiSchema, KokimokiStore, type Paginated, RoomSubscription, RoomSubscriptionMode, TextField, type Upload };
360
+ export { KokimokiAwareness, KokimokiClient, type KokimokiClientEvents, KokimokiQueue, KokimokiSchema, KokimokiStore, type Paginated, RoomSubscription, RoomSubscriptionMode, type Upload };
@@ -1,159 +1,6 @@
1
1
  import require$$1 from 'path';
2
2
  import require$$2 from 'fs';
3
3
 
4
- const defaultFieldOptions = {};
5
- class Field {
6
- options;
7
- constructor(options) {
8
- this.options = options;
9
- }
10
- }
11
- class BooleanField extends Field {
12
- value;
13
- constructor(value, options = defaultFieldOptions) {
14
- super(options);
15
- this.value = value;
16
- }
17
- get schema() {
18
- return {
19
- type: "boolean",
20
- default: this.value,
21
- };
22
- }
23
- }
24
- class ConstField extends Field {
25
- value;
26
- constructor(value, options = defaultFieldOptions) {
27
- super(options);
28
- this.value = value;
29
- }
30
- get schema() {
31
- return {
32
- const: this.value,
33
- };
34
- }
35
- }
36
- class ImageField extends Field {
37
- value;
38
- constructor(value, options = defaultFieldOptions) {
39
- super(options);
40
- this.value = value;
41
- }
42
- get schema() {
43
- return {
44
- type: "string",
45
- default: this.value,
46
- };
47
- }
48
- }
49
- class TextField extends Field {
50
- value;
51
- constructor(value, options = defaultFieldOptions) {
52
- super(options);
53
- this.value = value;
54
- }
55
- get schema() {
56
- return {
57
- type: "string",
58
- default: this.value,
59
- };
60
- }
61
- }
62
- class EnumField extends Field {
63
- enumValues;
64
- value;
65
- constructor(enumValues, value, options = defaultFieldOptions) {
66
- super(options);
67
- this.enumValues = enumValues;
68
- this.value = value;
69
- }
70
- get schema() {
71
- return {
72
- enum: Object.keys(this.enumValues),
73
- };
74
- }
75
- }
76
- class IntegerField extends Field {
77
- value;
78
- constructor(value, options = defaultFieldOptions) {
79
- super(options);
80
- this.value = value;
81
- }
82
- get schema() {
83
- return {
84
- type: "integer",
85
- default: this.value,
86
- };
87
- }
88
- }
89
- class FloatField extends Field {
90
- value;
91
- constructor(value, options = defaultFieldOptions) {
92
- super(options);
93
- this.value = value;
94
- }
95
- get schema() {
96
- return {
97
- type: "number",
98
- default: this.value,
99
- };
100
- }
101
- }
102
- class FormGroup extends Field {
103
- requiredFields;
104
- optionalFields;
105
- constructor(requiredFields, optionalFields = {}, options = defaultFieldOptions) {
106
- super(options);
107
- this.requiredFields = requiredFields;
108
- this.optionalFields = optionalFields;
109
- }
110
- get value() {
111
- const value = Object.entries(this.requiredFields).reduce((acc, [key, field]) => {
112
- acc[key] = field.value;
113
- return acc;
114
- }, {});
115
- Object.entries(this.optionalFields).forEach(([key, field]) => {
116
- if (field.value !== undefined) {
117
- value[key] = field.value;
118
- }
119
- });
120
- return value;
121
- }
122
- get schema() {
123
- const properties = {};
124
- Object.entries(this.requiredFields).forEach(([key, field]) => {
125
- properties[key] = field.schema;
126
- });
127
- Object.entries(this.optionalFields).forEach(([key, field]) => {
128
- properties[key] = field.schema;
129
- });
130
- return {
131
- type: "object",
132
- properties,
133
- required: Object.keys(this.requiredFields),
134
- };
135
- }
136
- }
137
- class FormArray extends Field {
138
- factory;
139
- value;
140
- constructor(factory, value, options = defaultFieldOptions) {
141
- super(options);
142
- this.factory = factory;
143
- this.value = value;
144
- }
145
- get schema() {
146
- const field = this.factory();
147
- return {
148
- type: "array",
149
- items: field.schema,
150
- default: this.value,
151
- };
152
- }
153
- }
154
- class Form extends FormGroup {
155
- }
156
-
157
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
158
5
 
159
6
  function getDefaultExportFromCjs (x) {
@@ -639,7 +486,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
639
486
  var eventsExports = events.exports;
640
487
  var EventEmitter$1 = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);
641
488
 
642
- const KOKIMOKI_APP_VERSION = "1.7.0";
489
+ const KOKIMOKI_APP_VERSION = "1.7.1";
643
490
 
644
491
  /**
645
492
  * Utility module to work with key-value stores.
@@ -15447,5 +15294,5 @@ class KokimokiClient extends EventEmitter$1 {
15447
15294
  }
15448
15295
  }
15449
15296
 
15450
- export { BooleanField, ConstField, EnumField, Field, FloatField, Form, FormArray, FormGroup, ImageField, IntegerField, KokimokiAwareness, KokimokiClient, KokimokiQueue, KokimokiSchema, KokimokiStore, RoomSubscription, RoomSubscriptionMode, TextField };
15297
+ export { KokimokiAwareness, KokimokiClient, KokimokiQueue, KokimokiSchema, KokimokiStore, RoomSubscription, RoomSubscriptionMode };
15451
15298
  //# sourceMappingURL=kokimoki.min.js.map