@encodeagent/platform-helper-data 1.2604.1020908 → 1.2604.1031117
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/cosmosdb/index.d.ts +5 -5
- package/dist/cosmosdb/index.d.ts.map +1 -1
- package/dist/cosmosdb/index.js +43 -32
- package/dist/cosmosdb/index.js.map +1 -1
- package/dist/dynamodb/index.d.ts +4 -4
- package/dist/dynamodb/index.d.ts.map +1 -1
- package/dist/dynamodb/index.js +51 -110
- package/dist/dynamodb/index.js.map +1 -1
- package/dist/firestore/index.d.ts +2 -2
- package/dist/firestore/index.d.ts.map +1 -1
- package/dist/firestore/index.js +45 -52
- package/dist/firestore/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/mongodb/index.d.ts +3 -7
- package/dist/mongodb/index.d.ts.map +1 -1
- package/dist/mongodb/index.js +47 -110
- package/dist/mongodb/index.js.map +1 -1
- package/dist/util.d.ts +11 -6
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js.map +1 -1
- package/dist/wrapper/index.d.ts +15 -12
- package/dist/wrapper/index.d.ts.map +1 -1
- package/dist/wrapper/index.js +81 -34
- package/dist/wrapper/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/firestore/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEH,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/firestore/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEH,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EAEhB,MAAM,SAAS,CAAC;AASjB,wBAAsB,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAU3F;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CA2C9E;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CA8CxE;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAkDxE;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAwExE"}
|
package/dist/firestore/index.js
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.connect = connect;
|
|
7
7
|
exports.retrieve = retrieve;
|
|
8
|
-
exports.
|
|
8
|
+
exports.insert = insert;
|
|
9
9
|
exports.upsert = upsert;
|
|
10
10
|
exports.update = update;
|
|
11
11
|
const util_1 = require("../util");
|
|
12
|
+
const platform_helper_util_1 = require("@encodeagent/platform-helper-util");
|
|
12
13
|
const SERVICE = "firestore";
|
|
13
14
|
const ERROR_INFO = {
|
|
14
15
|
package: util_1.PACKAGE,
|
|
@@ -21,7 +22,7 @@ async function connect(props) {
|
|
|
21
22
|
...ERROR_INFO,
|
|
22
23
|
source: "connect",
|
|
23
24
|
code: "not-implemented",
|
|
24
|
-
message:
|
|
25
|
+
message: "GCP Firestore connection not implemented"
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
}
|
|
@@ -42,7 +43,9 @@ async function retrieve(props) {
|
|
|
42
43
|
const collectionRef = client.collection(containerId);
|
|
43
44
|
const docRef = collectionRef.doc(id);
|
|
44
45
|
const snapshot = await docRef.get();
|
|
45
|
-
const data = snapshot?.exists
|
|
46
|
+
const data = snapshot?.exists
|
|
47
|
+
? { id: snapshot.id, ...(snapshot.data() || {}) }
|
|
48
|
+
: undefined;
|
|
46
49
|
return {
|
|
47
50
|
service: SERVICE,
|
|
48
51
|
result: data
|
|
@@ -55,14 +58,20 @@ async function retrieve(props) {
|
|
|
55
58
|
...ERROR_INFO,
|
|
56
59
|
source: "retrieve",
|
|
57
60
|
code: "database-retrieve",
|
|
58
|
-
message: error instanceof Error
|
|
61
|
+
message: error instanceof Error
|
|
62
|
+
? error.message
|
|
63
|
+
: "Failed to retrieve document from GCP Firestore"
|
|
59
64
|
}
|
|
60
65
|
};
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
|
-
async function
|
|
68
|
+
async function insert(props) {
|
|
64
69
|
try {
|
|
65
|
-
const { client, databaseId, containerId
|
|
70
|
+
const { client, databaseId, containerId } = props;
|
|
71
|
+
let record = { ...props.record, id: props.record.id ?? (0, platform_helper_util_1.newGuid)() };
|
|
72
|
+
if (props.onPreprocessRecord) {
|
|
73
|
+
record = await props.onPreprocessRecord(record);
|
|
74
|
+
}
|
|
66
75
|
const errorResult = (0, util_1.validateDatabaseSetting)({
|
|
67
76
|
service: SERVICE,
|
|
68
77
|
...ERROR_INFO,
|
|
@@ -74,24 +83,13 @@ async function create(props) {
|
|
|
74
83
|
if (errorResult) {
|
|
75
84
|
return errorResult;
|
|
76
85
|
}
|
|
77
|
-
if (!record) {
|
|
78
|
-
return {
|
|
79
|
-
service: SERVICE,
|
|
80
|
-
error: {
|
|
81
|
-
...ERROR_INFO,
|
|
82
|
-
source: "create",
|
|
83
|
-
code: "require-record",
|
|
84
|
-
message: 'The record is required'
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
86
|
return {
|
|
89
87
|
service: SERVICE,
|
|
90
88
|
error: {
|
|
91
89
|
...ERROR_INFO,
|
|
92
|
-
source: "
|
|
90
|
+
source: "insert",
|
|
93
91
|
code: "not-implemented",
|
|
94
|
-
message:
|
|
92
|
+
message: "GCP Firestore insert not implemented"
|
|
95
93
|
}
|
|
96
94
|
};
|
|
97
95
|
}
|
|
@@ -100,16 +98,22 @@ async function create(props) {
|
|
|
100
98
|
service: SERVICE,
|
|
101
99
|
error: {
|
|
102
100
|
...ERROR_INFO,
|
|
103
|
-
source: "
|
|
104
|
-
code: "database-
|
|
105
|
-
message: error instanceof Error
|
|
101
|
+
source: "insert",
|
|
102
|
+
code: "database-insert",
|
|
103
|
+
message: error instanceof Error
|
|
104
|
+
? error.message
|
|
105
|
+
: "Failed to insert record in GCP Firestore"
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
async function upsert(props) {
|
|
111
111
|
try {
|
|
112
|
-
const { client, databaseId, containerId
|
|
112
|
+
const { client, databaseId, containerId } = props;
|
|
113
|
+
let record = { ...props.record, id: props.record.id ?? (0, platform_helper_util_1.newGuid)() };
|
|
114
|
+
if (props.onPreprocessRecord) {
|
|
115
|
+
record = await props.onPreprocessRecord(record);
|
|
116
|
+
}
|
|
113
117
|
const errorResult = (0, util_1.validateDatabaseSetting)({
|
|
114
118
|
service: SERVICE,
|
|
115
119
|
...ERROR_INFO,
|
|
@@ -121,16 +125,8 @@ async function upsert(props) {
|
|
|
121
125
|
if (errorResult) {
|
|
122
126
|
return errorResult;
|
|
123
127
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
service: SERVICE,
|
|
127
|
-
error: {
|
|
128
|
-
...ERROR_INFO,
|
|
129
|
-
source: "upsert",
|
|
130
|
-
code: "require-record",
|
|
131
|
-
message: 'The record is required'
|
|
132
|
-
}
|
|
133
|
-
};
|
|
128
|
+
if (props.onPreprocessRecordWithExistingRecord) {
|
|
129
|
+
record = await props.onPreprocessRecordWithExistingRecord(record, undefined);
|
|
134
130
|
}
|
|
135
131
|
return {
|
|
136
132
|
service: SERVICE,
|
|
@@ -138,7 +134,7 @@ async function upsert(props) {
|
|
|
138
134
|
...ERROR_INFO,
|
|
139
135
|
source: "upsert",
|
|
140
136
|
code: "not-implemented",
|
|
141
|
-
message:
|
|
137
|
+
message: "GCP Firestore upsert not implemented"
|
|
142
138
|
}
|
|
143
139
|
};
|
|
144
140
|
}
|
|
@@ -149,14 +145,20 @@ async function upsert(props) {
|
|
|
149
145
|
...ERROR_INFO,
|
|
150
146
|
source: "upsert",
|
|
151
147
|
code: "database-upsert",
|
|
152
|
-
message: error instanceof Error
|
|
148
|
+
message: error instanceof Error
|
|
149
|
+
? error.message
|
|
150
|
+
: "Failed to upsert record in GCP Firestore"
|
|
153
151
|
}
|
|
154
152
|
};
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
async function update(props) {
|
|
158
156
|
try {
|
|
159
|
-
const { client, databaseId, containerId
|
|
157
|
+
const { client, databaseId, containerId } = props;
|
|
158
|
+
let record = props.record;
|
|
159
|
+
if (props.onPreprocessRecord) {
|
|
160
|
+
record = await props.onPreprocessRecord(record);
|
|
161
|
+
}
|
|
160
162
|
const errorResult = (0, util_1.validateDatabaseSetting)({
|
|
161
163
|
service: SERVICE,
|
|
162
164
|
...ERROR_INFO,
|
|
@@ -168,17 +170,6 @@ async function update(props) {
|
|
|
168
170
|
if (errorResult) {
|
|
169
171
|
return errorResult;
|
|
170
172
|
}
|
|
171
|
-
if (!record) {
|
|
172
|
-
return {
|
|
173
|
-
service: SERVICE,
|
|
174
|
-
error: {
|
|
175
|
-
...ERROR_INFO,
|
|
176
|
-
source: "update",
|
|
177
|
-
code: "require-record",
|
|
178
|
-
message: 'The record is required'
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
173
|
const id = record.id;
|
|
183
174
|
if (!id) {
|
|
184
175
|
return {
|
|
@@ -187,11 +178,11 @@ async function update(props) {
|
|
|
187
178
|
...ERROR_INFO,
|
|
188
179
|
source: "update",
|
|
189
180
|
code: "require-record-id",
|
|
190
|
-
message:
|
|
181
|
+
message: "The record.id is required for update"
|
|
191
182
|
}
|
|
192
183
|
};
|
|
193
184
|
}
|
|
194
|
-
const entries = Object.entries(record).filter(([k]) => k !==
|
|
185
|
+
const entries = Object.entries(record).filter(([k]) => k !== "id");
|
|
195
186
|
if (entries.length === 0) {
|
|
196
187
|
return {
|
|
197
188
|
service: SERVICE,
|
|
@@ -199,7 +190,7 @@ async function update(props) {
|
|
|
199
190
|
...ERROR_INFO,
|
|
200
191
|
source: "update",
|
|
201
192
|
code: "no-update-fields",
|
|
202
|
-
message:
|
|
193
|
+
message: "No fields to update"
|
|
203
194
|
}
|
|
204
195
|
};
|
|
205
196
|
}
|
|
@@ -209,7 +200,7 @@ async function update(props) {
|
|
|
209
200
|
...ERROR_INFO,
|
|
210
201
|
source: "update",
|
|
211
202
|
code: "not-implemented",
|
|
212
|
-
message:
|
|
203
|
+
message: "GCP Firestore update not implemented"
|
|
213
204
|
}
|
|
214
205
|
};
|
|
215
206
|
}
|
|
@@ -220,7 +211,9 @@ async function update(props) {
|
|
|
220
211
|
...ERROR_INFO,
|
|
221
212
|
source: "update",
|
|
222
213
|
code: "database-update",
|
|
223
|
-
message: error instanceof Error
|
|
214
|
+
message: error instanceof Error
|
|
215
|
+
? error.message
|
|
216
|
+
: "Failed to update record in GCP Firestore"
|
|
224
217
|
}
|
|
225
218
|
};
|
|
226
219
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/firestore/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/firestore/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAwBH,0BAUC;AAED,4BA2CC;AAED,wBA8CC;AAED,wBAkDC;AAED,wBAwEC;AA3PD,kCAaiB;AACjB,4EAA4D;AAE5D,MAAM,OAAO,GAAG,WAAW,CAAC;AAC5B,MAAM,UAAU,GAAG;IACf,OAAO,EAAE,cAAO;IAChB,MAAM,EAAE,oBAAoB;CAC/B,CAAC;AAEK,KAAK,UAAU,OAAO,CAAC,KAAiC;IAC3D,OAAO;QACH,OAAO,EAAE,OAAO;Q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BAChB,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE,sCAAsC;aAClD;SACJ,CAAC;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO;YACH,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE;gBACH,GAAG,UAAU;gBACb,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EACH,KAAK,YAAY,KAAK;oBAClB,CAAC,CAAC,KAAK,CAAC,OAAO;oBACf,CAAC,CAAC,0CAA0C;aACvD;SACJ,CAAC;IACN,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Main export file for @encodeagent/platform-helper-data
|
|
3
3
|
*/
|
|
4
|
-
export { connect, retrieve,
|
|
5
|
-
export type { IQuery, TDatabaseService, IConnectionResult, IRetrieveProps, IConnectionForServiceProps, IUpdateResult, IUpsertResult, IRetrieveResult,
|
|
6
|
-
export type {
|
|
4
|
+
export { connect, retrieve, insert, insertBatch, update, upsert, query } from "./wrapper";
|
|
5
|
+
export type { IQuery, TDatabaseService, IConnectionResult, IRetrieveProps, IConnectionForServiceProps, IUpdateResult, IUpsertResult, IRetrieveResult, IInsertResult, IInsertBatchResult, IQueryResult, IDatabaseSetting, IValidateDatabaseSettingProps, ISimpleFilter, IGroupFilter, IOrderBy } from "./util";
|
|
6
|
+
export type { IInsertProps, IInsertBatchProps, IQueryProps, IUpsertProps, IUpdateProps } from "./wrapper/index";
|
|
7
7
|
export { SERVICE, URI, KEY, DATABASE_ID, CONTAINER_ID_FOR_DATA, CONTAINER_ID_FOR_SETTINGS, PACKAGE, getDatabaseSetting, validateDatabaseSetting } from "./util";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAG1F,YAAY,EACR,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,aAAa,EACb,YAAY,EACZ,QAAQ,EACX,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACR,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,YAAY,EACf,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACH,OAAO,EACP,GAAG,EACH,GAAG,EACH,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,OAAO,EACP,kBAAkB,EAClB,uBAAuB,EAC1B,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* @fileoverview Main export file for @encodeagent/platform-helper-data
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateDatabaseSetting = exports.getDatabaseSetting = exports.PACKAGE = exports.CONTAINER_ID_FOR_SETTINGS = exports.CONTAINER_ID_FOR_DATA = exports.DATABASE_ID = exports.KEY = exports.URI = exports.SERVICE = exports.query = exports.upsert = exports.update = exports.
|
|
6
|
+
exports.validateDatabaseSetting = exports.getDatabaseSetting = exports.PACKAGE = exports.CONTAINER_ID_FOR_SETTINGS = exports.CONTAINER_ID_FOR_DATA = exports.DATABASE_ID = exports.KEY = exports.URI = exports.SERVICE = exports.query = exports.upsert = exports.update = exports.insertBatch = exports.insert = exports.retrieve = exports.connect = void 0;
|
|
7
7
|
// Export wrapper functions (main API)
|
|
8
8
|
var wrapper_1 = require("./wrapper");
|
|
9
9
|
Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return wrapper_1.connect; } });
|
|
10
10
|
Object.defineProperty(exports, "retrieve", { enumerable: true, get: function () { return wrapper_1.retrieve; } });
|
|
11
|
-
Object.defineProperty(exports, "
|
|
11
|
+
Object.defineProperty(exports, "insert", { enumerable: true, get: function () { return wrapper_1.insert; } });
|
|
12
|
+
Object.defineProperty(exports, "insertBatch", { enumerable: true, get: function () { return wrapper_1.insertBatch; } });
|
|
12
13
|
Object.defineProperty(exports, "update", { enumerable: true, get: function () { return wrapper_1.update; } });
|
|
13
14
|
Object.defineProperty(exports, "upsert", { enumerable: true, get: function () { return wrapper_1.upsert; } });
|
|
14
15
|
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return wrapper_1.query; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAsC;AACtC,qCAA0F;AAAjF,kGAAA,OAAO,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,gGAAA,KAAK,OAAA;AA8BtE,qCAAqC;AACrC,+BAUgB;AATZ,+FAAA,OAAO,OAAA;AACP,2FAAA,GAAG,OAAA;AACH,2FAAA,GAAG,OAAA;AACH,mGAAA,WAAW,OAAA;AACX,6GAAA,qBAAqB,OAAA;AACrB,iHAAA,yBAAyB,OAAA;AACzB,+FAAA,OAAO,OAAA;AACP,0GAAA,kBAAkB,OAAA;AAClB,+GAAA,uBAAuB,OAAA"}
|
package/dist/mongodb/index.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview MongoDB implementation
|
|
3
3
|
*/
|
|
4
|
-
import { IConnectionForServiceProps, IConnectionResult, IRetrieveResult, IRetrieveProps,
|
|
4
|
+
import { IConnectionForServiceProps, IConnectionResult, IRetrieveResult, IRetrieveProps, IInsertProps, IInsertResult, IUpsertProps, IUpsertResult, IUpdateProps, IUpdateResult } from "../util";
|
|
5
5
|
export declare function connect(props: IConnectionForServiceProps): Promise<IConnectionResult>;
|
|
6
6
|
export declare function retrieve(props: IRetrieveProps): Promise<IRetrieveResult>;
|
|
7
|
+
export declare function insert(props: IInsertProps): Promise<IInsertResult>;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* Uses same connection shape as retrieve, with optional filter, sort, and limit.
|
|
10
|
-
*/
|
|
11
|
-
export declare function create(props: ICreateProps): Promise<ICreateResult>;
|
|
12
|
-
/**
|
|
13
|
-
* Upsert (create or update) a document in MongoDB
|
|
9
|
+
* Upsert (insert or update) a document in MongoDB
|
|
14
10
|
* @param props Upsert properties with client, databaseId, containerId, and record
|
|
15
11
|
* @returns Promise<IUpsertResult>
|
|
16
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mongodb/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEH,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mongodb/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEH,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EAEhB,MAAM,SAAS,CAAC;AAUjB,wBAAsB,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAkC3F;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAmD9E;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CA4CxE;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAwDxE;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAqFxE"}
|
package/dist/mongodb/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.connect = connect;
|
|
7
7
|
exports.retrieve = retrieve;
|
|
8
|
-
exports.
|
|
8
|
+
exports.insert = insert;
|
|
9
9
|
exports.upsert = upsert;
|
|
10
10
|
exports.update = update;
|
|
11
11
|
const util_1 = require("../util");
|
|
@@ -44,7 +44,7 @@ async function connect(props) {
|
|
|
44
44
|
...ERROR_INFO,
|
|
45
45
|
source: "connect",
|
|
46
46
|
code: "database-connect",
|
|
47
|
-
message: error instanceof Error ? error.message :
|
|
47
|
+
message: error instanceof Error ? error.message : "Failed to connect to MongoDB"
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
|
@@ -72,11 +72,13 @@ async function retrieve(props) {
|
|
|
72
72
|
}
|
|
73
73
|
// Fallback to id field or string _id
|
|
74
74
|
if (!doc) {
|
|
75
|
-
doc =
|
|
75
|
+
doc =
|
|
76
|
+
(await collection.findOne({ id })) ||
|
|
77
|
+
(await collection.findOne({ _id: id }));
|
|
76
78
|
}
|
|
77
79
|
return {
|
|
78
80
|
service: SERVICE,
|
|
79
|
-
result:
|
|
81
|
+
result: doc ?? undefined
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
catch (error) {
|
|
@@ -86,56 +88,20 @@ async function retrieve(props) {
|
|
|
86
88
|
...ERROR_INFO,
|
|
87
89
|
source: "retrieve",
|
|
88
90
|
code: "database-retrieve",
|
|
89
|
-
message: error instanceof Error
|
|
91
|
+
message: error instanceof Error
|
|
92
|
+
? error.message
|
|
93
|
+
: "Failed to retrieve document from MongoDB"
|
|
90
94
|
}
|
|
91
95
|
};
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
* Query documents from MongoDB collection
|
|
96
|
-
* Uses same connection shape as retrieve, with optional filter, sort, and limit.
|
|
97
|
-
*/
|
|
98
|
-
// { filter ?: Record<string, any>; sort ?: Record<string, 1 | -1>; limit ?: number; }
|
|
99
|
-
// export async function query(props: IQueryProps): Promise<IQueryResult> {
|
|
100
|
-
// try {
|
|
101
|
-
// const { client, databaseId, containerId, query } = props;
|
|
102
|
-
// if (!databaseId) {
|
|
103
|
-
// return {
|
|
104
|
-
// service: SERVICE,
|
|
105
|
-
// error: 'The databaseId or process.env.DATABASE_ID is required'
|
|
106
|
-
// };
|
|
107
|
-
// }
|
|
108
|
-
// if (!containerId) {
|
|
109
|
-
// return {
|
|
110
|
-
// service: SERVICE,
|
|
111
|
-
// error: 'The containerId or process.env.DATABASE_CONTAINER_ID is required'
|
|
112
|
-
// };
|
|
113
|
-
// }
|
|
114
|
-
// const db = client.db(databaseId);
|
|
115
|
-
// const collection = db.collection(containerId);
|
|
116
|
-
// const { filter, sort, limit } = query;
|
|
117
|
-
// let cursor = collection.find(filter ?? {});
|
|
118
|
-
// if (sort && Object.keys(sort).length) {
|
|
119
|
-
// cursor = cursor.sort(sort as any);
|
|
120
|
-
// }
|
|
121
|
-
// if (typeof limit === 'number' && limit > 0) {
|
|
122
|
-
// cursor = cursor.limit(limit);
|
|
123
|
-
// }
|
|
124
|
-
// const items = await cursor.toArray();
|
|
125
|
-
// return {
|
|
126
|
-
// service: SERVICE,
|
|
127
|
-
// result: items
|
|
128
|
-
// };
|
|
129
|
-
// } catch (error) {
|
|
130
|
-
// return {
|
|
131
|
-
// service: SERVICE,
|
|
132
|
-
// error: error instanceof Error ? error.message : 'Failed to query documents from MongoDB'
|
|
133
|
-
// };
|
|
134
|
-
// }
|
|
135
|
-
// }
|
|
136
|
-
async function create(props) {
|
|
98
|
+
async function insert(props) {
|
|
137
99
|
try {
|
|
138
|
-
const { client, databaseId, containerId
|
|
100
|
+
const { client, databaseId, containerId } = props;
|
|
101
|
+
let record = { ...props.record, id: props.record.id ?? (0, platform_helper_util_1.newGuid)() };
|
|
102
|
+
if (props.onPreprocessRecord) {
|
|
103
|
+
record = await props.onPreprocessRecord(record);
|
|
104
|
+
}
|
|
139
105
|
const errorResult = (0, util_1.validateDatabaseSetting)({
|
|
140
106
|
service: SERVICE,
|
|
141
107
|
...ERROR_INFO,
|
|
@@ -147,27 +113,12 @@ async function create(props) {
|
|
|
147
113
|
if (errorResult) {
|
|
148
114
|
return errorResult;
|
|
149
115
|
}
|
|
150
|
-
if (!record) {
|
|
151
|
-
return {
|
|
152
|
-
service: SERVICE,
|
|
153
|
-
error: {
|
|
154
|
-
...ERROR_INFO,
|
|
155
|
-
source: "create",
|
|
156
|
-
code: "require-record",
|
|
157
|
-
message: "The record is required"
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
116
|
const db = client.db(databaseId);
|
|
162
117
|
const collection = db.collection(containerId);
|
|
163
|
-
|
|
164
|
-
...record,
|
|
165
|
-
id: record.id ?? (0, platform_helper_util_1.newGuid)()
|
|
166
|
-
};
|
|
167
|
-
await collection.insertOne(item);
|
|
118
|
+
await collection.insertOne(record);
|
|
168
119
|
return {
|
|
169
120
|
service: SERVICE,
|
|
170
|
-
result:
|
|
121
|
+
result: record
|
|
171
122
|
};
|
|
172
123
|
}
|
|
173
124
|
catch (error) {
|
|
@@ -175,21 +126,25 @@ async function create(props) {
|
|
|
175
126
|
service: SERVICE,
|
|
176
127
|
error: {
|
|
177
128
|
...ERROR_INFO,
|
|
178
|
-
source: "
|
|
179
|
-
code: "database-
|
|
180
|
-
message: error instanceof Error ? error.message :
|
|
129
|
+
source: "insert",
|
|
130
|
+
code: "database-insert",
|
|
131
|
+
message: error instanceof Error ? error.message : "Failed to insert record in MongoDB"
|
|
181
132
|
}
|
|
182
133
|
};
|
|
183
134
|
}
|
|
184
135
|
}
|
|
185
136
|
/**
|
|
186
|
-
* Upsert (
|
|
137
|
+
* Upsert (insert or update) a document in MongoDB
|
|
187
138
|
* @param props Upsert properties with client, databaseId, containerId, and record
|
|
188
139
|
* @returns Promise<IUpsertResult>
|
|
189
140
|
*/
|
|
190
141
|
async function upsert(props) {
|
|
191
142
|
try {
|
|
192
|
-
const { client, databaseId, containerId
|
|
143
|
+
const { client, databaseId, containerId } = props;
|
|
144
|
+
let record = { ...props.record, id: props.record.id ?? (0, platform_helper_util_1.newGuid)() };
|
|
145
|
+
if (props.onPreprocessRecord) {
|
|
146
|
+
record = await props.onPreprocessRecord(record);
|
|
147
|
+
}
|
|
193
148
|
const errorResult = (0, util_1.validateDatabaseSetting)({
|
|
194
149
|
service: SERVICE,
|
|
195
150
|
...ERROR_INFO,
|
|
@@ -201,32 +156,18 @@ async function upsert(props) {
|
|
|
201
156
|
if (errorResult) {
|
|
202
157
|
return errorResult;
|
|
203
158
|
}
|
|
204
|
-
if (!record) {
|
|
205
|
-
return {
|
|
206
|
-
service: SERVICE,
|
|
207
|
-
error: {
|
|
208
|
-
...ERROR_INFO,
|
|
209
|
-
source: "upsert",
|
|
210
|
-
code: "require-record",
|
|
211
|
-
message: "The record is required"
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
159
|
const db = client.db(databaseId);
|
|
216
160
|
const collection = db.collection(containerId);
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
161
|
+
const existingRecord = await collection.findOne({ id: record.id });
|
|
162
|
+
const isNew = !existingRecord;
|
|
163
|
+
if (props.onPreprocessRecordWithExistingRecord) {
|
|
164
|
+
record = await props.onPreprocessRecordWithExistingRecord(record, existingRecord ?? undefined);
|
|
165
|
+
}
|
|
222
166
|
// Use updateOne with upsert option
|
|
223
|
-
|
|
224
|
-
const result = await collection.updateOne({ id: recordWithId.id }, { $set: recordWithId }, { upsert: true });
|
|
225
|
-
// Check if this was a new document or an update
|
|
226
|
-
const isNew = result.upsertedCount > 0;
|
|
167
|
+
await collection.updateOne({ id: record.id }, { $set: record }, { upsert: true });
|
|
227
168
|
return {
|
|
228
169
|
service: SERVICE,
|
|
229
|
-
result:
|
|
170
|
+
result: record,
|
|
230
171
|
isNew
|
|
231
172
|
};
|
|
232
173
|
}
|
|
@@ -237,14 +178,18 @@ async function upsert(props) {
|
|
|
237
178
|
...ERROR_INFO,
|
|
238
179
|
source: "upsert",
|
|
239
180
|
code: "database-upsert",
|
|
240
|
-
message: error instanceof Error ? error.message :
|
|
181
|
+
message: error instanceof Error ? error.message : "Failed to upsert record in MongoDB"
|
|
241
182
|
}
|
|
242
183
|
};
|
|
243
184
|
}
|
|
244
185
|
}
|
|
245
186
|
async function update(props) {
|
|
246
187
|
try {
|
|
247
|
-
const { client, databaseId, containerId
|
|
188
|
+
const { client, databaseId, containerId } = props;
|
|
189
|
+
let record = props.record;
|
|
190
|
+
if (props.onPreprocessRecord) {
|
|
191
|
+
record = await props.onPreprocessRecord(record);
|
|
192
|
+
}
|
|
248
193
|
const errorResult = (0, util_1.validateDatabaseSetting)({
|
|
249
194
|
service: SERVICE,
|
|
250
195
|
...ERROR_INFO,
|
|
@@ -256,17 +201,6 @@ async function update(props) {
|
|
|
256
201
|
if (errorResult) {
|
|
257
202
|
return errorResult;
|
|
258
203
|
}
|
|
259
|
-
if (!record) {
|
|
260
|
-
return {
|
|
261
|
-
service: SERVICE,
|
|
262
|
-
error: {
|
|
263
|
-
...ERROR_INFO,
|
|
264
|
-
source: "update",
|
|
265
|
-
code: "require-record",
|
|
266
|
-
message: "The record is required"
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
204
|
const id = record.id;
|
|
271
205
|
if (!id) {
|
|
272
206
|
return {
|
|
@@ -280,8 +214,11 @@ async function update(props) {
|
|
|
280
214
|
};
|
|
281
215
|
}
|
|
282
216
|
const updates = Object.entries(record)
|
|
283
|
-
.filter(([k]) => k !==
|
|
284
|
-
.reduce((acc, [k, v]) => {
|
|
217
|
+
.filter(([k]) => k !== "id")
|
|
218
|
+
.reduce((acc, [k, v]) => {
|
|
219
|
+
acc[k] = v;
|
|
220
|
+
return acc;
|
|
221
|
+
}, {});
|
|
285
222
|
if (!Object.keys(updates).length) {
|
|
286
223
|
return {
|
|
287
224
|
service: SERVICE,
|
|
@@ -295,8 +232,8 @@ async function update(props) {
|
|
|
295
232
|
}
|
|
296
233
|
const db = client.db(databaseId);
|
|
297
234
|
const collection = db.collection(containerId);
|
|
298
|
-
const result = await collection.findOneAndUpdate({ id }, { $set: updates }, { returnDocument:
|
|
299
|
-
const data =
|
|
235
|
+
const result = await collection.findOneAndUpdate({ id }, { $set: updates }, { returnDocument: "after" });
|
|
236
|
+
const data = result && (result.value ?? (await collection.findOne({ id })));
|
|
300
237
|
return {
|
|
301
238
|
service: SERVICE,
|
|
302
239
|
result: data
|
|
@@ -309,7 +246,7 @@ async function update(props) {
|
|
|
309
246
|
...ERROR_INFO,
|
|
310
247
|
source: "update",
|
|
311
248
|
code: "database-update",
|
|
312
|
-
message: error instanceof Error ? error.message :
|
|
249
|
+
message: error instanceof Error ? error.message : "Failed to update record in MongoDB"
|
|
313
250
|
}
|
|
314
251
|
};
|
|
315
252
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mongodb/index.ts"],"names":[],"mappings":";AAAA;;G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