ots-client 0.0.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.
Files changed (48) hide show
  1. package/dist/adapters/type-adapter.d.ts +6 -0
  2. package/dist/client/base-client.d.ts +59 -0
  3. package/dist/client/index.d.ts +3 -0
  4. package/dist/client/query-builder.d.ts +23 -0
  5. package/dist/decorators/index.d.ts +56 -0
  6. package/dist/deps/acorn-BOl0sFTPW7-g7l5tn7d4.js +16 -0
  7. package/dist/deps/acorn-BOl0sFTPW7-hklkvjepo.js +3005 -0
  8. package/dist/deps/angular-XNXkkMW2x2-7du6op6fw.js +2533 -0
  9. package/dist/deps/angular-XNXkkMW2x2-we6wvxttc.js +3 -0
  10. package/dist/deps/babel-JmunAd9gx3-6dq643w5b.js +7217 -0
  11. package/dist/deps/babel-JmunAd9gx3-wao5c2v19.js +15 -0
  12. package/dist/deps/estree-QR0a7eAiZm-36ju20hxl.js +4528 -0
  13. package/dist/deps/estree-QR0a7eAiZm-t0kwe9gae.js +44 -0
  14. package/dist/deps/flow-GdDnVSvT5w-rgi5vp4qm.js +27411 -0
  15. package/dist/deps/flow-GdDnVSvT5w-rnla0vmdw.js +20 -0
  16. package/dist/deps/glimmer-Yu8RjFE1-a-5ivcwuhu1.js +37 -0
  17. package/dist/deps/glimmer-Yu8RjFE1-a-60xpuum9o.js +2703 -0
  18. package/dist/deps/graphql-b_914AArZY-uwrebifsb.js +28 -0
  19. package/dist/deps/graphql-b_914AArZY-yc77nhrwj.js +1221 -0
  20. package/dist/deps/html-6ymxY6PL6B-ge7hzyfqj.js +2791 -0
  21. package/dist/deps/html-6ymxY6PL6B-ug8ebf4sa.js +25 -0
  22. package/dist/deps/index-apktVSn0Wa-1pqh8j69b.js +7 -0
  23. package/dist/deps/index-apktVSn0Wa-m4m4s4pcy.js +24535 -0
  24. package/dist/deps/markdown-44cJkal_TC-rli9cqus2.js +3190 -0
  25. package/dist/deps/markdown-44cJkal_TC-t8vpmxjyl.js +62 -0
  26. package/dist/deps/meriyah-IwksJmaFJr-1kz9p5807.js +5 -0
  27. package/dist/deps/meriyah-IwksJmaFJr-aj8jxnzem.js +2645 -0
  28. package/dist/deps/postcss-gD1c7_GzEP-7h0ly93la.js +61 -0
  29. package/dist/deps/postcss-gD1c7_GzEP-kecpdijjx.js +4739 -0
  30. package/dist/deps/typescript-tYbKJGRdB5-3c3whaiss.js +12947 -0
  31. package/dist/deps/typescript-tYbKJGRdB5-4n3mbr7g0.js +21 -0
  32. package/dist/deps/yaml-LL7qhBUJFz-xb6k8do2g.js +4079 -0
  33. package/dist/deps/yaml-LL7qhBUJFz-zl5hfpq31.js +159 -0
  34. package/dist/generate.cjs +42349 -0
  35. package/dist/generate.d.ts +1 -0
  36. package/dist/generate.js +241530 -0
  37. package/dist/generator/index.d.ts +6 -0
  38. package/dist/generator/parser.d.ts +20 -0
  39. package/dist/generator/table-generator.d.ts +3 -0
  40. package/dist/generator/type-generator.d.ts +6 -0
  41. package/dist/index.cjs +1 -0
  42. package/dist/index.d.ts +4 -0
  43. package/dist/index.js +726 -0
  44. package/dist/init/index.d.ts +3 -0
  45. package/dist/types/client.d.ts +35 -0
  46. package/dist/types/index.d.ts +98 -0
  47. package/dist/utils/index.d.ts +31 -0
  48. package/package.json +47 -0
@@ -0,0 +1,3 @@
1
+ import { SchemaMeta } from '../types';
2
+ import * as TableStore from 'tablestore';
3
+ export declare function initTables(client: TableStore.Client, schemaMeta: SchemaMeta): Promise<void>;
@@ -0,0 +1,35 @@
1
+ export interface PageResult<T = any> {
2
+ data: T[];
3
+ total: number;
4
+ page: number;
5
+ pageCount: number;
6
+ limit: number;
7
+ hasPrev: boolean;
8
+ hasNext: boolean;
9
+ }
10
+ export interface FindManyOptions<WHERE = Record<string, any>, ORDER_BY = Record<string, 'asc' | 'desc'>> {
11
+ where?: WHERE;
12
+ orderBy?: ORDER_BY;
13
+ limit?: number;
14
+ offset?: number;
15
+ select?: Record<string, boolean>;
16
+ }
17
+ export interface FindPageOptions<WHERE = Record<string, any>, ORDER_BY = Record<string, 'asc' | 'desc'>> {
18
+ where?: WHERE;
19
+ orderBy?: ORDER_BY;
20
+ page: number;
21
+ limit: number;
22
+ select?: Record<string, boolean>;
23
+ }
24
+ export interface FindRealtimeOptions {
25
+ where?: Record<string, any>;
26
+ orderBy?: Record<string, 'asc' | 'desc'>;
27
+ limit?: number;
28
+ offset?: number;
29
+ select?: Record<string, boolean>;
30
+ bizId?: string;
31
+ }
32
+ export interface RealtimeResult {
33
+ data: Record<string, any>[];
34
+ total: number;
35
+ }
@@ -0,0 +1,98 @@
1
+ export interface StringOperators {
2
+ eq?: string;
3
+ in?: string[];
4
+ lt?: string;
5
+ lte?: string;
6
+ gt?: string;
7
+ gte?: string;
8
+ contains?: string;
9
+ startsWith?: string;
10
+ endsWith?: string;
11
+ }
12
+ export interface NumberOperators {
13
+ eq?: number;
14
+ in?: number[];
15
+ lt?: number;
16
+ lte?: number;
17
+ gt?: number;
18
+ gte?: number;
19
+ }
20
+ export interface BooleanOperators {
21
+ eq?: boolean;
22
+ }
23
+ export interface DateOperators {
24
+ eq?: Date | string;
25
+ in?: Date[] | string[];
26
+ lt?: Date | string;
27
+ lte?: Date | string;
28
+ gt?: Date | string;
29
+ gte?: Date | string;
30
+ }
31
+ export interface StringConditionType {
32
+ eq?: string;
33
+ not?: string;
34
+ lt?: string;
35
+ lte?: string;
36
+ gt?: string;
37
+ gte?: string;
38
+ }
39
+ export interface NumberConditionType {
40
+ eq?: number;
41
+ not?: number;
42
+ lt?: number;
43
+ lte?: number;
44
+ gt?: number;
45
+ gte?: number;
46
+ }
47
+ export interface BooleanConditionType {
48
+ eq?: number;
49
+ not?: number;
50
+ }
51
+ export interface DateConditionType {
52
+ eq?: Date | string;
53
+ not?: Date | string;
54
+ lt?: Date | string;
55
+ lte?: Date | string;
56
+ gt?: Date | string;
57
+ gte?: Date | string;
58
+ }
59
+ export type VectorOperators = number[];
60
+ export type ColumnType = 'string' | 'number' | 'long' | 'boolean' | 'json' | 'date';
61
+ export type SearchIndexType = 'keyword' | 'text' | 'number' | 'long' | 'boolean' | 'date' | 'geopoint' | 'vector';
62
+ export interface ColumnMeta {
63
+ name: string;
64
+ type: ColumnType;
65
+ isPrimaryKey: boolean;
66
+ isPartitionKey: boolean;
67
+ default?: any | ((data: any, context?: any) => any);
68
+ auto?: (data: any, context?: any) => any;
69
+ createdAt?: boolean;
70
+ updatedAt?: boolean;
71
+ searchIndex?: {
72
+ type: SearchIndexType;
73
+ options?: object;
74
+ };
75
+ }
76
+ export interface TableMeta {
77
+ tableName: string;
78
+ primaryKeys: string[];
79
+ columnKeys: string[];
80
+ partitionKeyColumn: ColumnMeta;
81
+ updatedAtColumns: ColumnMeta[];
82
+ columns: ColumnMeta[];
83
+ searchIndexes?: Array<{
84
+ fieldName: string;
85
+ indexType: SearchIndexType;
86
+ options?: object;
87
+ }>;
88
+ }
89
+ export type SchemaMeta = Record<string, TableMeta>;
90
+ export * from './client';
91
+ export declare const VectorMetricType: {
92
+ /** 欧氏距离 */
93
+ VM_EUCLIDEAN: number;
94
+ /** 余弦相似度 */
95
+ VM_COSINE: number;
96
+ /** 点积 */
97
+ VM_DOT_PRODUCT: number;
98
+ };
@@ -0,0 +1,31 @@
1
+ import { ColumnMeta, TableMeta } from '../types/index';
2
+
3
+ /**
4
+ * 补充分区键
5
+ * 如果where/data中缺少分区键,但表元数据中存在分区键且有auto函数,则调用auto函数补全
6
+ * @param data - 输入数据对象
7
+ * @param partitionKeyColumn - 分区键元数据
8
+ * @param context - 运行时上下文
9
+ */
10
+ export declare function fillPartitionKey(data: Record<string, any>, partitionKeyColumn: ColumnMeta, context?: any): Record<string, any>;
11
+ /**
12
+ * 应用默认值
13
+ * 遍历columns,对缺失的字段应用默认值
14
+ * @param data - 输入数据对象
15
+ * @param tableMeta - 表元数据
16
+ * @param context - 运行时上下文
17
+ */
18
+ export declare function applyDefaultValues(data: Record<string, any>, tableMeta: TableMeta, context?: any): Record<string, any>;
19
+ export declare function applyUpdateValues(data: Record<string, any>[], tableMeta: TableMeta): Record<string, any>[];
20
+ /**
21
+ * 验证分区键是否已填充
22
+ * @param data - 输入数据对象
23
+ * @param tableMeta - 表元数据
24
+ * @throws 如果分区键缺失且没有auto函数
25
+ */
26
+ export declare function validatePartitionKey(data: Record<string, any>, partitionKeyColumn: ColumnMeta): void;
27
+ /**
28
+ * 将 JavaScript 对象转换为源码字符串
29
+ * 支持:基本类型、对象、数组、函数、Map、Set、Date、RegExp、循环引用
30
+ */
31
+ export declare function objectToSource(obj: any): any;
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "ots-client",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "dev": "vite-node examples/index.ts",
17
+ "build": "vite build --ssr",
18
+ "publish-module": "npm run build && npm publish --registry=https://registry.npmjs.com",
19
+ "npm:adduser": "npm adduser --registry=https://registry.npmjs.com"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "registry": "https://registry.npmjs.com"
24
+ },
25
+ "keywords": [],
26
+ "author": "lanbomo",
27
+ "license": "ISC",
28
+ "dependencies": {
29
+ "es-toolkit": "^1.44.0",
30
+ "int64-buffer": "^1.1.0",
31
+ "tablestore": "^5.6.3"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^20.14.12",
35
+ "@types/tablestore": "^5.1.3",
36
+ "fast-glob": "^3.3.2",
37
+ "prettier": "^3.3.3",
38
+ "ts-morph": "^27.0.2",
39
+ "typescript": "^5.5.4",
40
+ "vite": "^5.3.5",
41
+ "vite-node": "^2.0.4",
42
+ "vite-plugin-dts": "4.0.0-beta.2"
43
+ },
44
+ "files": [
45
+ "dist"
46
+ ]
47
+ }