@kinotic-ai/persistence 5.0.0-beta.13 → 5.0.0-beta.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.
- package/dist/index.cjs +24 -0
- package/dist/vite/index.cjs +94 -0
- package/dist/vite/index.d.cts +11 -0
- package/dist/vite/index.d.ts +11 -0
- package/dist/vite/index.js +29 -0
- package/package.json +26 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var import_node_module = require("node:module");
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,6 +8,28 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
6
8
|
function __accessProp(key) {
|
|
7
9
|
return this[key];
|
|
8
10
|
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
9
33
|
var __toCommonJS = (from) => {
|
|
10
34
|
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
35
|
if (entry)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var import_node_module = require("node:module");
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toCommonJS = (from) => {
|
|
34
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
35
|
+
if (entry)
|
|
36
|
+
return entry;
|
|
37
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (var key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(entry, key))
|
|
41
|
+
__defProp(entry, key, {
|
|
42
|
+
get: __accessProp.bind(from, key),
|
|
43
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
__moduleCache.set(from, entry);
|
|
47
|
+
return entry;
|
|
48
|
+
};
|
|
49
|
+
var __moduleCache;
|
|
50
|
+
var __returnValue = (v) => v;
|
|
51
|
+
function __exportSetter(name, newValue) {
|
|
52
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
53
|
+
}
|
|
54
|
+
var __export = (target, all) => {
|
|
55
|
+
for (var name in all)
|
|
56
|
+
__defProp(target, name, {
|
|
57
|
+
get: all[name],
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
set: __exportSetter.bind(all, name)
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// packages/persistence/src/vite/index.ts
|
|
65
|
+
var exports_vite = {};
|
|
66
|
+
__export(exports_vite, {
|
|
67
|
+
kinoticDecorators: () => kinoticDecorators
|
|
68
|
+
});
|
|
69
|
+
module.exports = __toCommonJS(exports_vite);
|
|
70
|
+
var import_typescript = __toESM(require("typescript"));
|
|
71
|
+
var PERSISTENCE_IMPORT = /from\s*['"]@kinotic-ai\/persistence['"]/;
|
|
72
|
+
function kinoticDecorators() {
|
|
73
|
+
return {
|
|
74
|
+
name: "kinotic-decorators",
|
|
75
|
+
enforce: "pre",
|
|
76
|
+
transform(code, id) {
|
|
77
|
+
const file = id.split("?", 1)[0] ?? id;
|
|
78
|
+
let ret;
|
|
79
|
+
if (file.endsWith(".ts") && !file.includes("/node_modules/") && PERSISTENCE_IMPORT.test(code)) {
|
|
80
|
+
const result = import_typescript.default.transpileModule(code, {
|
|
81
|
+
fileName: file,
|
|
82
|
+
compilerOptions: {
|
|
83
|
+
target: import_typescript.default.ScriptTarget.ES2022,
|
|
84
|
+
module: import_typescript.default.ModuleKind.ESNext,
|
|
85
|
+
useDefineForClassFields: true,
|
|
86
|
+
sourceMap: true
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
ret = { code: result.outputText, map: result.sourceMapText };
|
|
90
|
+
}
|
|
91
|
+
return ret;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* A Vite plugin that compiles the persistence decorators on bundled entity and repository classes
|
|
4
|
+
* to plain JavaScript, so a UI that uses those classes as values (`new Todo()`, `instanceof`) runs
|
|
5
|
+
* in the browser. It compiles every `.ts` module outside `node_modules` that imports from
|
|
6
|
+
* `@kinotic-ai/persistence`, and leaves every other module to Vite.
|
|
7
|
+
*
|
|
8
|
+
* @return the plugin, to add to the `plugins` of a Vite config
|
|
9
|
+
*/
|
|
10
|
+
declare function kinoticDecorators(): Plugin;
|
|
11
|
+
export { kinoticDecorators };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* A Vite plugin that compiles the persistence decorators on bundled entity and repository classes
|
|
4
|
+
* to plain JavaScript, so a UI that uses those classes as values (`new Todo()`, `instanceof`) runs
|
|
5
|
+
* in the browser. It compiles every `.ts` module outside `node_modules` that imports from
|
|
6
|
+
* `@kinotic-ai/persistence`, and leaves every other module to Vite.
|
|
7
|
+
*
|
|
8
|
+
* @return the plugin, to add to the `plugins` of a Vite config
|
|
9
|
+
*/
|
|
10
|
+
declare function kinoticDecorators(): Plugin;
|
|
11
|
+
export { kinoticDecorators };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// packages/persistence/src/vite/index.ts
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
var PERSISTENCE_IMPORT = /from\s*['"]@kinotic-ai\/persistence['"]/;
|
|
4
|
+
function kinoticDecorators() {
|
|
5
|
+
return {
|
|
6
|
+
name: "kinotic-decorators",
|
|
7
|
+
enforce: "pre",
|
|
8
|
+
transform(code, id) {
|
|
9
|
+
const file = id.split("?", 1)[0] ?? id;
|
|
10
|
+
let ret;
|
|
11
|
+
if (file.endsWith(".ts") && !file.includes("/node_modules/") && PERSISTENCE_IMPORT.test(code)) {
|
|
12
|
+
const result = ts.transpileModule(code, {
|
|
13
|
+
fileName: file,
|
|
14
|
+
compilerOptions: {
|
|
15
|
+
target: ts.ScriptTarget.ES2022,
|
|
16
|
+
module: ts.ModuleKind.ESNext,
|
|
17
|
+
useDefineForClassFields: true,
|
|
18
|
+
sourceMap: true
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
ret = { code: result.outputText, map: result.sourceMapText };
|
|
22
|
+
}
|
|
23
|
+
return ret;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
kinoticDecorators
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/persistence",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
"default": "./dist/index.cjs"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
+
"./vite": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/vite/index.d.ts",
|
|
25
|
+
"default": "./dist/vite/index.js"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/vite/index.d.cts",
|
|
29
|
+
"default": "./dist/vite/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
22
32
|
"./package.json": "./package.json"
|
|
23
33
|
},
|
|
24
34
|
"homepage": "https://github.com/kinotic-ai/kinotic",
|
|
@@ -37,16 +47,27 @@
|
|
|
37
47
|
"coverage": "bun test --coverage --pass-with-no-tests"
|
|
38
48
|
},
|
|
39
49
|
"peerDependencies": {
|
|
40
|
-
"@kinotic-ai/core": "^5.0.0-beta.
|
|
50
|
+
"@kinotic-ai/core": "^5.0.0-beta.23",
|
|
51
|
+
"typescript": ">=5.0.0",
|
|
52
|
+
"vite": ">=7.0.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"typescript": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"vite": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
41
61
|
},
|
|
42
62
|
"dependencies": {
|
|
43
|
-
"@kinotic-ai/idl": "5.0.0-beta.
|
|
63
|
+
"@kinotic-ai/idl": "^5.0.0-beta.4",
|
|
44
64
|
"rxjs": "^7.8.2"
|
|
45
65
|
},
|
|
46
66
|
"devDependencies": {
|
|
47
|
-
"@kinotic-ai/core": "5.0.0-beta.
|
|
67
|
+
"@kinotic-ai/core": "5.0.0-beta.23",
|
|
48
68
|
"@types/node": "^25.3.2",
|
|
49
69
|
"tslib": "^2.8.1",
|
|
50
|
-
"typescript": "^5.9.3"
|
|
70
|
+
"typescript": "^5.9.3",
|
|
71
|
+
"vite": "^7.3.5"
|
|
51
72
|
}
|
|
52
73
|
}
|