akeyless-server-commons 1.0.184 → 1.0.185
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/cjs/helpers/redis/helpers.d.ts +11 -0
- package/dist/cjs/helpers/redis/helpers.js +237 -0
- package/dist/cjs/helpers/redis/helpers.js.map +1 -0
- package/dist/cjs/helpers/redis/index.d.ts +1 -0
- package/dist/cjs/helpers/redis/index.js +1 -0
- package/dist/cjs/helpers/redis/index.js.map +1 -1
- package/dist/esm/helpers/redis/helpers.d.ts +11 -0
- package/dist/esm/helpers/redis/helpers.js +225 -0
- package/dist/esm/helpers/redis/helpers.js.map +1 -0
- package/dist/esm/helpers/redis/index.d.ts +1 -0
- package/dist/esm/helpers/redis/index.js +1 -0
- package/dist/esm/helpers/redis/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TObject } from "akeyless-types-commons";
|
|
2
|
+
import { WhereCondition } from "../../types";
|
|
3
|
+
export declare const redis_simple_extract_data: (raw: string) => TObject<any>;
|
|
4
|
+
export declare const redis_get_all_documents: (collection_path: string) => Promise<TObject<any>[]>;
|
|
5
|
+
export declare const redis_query_documents: (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any) => Promise<TObject<any>[]>;
|
|
6
|
+
export declare const redis_query_documents_by_conditions: (collection_path: string, where_conditions: WhereCondition[]) => Promise<TObject<any>[]>;
|
|
7
|
+
export declare const redis_query_document_by_conditions: (collection_path: string, where_conditions: WhereCondition[], log?: boolean) => Promise<TObject<any>>;
|
|
8
|
+
export declare const redis_query_document: (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any, ignore_log?: boolean) => Promise<TObject<any>>;
|
|
9
|
+
export declare const redis_query_document_optional: (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any, ignore_log?: boolean) => Promise<TObject<any> | null>;
|
|
10
|
+
export declare const redis_get_document_by_id: (collection_path: string, doc_id: string) => Promise<TObject<any>>;
|
|
11
|
+
export declare const redis_get_document_by_id_optional: (collection_path: string, doc_id: string) => Promise<TObject<any> | null>;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.redis_get_document_by_id_optional = exports.redis_get_document_by_id = exports.redis_query_document_optional = exports.redis_query_document = exports.redis_query_document_by_conditions = exports.redis_query_documents_by_conditions = exports.redis_query_documents = exports.redis_get_all_documents = exports.redis_simple_extract_data = void 0;
|
|
13
|
+
const managers_1 = require("../../managers");
|
|
14
|
+
const initialize_1 = require("./initialize");
|
|
15
|
+
const keys_1 = require("./keys");
|
|
16
|
+
const firebase_helpers_1 = require("../firebase_helpers");
|
|
17
|
+
const should_use_redis = (collection_path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
if (!initialize_1.redis_commander_connected) {
|
|
19
|
+
managers_1.logger.warn(`⚠️ Redis commander not connected, falling back to Firebase for collection: "${collection_path}"`);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const nx_settings = yield (0, firebase_helpers_1.get_nx_settings)();
|
|
24
|
+
const cache_collections_config = nx_settings.cache_collections_config || {};
|
|
25
|
+
const config = cache_collections_config[collection_path];
|
|
26
|
+
if (!config) {
|
|
27
|
+
managers_1.logger.warn(`⚠️ Collection "${collection_path}" not found in cache_collections_config, falling back to Firebase`);
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (config.sync_direction === "redis_to_firebase") {
|
|
31
|
+
managers_1.logger.warn(`⚠️ Collection "${collection_path}" sync_direction is "redis_to_firebase", falling back to Firebase`);
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (_a) {
|
|
36
|
+
managers_1.logger.warn(`⚠️ Failed to validate Redis config for collection: "${collection_path}", falling back to Firebase`);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
|
+
const parse_redis_value = (raw) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const parsed = JSON.parse(raw);
|
|
44
|
+
return (_a = parsed.data) !== null && _a !== void 0 ? _a : parsed;
|
|
45
|
+
};
|
|
46
|
+
const get_all_collection_docs = (collection_path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const commander = (0, initialize_1.get_redis_commander)();
|
|
48
|
+
const keys = yield (0, keys_1.scan_redis_keys)((0, keys_1.get_collection_keys)(collection_path), commander);
|
|
49
|
+
if (keys.length === 0)
|
|
50
|
+
return [];
|
|
51
|
+
const values = yield commander.mget(keys);
|
|
52
|
+
return values.filter(Boolean).map((v) => {
|
|
53
|
+
const data = parse_redis_value(v);
|
|
54
|
+
const key = keys[values.indexOf(v)];
|
|
55
|
+
const id = key.split(":").slice(1).join(":");
|
|
56
|
+
return Object.assign(Object.assign({}, data), { id });
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const apply_operator = (doc_value, operator, value) => {
|
|
60
|
+
switch (operator) {
|
|
61
|
+
case "==":
|
|
62
|
+
return doc_value === value;
|
|
63
|
+
case "!=":
|
|
64
|
+
return doc_value !== value;
|
|
65
|
+
case "<":
|
|
66
|
+
return doc_value < value;
|
|
67
|
+
case "<=":
|
|
68
|
+
return doc_value <= value;
|
|
69
|
+
case ">":
|
|
70
|
+
return doc_value > value;
|
|
71
|
+
case ">=":
|
|
72
|
+
return doc_value >= value;
|
|
73
|
+
case "in":
|
|
74
|
+
return Array.isArray(value) && value.includes(doc_value);
|
|
75
|
+
case "not-in":
|
|
76
|
+
return Array.isArray(value) && !value.includes(doc_value);
|
|
77
|
+
case "array-contains":
|
|
78
|
+
return Array.isArray(doc_value) && doc_value.includes(value);
|
|
79
|
+
case "array-contains-any":
|
|
80
|
+
return Array.isArray(doc_value) && Array.isArray(value) && value.some((v) => doc_value.includes(v));
|
|
81
|
+
default:
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const filter_by_condition = (docs, field_name, operator, value) => {
|
|
86
|
+
return docs.filter((doc) => apply_operator(doc[field_name], operator, value));
|
|
87
|
+
};
|
|
88
|
+
const filter_by_conditions = (docs, conditions) => {
|
|
89
|
+
return conditions.reduce((filtered, { field_name, operator, value }) => {
|
|
90
|
+
return filter_by_condition(filtered, field_name, operator, value);
|
|
91
|
+
}, docs);
|
|
92
|
+
};
|
|
93
|
+
// ── extract ──
|
|
94
|
+
const redis_simple_extract_data = (raw) => {
|
|
95
|
+
const data = parse_redis_value(raw);
|
|
96
|
+
return data;
|
|
97
|
+
};
|
|
98
|
+
exports.redis_simple_extract_data = redis_simple_extract_data;
|
|
99
|
+
// ── documents ──
|
|
100
|
+
const redis_get_all_documents = (collection_path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
102
|
+
return (0, firebase_helpers_1.get_all_documents)(collection_path);
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
return yield get_all_collection_docs(collection_path);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
managers_1.logger.error("Error fetching documents from Redis:", error);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
exports.redis_get_all_documents = redis_get_all_documents;
|
|
113
|
+
const redis_query_documents = (collection_path, field_name, operator, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
115
|
+
return (0, firebase_helpers_1.query_documents)(collection_path, field_name, operator, value);
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
119
|
+
return filter_by_condition(all_docs, field_name, operator, value);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
managers_1.logger.error(`Error querying documents from Redis: ${collection_path} - ${field_name} - ${operator} - ${value} `, error);
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
exports.redis_query_documents = redis_query_documents;
|
|
127
|
+
const redis_query_documents_by_conditions = (collection_path, where_conditions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
129
|
+
return (0, firebase_helpers_1.query_documents_by_conditions)(collection_path, where_conditions);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
133
|
+
return filter_by_conditions(all_docs, where_conditions);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
managers_1.logger.error(`Error querying documents from Redis: ${collection_path} - ${JSON.stringify(where_conditions)} `, error);
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
exports.redis_query_documents_by_conditions = redis_query_documents_by_conditions;
|
|
141
|
+
const redis_query_document_by_conditions = (collection_path_1, where_conditions_1, ...args_1) => __awaiter(void 0, [collection_path_1, where_conditions_1, ...args_1], void 0, function* (collection_path, where_conditions, log = true) {
|
|
142
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
143
|
+
return (0, firebase_helpers_1.query_document_by_conditions)(collection_path, where_conditions, log);
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
147
|
+
const documents = filter_by_conditions(all_docs, where_conditions);
|
|
148
|
+
if (!documents[0]) {
|
|
149
|
+
throw "no data returned from Redis";
|
|
150
|
+
}
|
|
151
|
+
return documents[0];
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (log) {
|
|
155
|
+
managers_1.logger.error(`Error querying documents from Redis: ${collection_path} - ${JSON.stringify(where_conditions)} `, error);
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
exports.redis_query_document_by_conditions = redis_query_document_by_conditions;
|
|
161
|
+
// ── document ──
|
|
162
|
+
const redis_query_document = (collection_path_1, field_name_1, operator_1, value_1, ...args_1) => __awaiter(void 0, [collection_path_1, field_name_1, operator_1, value_1, ...args_1], void 0, function* (collection_path, field_name, operator, value, ignore_log = false) {
|
|
163
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
164
|
+
return (0, firebase_helpers_1.query_document)(collection_path, field_name, operator, value, ignore_log);
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
168
|
+
const documents = filter_by_condition(all_docs, field_name, operator, value);
|
|
169
|
+
if (documents.length < 1) {
|
|
170
|
+
throw `No data to return from Redis: collection: ${collection_path}, field_name: ${field_name}, operator: ${operator}, value:${value}`;
|
|
171
|
+
}
|
|
172
|
+
return documents[0];
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (!ignore_log) {
|
|
176
|
+
managers_1.logger.error("Error querying document from Redis: " + JSON.stringify({ collection_path, field_name, operator, value }), error);
|
|
177
|
+
}
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
exports.redis_query_document = redis_query_document;
|
|
182
|
+
const redis_query_document_optional = (collection_path_1, field_name_1, operator_1, value_1, ...args_1) => __awaiter(void 0, [collection_path_1, field_name_1, operator_1, value_1, ...args_1], void 0, function* (collection_path, field_name, operator, value, ignore_log = true) {
|
|
183
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
184
|
+
return (0, firebase_helpers_1.query_document_optional)(collection_path, field_name, operator, value, ignore_log);
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
188
|
+
const documents = filter_by_condition(all_docs, field_name, operator, value);
|
|
189
|
+
return documents[0] || null;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (!ignore_log) {
|
|
193
|
+
managers_1.logger.error("Error querying optional document from Redis: " + JSON.stringify({ collection_path, field_name, operator, value }), error);
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
exports.redis_query_document_optional = redis_query_document_optional;
|
|
199
|
+
const redis_get_document_by_id = (collection_path, doc_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
201
|
+
return (0, firebase_helpers_1.get_document_by_id)(collection_path, doc_id);
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const commander = (0, initialize_1.get_redis_commander)();
|
|
205
|
+
const key = (0, keys_1.get_doc_key)(collection_path, doc_id);
|
|
206
|
+
const raw = yield commander.get(key);
|
|
207
|
+
if (!raw) {
|
|
208
|
+
throw "Document not found in Redis, document id: " + doc_id;
|
|
209
|
+
}
|
|
210
|
+
return (0, exports.redis_simple_extract_data)(raw);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
managers_1.logger.error("error from redis_get_document_by_id", error);
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
exports.redis_get_document_by_id = redis_get_document_by_id;
|
|
218
|
+
const redis_get_document_by_id_optional = (collection_path, doc_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
219
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
220
|
+
return (0, firebase_helpers_1.get_document_by_id_optional)(collection_path, doc_id);
|
|
221
|
+
}
|
|
222
|
+
try {
|
|
223
|
+
const commander = (0, initialize_1.get_redis_commander)();
|
|
224
|
+
const key = (0, keys_1.get_doc_key)(collection_path, doc_id);
|
|
225
|
+
const raw = yield commander.get(key);
|
|
226
|
+
if (!raw) {
|
|
227
|
+
throw "Document not found in Redis, document id: " + doc_id;
|
|
228
|
+
}
|
|
229
|
+
return (0, exports.redis_simple_extract_data)(raw);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
managers_1.logger.error("error from redis_get_document_by_id_optional", error);
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
exports.redis_get_document_by_id_optional = redis_get_document_by_id_optional;
|
|
237
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/helpers/redis/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6CAAwC;AACxC,6CAA8E;AAC9E,iCAA2E;AAC3E,0DAU6B;AAE7B,MAAM,gBAAgB,GAAG,CAAO,eAAuB,EAAoB,EAAE;IACzE,IAAI,CAAC,sCAAyB,EAAE,CAAC;QAC7B,iBAAM,CAAC,IAAI,CAAC,+EAA+E,eAAe,GAAG,CAAC,CAAC;QAC/G,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,IAAA,kCAAe,GAAE,CAAC;QAC5C,MAAM,wBAAwB,GAA8B,WAAW,CAAC,wBAAwB,IAAI,EAAE,CAAC;QACvG,MAAM,MAAM,GAAG,wBAAwB,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,iBAAM,CAAC,IAAI,CAAC,kBAAkB,eAAe,mEAAmE,CAAC,CAAC;YAClH,OAAO,KAAK,CAAC;QACjB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AAM,SAAS,GAAG,IAAA,gCAAmB,GAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAA,kBAAW,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,4CAA4C,GAAG,MAAM,CAAC;QAChE,CAAC;QACD,OAAO,IAAA,iCAAyB,EAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,iBAAM,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAA,CAAC;AAhBW,QAAA,iCAAiC,qCAgB5C"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./initialize"), exports);
|
|
18
18
|
__exportStar(require("./keys"), exports);
|
|
19
19
|
__exportStar(require("./snapshot"), exports);
|
|
20
|
+
__exportStar(require("./helpers"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/redis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,yCAAuB;AACvB,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/redis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,yCAAuB;AACvB,6CAA2B;AAC3B,4CAA0B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TObject } from "akeyless-types-commons";
|
|
2
|
+
import { WhereCondition } from "../../types";
|
|
3
|
+
export declare const redis_simple_extract_data: (raw: string) => TObject<any>;
|
|
4
|
+
export declare const redis_get_all_documents: (collection_path: string) => Promise<TObject<any>[]>;
|
|
5
|
+
export declare const redis_query_documents: (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any) => Promise<TObject<any>[]>;
|
|
6
|
+
export declare const redis_query_documents_by_conditions: (collection_path: string, where_conditions: WhereCondition[]) => Promise<TObject<any>[]>;
|
|
7
|
+
export declare const redis_query_document_by_conditions: (collection_path: string, where_conditions: WhereCondition[], log?: boolean) => Promise<TObject<any>>;
|
|
8
|
+
export declare const redis_query_document: (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any, ignore_log?: boolean) => Promise<TObject<any>>;
|
|
9
|
+
export declare const redis_query_document_optional: (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any, ignore_log?: boolean) => Promise<TObject<any> | null>;
|
|
10
|
+
export declare const redis_get_document_by_id: (collection_path: string, doc_id: string) => Promise<TObject<any>>;
|
|
11
|
+
export declare const redis_get_document_by_id_optional: (collection_path: string, doc_id: string) => Promise<TObject<any> | null>;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { logger } from "../../managers";
|
|
11
|
+
import { get_redis_commander, redis_commander_connected } from "./initialize";
|
|
12
|
+
import { get_doc_key, get_collection_keys, scan_redis_keys } from "./keys";
|
|
13
|
+
import { get_nx_settings, get_all_documents, query_documents, query_documents_by_conditions, query_document_by_conditions, query_document, query_document_optional, get_document_by_id, get_document_by_id_optional, } from "../firebase_helpers";
|
|
14
|
+
const should_use_redis = (collection_path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
if (!redis_commander_connected) {
|
|
16
|
+
logger.warn(`⚠️ Redis commander not connected, falling back to Firebase for collection: "${collection_path}"`);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const nx_settings = yield get_nx_settings();
|
|
21
|
+
const cache_collections_config = nx_settings.cache_collections_config || {};
|
|
22
|
+
const config = cache_collections_config[collection_path];
|
|
23
|
+
if (!config) {
|
|
24
|
+
logger.warn(`⚠️ Collection "${collection_path}" not found in cache_collections_config, falling back to Firebase`);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (config.sync_direction === "redis_to_firebase") {
|
|
28
|
+
logger.warn(`⚠️ Collection "${collection_path}" sync_direction is "redis_to_firebase", falling back to Firebase`);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (_a) {
|
|
33
|
+
logger.warn(`⚠️ Failed to validate Redis config for collection: "${collection_path}", falling back to Firebase`);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
});
|
|
38
|
+
const parse_redis_value = (raw) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const parsed = JSON.parse(raw);
|
|
41
|
+
return (_a = parsed.data) !== null && _a !== void 0 ? _a : parsed;
|
|
42
|
+
};
|
|
43
|
+
const get_all_collection_docs = (collection_path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
const commander = get_redis_commander();
|
|
45
|
+
const keys = yield scan_redis_keys(get_collection_keys(collection_path), commander);
|
|
46
|
+
if (keys.length === 0)
|
|
47
|
+
return [];
|
|
48
|
+
const values = yield commander.mget(keys);
|
|
49
|
+
return values.filter(Boolean).map((v) => {
|
|
50
|
+
const data = parse_redis_value(v);
|
|
51
|
+
const key = keys[values.indexOf(v)];
|
|
52
|
+
const id = key.split(":").slice(1).join(":");
|
|
53
|
+
return Object.assign(Object.assign({}, data), { id });
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
const apply_operator = (doc_value, operator, value) => {
|
|
57
|
+
switch (operator) {
|
|
58
|
+
case "==":
|
|
59
|
+
return doc_value === value;
|
|
60
|
+
case "!=":
|
|
61
|
+
return doc_value !== value;
|
|
62
|
+
case "<":
|
|
63
|
+
return doc_value < value;
|
|
64
|
+
case "<=":
|
|
65
|
+
return doc_value <= value;
|
|
66
|
+
case ">":
|
|
67
|
+
return doc_value > value;
|
|
68
|
+
case ">=":
|
|
69
|
+
return doc_value >= value;
|
|
70
|
+
case "in":
|
|
71
|
+
return Array.isArray(value) && value.includes(doc_value);
|
|
72
|
+
case "not-in":
|
|
73
|
+
return Array.isArray(value) && !value.includes(doc_value);
|
|
74
|
+
case "array-contains":
|
|
75
|
+
return Array.isArray(doc_value) && doc_value.includes(value);
|
|
76
|
+
case "array-contains-any":
|
|
77
|
+
return Array.isArray(doc_value) && Array.isArray(value) && value.some((v) => doc_value.includes(v));
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const filter_by_condition = (docs, field_name, operator, value) => {
|
|
83
|
+
return docs.filter((doc) => apply_operator(doc[field_name], operator, value));
|
|
84
|
+
};
|
|
85
|
+
const filter_by_conditions = (docs, conditions) => {
|
|
86
|
+
return conditions.reduce((filtered, { field_name, operator, value }) => {
|
|
87
|
+
return filter_by_condition(filtered, field_name, operator, value);
|
|
88
|
+
}, docs);
|
|
89
|
+
};
|
|
90
|
+
// ── extract ──
|
|
91
|
+
export const redis_simple_extract_data = (raw) => {
|
|
92
|
+
const data = parse_redis_value(raw);
|
|
93
|
+
return data;
|
|
94
|
+
};
|
|
95
|
+
// ── documents ──
|
|
96
|
+
export const redis_get_all_documents = (collection_path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
98
|
+
return get_all_documents(collection_path);
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
return yield get_all_collection_docs(collection_path);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
logger.error("Error fetching documents from Redis:", error);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export const redis_query_documents = (collection_path, field_name, operator, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
110
|
+
return query_documents(collection_path, field_name, operator, value);
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
114
|
+
return filter_by_condition(all_docs, field_name, operator, value);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
logger.error(`Error querying documents from Redis: ${collection_path} - ${field_name} - ${operator} - ${value} `, error);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
export const redis_query_documents_by_conditions = (collection_path, where_conditions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
123
|
+
return query_documents_by_conditions(collection_path, where_conditions);
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
127
|
+
return filter_by_conditions(all_docs, where_conditions);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
logger.error(`Error querying documents from Redis: ${collection_path} - ${JSON.stringify(where_conditions)} `, error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
export const redis_query_document_by_conditions = (collection_path_1, where_conditions_1, ...args_1) => __awaiter(void 0, [collection_path_1, where_conditions_1, ...args_1], void 0, function* (collection_path, where_conditions, log = true) {
|
|
135
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
136
|
+
return query_document_by_conditions(collection_path, where_conditions, log);
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
140
|
+
const documents = filter_by_conditions(all_docs, where_conditions);
|
|
141
|
+
if (!documents[0]) {
|
|
142
|
+
throw "no data returned from Redis";
|
|
143
|
+
}
|
|
144
|
+
return documents[0];
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (log) {
|
|
148
|
+
logger.error(`Error querying documents from Redis: ${collection_path} - ${JSON.stringify(where_conditions)} `, error);
|
|
149
|
+
}
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// ── document ──
|
|
154
|
+
export const redis_query_document = (collection_path_1, field_name_1, operator_1, value_1, ...args_1) => __awaiter(void 0, [collection_path_1, field_name_1, operator_1, value_1, ...args_1], void 0, function* (collection_path, field_name, operator, value, ignore_log = false) {
|
|
155
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
156
|
+
return query_document(collection_path, field_name, operator, value, ignore_log);
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
160
|
+
const documents = filter_by_condition(all_docs, field_name, operator, value);
|
|
161
|
+
if (documents.length < 1) {
|
|
162
|
+
throw `No data to return from Redis: collection: ${collection_path}, field_name: ${field_name}, operator: ${operator}, value:${value}`;
|
|
163
|
+
}
|
|
164
|
+
return documents[0];
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (!ignore_log) {
|
|
168
|
+
logger.error("Error querying document from Redis: " + JSON.stringify({ collection_path, field_name, operator, value }), error);
|
|
169
|
+
}
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
export const redis_query_document_optional = (collection_path_1, field_name_1, operator_1, value_1, ...args_1) => __awaiter(void 0, [collection_path_1, field_name_1, operator_1, value_1, ...args_1], void 0, function* (collection_path, field_name, operator, value, ignore_log = true) {
|
|
174
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
175
|
+
return query_document_optional(collection_path, field_name, operator, value, ignore_log);
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const all_docs = yield get_all_collection_docs(collection_path);
|
|
179
|
+
const documents = filter_by_condition(all_docs, field_name, operator, value);
|
|
180
|
+
return documents[0] || null;
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
if (!ignore_log) {
|
|
184
|
+
logger.error("Error querying optional document from Redis: " + JSON.stringify({ collection_path, field_name, operator, value }), error);
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
export const redis_get_document_by_id = (collection_path, doc_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
190
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
191
|
+
return get_document_by_id(collection_path, doc_id);
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
const commander = get_redis_commander();
|
|
195
|
+
const key = get_doc_key(collection_path, doc_id);
|
|
196
|
+
const raw = yield commander.get(key);
|
|
197
|
+
if (!raw) {
|
|
198
|
+
throw "Document not found in Redis, document id: " + doc_id;
|
|
199
|
+
}
|
|
200
|
+
return redis_simple_extract_data(raw);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
logger.error("error from redis_get_document_by_id", error);
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
export const redis_get_document_by_id_optional = (collection_path, doc_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
+
if (!(yield should_use_redis(collection_path))) {
|
|
209
|
+
return get_document_by_id_optional(collection_path, doc_id);
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const commander = get_redis_commander();
|
|
213
|
+
const key = get_doc_key(collection_path, doc_id);
|
|
214
|
+
const raw = yield commander.get(key);
|
|
215
|
+
if (!raw) {
|
|
216
|
+
throw "Document not found in Redis, document id: " + doc_id;
|
|
217
|
+
}
|
|
218
|
+
return redis_simple_extract_data(raw);
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
logger.error("error from redis_get_document_by_id_optional", error);
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/helpers/redis/helpers.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EACH,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,6BAA6B,EAC7B,4BAA4B,EAC5B,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,gBAAgB,GAAG,CAAO,eAAuB,EAAoB,EAAE;IACzE,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,+EAA+E,eAAe,GAAG,CAAC,CAAC;QAC/G,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;QAC5C,MAAM,wBAAwB,GAA8B,WAAW,CAAC,wBAAwB,IAAI,EAAE,CAAC;QACvG,MAAM,MAAM,GAAG,wBAAwB,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CAAC,kBAAkB,eAAe,mEAAmE,CAAC,CAAC;YAClH,OAAO,KAAK,CAAC;QACjB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C,GAAG,MAAM,CAAC;QAChE,CAAC;QACD,OAAO,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/redis/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/redis/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|