detaorm 1.2.1 → 1.2.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.
package/index.ts ADDED
@@ -0,0 +1,57 @@
1
+ import _Deta, { Deta, Base } from "deta";
2
+ import fs from "fs";
3
+
4
+ // import Deta from "deta/dist/types/deta";
5
+
6
+ export class Schema {
7
+ constructor(
8
+ public config: {
9
+ [keys in string]: {
10
+ type: "String" | "Number" | "boolean" | "array" | "object";
11
+ defualt?: any;
12
+ unique?: boolean;
13
+ };
14
+ }
15
+ ) {}
16
+ }
17
+ export class Basec {
18
+ constructor(public config: { name: string; schema: Schema }) {}
19
+ }
20
+
21
+ export class Orm {
22
+ private deta = Deta(this.config.projectKey);
23
+
24
+ constructor(
25
+ private config: {
26
+ projectKey: string;
27
+ }
28
+ ) {}
29
+
30
+ getrepo(_base: Basec) {
31
+ return new _getrepo(_base, this.deta);
32
+ }
33
+ }
34
+
35
+ class _getrepo {
36
+ _db: ReturnType<typeof Base>;
37
+
38
+ constructor(private base: Basec, private deta: ReturnType<typeof Deta>) {
39
+ this._db = this.deta.Base(this.base.config.name);
40
+ }
41
+
42
+ create(data: any) {
43
+ return this._db.insert(data);
44
+ }
45
+ findOne(q: any) {
46
+ return this._db.fetch(q);
47
+ }
48
+ findOneById(key: any) {
49
+ return this._db.get(key);
50
+ }
51
+ update(key: any, data: any) {
52
+ return this._db.update(data, key);
53
+ }
54
+ delet(key: any) {
55
+ return this._db.delete(key);
56
+ }
57
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { Deta, Base } from "deta";
2
+ export declare class Schema {
3
+ config: {
4
+ [keys in string]: {
5
+ type: "String" | "Number" | "boolean" | "array" | "object";
6
+ defualt?: any;
7
+ unique?: boolean;
8
+ };
9
+ };
10
+ constructor(config: {
11
+ [keys in string]: {
12
+ type: "String" | "Number" | "boolean" | "array" | "object";
13
+ defualt?: any;
14
+ unique?: boolean;
15
+ };
16
+ });
17
+ }
18
+ export declare class Basec {
19
+ config: {
20
+ name: string;
21
+ schema: Schema;
22
+ };
23
+ constructor(config: {
24
+ name: string;
25
+ schema: Schema;
26
+ });
27
+ }
28
+ export declare class Orm {
29
+ private config;
30
+ private deta;
31
+ constructor(config: {
32
+ projectKey: string;
33
+ });
34
+ getrepo(_base: Basec): _getrepo;
35
+ }
36
+ declare class _getrepo {
37
+ private base;
38
+ private deta;
39
+ _db: ReturnType<typeof Base>;
40
+ constructor(base: Basec, deta: ReturnType<typeof Deta>);
41
+ create(data: any): Promise<import("deta/dist/types/types/basic").ObjectType>;
42
+ findOne(q: any): Promise<import("deta/dist/types/types/base/response").FetchResponse>;
43
+ findOneById(key: any): Promise<import("deta/dist/types/types/basic").ObjectType>;
44
+ update(key: any, data: any): Promise<null>;
45
+ delet(key: any): Promise<null>;
46
+ }
47
+ export {};
package/lib/index.js ADDED
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Orm = exports.Basec = exports.Schema = void 0;
4
+ var deta_1 = require("deta");
5
+ // import Deta from "deta/dist/types/deta";
6
+ var Schema = /** @class */ (function () {
7
+ function Schema(config) {
8
+ this.config = config;
9
+ }
10
+ return Schema;
11
+ }());
12
+ exports.Schema = Schema;
13
+ var Basec = /** @class */ (function () {
14
+ function Basec(config) {
15
+ this.config = config;
16
+ }
17
+ return Basec;
18
+ }());
19
+ exports.Basec = Basec;
20
+ var Orm = /** @class */ (function () {
21
+ function Orm(config) {
22
+ this.config = config;
23
+ this.deta = (0, deta_1.Deta)(this.config.projectKey);
24
+ }
25
+ Orm.prototype.getrepo = function (_base) {
26
+ return new _getrepo(_base, this.deta);
27
+ };
28
+ return Orm;
29
+ }());
30
+ exports.Orm = Orm;
31
+ var _getrepo = /** @class */ (function () {
32
+ function _getrepo(base, deta) {
33
+ this.base = base;
34
+ this.deta = deta;
35
+ this._db = this.deta.Base(this.base.config.name);
36
+ }
37
+ _getrepo.prototype.create = function (data) {
38
+ return this._db.insert(data);
39
+ };
40
+ _getrepo.prototype.findOne = function (q) {
41
+ return this._db.fetch(q);
42
+ };
43
+ _getrepo.prototype.findOneById = function (key) {
44
+ return this._db.get(key);
45
+ };
46
+ _getrepo.prototype.update = function (key, data) {
47
+ return this._db.update(data, key);
48
+ };
49
+ _getrepo.prototype.delet = function (key) {
50
+ return this._db.delete(key);
51
+ };
52
+ return _getrepo;
53
+ }());
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.d.ts","../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../node_modules/typescript/lib/lib.scripthost.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/deta/dist/types/types/libjs.d.ts","../node_modules/deta/dist/types/types/key.d.ts","../node_modules/deta/dist/types/types/action.d.ts","../node_modules/deta/dist/types/types/basic.d.ts","../node_modules/deta/dist/types/base/utils.d.ts","../node_modules/deta/dist/types/types/base/request.d.ts","../node_modules/deta/dist/types/types/base/response.d.ts","../node_modules/deta/dist/types/base/base.d.ts","../node_modules/deta/dist/types/base/index.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/deta/dist/types/types/drive/request.d.ts","../node_modules/deta/dist/types/types/drive/response.d.ts","../node_modules/deta/dist/types/drive/drive.d.ts","../node_modules/deta/dist/types/drive/index.d.ts","../node_modules/deta/dist/types/deta.d.ts","../node_modules/deta/dist/types/index.d.ts","../node_modules/deta/dist/types/index.node.d.ts","../index.ts"],"fileInfos":["2dc8c927c9c162a773c6bb3cdc4f3286c23f10eedc67414028f9cb5951610f60",{"version":"f5c28122bee592cfaf5c72ed7bcc47f453b79778ffa6e301f45d21a0970719d4","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3f149f903dd20dfeb7c80e228b659f0e436532de772469980dbd00702cc05cc1","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"cd483c056da900716879771893a3c9772b66c3c88f8943b4205aec738a94b1d0","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"c37f8a49593a0030eecb51bbfa270e709bec9d79a6cc3bb851ef348d4e6b26f8","affectsGlobalScope":true},"7ed334543253d45826f25c4c8300bca1ffde80cc99be4c0089004c8cf2630175","ecae810743096d4e994797dcacf684a413aaa6891c5a8012fd386b79bfad29f0","ccf8cb118307f4ecb1ad7fbdb4e9b0e8d571a4cb91d2f44df8405f4802a624ac","37645d9e8765ef55ceb646d35eac86f069849a42c7110b0a771989748a8bbf87","97e92ae7e3e8512c5fb7be54bc9499c5287fc8de09693eff9d8e5d439e8e6aee","69c74469b9fd09eb2141f6a0b345a8bba8db7053cdddbdfef7df9a2a31e5d054","42585047c2e328f5844777e17cf4b939f729c58ecea7e699c5c46a93cb530366","0e5aa3ddc51e4fc1f98c41ab47e7072fd5862ecd970c8dd53e5400ace1cbf0fc","1d2cbb4485b870105369726a6a74c661d04c8e2409b60cc0874ddf466a4c41b9","9122ed7070e054b73ebab37c2373a196def2d90e7d1a9a7fcd9d46b0e51fae78","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"002d6d5f044365b3fbfba0ba9be3bb57cac09b81547c8df4b0795755d2081d90","affectsGlobalScope":true},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","55c428f339f80f4ede27cfed15aa1124cd583b43ac3feaf59da19c492c9cd6be","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"bae4ea23beb8397755b935cb84d3cdc6cdb0b1b4a329b90de9fc6c8774d71994","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","df36874d9e56aff601e921c4b3971d37cf66d14f6455935ce821e6cad13b1823","aeee0090b38de0dd47ca9a79ad5c2d156e3e09d92306719b0b45a3e96098e564","acfbb5aaef964e1d441f961a1846197f03241dba3c63b1e4d1903684888ef465","09416dd69576b03a3f485adf329a02f043e4a481e060ef5b208194e488d31fd9","8acf99b1c8682276a63ea5bb68433782715892726b97e4604a415e4e56bce41c",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"9499ba4dcd1ee0596d8c98d01341bc874840c5291156513bda667fecad54d5be","a907bf91df26df2400858ef75f749498fb5cf00062bf90a737ac3949cc07978d","cb92bc2e42b261e4299025756f1beb826b3d9666a3f0d46f8a7254ca512f57e4","cb4f3f03480e1727eae46400606cecaa97f550186ff8fa909ebc00db4180531b",{"version":"59104b2e80c588b813d03d3a45f57117ca4601ae3fc216c5ffbcbafc4effc1c5","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","d1a78a3c5708807e8de3e399f91df4797c62e44b02195eefc2209b2e713e54ee","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","556bf5c36deb62cffa1bf697c1789fe008ec82db0273025001db66732714e9d9","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","653968fc1b35c5eb3d273d36fac1c1dc66f9537edf28f33485b8776bd956e23d",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","a381f079c4804442f179d742fdb2e495fe28d67a47cac673485f75ae2e77aeca","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"bfe39beb986d2a2e512c091cbe924f1c415bc65de54de0e2f6a0dc6f84c183d9","affectsGlobalScope":true},"2d526e6f21d8cc66ac11ada32874e95ae88d870c6c9d3d9d4e03b1d1f9ad7b8e","06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","d2ec52f565f0570e90b659811347bd689f8c6039b11eaaccd0f243759d46da6e","8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a12806a1bde5e9f137bb79728d87a4ceaedf04e95efc9967d3288a3c252d9a7b","ea09ce896d12e71f01ebf7b29f806abf66d69cc4f77193874c0eed0431652866","bc222fb6217de354e582d733cb84570201a470aa6c1305010dee860869c126e5","90535f451d4788198ce307019bf983c9b6443872fbfd393459eac033ecdaf0ab","d5c1e6ebf0feb4ff6a8b7da710e4c3d644277831980b331ff529ee0817e453c6","b17b0084bd78290080054583581e8dd41af07221435e5d35717dce308f57b13b","8ecd426d19b3bcacc8584389d9fd790c987f9d17844230a8838763f86fc7d458","80ee68757231de4cd78c2f1e7077fb90c57794bf05f19557413940af70d072d4",{"version":"b84a98cba151d103f2384a3cec30cb507f3de2acbcec1e5fcc06a81e0ed2110d","signature":"45b06c5b259099d6b7b36f4793981f333d92a3793549e1084db8650f56771170"}],"options":{"declaration":true,"esModuleInterop":true,"module":1,"outDir":"./","skipLibCheck":true,"target":1},"fileIdsList":[[70,99,113],[54,99],[57,99],[58,63,99],[59,69,70,77,87,98,99],[59,60,69,77,99],[61,99],[62,63,70,78,99],[63,87,95,99],[64,66,69,77,99],[65,99],[66,67,99],[68,69,99],[69,99],[69,70,71,87,98,99],[69,70,71,87,90,99],[99,103],[99],[72,77,87,98,99],[69,70,72,73,77,87,95,98,99],[72,74,87,95,98,99],[54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105],[69,75,99],[76,98,99],[66,69,77,87,99],[78,99],[79,99],[57,80,99],[81,97,99,103],[82,99],[83,99],[69,84,85,99],[84,86,99,101],[69,87,88,89,90,99],[87,89,99],[87,88,99],[90,99],[91,99],[69,93,94,99],[93,94,99],[63,77,87,95,99],[96,99],[77,97,99],[58,72,83,98,99],[63,99],[87,99,100],[99,101],[99,102],[58,63,69,71,80,87,98,99,101,103],[87,99,104],[46,48,49,50,51,99],[52,99],[47,48,99],[46,53,99,110],[46,99,107,108],[99,109],[53,99,110,111],[45,99,112],[48,99],[47,99],[99,106],[48,51,113]],"referencedMap":[[114,1],[54,2],[55,2],[57,3],[58,4],[59,5],[60,6],[61,7],[62,8],[63,9],[64,10],[65,11],[66,12],[67,12],[68,13],[69,14],[70,15],[71,16],[56,17],[105,18],[72,19],[73,20],[74,21],[106,22],[75,23],[76,24],[77,25],[78,26],[79,27],[80,28],[81,29],[82,30],[83,31],[84,32],[85,32],[86,33],[87,34],[89,35],[88,36],[90,37],[91,38],[92,18],[93,39],[94,40],[95,41],[96,42],[97,43],[98,44],[99,45],[100,46],[101,47],[102,48],[103,49],[104,50],[52,51],[53,52],[49,53],[111,54],[109,55],[110,56],[112,57],[113,58],[47,18],[50,18],[51,59],[48,60],[107,61],[108,59],[46,18],[45,18],[1,18],[9,18],[13,18],[12,18],[3,18],[14,18],[15,18],[16,18],[17,18],[18,18],[19,18],[20,18],[21,18],[4,18],[5,18],[25,18],[22,18],[23,18],[24,18],[26,18],[27,18],[28,18],[6,18],[29,18],[30,18],[31,18],[32,18],[7,18],[33,18],[34,18],[35,18],[36,18],[8,18],[37,18],[42,18],[43,18],[38,18],[39,18],[40,18],[41,18],[2,18],[44,18],[11,18],[10,18]],"exportedModulesMap":[[114,62],[54,2],[55,2],[57,3],[58,4],[59,5],[60,6],[61,7],[62,8],[63,9],[64,10],[65,11],[66,12],[67,12],[68,13],[69,14],[70,15],[71,16],[56,17],[105,18],[72,19],[73,20],[74,21],[106,22],[75,23],[76,24],[77,25],[78,26],[79,27],[80,28],[81,29],[82,30],[83,31],[84,32],[85,32],[86,33],[87,34],[89,35],[88,36],[90,37],[91,38],[92,18],[93,39],[94,40],[95,41],[96,42],[97,43],[98,44],[99,45],[100,46],[101,47],[102,48],[103,49],[104,50],[52,51],[53,52],[49,53],[111,54],[109,55],[110,56],[112,57],[113,58],[47,18],[50,18],[51,59],[48,60],[107,61],[108,59],[46,18],[45,18],[1,18],[9,18],[13,18],[12,18],[3,18],[14,18],[15,18],[16,18],[17,18],[18,18],[19,18],[20,18],[21,18],[4,18],[5,18],[25,18],[22,18],[23,18],[24,18],[26,18],[27,18],[28,18],[6,18],[29,18],[30,18],[31,18],[32,18],[7,18],[33,18],[34,18],[35,18],[36,18],[8,18],[37,18],[42,18],[43,18],[38,18],[39,18],[40,18],[41,18],[2,18],[44,18],[11,18],[10,18]],"semanticDiagnosticsPerFile":[114,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,56,105,72,73,74,106,75,76,77,78,79,80,81,82,83,84,85,86,87,89,88,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,52,53,49,111,109,110,112,113,47,50,51,48,107,108,46,45,1,9,13,12,3,14,15,16,17,18,19,20,21,4,5,25,22,23,24,26,27,28,6,29,30,31,32,7,33,34,35,36,8,37,42,43,38,39,40,41,2,44,11,10]},"version":"4.7.4"}
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "dependencies": {
3
- "deta": "^1.1.0"
3
+ "deta": "^1.1.0",
4
+ "typescript": "^4.7.4"
4
5
  },
5
6
  "name": "detaorm",
6
- "version": "1.2.1",
7
+ "version": "1.2.2",
7
8
  "main": "index.js",
8
- "scripts": {},
9
+ "scripts": {
10
+ "build": "npx tsc"
11
+ },
9
12
  "keywords": [
10
13
  "deta",
11
14
  "orm"
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": true, /* Enable incremental compilation */
4
+ "target": "es5", /* Specify ECMAScript target version: */
5
+ "module": "commonjs", /* 'none', 'commonjs', 'amd', 'system', etc */
6
+ "declaration": true, /* Concatenate & emit output to single file.*/
7
+ "outDir": "lib", /* Redirect output to the directory. */
8
+ "esModuleInterop": true, /* Enables intero between CommonJS and ES */
9
+ "skipLibCheck": true, /* Skip type checking of declaration files. */
10
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently */
11
+ }
12
+ }
package/build/index.js DELETED
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Orm = exports._Base = exports.Schema = void 0;
4
- const deta_1 = require("deta");
5
- class Schema {
6
- constructor(config) {
7
- this.config = config;
8
- }
9
- }
10
- exports.Schema = Schema;
11
- class _Base {
12
- constructor(config) {
13
- this.config = config;
14
- }
15
- }
16
- exports._Base = _Base;
17
- class Orm {
18
- constructor(config) {
19
- this.config = config;
20
- this.deta = (0, deta_1.Deta)(this.config.projectKey);
21
- }
22
- getrepo(_base) {
23
- return new _getrepo(_base, this.deta);
24
- }
25
- }
26
- exports.Orm = Orm;
27
- class _getrepo {
28
- constructor(base, deta) {
29
- this.base = base;
30
- this.deta = deta;
31
- this._db = this.deta.Base(this.base.config.name);
32
- }
33
- create(data) {
34
- return this._db.insert(data);
35
- }
36
- findOne(q) {
37
- return this._db.fetch(q);
38
- }
39
- findOneById(key) {
40
- return this._db.get(key);
41
- }
42
- update(key, data) {
43
- return this._db.update(data, key);
44
- }
45
- delet(key) {
46
- return this._db.delete(key);
47
- }
48
- }