@ekodb/ekodb-client 0.2.1 → 0.4.0

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.
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ /**
3
+ * Scripts API for ekoDB TypeScript client
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Stage = exports.ChatMessage = void 0;
7
+ exports.ChatMessage = {
8
+ system: (content) => ({
9
+ role: "system",
10
+ content: content,
11
+ }),
12
+ user: (content) => ({
13
+ role: "user",
14
+ content: content,
15
+ }),
16
+ assistant: (content) => ({
17
+ role: "assistant",
18
+ content: content,
19
+ }),
20
+ };
21
+ // Stage builder functions
22
+ exports.Stage = {
23
+ findAll: (collection) => ({
24
+ type: "FindAll",
25
+ collection,
26
+ }),
27
+ query: (collection, filter, sort, limit, skip) => ({
28
+ type: "Query",
29
+ collection,
30
+ filter,
31
+ sort,
32
+ limit,
33
+ skip,
34
+ }),
35
+ project: (fields, exclude = false) => ({
36
+ type: "Project",
37
+ fields,
38
+ exclude,
39
+ }),
40
+ group: (by_fields, functions) => ({
41
+ type: "Group",
42
+ by_fields,
43
+ functions,
44
+ }),
45
+ count: (output_field = "count") => ({
46
+ type: "Count",
47
+ output_field,
48
+ }),
49
+ insert: (collection, record, bypassRipple = false, ttl) => ({
50
+ type: "Insert",
51
+ collection,
52
+ record,
53
+ bypass_ripple: bypassRipple,
54
+ ttl,
55
+ }),
56
+ update: (collection, filter, updates, bypassRipple = false, ttl) => ({
57
+ type: "Update",
58
+ collection,
59
+ filter,
60
+ updates,
61
+ bypass_ripple: bypassRipple,
62
+ ttl,
63
+ }),
64
+ updateById: (collection, record_id, updates, bypassRipple = false, ttl) => ({
65
+ type: "UpdateById",
66
+ collection,
67
+ record_id,
68
+ updates,
69
+ bypass_ripple: bypassRipple,
70
+ ttl,
71
+ }),
72
+ delete: (collection, filter, bypassRipple = false) => ({
73
+ type: "Delete",
74
+ collection,
75
+ filter,
76
+ bypass_ripple: bypassRipple,
77
+ }),
78
+ deleteById: (collection, record_id, bypassRipple = false) => ({
79
+ type: "DeleteById",
80
+ collection,
81
+ record_id,
82
+ bypass_ripple: bypassRipple,
83
+ }),
84
+ batchInsert: (collection, records, bypassRipple = false) => ({
85
+ type: "BatchInsert",
86
+ collection,
87
+ records,
88
+ bypass_ripple: bypassRipple,
89
+ }),
90
+ batchDelete: (collection, record_ids, bypassRipple = false) => ({
91
+ type: "BatchDelete",
92
+ collection,
93
+ record_ids,
94
+ bypass_ripple: bypassRipple,
95
+ }),
96
+ filter: (filter) => ({
97
+ type: "Filter",
98
+ filter,
99
+ }),
100
+ sort: (sort) => ({
101
+ type: "Sort",
102
+ sort,
103
+ }),
104
+ limit: (limit) => ({
105
+ type: "Limit",
106
+ limit,
107
+ }),
108
+ skip: (skip) => ({
109
+ type: "Skip",
110
+ skip,
111
+ }),
112
+ httpRequest: (url, method = "GET", headers, body) => ({
113
+ type: "HttpRequest",
114
+ url,
115
+ method,
116
+ headers,
117
+ body,
118
+ }),
119
+ vectorSearch: (collection, query_vector, limit, threshold) => ({
120
+ type: "VectorSearch",
121
+ collection,
122
+ query_vector,
123
+ limit,
124
+ threshold,
125
+ }),
126
+ textSearch: (collection, query_text, options) => ({
127
+ type: "TextSearch",
128
+ collection,
129
+ query_text,
130
+ fields: options?.fields,
131
+ limit: options?.limit,
132
+ fuzzy: options?.fuzzy,
133
+ }),
134
+ hybridSearch: (collection, query_text, query_vector, limit) => ({
135
+ type: "HybridSearch",
136
+ collection,
137
+ query_text,
138
+ query_vector,
139
+ limit,
140
+ }),
141
+ chat: (messages, model, temperature, max_tokens) => ({
142
+ type: "Chat",
143
+ messages,
144
+ model,
145
+ temperature,
146
+ max_tokens,
147
+ }),
148
+ embed: (input_field, output_field, model) => ({
149
+ type: "Embed",
150
+ input_field,
151
+ output_field,
152
+ model,
153
+ }),
154
+ };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- export { EkoDBClient, WebSocketClient, MergeStrategy, RateLimitError, } from "./client";
1
+ export { EkoDBClient, WebSocketClient, SerializationFormat, MergeStrategy, RateLimitError, } from "./client";
2
2
  export { QueryBuilder, SortOrder } from "./query-builder";
3
3
  export { SearchQueryBuilder } from "./search";
4
4
  export { SchemaBuilder, FieldTypeSchemaBuilder, VectorIndexAlgorithm, DistanceMetric, } from "./schema";
5
5
  export { JoinBuilder } from "./join";
6
+ export { Stage, ChatMessage } from "./functions";
6
7
  export type { SearchQuery, SearchResult, SearchResponse } from "./search";
7
8
  export type { Schema, FieldTypeSchema, IndexConfig, CollectionMetadata, } from "./schema";
8
9
  export type { JoinConfig } from "./join";
10
+ export type { Script, ParameterDefinition, FunctionStageConfig, GroupFunctionConfig, SortFieldConfig, FunctionResult, FunctionStats, StageStats, } from "./functions";
9
11
  export type { Record, Query, BatchOperationResult, ClientConfig, RateLimitInfo, CollectionConfig, ChatRequest, CreateChatSessionRequest, ChatMessageRequest, TokenUsage, ChatResponse, ChatSession, ChatSessionResponse, ListSessionsQuery, ListSessionsResponse, GetMessagesQuery, GetMessagesResponse, UpdateSessionRequest, MergeSessionsRequest, } from "./client";
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JoinBuilder = exports.DistanceMetric = exports.VectorIndexAlgorithm = exports.FieldTypeSchemaBuilder = exports.SchemaBuilder = exports.SearchQueryBuilder = exports.SortOrder = exports.QueryBuilder = exports.RateLimitError = exports.MergeStrategy = exports.WebSocketClient = exports.EkoDBClient = void 0;
3
+ exports.ChatMessage = exports.Stage = exports.JoinBuilder = exports.DistanceMetric = exports.VectorIndexAlgorithm = exports.FieldTypeSchemaBuilder = exports.SchemaBuilder = exports.SearchQueryBuilder = exports.SortOrder = exports.QueryBuilder = exports.RateLimitError = exports.MergeStrategy = exports.SerializationFormat = exports.WebSocketClient = exports.EkoDBClient = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "EkoDBClient", { enumerable: true, get: function () { return client_1.EkoDBClient; } });
6
6
  Object.defineProperty(exports, "WebSocketClient", { enumerable: true, get: function () { return client_1.WebSocketClient; } });
7
+ Object.defineProperty(exports, "SerializationFormat", { enumerable: true, get: function () { return client_1.SerializationFormat; } });
7
8
  Object.defineProperty(exports, "MergeStrategy", { enumerable: true, get: function () { return client_1.MergeStrategy; } });
8
9
  Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return client_1.RateLimitError; } });
9
10
  var query_builder_1 = require("./query-builder");
@@ -18,3 +19,6 @@ Object.defineProperty(exports, "VectorIndexAlgorithm", { enumerable: true, get:
18
19
  Object.defineProperty(exports, "DistanceMetric", { enumerable: true, get: function () { return schema_1.DistanceMetric; } });
19
20
  var join_1 = require("./join");
20
21
  Object.defineProperty(exports, "JoinBuilder", { enumerable: true, get: function () { return join_1.JoinBuilder; } });
22
+ var functions_1 = require("./functions");
23
+ Object.defineProperty(exports, "Stage", { enumerable: true, get: function () { return functions_1.Stage; } });
24
+ Object.defineProperty(exports, "ChatMessage", { enumerable: true, get: function () { return functions_1.ChatMessage; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekodb/ekodb-client",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Official TypeScript/JavaScript client for ekoDB",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,6 +22,7 @@
22
22
  "typescript": "^5.3.0"
23
23
  },
24
24
  "dependencies": {
25
+ "@msgpack/msgpack": "^3.0.0",
25
26
  "ws": "^8.16.0"
26
27
  }
27
28
  }