odm-client 0.0.2 → 0.0.4
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/client/mongodb-client.d.ts +9 -7
- package/dist/client/mongodb-index.d.ts +2 -2
- package/dist/cloudbase-index.cjs +1 -1
- package/dist/cloudbase-index.js +66 -56
- package/dist/decorators/index.d.ts +55 -0
- package/dist/deps/_commonjsHelpers-KaVRbhAgd4-ge9xpwxzx.js +28 -0
- package/dist/deps/_commonjsHelpers-KaVRbhAgd4-v8zf2xtpz.js +1 -0
- package/dist/deps/acorn-DYjaOAP8Gz-6wlulbu53.js +3005 -0
- package/dist/deps/acorn-DYjaOAP8Gz-rtafso695.js +16 -0
- package/dist/deps/angular-1bp1uAROl4-h1y0hjw1c.js +3 -0
- package/dist/deps/angular-1bp1uAROl4-l9nfoii8u.js +2533 -0
- package/dist/deps/babel-_P9jsDBVVy-35haxb0wg.js +15 -0
- package/dist/deps/babel-_P9jsDBVVy-vug1rua9o.js +7217 -0
- package/dist/deps/estree-Q-oFBmJEml-0g2ctosvo.js +4528 -0
- package/dist/deps/estree-Q-oFBmJEml-e3lsybu88.js +44 -0
- package/dist/deps/flow-j77MFvzLrn-gmx10rk3y.js +27411 -0
- package/dist/deps/flow-j77MFvzLrn-sz9bqt4jx.js +20 -0
- package/dist/deps/glimmer-ewQPb5nTUl-0rld629hy.js +2703 -0
- package/dist/deps/glimmer-ewQPb5nTUl-t0udqv0lr.js +37 -0
- package/dist/deps/graphql-8EXR1_taGG-5y6avd4ti.js +1221 -0
- package/dist/deps/graphql-8EXR1_taGG-751nqiy3a.js +28 -0
- package/dist/deps/html-dGbiW_CFWL-uw8wnl1gk.js +2791 -0
- package/dist/deps/html-dGbiW_CFWL-wq1s5ethb.js +25 -0
- package/dist/deps/markdown-vAYIRClyWZ-56qwpujmt.js +62 -0
- package/dist/deps/markdown-vAYIRClyWZ-l86q790r4.js +3190 -0
- package/dist/deps/meriyah-d5_qqf88x--c6d7ate4y.js +2645 -0
- package/dist/deps/meriyah-d5_qqf88x--tkflmonbr.js +5 -0
- package/dist/deps/postcss-Vz5bDQ3hJO-2iukzp912.js +4739 -0
- package/dist/deps/postcss-Vz5bDQ3hJO-hmcg09wlz.js +61 -0
- package/dist/deps/typescript-2hCq12HCbJ-1gzolgqdi.js +12947 -0
- package/dist/deps/typescript-2hCq12HCbJ-8yg3aw5l3.js +21 -0
- package/dist/deps/yaml-I5o0CrcX7J-0sd3e9jv6.js +4079 -0
- package/dist/deps/yaml-I5o0CrcX7J-92qe3upn5.js +159 -0
- package/dist/generator/cloudbase-init-generator.d.ts +8 -0
- package/dist/generator/enum-generator.d.ts +3 -0
- package/dist/generator/index.d.ts +6 -0
- package/dist/generator/mongodb-init-generator.d.ts +9 -0
- package/dist/generator/parser.d.ts +21 -0
- package/dist/generator/table-generator.d.ts +3 -0
- package/dist/generator/type-generator.d.ts +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index2.cjs +42770 -0
- package/dist/index2.js +242204 -0
- package/dist/mongodb-index.cjs +11 -11
- package/dist/mongodb-index.js +2103 -2106
- package/dist/types/index.d.ts +14 -0
- package/package.json +3 -1
- /package/dist/deps/{query-builder-h6B2D2BCoQ-lveomig6j.js → query-builder-h6B2D2BCoQ-ac12dlz8z.js} +0 -0
- /package/dist/deps/{query-builder-h6B2D2BCoQ-7t1lrgoqc.js → query-builder-h6B2D2BCoQ-lelbzdog2.js} +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SchemaMeta, PageResult, FindManyOptions, FindPageOptions } from '../types';
|
|
2
|
+
import { MongoClient, ClientSession } from 'mongodb';
|
|
3
3
|
|
|
4
4
|
export declare class MongoDbClient {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
private client;
|
|
6
|
+
private schemaMeta;
|
|
7
|
+
private context;
|
|
8
|
+
private fieldMetaMap;
|
|
9
9
|
private idField;
|
|
10
|
-
|
|
10
|
+
private dbName;
|
|
11
|
+
private session;
|
|
12
|
+
constructor(client: MongoClient, schemaMeta: SchemaMeta, context?: any, session?: ClientSession);
|
|
11
13
|
private getObjectId;
|
|
12
14
|
/**
|
|
13
15
|
* 辅助方法:安全获取集合实例
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SchemaMeta } from '../types/index';
|
|
2
|
-
import {
|
|
2
|
+
import { MongoClient } from 'mongodb';
|
|
3
3
|
|
|
4
|
-
export declare function createMongoDBClient<T>(client:
|
|
4
|
+
export declare function createMongoDBClient<T>(client: MongoClient, schemaMeta: SchemaMeta, context?: any): T;
|
package/dist/cloudbase-index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var q=Object.defineProperty;var C=(l,t,e)=>t in l?q(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var f=(l,t,e)=>C(l,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./deps/query-builder-h6B2D2BCoQ-ac12dlz8z.js");class O{constructor(t,e,r){f(this,"client");f(this,"schemaMeta");f(this,"context");f(this,"fieldMetaMap",{});f(this,"idField","_id");this.client=t,this.schemaMeta=e,this.context=r,this.fieldMetaMap=Object.entries(e).reduce((c,[n,i])=>(c[n]=i.columns.reduce((d,u)=>(d[u.name]=u,d),{}),c),{})}async findUnique(t,{where:e,select:r}){var d,u,s,w;const c=Object.keys(e??{});if(c.length===1&&c[0]===this.idField){if(r){const y=await this.client.collection(t).doc(e[this.idField]).field(r).get();return((d=y==null?void 0:y.data)==null?void 0:d[0])??null}const a=await this.client.collection(t).doc(e[this.idField]).get();return((u=a==null?void 0:a.data)==null?void 0:u[0])??null}const n=h.QueryBuilder.buildCloudBaseQuery(e,this.fieldMetaMap[t]);if(r){const a=await this.client.collection(t).where(n).field(r).get();return((s=a==null?void 0:a.data)==null?void 0:s[0])??null}const i=await this.client.collection(t).where(n).get();return((w=i==null?void 0:i.data)==null?void 0:w[0])??null}async findUniqueOrThrow(t,{where:e,select:r}){const c=await this.findUnique(t,{where:e,select:r});if(!c)throw new Error("Data Not Found");return c}async findFirst(t,e){const{data:r}=await this.findManyInner(t,{where:e==null?void 0:e.where,orderBy:e==null?void 0:e.orderBy,select:e==null?void 0:e.select,limit:1,offset:0});return(r==null?void 0:r[0])??null}async findFirstOrThrow(t,e){const r=await this.findFirst(t,e);if(!r)throw new Error("Data Not Found");return r}getFindQuery(t,e){const r=h.QueryBuilder.buildCloudBaseQuery((e==null?void 0:e.where)??{},this.fieldMetaMap[t]),c=h.QueryBuilder.getOrderByArray(e==null?void 0:e.orderBy);let n;return e!=null&&e.select?n=this.client.collection(t).where(r).field(e==null?void 0:e.select).skip((e==null?void 0:e.offset)??0):n=this.client.collection(t).where(r).skip((e==null?void 0:e.offset)??0),(e==null?void 0:e.limit)!=null&&(n=n.limit(e.limit)),c.length>0&&c.forEach(i=>{n=n.orderBy(i.fieldName,i.order)}),n}async findManyInner(t,e){return await this.getFindQuery(t,e).get()}async findMany(t,e){const r=e==null?void 0:e.where,c=e==null?void 0:e.orderBy,n=e==null?void 0:e.select,{data:i}=await this.findManyInner(t,{where:r,orderBy:c,select:n,limit:1e3,offset:0});return i}async findPage(t,e){const c=(e==null?void 0:e.limit)||10;if(c>1e3)throw new Error("limit must be less than or equal to 1000");const n=e==null?void 0:e.where,i=e==null?void 0:e.orderBy,d=(e==null?void 0:e.page)||1,u=e==null?void 0:e.select,s=(d-1)*c,w=this.findManyInner(t,{where:n,orderBy:i,select:u,limit:c,offset:s}),a=this.count(t,{where:n}),{data:y}=await w,B=await a,M=Math.ceil(B/c);return{data:y,total:B,page:d,pageCount:M,limit:c,hasPrev:d>1,hasNext:d<M}}async create(t,{data:e}){const r=h.applyDefaultValues(e,this.schemaMeta[t],this.context),c=await this.client.collection(t).add(r);return{_id:(c==null?void 0:c.id)??(c==null?void 0:c[this.idField])}}async update(t,{where:e,data:r}){const c=h.applyUpdateValues(r,this.schemaMeta[t]),n=Object.keys(e??{});if(n.length===1&&n[0]===this.idField){await this.client.collection(t).doc(e[this.idField]).update(c);return}const i=h.QueryBuilder.buildCloudBaseQuery(e,this.fieldMetaMap[t]);await this.client.collection(t).where(i).update(c)}async delete(t,{where:e}){const r=Object.keys(e??{});if(r.length===1&&r[0]===this.idField)return await this.client.collection(t).doc(e[this.idField]).remove();const c=h.QueryBuilder.buildCloudBaseQuery(e,this.fieldMetaMap[t]);await this.client.collection(t).where(c).remove()}async count(t,e){try{const r=this.getFindQuery(t,{where:e==null?void 0:e.where,offset:0}),{total:c}=await r.count();return c}catch(r){throw console.error("count error:",r),r}}}function F(l,t,e){const r=new O(l,t,e),c={};return Object.keys(t).forEach(n=>{c[n]={findUnique:i=>r.findUnique(n,i),findUniqueOrThrow:i=>r.findUniqueOrThrow(n,i),findFirst:i=>r.findFirst(n,i),findFirstOrThrow:i=>r.findFirstOrThrow(n,i),findMany:i=>r.findMany(n,i),findPage:i=>r.findPage(n,i),create:i=>r.create(n,i),update:i=>r.update(n,i),delete:i=>r.delete(n,i),count:i=>r.count(n,i)}}),c.$transaction=async n=>{const i=await l.startTransaction();try{const d=F(i,t,e);d.$transaction=void 0;const u=await n(d);return await i.commit(),u}catch(d){throw await i.rollback(),d}},c}exports.createCloudBaseClient=F;
|
package/dist/cloudbase-index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
var B = Object.defineProperty;
|
|
2
|
-
var q = (
|
|
3
|
-
var
|
|
4
|
-
import { Q as
|
|
2
|
+
var q = (l, t, e) => t in l ? B(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
|
|
3
|
+
var h = (l, t, e) => q(l, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { Q as s, a as C, b as O } from "./deps/query-builder-h6B2D2BCoQ-lelbzdog2.js";
|
|
5
5
|
class k {
|
|
6
6
|
constructor(t, e, r) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.client = t, this.schemaMeta = e, this.context = r, this.fieldMetaMap = Object.entries(e).reduce((
|
|
7
|
+
h(this, "client");
|
|
8
|
+
h(this, "schemaMeta");
|
|
9
|
+
h(this, "context");
|
|
10
|
+
h(this, "fieldMetaMap", {});
|
|
11
|
+
h(this, "idField", "_id");
|
|
12
|
+
this.client = t, this.schemaMeta = e, this.context = r, this.fieldMetaMap = Object.entries(e).reduce((c, [n, i]) => (c[n] = i.columns.reduce((d, a) => (d[a.name] = a, d), {}), c), {});
|
|
13
13
|
}
|
|
14
14
|
async findUnique(t, { where: e, select: r }) {
|
|
15
|
-
var d,
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
15
|
+
var d, a, y, w;
|
|
16
|
+
const c = Object.keys(e ?? {});
|
|
17
|
+
if (c.length === 1 && c[0] === this.idField) {
|
|
18
18
|
if (r) {
|
|
19
19
|
const f = await this.client.collection(t).doc(e[this.idField]).field(r).get();
|
|
20
20
|
return ((d = f == null ? void 0 : f.data) == null ? void 0 : d[0]) ?? null;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
return ((
|
|
22
|
+
const u = await this.client.collection(t).doc(e[this.idField]).get();
|
|
23
|
+
return ((a = u == null ? void 0 : u.data) == null ? void 0 : a[0]) ?? null;
|
|
24
24
|
}
|
|
25
|
-
const n =
|
|
25
|
+
const n = s.buildCloudBaseQuery(e, this.fieldMetaMap[t]);
|
|
26
26
|
if (r) {
|
|
27
|
-
const
|
|
28
|
-
return ((
|
|
27
|
+
const u = await this.client.collection(t).where(n).field(r).get();
|
|
28
|
+
return ((y = u == null ? void 0 : u.data) == null ? void 0 : y[0]) ?? null;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
return ((w =
|
|
30
|
+
const i = await this.client.collection(t).where(n).get();
|
|
31
|
+
return ((w = i == null ? void 0 : i.data) == null ? void 0 : w[0]) ?? null;
|
|
32
32
|
}
|
|
33
33
|
async findUniqueOrThrow(t, { where: e, select: r }) {
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
34
|
+
const c = await this.findUnique(t, { where: e, select: r });
|
|
35
|
+
if (!c)
|
|
36
36
|
throw new Error("Data Not Found");
|
|
37
|
-
return
|
|
37
|
+
return c;
|
|
38
38
|
}
|
|
39
39
|
async findFirst(t, e) {
|
|
40
40
|
const { data: r } = await this.findManyInner(t, {
|
|
@@ -53,72 +53,82 @@ class k {
|
|
|
53
53
|
return r;
|
|
54
54
|
}
|
|
55
55
|
getFindQuery(t, e) {
|
|
56
|
-
const r =
|
|
56
|
+
const r = s.buildCloudBaseQuery((e == null ? void 0 : e.where) ?? {}, this.fieldMetaMap[t]), c = s.getOrderByArray(e == null ? void 0 : e.orderBy);
|
|
57
57
|
let n;
|
|
58
|
-
return e != null && e.select ? n = this.client.collection(t).where(r).field(e == null ? void 0 : e.select).skip((e == null ? void 0 : e.offset) ?? 0) : n = this.client.collection(t).where(r).skip((e == null ? void 0 : e.offset) ?? 0), (e == null ? void 0 : e.limit) != null && (n = n.limit(e.limit)),
|
|
59
|
-
n = n.orderBy(
|
|
58
|
+
return e != null && e.select ? n = this.client.collection(t).where(r).field(e == null ? void 0 : e.select).skip((e == null ? void 0 : e.offset) ?? 0) : n = this.client.collection(t).where(r).skip((e == null ? void 0 : e.offset) ?? 0), (e == null ? void 0 : e.limit) != null && (n = n.limit(e.limit)), c.length > 0 && c.forEach((i) => {
|
|
59
|
+
n = n.orderBy(i.fieldName, i.order);
|
|
60
60
|
}), n;
|
|
61
61
|
}
|
|
62
62
|
async findManyInner(t, e) {
|
|
63
63
|
return await this.getFindQuery(t, e).get();
|
|
64
64
|
}
|
|
65
65
|
async findMany(t, e) {
|
|
66
|
-
const r = e == null ? void 0 : e.where,
|
|
67
|
-
return
|
|
66
|
+
const r = e == null ? void 0 : e.where, c = e == null ? void 0 : e.orderBy, n = e == null ? void 0 : e.select, { data: i } = await this.findManyInner(t, { where: r, orderBy: c, select: n, limit: 1e3, offset: 0 });
|
|
67
|
+
return i;
|
|
68
68
|
}
|
|
69
69
|
async findPage(t, e) {
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
70
|
+
const c = (e == null ? void 0 : e.limit) || 10;
|
|
71
|
+
if (c > 1e3)
|
|
72
72
|
throw new Error("limit must be less than or equal to 1000");
|
|
73
|
-
const n = e == null ? void 0 : e.where,
|
|
74
|
-
return { data: f, total:
|
|
73
|
+
const n = e == null ? void 0 : e.where, i = e == null ? void 0 : e.orderBy, d = (e == null ? void 0 : e.page) || 1, a = e == null ? void 0 : e.select, y = (d - 1) * c, w = this.findManyInner(t, { where: n, orderBy: i, select: a, limit: c, offset: y }), u = this.count(t, { where: n }), { data: f } = await w, F = await u, M = Math.ceil(F / c);
|
|
74
|
+
return { data: f, total: F, page: d, pageCount: M, limit: c, hasPrev: d > 1, hasNext: d < M };
|
|
75
75
|
}
|
|
76
76
|
async create(t, { data: e }) {
|
|
77
|
-
const r =
|
|
78
|
-
return { _id: (
|
|
77
|
+
const r = C(e, this.schemaMeta[t], this.context), c = await this.client.collection(t).add(r);
|
|
78
|
+
return { _id: (c == null ? void 0 : c.id) ?? (c == null ? void 0 : c[this.idField]) };
|
|
79
79
|
}
|
|
80
80
|
async update(t, { where: e, data: r }) {
|
|
81
|
-
const
|
|
81
|
+
const c = O(r, this.schemaMeta[t]), n = Object.keys(e ?? {});
|
|
82
82
|
if (n.length === 1 && n[0] === this.idField) {
|
|
83
|
-
await this.client.collection(t).doc(e[this.idField]).update(
|
|
83
|
+
await this.client.collection(t).doc(e[this.idField]).update(c);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
await this.client.collection(t).where(
|
|
86
|
+
const i = s.buildCloudBaseQuery(e, this.fieldMetaMap[t]);
|
|
87
|
+
await this.client.collection(t).where(i).update(c);
|
|
88
88
|
}
|
|
89
89
|
async delete(t, { where: e }) {
|
|
90
90
|
const r = Object.keys(e ?? {});
|
|
91
91
|
if (r.length === 1 && r[0] === this.idField)
|
|
92
92
|
return await this.client.collection(t).doc(e[this.idField]).remove();
|
|
93
|
-
const
|
|
94
|
-
await this.client.collection(t).where(
|
|
93
|
+
const c = s.buildCloudBaseQuery(e, this.fieldMetaMap[t]);
|
|
94
|
+
await this.client.collection(t).where(c).remove();
|
|
95
95
|
}
|
|
96
96
|
async count(t, e) {
|
|
97
97
|
try {
|
|
98
|
-
const r = this.getFindQuery(t, { where: e == null ? void 0 : e.where, offset: 0 }), { total:
|
|
99
|
-
return
|
|
98
|
+
const r = this.getFindQuery(t, { where: e == null ? void 0 : e.where, offset: 0 }), { total: c } = await r.count();
|
|
99
|
+
return c;
|
|
100
100
|
} catch (r) {
|
|
101
101
|
throw console.error("count error:", r), r;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const r = new k(
|
|
105
|
+
function Q(l, t, e) {
|
|
106
|
+
const r = new k(l, t, e), c = {};
|
|
107
107
|
return Object.keys(t).forEach((n) => {
|
|
108
|
-
|
|
109
|
-
findUnique: (
|
|
110
|
-
findUniqueOrThrow: (
|
|
111
|
-
findFirst: (
|
|
112
|
-
findFirstOrThrow: (
|
|
113
|
-
findMany: (
|
|
114
|
-
findPage: (
|
|
115
|
-
create: (
|
|
116
|
-
update: (
|
|
117
|
-
delete: (
|
|
118
|
-
count: (
|
|
108
|
+
c[n] = {
|
|
109
|
+
findUnique: (i) => r.findUnique(n, i),
|
|
110
|
+
findUniqueOrThrow: (i) => r.findUniqueOrThrow(n, i),
|
|
111
|
+
findFirst: (i) => r.findFirst(n, i),
|
|
112
|
+
findFirstOrThrow: (i) => r.findFirstOrThrow(n, i),
|
|
113
|
+
findMany: (i) => r.findMany(n, i),
|
|
114
|
+
findPage: (i) => r.findPage(n, i),
|
|
115
|
+
create: (i) => r.create(n, i),
|
|
116
|
+
update: (i) => r.update(n, i),
|
|
117
|
+
delete: (i) => r.delete(n, i),
|
|
118
|
+
count: (i) => r.count(n, i)
|
|
119
119
|
};
|
|
120
|
-
}),
|
|
120
|
+
}), c.$transaction = async (n) => {
|
|
121
|
+
const i = await l.startTransaction();
|
|
122
|
+
try {
|
|
123
|
+
const d = Q(i, t, e);
|
|
124
|
+
d.$transaction = void 0;
|
|
125
|
+
const a = await n(d);
|
|
126
|
+
return await i.commit(), a;
|
|
127
|
+
} catch (d) {
|
|
128
|
+
throw await i.rollback(), d;
|
|
129
|
+
}
|
|
130
|
+
}, c;
|
|
121
131
|
}
|
|
122
132
|
export {
|
|
123
|
-
|
|
133
|
+
Q as createCloudBaseClient
|
|
124
134
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ColumnType, SearchIndexSort } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface TableOptions {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FieldOptions {
|
|
7
|
+
type: ColumnType;
|
|
8
|
+
title?: string;
|
|
9
|
+
default?: any | ((data: any, context?: any) => any);
|
|
10
|
+
isIndex?: boolean;
|
|
11
|
+
indexSort?: SearchIndexSort;
|
|
12
|
+
indexOptions?: {
|
|
13
|
+
unique: boolean;
|
|
14
|
+
};
|
|
15
|
+
enum?: Record<string, {
|
|
16
|
+
label: string;
|
|
17
|
+
value: any;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface CreatedAtOptions {
|
|
21
|
+
title?: string;
|
|
22
|
+
isIndex?: boolean;
|
|
23
|
+
indexSort?: SearchIndexSort;
|
|
24
|
+
indexOptions?: {
|
|
25
|
+
unique: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface UpdatedAtOptions {
|
|
29
|
+
title?: string;
|
|
30
|
+
isIndex?: boolean;
|
|
31
|
+
indexSort?: SearchIndexSort;
|
|
32
|
+
indexOptions?: {
|
|
33
|
+
unique: boolean;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 表装饰器:标记一个类为表格存储的表定义
|
|
38
|
+
*/
|
|
39
|
+
export declare function Table(options: TableOptions): ClassDecorator;
|
|
40
|
+
/**
|
|
41
|
+
* 主键字段装饰器:标记一个字段为主键列
|
|
42
|
+
*/
|
|
43
|
+
export declare function PrimaryKey(): PropertyDecorator;
|
|
44
|
+
/**
|
|
45
|
+
* 普通字段装饰器:标记一个字段为数据列
|
|
46
|
+
*/
|
|
47
|
+
export declare function Field(options: FieldOptions): PropertyDecorator;
|
|
48
|
+
/**
|
|
49
|
+
* 创建时间装饰器:标记一个字段为创建时间
|
|
50
|
+
*/
|
|
51
|
+
export declare function CreatedAt(options?: CreatedAtOptions): PropertyDecorator;
|
|
52
|
+
/**
|
|
53
|
+
* 更新时间装饰器:标记一个字段为更新时间
|
|
54
|
+
*/
|
|
55
|
+
export declare function UpdatedAt(options?: UpdatedAtOptions): PropertyDecorator;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function f(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
function l(e) {
|
|
6
|
+
if (e.__esModule) return e;
|
|
7
|
+
var r = e.default;
|
|
8
|
+
if (typeof r == "function") {
|
|
9
|
+
var t = function o() {
|
|
10
|
+
return this instanceof o ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
t.prototype = r.prototype;
|
|
13
|
+
} else t = {};
|
|
14
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
|
|
15
|
+
var n = Object.getOwnPropertyDescriptor(e, o);
|
|
16
|
+
Object.defineProperty(t, o, n.get ? n : {
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
get: function() {
|
|
19
|
+
return e[o];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}), t;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
l as a,
|
|
26
|
+
u as c,
|
|
27
|
+
f as g
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function o(){return this instanceof o?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}),t}exports.commonjsGlobal=u;exports.getAugmentedNamespace=l;exports.getDefaultExportFromCjs=f;
|