@kokimoki/app 1.0.0 → 1.0.2

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.
@@ -49,4 +49,10 @@ export declare namespace KokimokiSchema {
49
49
  constructor(schema: T, defaultValue?: T["defaultValue"][]);
50
50
  }
51
51
  function list<T extends Generic<unknown>>(schema: T, defaultValue?: T["defaultValue"][]): List<T>;
52
+ class Nullable<T extends Generic<unknown>> extends Generic<T["defaultValue"] | null> {
53
+ schema: T;
54
+ defaultValue: T["defaultValue"] | null;
55
+ constructor(schema: T, defaultValue: T["defaultValue"] | null);
56
+ }
57
+ function nullable<T extends Generic<unknown>>(schema: T, defaultValue?: T["defaultValue"] | null): Nullable<T>;
52
58
  }
@@ -89,4 +89,18 @@ export var KokimokiSchema;
89
89
  return new List(schema, defaultValue);
90
90
  }
91
91
  KokimokiSchema.list = list;
92
+ class Nullable extends Generic {
93
+ schema;
94
+ defaultValue;
95
+ constructor(schema, defaultValue) {
96
+ super();
97
+ this.schema = schema;
98
+ this.defaultValue = defaultValue;
99
+ }
100
+ }
101
+ KokimokiSchema.Nullable = Nullable;
102
+ function nullable(schema, defaultValue = null) {
103
+ return new Nullable(schema, defaultValue);
104
+ }
105
+ KokimokiSchema.nullable = nullable;
92
106
  })(KokimokiSchema || (KokimokiSchema = {}));
@@ -10,6 +10,7 @@ export declare class KokimokiTransaction {
10
10
  private _parseTarget;
11
11
  private _parsePath;
12
12
  private _getClone;
13
+ get<T>(target: T): any;
13
14
  set<T>(target: T, value: T): void;
14
15
  delete<T>(target: T): void;
15
16
  push<T>(target: T[], value: T): void;
@@ -45,6 +45,12 @@ export class KokimokiTransaction {
45
45
  }
46
46
  return this._clones.get(roomName);
47
47
  }
48
+ get(target) {
49
+ const { roomName, doc, path } = this._parseTarget(target);
50
+ const { proxyClone } = this._getClone(roomName, doc);
51
+ const { obj, key } = this._parsePath(proxyClone, path);
52
+ return obj[key];
53
+ }
48
54
  set(target, value) {
49
55
  const { roomName, doc, path } = this._parseTarget(target);
50
56
  const { proxyClone } = this._getClone(roomName, doc);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const KOKIMOKI_APP_VERSION = "1.0.0";
1
+ export declare const KOKIMOKI_APP_VERSION = "1.0.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const KOKIMOKI_APP_VERSION = "1.0.0";
1
+ export const KOKIMOKI_APP_VERSION = "1.0.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kokimoki/app",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "Kokimoki app",
6
6
  "main": "dist/index.js",