@event-driven-io/pongo 0.17.0-beta.39 → 0.17.0-beta.40
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/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare.cjs +2 -2
- package/dist/cloudflare.d.cts +2 -2
- package/dist/cloudflare.d.ts +2 -2
- package/dist/cloudflare.js +2 -2
- package/dist/{core-Dtn-d-91.js → core-BHdOCUrr.js} +111 -3
- package/dist/core-BHdOCUrr.js.map +1 -0
- package/dist/{core-BdTIuXiI.cjs → core-C9SB3XMx.cjs} +116 -2
- package/dist/core-C9SB3XMx.cjs.map +1 -0
- package/dist/{core-wHw_lMM5.js → core-CH0SOCr3.js} +65 -11
- package/dist/core-CH0SOCr3.js.map +1 -0
- package/dist/{core-BYk4wCpe.cjs → core-CkmE5dkK.cjs} +65 -11
- package/dist/core-CkmE5dkK.cjs.map +1 -0
- package/dist/{index-CL0zRxRl.d.ts → index-C3pnS1S_.d.cts} +23 -8
- package/dist/{index-Cxo6j266.d.ts → index-CZOmOsQt.d.ts} +2 -2
- package/dist/{index-DyNmc6tD.d.cts → index-FXnldVnn.d.cts} +2 -2
- package/dist/{index-BfOn92K5.d.cts → index-r7V4paf_.d.ts} +23 -8
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/pg.cjs +67 -10
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +1 -1
- package/dist/pg.d.ts +1 -1
- package/dist/pg.js +67 -10
- package/dist/pg.js.map +1 -1
- package/dist/shim.cjs +18 -8
- package/dist/shim.cjs.map +1 -1
- package/dist/shim.d.cts +1 -1
- package/dist/shim.d.ts +1 -1
- package/dist/shim.js +18 -8
- package/dist/shim.js.map +1 -1
- package/dist/sqlite3.cjs +2 -2
- package/dist/sqlite3.d.cts +2 -2
- package/dist/sqlite3.d.ts +2 -2
- package/dist/sqlite3.js +2 -2
- package/package.json +2 -2
- package/dist/core-BYk4wCpe.cjs.map +0 -1
- package/dist/core-BdTIuXiI.cjs.map +0 -1
- package/dist/core-Dtn-d-91.js.map +0 -1
- package/dist/core-wHw_lMM5.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_core = require('./core-
|
|
1
|
+
const require_core = require('./core-C9SB3XMx.cjs');
|
|
2
2
|
const require_cli = require('./cli.cjs');
|
|
3
3
|
let _event_driven_io_dumbo = require("@event-driven-io/dumbo");
|
|
4
4
|
|
|
@@ -85,11 +85,51 @@ const buildJsonPath = (path) => {
|
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/storage/sqlite/core/sqlBuilder/filter/index.ts
|
|
87
87
|
const AND = "AND";
|
|
88
|
-
const
|
|
88
|
+
const OR = "OR";
|
|
89
|
+
const unsupportedRootOperators = [
|
|
90
|
+
"$text",
|
|
91
|
+
"$where",
|
|
92
|
+
"$comment"
|
|
93
|
+
];
|
|
94
|
+
const constructFilterQuery = (filter, serializer) => {
|
|
95
|
+
ensureSupportedRootOperators(filter);
|
|
96
|
+
const parts = [];
|
|
97
|
+
const fieldFilterQuery = constructFieldFilterQuery(filter, serializer);
|
|
98
|
+
if (!_event_driven_io_dumbo.SQL.check.isEmpty(fieldFilterQuery)) parts.push(fieldFilterQuery);
|
|
99
|
+
const orFilterQuery = constructLogicalFilterQuery(filter.$or, OR, serializer);
|
|
100
|
+
if (!_event_driven_io_dumbo.SQL.check.isEmpty(orFilterQuery)) parts.push(orFilterQuery);
|
|
101
|
+
const andFilterQuery = constructLogicalFilterQuery(filter.$and, AND, serializer);
|
|
102
|
+
if (!_event_driven_io_dumbo.SQL.check.isEmpty(andFilterQuery)) parts.push(andFilterQuery);
|
|
103
|
+
const norFilterQuery = constructNorFilterQuery(filter.$nor, serializer);
|
|
104
|
+
if (!_event_driven_io_dumbo.SQL.check.isEmpty(norFilterQuery)) parts.push(norFilterQuery);
|
|
105
|
+
return _event_driven_io_dumbo.SQL.merge(parts, ` ${AND} `);
|
|
106
|
+
};
|
|
107
|
+
const constructFieldFilterQuery = (filter, serializer) => _event_driven_io_dumbo.SQL.merge(require_core.objectEntries(filter).flatMap(([key, value]) => isLogicalRootOperator(key) ? [] : [isRecord(value) ? constructComplexFilterQuery(key, value, serializer) : handleOperator(key, require_core.QueryOperators.$eq, value, serializer)]), ` ${AND} `);
|
|
108
|
+
const constructLogicalFilterQuery = (filters, joinOperator, serializer) => {
|
|
109
|
+
if (!filters?.length) return _event_driven_io_dumbo.SQL.EMPTY;
|
|
110
|
+
const subFilterQueries = filters.reduce((queries, filter) => {
|
|
111
|
+
const query = constructFilterQuery(filter, serializer);
|
|
112
|
+
if (!_event_driven_io_dumbo.SQL.check.isEmpty(query)) queries.push(query);
|
|
113
|
+
return queries;
|
|
114
|
+
}, []);
|
|
115
|
+
if (subFilterQueries.length === 0) return _event_driven_io_dumbo.SQL.EMPTY;
|
|
116
|
+
if (subFilterQueries.length === 1) return wrapFilterQuery(subFilterQueries[0]);
|
|
117
|
+
return _event_driven_io_dumbo.SQL`(${_event_driven_io_dumbo.SQL.merge(subFilterQueries.map(wrapFilterQuery), ` ${joinOperator} `)})`;
|
|
118
|
+
};
|
|
119
|
+
const constructNorFilterQuery = (filters, serializer) => {
|
|
120
|
+
if (!filters?.length) return _event_driven_io_dumbo.SQL.EMPTY;
|
|
121
|
+
const logicalFilterQuery = constructLogicalFilterQuery(filters, OR, serializer);
|
|
122
|
+
return _event_driven_io_dumbo.SQL.check.isEmpty(logicalFilterQuery) ? _event_driven_io_dumbo.SQL.EMPTY : _event_driven_io_dumbo.SQL`NOT ${logicalFilterQuery}`;
|
|
123
|
+
};
|
|
89
124
|
const constructComplexFilterQuery = (key, value, serializer) => {
|
|
90
125
|
const isEquality = !require_core.hasOperators(value);
|
|
91
126
|
return _event_driven_io_dumbo.SQL.merge(require_core.objectEntries(value).map(([nestedKey, val]) => isEquality ? handleOperator(`${key}.${nestedKey}`, require_core.QueryOperators.$eq, val, serializer) : handleOperator(key, nestedKey, val, serializer)), ` ${AND} `);
|
|
92
127
|
};
|
|
128
|
+
const wrapFilterQuery = (filterQuery) => _event_driven_io_dumbo.SQL`(${filterQuery})`;
|
|
129
|
+
const ensureSupportedRootOperators = (filter) => {
|
|
130
|
+
for (const operator of unsupportedRootOperators) if (operator in filter) throw new Error(`Unsupported root operator: ${operator}`);
|
|
131
|
+
};
|
|
132
|
+
const isLogicalRootOperator = (key) => key === "$and" || key === "$nor" || key === "$or";
|
|
93
133
|
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
94
134
|
|
|
95
135
|
//#endregion
|
|
@@ -128,6 +168,10 @@ const buildPushQuery = (push, currentUpdateQuery, serializer) => {
|
|
|
128
168
|
|
|
129
169
|
//#endregion
|
|
130
170
|
//#region src/storage/sqlite/core/sqlBuilder/index.ts
|
|
171
|
+
const versionCheckClause = (expectedVersion) => {
|
|
172
|
+
const predicate = require_core.expectedVersionPredicate(expectedVersion);
|
|
173
|
+
return predicate.operator === "none" ? _event_driven_io_dumbo.SQL.EMPTY : _event_driven_io_dumbo.SQL`AND _version = ${predicate.value}`;
|
|
174
|
+
};
|
|
131
175
|
const createCollection = (collectionName) => _event_driven_io_dumbo.SQL`
|
|
132
176
|
CREATE TABLE IF NOT EXISTS ${_event_driven_io_dumbo.SQL.identifier(collectionName)} (
|
|
133
177
|
_id TEXT PRIMARY KEY,
|
|
@@ -156,10 +200,19 @@ const sqliteSQLBuilder = (collectionName, serializer) => ({
|
|
|
156
200
|
return _event_driven_io_dumbo.SQL`
|
|
157
201
|
INSERT OR IGNORE INTO ${_event_driven_io_dumbo.SQL.identifier(collectionName)} (_id, data, _version) VALUES ${values}
|
|
158
202
|
RETURNING _id;`;
|
|
203
|
+
},
|
|
204
|
+
insertOrReplace: (documents) => {
|
|
205
|
+
const col = _event_driven_io_dumbo.SQL.identifier(collectionName);
|
|
206
|
+
return _event_driven_io_dumbo.SQL`
|
|
207
|
+
INSERT INTO ${col} (_id, data, _version)
|
|
208
|
+
VALUES ${_event_driven_io_dumbo.SQL.merge(documents.map((d) => _event_driven_io_dumbo.SQL`(${d._id}, json_patch(${serializer.serialize(d)}, json_object('_id', ${d._id}, '_version', '1')), 1)`), ",")}
|
|
209
|
+
ON CONFLICT(_id) DO UPDATE SET
|
|
210
|
+
data = json_patch(excluded.data, json_object('_id', ${col}._id, '_version', cast(${col}._version + 1 as TEXT))),
|
|
211
|
+
_version = ${col}._version + 1
|
|
212
|
+
RETURNING _id, cast(_version as TEXT) as version;`;
|
|
159
213
|
},
|
|
160
214
|
updateOne: (filter, update, options) => {
|
|
161
|
-
const
|
|
162
|
-
const expectedVersionCheck = expectedVersion != null ? _event_driven_io_dumbo.SQL`AND _version = ${expectedVersion}` : _event_driven_io_dumbo.SQL``;
|
|
215
|
+
const expectedVersionCheck = versionCheckClause(options?.expectedVersion);
|
|
163
216
|
const filterQuery = (0, _event_driven_io_dumbo.isSQL)(filter) ? filter : constructFilterQuery(filter, serializer);
|
|
164
217
|
const updateQuery = (0, _event_driven_io_dumbo.isSQL)(update) ? update : buildUpdateQuery(update, serializer);
|
|
165
218
|
return _event_driven_io_dumbo.SQL`
|
|
@@ -180,8 +233,7 @@ const sqliteSQLBuilder = (collectionName, serializer) => ({
|
|
|
180
233
|
1 as modified;`;
|
|
181
234
|
},
|
|
182
235
|
replaceOne: (filter, document, options) => {
|
|
183
|
-
const
|
|
184
|
-
const expectedVersionCheck = expectedVersion != null ? _event_driven_io_dumbo.SQL`AND _version = ${expectedVersion}` : _event_driven_io_dumbo.SQL``;
|
|
236
|
+
const expectedVersionCheck = versionCheckClause(options?.expectedVersion);
|
|
185
237
|
const filterQuery = (0, _event_driven_io_dumbo.isSQL)(filter) ? filter : constructFilterQuery(filter, serializer);
|
|
186
238
|
return _event_driven_io_dumbo.SQL`
|
|
187
239
|
UPDATE ${_event_driven_io_dumbo.SQL.identifier(collectionName)}
|
|
@@ -213,8 +265,7 @@ const sqliteSQLBuilder = (collectionName, serializer) => ({
|
|
|
213
265
|
RETURNING _id;`;
|
|
214
266
|
},
|
|
215
267
|
deleteOne: (filter, options) => {
|
|
216
|
-
const
|
|
217
|
-
const expectedVersionCheck = expectedVersion != null ? _event_driven_io_dumbo.SQL`AND _version = ${expectedVersion}` : _event_driven_io_dumbo.SQL``;
|
|
268
|
+
const expectedVersionCheck = versionCheckClause(options?.expectedVersion);
|
|
218
269
|
const filterQuery = (0, _event_driven_io_dumbo.isSQL)(filter) ? filter : constructFilterQuery(filter, serializer);
|
|
219
270
|
return _event_driven_io_dumbo.SQL`
|
|
220
271
|
DELETE FROM ${_event_driven_io_dumbo.SQL.identifier(collectionName)}
|
|
@@ -236,7 +287,10 @@ const sqliteSQLBuilder = (collectionName, serializer) => ({
|
|
|
236
287
|
const col = _event_driven_io_dumbo.SQL.identifier(collectionName);
|
|
237
288
|
if (documents.some((d) => "_version" in d && d._version !== void 0)) return _event_driven_io_dumbo.SQL`
|
|
238
289
|
WITH replacements(_id, data, expected_version) AS (
|
|
239
|
-
VALUES ${_event_driven_io_dumbo.SQL.merge(documents.map((d) =>
|
|
290
|
+
VALUES ${_event_driven_io_dumbo.SQL.merge(documents.map((d) => {
|
|
291
|
+
const expectedVersion = d._version;
|
|
292
|
+
return expectedVersion !== void 0 ? _event_driven_io_dumbo.SQL`(${d._id}, ${serializer.serialize(d)}, ${expectedVersion})` : _event_driven_io_dumbo.SQL`(${d._id}, ${serializer.serialize(d)}, NULL)`;
|
|
293
|
+
}), ",")}
|
|
240
294
|
)
|
|
241
295
|
UPDATE ${col}
|
|
242
296
|
SET
|
|
@@ -244,7 +298,7 @@ const sqliteSQLBuilder = (collectionName, serializer) => ({
|
|
|
244
298
|
_version = ${col}._version + 1,
|
|
245
299
|
_updated = datetime('now')
|
|
246
300
|
FROM replacements r
|
|
247
|
-
WHERE ${col}._id = r._id AND ${col}._version = r.expected_version
|
|
301
|
+
WHERE ${col}._id = r._id AND (r.expected_version IS NULL OR ${col}._version = r.expected_version)
|
|
248
302
|
RETURNING ${col}._id, cast(${col}._version as TEXT) as version;`;
|
|
249
303
|
return _event_driven_io_dumbo.SQL`
|
|
250
304
|
WITH replacements(_id, data) AS (
|
|
@@ -316,4 +370,4 @@ Object.defineProperty(exports, 'sqliteSQLBuilder', {
|
|
|
316
370
|
return sqliteSQLBuilder;
|
|
317
371
|
}
|
|
318
372
|
});
|
|
319
|
-
//# sourceMappingURL=core-
|
|
373
|
+
//# sourceMappingURL=core-CkmE5dkK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-CkmE5dkK.cjs","names":["SQL","OperatorMap","objectEntries","SQL","objectEntries","QueryOperators","hasOperators","objectEntries","SQL","expectedVersionPredicate","SQL"],"sources":["../src/storage/sqlite/core/sqlBuilder/filter/queryOperators.ts","../src/storage/sqlite/core/sqlBuilder/filter/index.ts","../src/storage/sqlite/core/sqlBuilder/update/index.ts","../src/storage/sqlite/core/sqlBuilder/index.ts"],"sourcesContent":["import type { JSONSerializer } from '@event-driven-io/dumbo';\nimport { SQL } from '@event-driven-io/dumbo';\nimport { objectEntries, OperatorMap } from '../../../../../core';\n\nexport const handleOperator = (\n path: string,\n operator: string,\n value: unknown,\n serializer: JSONSerializer,\n): SQL => {\n if (path === '_id' || path === '_version') {\n return handleMetadataOperator(path, operator, value);\n }\n\n switch (operator) {\n case '$eq': {\n const jsonPath = buildJsonPath(path);\n\n return SQL`(\n json_extract(data, '${SQL.plain(jsonPath)}') = ${value}\n OR (\n json_type(data, '${SQL.plain(jsonPath)}') = 'array'\n AND EXISTS(\n SELECT 1 FROM json_each(data, '${SQL.plain(jsonPath)}')\n WHERE json_each.value = ${value}\n )\n )\n )`;\n }\n case '$gt':\n case '$gte':\n case '$lt':\n case '$lte':\n case '$ne': {\n const jsonPath = buildJsonPath(path);\n\n return SQL`json_extract(data, '${SQL.plain(jsonPath)}') ${SQL.plain(OperatorMap[operator])} ${value}`;\n }\n case '$in': {\n const jsonPath = buildJsonPath(path);\n const values = value as unknown[];\n const inClause = SQL.merge(\n values.map((v) => SQL`${v}`),\n ', ',\n );\n\n return SQL`json_extract(data, '${SQL.plain(jsonPath)}') IN (${inClause})`;\n }\n case '$nin': {\n const jsonPath = buildJsonPath(path);\n const values = value as unknown[];\n const inClause = SQL.merge(\n values.map((v) => SQL`${v}`),\n ', ',\n );\n\n return SQL`json_extract(data, '${SQL.plain(jsonPath)}') NOT IN (${inClause})`;\n }\n case '$elemMatch': {\n const subConditions = objectEntries(value as Record<string, unknown>)\n .map(([subKey, subValue]) => {\n const serializedValue = serializer.serialize(subValue);\n return `json_extract(value, '$.${subKey}') = json('${serializedValue}')`;\n })\n .join(' AND ');\n\n const jsonPath = buildJsonPath(path);\n return SQL`EXISTS(SELECT 1 FROM json_each(data, '${SQL.plain(jsonPath)}') WHERE ${SQL.plain(subConditions)})`;\n }\n case '$all': {\n const jsonPath = buildJsonPath(path);\n const serializedValue = serializer.serialize(value);\n\n return SQL`(SELECT COUNT(*) FROM json_each(json(${serializedValue})) WHERE json_each.value NOT IN (SELECT value FROM json_each(data, '${SQL.plain(jsonPath)}'))) = 0`;\n }\n case '$size': {\n const jsonPath = buildJsonPath(path);\n\n return SQL`json_array_length(json_extract(data, '${SQL.plain(jsonPath)}')) = ${value}`;\n }\n default:\n throw new Error(`Unsupported operator: ${operator}`);\n }\n};\n\nconst handleMetadataOperator = (\n fieldName: string,\n operator: string,\n value: unknown,\n): SQL => {\n switch (operator) {\n case '$eq':\n return SQL`${SQL.plain(fieldName)} = ${value}`;\n case '$gt':\n case '$gte':\n case '$lt':\n case '$lte':\n case '$ne':\n return SQL`${SQL.plain(fieldName)} ${SQL.plain(OperatorMap[operator])} ${value}`;\n case '$in': {\n const values = value as unknown[];\n const inClause = SQL.merge(\n values.map((v) => SQL`${v}`),\n ', ',\n );\n return SQL`${SQL.plain(fieldName)} IN (${inClause})`;\n }\n case '$nin': {\n const values = value as unknown[];\n const inClause = SQL.merge(\n values.map((v) => SQL`${v}`),\n ', ',\n );\n return SQL`${SQL.plain(fieldName)} NOT IN (${inClause})`;\n }\n default:\n throw new Error(`Unsupported operator: ${operator}`);\n }\n};\n\nconst buildJsonPath = (path: string): string => {\n return `$.${path}`;\n};\n","import type { JSONSerializer } from '@event-driven-io/dumbo';\nimport { SQL } from '@event-driven-io/dumbo';\nimport {\n hasOperators,\n objectEntries,\n QueryOperators,\n type PongoFilter,\n} from '../../../../../core';\nimport { handleOperator } from './queryOperators';\n\nexport * from './queryOperators';\n\nconst AND = 'AND';\nconst OR = 'OR';\n\nconst unsupportedRootOperators = ['$text', '$where', '$comment'] as const;\n\nexport const constructFilterQuery = <T>(\n filter: PongoFilter<T>,\n serializer: JSONSerializer,\n): SQL => {\n ensureSupportedRootOperators(filter);\n const parts: SQL[] = [];\n\n const fieldFilterQuery = constructFieldFilterQuery(filter, serializer);\n if (!SQL.check.isEmpty(fieldFilterQuery)) {\n parts.push(fieldFilterQuery);\n }\n\n const orFilterQuery = constructLogicalFilterQuery(filter.$or, OR, serializer);\n if (!SQL.check.isEmpty(orFilterQuery)) {\n parts.push(orFilterQuery);\n }\n\n const andFilterQuery = constructLogicalFilterQuery(\n filter.$and,\n AND,\n serializer,\n );\n if (!SQL.check.isEmpty(andFilterQuery)) {\n parts.push(andFilterQuery);\n }\n\n const norFilterQuery = constructNorFilterQuery(filter.$nor, serializer);\n if (!SQL.check.isEmpty(norFilterQuery)) {\n parts.push(norFilterQuery);\n }\n\n return SQL.merge(parts, ` ${AND} `);\n};\n\nconst constructFieldFilterQuery = <T>(\n filter: PongoFilter<T>,\n serializer: JSONSerializer,\n): SQL =>\n SQL.merge(\n objectEntries(filter).flatMap(([key, value]) =>\n isLogicalRootOperator(key)\n ? []\n : [\n isRecord(value)\n ? constructComplexFilterQuery(key, value, serializer)\n : handleOperator(key, QueryOperators.$eq, value, serializer),\n ],\n ),\n ` ${AND} `,\n );\n\nconst constructLogicalFilterQuery = <T>(\n filters: PongoFilter<T>[] | undefined,\n joinOperator: typeof AND | typeof OR,\n serializer: JSONSerializer,\n): SQL => {\n if (!filters?.length) {\n return SQL.EMPTY;\n }\n\n const subFilterQueries = filters.reduce<SQL[]>((queries, filter) => {\n const query = constructFilterQuery(filter, serializer);\n if (!SQL.check.isEmpty(query)) {\n queries.push(query);\n }\n\n return queries;\n }, []);\n\n if (subFilterQueries.length === 0) {\n return SQL.EMPTY;\n }\n\n if (subFilterQueries.length === 1) {\n return wrapFilterQuery(subFilterQueries[0]!);\n }\n\n return SQL`(${SQL.merge(subFilterQueries.map(wrapFilterQuery), ` ${joinOperator} `)})`;\n};\n\nconst constructNorFilterQuery = <T>(\n filters: PongoFilter<T>[] | undefined,\n serializer: JSONSerializer,\n): SQL => {\n if (!filters?.length) {\n return SQL.EMPTY;\n }\n\n const logicalFilterQuery = constructLogicalFilterQuery(\n filters,\n OR,\n serializer,\n );\n return SQL.check.isEmpty(logicalFilterQuery)\n ? SQL.EMPTY\n : SQL`NOT ${logicalFilterQuery}`;\n};\n\nconst constructComplexFilterQuery = (\n key: string,\n value: Record<string, unknown>,\n serializer: JSONSerializer,\n): SQL => {\n const isEquality = !hasOperators(value);\n\n return SQL.merge(\n objectEntries(value).map(([nestedKey, val]) =>\n isEquality\n ? handleOperator(\n `${key}.${nestedKey}`,\n QueryOperators.$eq,\n val,\n serializer,\n )\n : handleOperator(key, nestedKey, val, serializer),\n ),\n ` ${AND} `,\n );\n};\n\nconst wrapFilterQuery = (filterQuery: SQL): SQL => SQL`(${filterQuery})`;\n\nconst ensureSupportedRootOperators = (filter: object): void => {\n for (const operator of unsupportedRootOperators) {\n if (operator in filter) {\n throw new Error(`Unsupported root operator: ${operator}`);\n }\n }\n};\n\nconst isLogicalRootOperator = (key: string): key is '$and' | '$nor' | '$or' =>\n key === '$and' || key === '$nor' || key === '$or';\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n","import type { JSONSerializer } from '@event-driven-io/dumbo';\nimport { SQL } from '@event-driven-io/dumbo';\nimport {\n objectEntries,\n type $inc,\n type $push,\n type $set,\n type $unset,\n type PongoUpdate,\n} from '../../../../../core';\n\nexport const buildUpdateQuery = <T>(\n update: PongoUpdate<T>,\n serializer: JSONSerializer,\n): SQL =>\n objectEntries(update).reduce(\n (currentUpdateQuery, [op, value]) => {\n switch (op) {\n case '$set':\n return buildSetQuery(value, currentUpdateQuery, serializer);\n case '$unset':\n return buildUnsetQuery(value, currentUpdateQuery);\n case '$inc':\n return buildIncQuery(value, currentUpdateQuery);\n case '$push':\n return buildPushQuery(value, currentUpdateQuery, serializer);\n default:\n return currentUpdateQuery;\n }\n },\n SQL`data`,\n );\n\nexport const buildSetQuery = <T>(\n set: $set<T>,\n currentUpdateQuery: SQL,\n serializer: JSONSerializer,\n): SQL => SQL`json_patch(${currentUpdateQuery}, ${serializer.serialize(set)})`;\n\nexport const buildUnsetQuery = <T>(\n unset: $unset<T>,\n currentUpdateQuery: SQL,\n): SQL => {\n const keys = Object.keys(unset);\n let query = currentUpdateQuery;\n for (const key of keys) {\n query = SQL`json_remove(${query}, '$.${SQL.plain(key)}')`;\n }\n return query;\n};\n\nexport const buildIncQuery = <T>(\n inc: $inc<T>,\n currentUpdateQuery: SQL,\n): SQL => {\n for (const [key, value] of Object.entries(inc)) {\n currentUpdateQuery =\n typeof value === 'bigint'\n ? SQL`json_set(${currentUpdateQuery}, '$.${SQL.plain(key)}', CAST((COALESCE(json_extract(${currentUpdateQuery}, '$.${SQL.plain(key)}'), 0) + ${value}) AS TEXT))`\n : SQL`json_set(${currentUpdateQuery}, '$.${SQL.plain(key)}', COALESCE(json_extract(${currentUpdateQuery}, '$.${SQL.plain(key)}'), 0) + ${value})`;\n }\n return currentUpdateQuery;\n};\n\nexport const buildPushQuery = <T>(\n push: $push<T>,\n currentUpdateQuery: SQL,\n serializer: JSONSerializer,\n): SQL => {\n for (const [key, value] of Object.entries(push)) {\n const serializedValue = serializer.serialize(value);\n currentUpdateQuery = SQL`json_set(${currentUpdateQuery}, '$.${SQL.plain(key)}', CASE\n WHEN json_type(json_extract(${currentUpdateQuery}, '$.${SQL.plain(key)}')) = 'array'\n THEN json_insert(json_extract(${currentUpdateQuery}, '$.${SQL.plain(key)}'), '$[#]', json(${serializedValue}))\n ELSE json_array(json(${serializedValue}))\n END)`;\n }\n return currentUpdateQuery;\n};\n","import type { JSONSerializer } from '@event-driven-io/dumbo';\nimport { isSQL, SQL, sqlMigration } from '@event-driven-io/dumbo';\nimport {\n expectedVersionPredicate,\n type DeleteOneOptions,\n type ExpectedDocumentVersion,\n type FindOptions,\n type OptionalUnlessRequiredIdAndVersion,\n type PongoCollectionSQLBuilder,\n type PongoFilter,\n type PongoUpdate,\n type ReplaceOneOptions,\n type UpdateOneOptions,\n type WithId,\n type WithIdAndVersion,\n type WithoutId,\n} from '../../../../core';\nimport { constructFilterQuery } from './filter';\nimport { buildUpdateQuery } from './update';\n\nconst versionCheckClause = (\n expectedVersion: ExpectedDocumentVersion | undefined,\n): SQL => {\n const predicate = expectedVersionPredicate(expectedVersion);\n return predicate.operator === 'none'\n ? SQL.EMPTY\n : SQL`AND _version = ${predicate.value}`;\n};\n\nconst createCollection = (collectionName: string): SQL =>\n SQL`\n CREATE TABLE IF NOT EXISTS ${SQL.identifier(collectionName)} (\n _id TEXT PRIMARY KEY,\n data JSON NOT NULL,\n metadata JSON NOT NULL DEFAULT '{}',\n _version INTEGER NOT NULL DEFAULT 1,\n _partition TEXT NOT NULL DEFAULT 'png_global',\n _archived INTEGER NOT NULL DEFAULT 0,\n _created TEXT NOT NULL DEFAULT (datetime('now')),\n _updated TEXT NOT NULL DEFAULT (datetime('now'))\n )`;\n\nexport const pongoCollectionSQLiteMigrations = (collectionName: string) => [\n sqlMigration(`pongoCollection:${collectionName}:001:createtable`, [\n createCollection(collectionName),\n ]),\n];\n\nexport const sqliteSQLBuilder = (\n collectionName: string,\n serializer: JSONSerializer,\n): PongoCollectionSQLBuilder => ({\n createCollection: (): SQL => createCollection(collectionName),\n insertOne: <T>(document: OptionalUnlessRequiredIdAndVersion<T>): SQL => {\n const serialized = document;\n const id = document._id;\n const version = document._version ?? 1n;\n\n return SQL`\n INSERT OR IGNORE INTO ${SQL.identifier(collectionName)} (_id, data, _version)\n VALUES (${id}, ${serialized}, ${version})\n RETURNING _id;`;\n },\n insertMany: <T>(documents: OptionalUnlessRequiredIdAndVersion<T>[]): SQL => {\n const values = SQL.merge(\n documents.map(\n (doc) =>\n SQL`(${doc._id}, ${serializer.serialize(doc)}, ${doc._version ?? 1n})`,\n ),\n ',',\n );\n\n return SQL`\n INSERT OR IGNORE INTO ${SQL.identifier(collectionName)} (_id, data, _version) VALUES ${values}\n RETURNING _id;`;\n },\n insertOrReplace: <T>(documents: Array<WithId<T>>): SQL => {\n const col = SQL.identifier(collectionName);\n const values = SQL.merge(\n documents.map(\n (d) =>\n SQL`(${d._id}, json_patch(${serializer.serialize(d)}, json_object('_id', ${d._id}, '_version', '1')), 1)`,\n ),\n ',',\n );\n\n return SQL`\n INSERT INTO ${col} (_id, data, _version)\n VALUES ${values}\n ON CONFLICT(_id) DO UPDATE SET\n data = json_patch(excluded.data, json_object('_id', ${col}._id, '_version', cast(${col}._version + 1 as TEXT))),\n _version = ${col}._version + 1\n RETURNING _id, cast(_version as TEXT) as version;`;\n },\n updateOne: <T>(\n filter: PongoFilter<T> | SQL,\n update: PongoUpdate<T> | SQL,\n options?: UpdateOneOptions,\n ): SQL => {\n const expectedVersionCheck = versionCheckClause(options?.expectedVersion);\n\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n const updateQuery = isSQL(update)\n ? update\n : buildUpdateQuery(update, serializer);\n\n return SQL`\n UPDATE ${SQL.identifier(collectionName)}\n SET\n data = json_patch(${updateQuery}, json_object('_id', _id, '_version', cast(_version + 1 as TEXT))),\n _version = _version + 1,\n _updated = datetime('now')\n WHERE _id = (\n SELECT _id FROM ${SQL.identifier(collectionName)}\n ${where(filterQuery)}\n LIMIT 1\n ) ${expectedVersionCheck}\n RETURNING\n _id,\n cast(_version as TEXT) as version,\n 1 as matched,\n 1 as modified;`;\n },\n replaceOne: <T>(\n filter: PongoFilter<T> | SQL,\n document: WithoutId<T>,\n options?: ReplaceOneOptions,\n ): SQL => {\n const expectedVersionCheck = versionCheckClause(options?.expectedVersion);\n\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n\n return SQL`\n UPDATE ${SQL.identifier(collectionName)}\n SET\n data = json_patch(${serializer.serialize(document)}, json_object('_id', _id, '_version', cast(_version + 1 as TEXT))),\n _version = _version + 1,\n _updated = datetime('now')\n WHERE _id = (\n SELECT _id FROM ${SQL.identifier(collectionName)}\n ${where(filterQuery)}\n LIMIT 1\n ) ${expectedVersionCheck}\n RETURNING\n _id,\n cast(_version as TEXT) AS version,\n 1 AS matched,\n 1 AS modified;`;\n },\n updateMany: <T>(\n filter: PongoFilter<T> | SQL,\n update: PongoUpdate<T> | SQL,\n ): SQL => {\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n const updateQuery = isSQL(update)\n ? update\n : buildUpdateQuery(update, serializer);\n\n return SQL`\n UPDATE ${SQL.identifier(collectionName)}\n SET\n data = json_patch(${updateQuery}, json_object('_version', cast(_version + 1 as TEXT))),\n _version = _version + 1,\n _updated = datetime('now')\n ${where(filterQuery)}\n RETURNING _id;`;\n },\n deleteOne: <T>(\n filter: PongoFilter<T> | SQL,\n options?: DeleteOneOptions,\n ): SQL => {\n const expectedVersionCheck = versionCheckClause(options?.expectedVersion);\n\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n\n return SQL`\n DELETE FROM ${SQL.identifier(collectionName)}\n WHERE _id = (\n SELECT _id FROM ${SQL.identifier(collectionName)}\n ${where(filterQuery)}\n LIMIT 1\n ) ${expectedVersionCheck}\n RETURNING\n _id,\n 1 AS matched,\n 1 AS deleted;`;\n },\n deleteMany: <T>(filter: PongoFilter<T> | SQL): SQL => {\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n\n return SQL`DELETE FROM ${SQL.identifier(collectionName)} ${where(filterQuery)} RETURNING _id`;\n },\n replaceMany: <T>(\n documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>,\n ): SQL => {\n const col = SQL.identifier(collectionName);\n const hasVersions = documents.some(\n (d) => '_version' in d && d._version !== undefined,\n );\n\n if (hasVersions) {\n const values = SQL.merge(\n documents.map((d) => {\n const expectedVersion = (d as WithIdAndVersion<T>)._version;\n return expectedVersion !== undefined\n ? SQL`(${d._id}, ${serializer.serialize(d)}, ${expectedVersion})`\n : SQL`(${d._id}, ${serializer.serialize(d)}, NULL)`;\n }),\n ',',\n );\n return SQL`\n WITH replacements(_id, data, expected_version) AS (\n VALUES ${values}\n )\n UPDATE ${col}\n SET\n data = json_patch(r.data, json_object('_id', ${col}._id, '_version', cast(${col}._version + 1 as TEXT))),\n _version = ${col}._version + 1,\n _updated = datetime('now')\n FROM replacements r\n WHERE ${col}._id = r._id AND (r.expected_version IS NULL OR ${col}._version = r.expected_version)\n RETURNING ${col}._id, cast(${col}._version as TEXT) as version;`;\n }\n\n const values = SQL.merge(\n documents.map((d) => SQL`(${d._id}, ${serializer.serialize(d)})`),\n ',',\n );\n return SQL`\n WITH replacements(_id, data) AS (\n VALUES ${values}\n )\n UPDATE ${col}\n SET\n data = json_patch(r.data, json_object('_id', ${col}._id, '_version', cast(${col}._version + 1 as TEXT))),\n _version = ${col}._version + 1,\n _updated = datetime('now')\n FROM replacements r\n WHERE ${col}._id = r._id\n RETURNING ${col}._id, cast(${col}._version as TEXT) as version;`;\n },\n deleteManyByIds: (ids: Array<{ _id: string; _version?: bigint }>): SQL => {\n const hasVersions = ids.some((d) => d._version !== undefined);\n\n if (hasVersions) {\n const values = SQL.merge(\n ids.map((d) => SQL`(${d._id}, ${d._version ?? 0n})`),\n ',',\n );\n\n return SQL`\n WITH targets(_id, expected_version) AS (\n VALUES ${values}\n )\n DELETE FROM ${SQL.identifier(collectionName)}\n WHERE _id IN (SELECT _id FROM targets)\n AND _version = (SELECT expected_version FROM targets WHERE targets._id = ${SQL.identifier(collectionName)}._id)\n RETURNING _id;`;\n }\n\n const idList = SQL.merge(\n ids.map((d) => SQL`${d._id}`),\n ',',\n );\n\n return SQL`\n DELETE FROM ${SQL.identifier(collectionName)}\n WHERE _id IN (${idList})\n RETURNING _id;`;\n },\n findOne: <T>(filter: PongoFilter<T> | SQL): SQL => {\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n\n return SQL`SELECT data, _id, _version FROM ${SQL.identifier(collectionName)} ${where(filterQuery)} LIMIT 1;`;\n },\n find: <T>(filter: PongoFilter<T> | SQL, options?: FindOptions): SQL => {\n const filterQuery = isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n const query: SQL[] = [];\n\n query.push(\n SQL`SELECT data, _id, _version FROM ${SQL.identifier(collectionName)}`,\n );\n\n query.push(where(filterQuery));\n\n if (options?.sort && Object.keys(options.sort).length > 0) {\n const clauses = Object.entries(options.sort).map(([field, dir]) => {\n // _id and _version are native columns, not JSON fields.\n const isMetadata = field === '_id' || field === '_version';\n const accessor = isMetadata\n ? SQL`${SQL.plain(field)}`\n : SQL`json_extract(data, '${SQL.plain(`$.${field}`)}')`;\n return dir === 1 ? SQL`${accessor} ASC` : SQL`${accessor} DESC`;\n });\n query.push(SQL`ORDER BY ${SQL.merge(clauses, ',')}`);\n }\n\n if (options?.limit) {\n query.push(SQL`LIMIT ${options.limit}`);\n }\n\n if (options?.skip) {\n query.push(SQL`OFFSET ${options.skip}`);\n }\n\n return SQL.merge([...query, SQL`;`]);\n },\n countDocuments: <T>(filter: PongoFilter<T> | SQL): SQL => {\n const filterQuery = SQL.check.isSQL(filter)\n ? filter\n : constructFilterQuery(filter, serializer);\n return SQL`SELECT COUNT(1) as count FROM ${SQL.identifier(collectionName)} ${where(filterQuery)};`;\n },\n rename: (newName: string): SQL =>\n SQL`ALTER TABLE ${SQL.identifier(collectionName)} RENAME TO ${SQL.identifier(newName)};`,\n drop: (targetName: string = collectionName): SQL =>\n SQL`DROP TABLE IF EXISTS ${SQL.identifier(targetName)}`,\n});\n\nconst where = (filterQuery: SQL): SQL =>\n SQL.check.isEmpty(filterQuery)\n ? SQL.EMPTY\n : SQL.merge([SQL`WHERE `, filterQuery]);\n"],"mappings":";;;;;AAIA,MAAa,kBACX,MACA,UACA,OACA,eACQ;AACR,KAAI,SAAS,SAAS,SAAS,WAC7B,QAAO,uBAAuB,MAAM,UAAU,MAAM;AAGtD,SAAQ,UAAR;EACE,KAAK,OAAO;GACV,MAAM,WAAW,cAAc,KAAK;AAEpC,UAAO,0BAAG;8BACcA,2BAAI,MAAM,SAAS,CAAC,OAAO,MAAM;;6BAElCA,2BAAI,MAAM,SAAS,CAAC;;6CAEJA,2BAAI,MAAM,SAAS,CAAC;sCAC3B,MAAM;;;;;EAKxC,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,OAAO;GACV,MAAM,WAAW,cAAc,KAAK;AAEpC,UAAO,0BAAG,uBAAuBA,2BAAI,MAAM,SAAS,CAAC,KAAKA,2BAAI,MAAMC,yBAAY,UAAU,CAAC,GAAG;;EAEhG,KAAK,OAAO;GACV,MAAM,WAAW,cAAc,KAAK;GACpC,MAAM,SAAS;GACf,MAAM,WAAWD,2BAAI,MACnB,OAAO,KAAK,MAAM,0BAAG,GAAG,IAAI,EAC5B,KACD;AAED,UAAO,0BAAG,uBAAuBA,2BAAI,MAAM,SAAS,CAAC,SAAS,SAAS;;EAEzE,KAAK,QAAQ;GACX,MAAM,WAAW,cAAc,KAAK;GACpC,MAAM,SAAS;GACf,MAAM,WAAWA,2BAAI,MACnB,OAAO,KAAK,MAAM,0BAAG,GAAG,IAAI,EAC5B,KACD;AAED,UAAO,0BAAG,uBAAuBA,2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 +1,5 @@
|
|
|
1
|
-
import { LRUCache } from "lru-cache";
|
|
2
1
|
import { AnyConnection, DatabaseDriverType, DatabaseTransaction, Dumbo, JSONSerializationOptions, JSONSerializer, MigrationStyle, QueryResult, QueryResultRow, RunSQLMigrationsResult, SQL, SQLCommandOptions, SQLExecutor, SQLQueryOptions, SchemaComponent, SchemaComponentOptions, WithDatabaseTransactionFactory } from "@event-driven-io/dumbo";
|
|
2
|
+
import { LRUCache } from "lru-cache";
|
|
3
3
|
|
|
4
4
|
//#region src/core/typing/entries.d.ts
|
|
5
5
|
type Entry<T> = { [K in keyof Required<T>]: [K, Required<T>[K]] }[keyof Required<T>];
|
|
@@ -78,12 +78,13 @@ type PongoCollectionSQLBuilder = {
|
|
|
78
78
|
createCollection: () => SQL;
|
|
79
79
|
insertOne: <T>(document: OptionalUnlessRequiredIdAndVersion<T>) => SQL;
|
|
80
80
|
insertMany: <T>(documents: OptionalUnlessRequiredIdAndVersion<T>[]) => SQL;
|
|
81
|
+
insertOrReplace: <T>(documents: Array<WithId<T>>) => SQL;
|
|
81
82
|
updateOne: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions) => SQL;
|
|
82
83
|
replaceOne: <T>(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions) => SQL;
|
|
83
84
|
updateMany: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL) => SQL;
|
|
84
85
|
deleteOne: <T>(filter: PongoFilter<T> | SQL, options?: DeleteOneOptions) => SQL;
|
|
85
86
|
deleteMany: <T>(filter: PongoFilter<T> | SQL) => SQL;
|
|
86
|
-
replaceMany: <T>(documents: Array<WithIdAndVersion<T
|
|
87
|
+
replaceMany: <T>(documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>) => SQL;
|
|
87
88
|
deleteManyByIds: (ids: Array<{
|
|
88
89
|
_id: string;
|
|
89
90
|
_version?: bigint;
|
|
@@ -343,9 +344,11 @@ type CollectionOperationOptions = {
|
|
|
343
344
|
};
|
|
344
345
|
type InsertOneOptions = {
|
|
345
346
|
expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
|
|
347
|
+
upsert?: boolean;
|
|
346
348
|
} & CollectionOperationOptions;
|
|
347
349
|
type InsertManyOptions = {
|
|
348
350
|
expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
|
|
351
|
+
upsert?: boolean;
|
|
349
352
|
} & CollectionOperationOptions;
|
|
350
353
|
type UpdateOneOptions = {
|
|
351
354
|
expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
|
|
@@ -359,11 +362,14 @@ type BatchHandleOptions = {
|
|
|
359
362
|
} & CollectionOperationOptions;
|
|
360
363
|
type ReplaceOneOptions = {
|
|
361
364
|
expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
|
|
365
|
+
upsert?: boolean;
|
|
362
366
|
} & CollectionOperationOptions;
|
|
363
367
|
type DeleteOneOptions = {
|
|
364
368
|
expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
|
|
365
369
|
} & CollectionOperationOptions;
|
|
366
|
-
type ReplaceManyOptions =
|
|
370
|
+
type ReplaceManyOptions = {
|
|
371
|
+
upsert?: boolean;
|
|
372
|
+
} & CollectionOperationOptions;
|
|
367
373
|
type DeleteManyOptions = {
|
|
368
374
|
expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
|
|
369
375
|
} & CollectionOperationOptions;
|
|
@@ -379,7 +385,7 @@ interface PongoCollection<T extends PongoDocument> {
|
|
|
379
385
|
readonly collectionName: string;
|
|
380
386
|
createCollection(options?: CollectionOperationOptions): Promise<void>;
|
|
381
387
|
insertOne(document: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<PongoInsertOneResult>;
|
|
382
|
-
insertMany(documents: OptionalUnlessRequiredId<T>[], options?:
|
|
388
|
+
insertMany(documents: OptionalUnlessRequiredId<T>[], options?: InsertManyOptions): Promise<PongoInsertManyResult>;
|
|
383
389
|
updateOne(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions): Promise<PongoUpdateResult>;
|
|
384
390
|
replaceOne(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions): Promise<PongoUpdateResult>;
|
|
385
391
|
updateMany(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateManyOptions): Promise<PongoUpdateManyResult>;
|
|
@@ -395,7 +401,7 @@ interface PongoCollection<T extends PongoDocument> {
|
|
|
395
401
|
rename(newName: string, options?: CollectionOperationOptions): Promise<PongoCollection<T>>;
|
|
396
402
|
handle(id: string | DocumentCommandHandlerInput, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
|
|
397
403
|
handle(id: string[] | DocumentCommandHandlerInput[], handle: DocumentHandler<T>, options?: BatchHandleOptions): Promise<PongoHandleResult<T>[]>;
|
|
398
|
-
replaceMany(documents: Array<
|
|
404
|
+
replaceMany(documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>, options?: ReplaceManyOptions): Promise<PongoReplaceManyResult>;
|
|
399
405
|
readonly schema: Readonly<{
|
|
400
406
|
component: PongoCollectionSchemaComponent;
|
|
401
407
|
migrate(options?: PongoMigrationOptions): Promise<RunSQLMigrationsResult>;
|
|
@@ -454,7 +460,6 @@ declare interface ObjectIdLike {
|
|
|
454
460
|
declare type NonObjectIdLikeDocument = { [key in keyof ObjectIdLike]?: never } & Document;
|
|
455
461
|
declare type AlternativeType<T> = T extends ReadonlyArray<infer U> ? T | RegExpOrString<U> : RegExpOrString<T>;
|
|
456
462
|
declare type Condition<T> = AlternativeType<T> | PongoFilterOperator<AlternativeType<T>>;
|
|
457
|
-
declare type PongoFilter<TSchema> = { [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]> } | HasId;
|
|
458
463
|
declare interface RootFilterOperators<TSchema> extends Document {
|
|
459
464
|
$and?: PongoFilter<TSchema>[];
|
|
460
465
|
$nor?: PongoFilter<TSchema>[];
|
|
@@ -468,6 +473,7 @@ declare interface RootFilterOperators<TSchema> extends Document {
|
|
|
468
473
|
$where?: string | ((this: TSchema) => boolean);
|
|
469
474
|
$comment?: string | Document;
|
|
470
475
|
}
|
|
476
|
+
declare type PongoFilter<TSchema> = ({ [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]> } & Pick<RootFilterOperators<WithId<TSchema>>, '$and' | '$nor' | '$or'>) | (HasId & Pick<RootFilterOperators<WithId<TSchema>>, '$and' | '$nor' | '$or'>);
|
|
471
477
|
declare interface PongoFilterOperator<TValue> extends NonObjectIdLikeDocument {
|
|
472
478
|
$eq?: TValue;
|
|
473
479
|
$gt?: TValue;
|
|
@@ -494,6 +500,13 @@ declare const DOCUMENT_DOES_NOT_EXIST: ExpectedDocumentVersionGeneral;
|
|
|
494
500
|
declare const NO_CONCURRENCY_CHECK: ExpectedDocumentVersionGeneral;
|
|
495
501
|
declare const isGeneralExpectedDocumentVersion: (version: ExpectedDocumentVersion) => version is ExpectedDocumentVersionGeneral;
|
|
496
502
|
declare const expectedVersionValue: (version: ExpectedDocumentVersion | undefined) => ExpectedDocumentVersionValue | null;
|
|
503
|
+
type ExpectedVersionPredicate = {
|
|
504
|
+
operator: 'none';
|
|
505
|
+
} | {
|
|
506
|
+
operator: '=';
|
|
507
|
+
value: bigint;
|
|
508
|
+
};
|
|
509
|
+
declare const expectedVersionPredicate: (version: ExpectedDocumentVersion | undefined) => ExpectedVersionPredicate;
|
|
497
510
|
declare const expectedVersion: (version: number | bigint | string | undefined | null) => ExpectedDocumentVersion;
|
|
498
511
|
type PongoUpdate<T> = {
|
|
499
512
|
$set?: Partial<T>;
|
|
@@ -525,6 +538,8 @@ interface PongoInsertManyResult extends OperationResult {
|
|
|
525
538
|
interface PongoUpdateResult extends OperationResult {
|
|
526
539
|
matchedCount: number;
|
|
527
540
|
modifiedCount: number;
|
|
541
|
+
upsertedId: string | null;
|
|
542
|
+
upsertedCount: number;
|
|
528
543
|
nextExpectedVersion: bigint;
|
|
529
544
|
}
|
|
530
545
|
interface PongoUpdateManyResult extends OperationResult {
|
|
@@ -701,5 +716,5 @@ declare const pongoSession: (options?: PongoSessionOptions) => PongoSession;
|
|
|
701
716
|
//#region src/core/pongoTransaction.d.ts
|
|
702
717
|
declare const pongoTransaction: (options: PongoTransactionOptions) => PongoDbTransaction;
|
|
703
718
|
//#endregion
|
|
704
|
-
export {
|
|
705
|
-
//# sourceMappingURL=index-
|
|
719
|
+
export { HasId as $, AnyPongoDriverOptions as $t, MaybePromise as A, hasOperators as An, PongoSession as At, DOCUMENT_DOES_NOT_EXIST as B, DocumentCommandHandler as Bn, UpdateOneOptions as Bt, PongoCacheType as C, pongoSchema as Cn, PongoFilter as Ct, LRUCacheOptions as D, toDbSchemaMetadata as Dn, PongoInsertOneResult as Dt, noopCacheProvider as E, toClientSchemaMetadata as En, PongoInsertManyResult as Et, AlternativeType as F, PongoCollectionURNType as Fn, RegExpOrString as Ft, DocumentHandler as G, NonPartial as Gn, WithoutIdAndVersion as Gt, DeleteManyOptions as H, DocumentCommandHandlerOptions as Hn, WithIdAndVersion as Ht, AnyPongoDb as I, PongoCollectionSQLBuilder as In, ReplaceManyOptions as It, ExpectedDocumentVersionGeneral as J, expectedVersionPredicate as Jt, EnhancedOmit as K, objectEntries as Kn, WithoutVersion as Kt, BatchHandleOptions as L, PongoCollectionOptions as Ln, ReplaceOneOptions as Lt, $push as M, PongoCollectionSchemaComponent as Mn, PongoUpdate as Mt, $set as N, PongoCollectionSchemaComponentOptions as Nn, PongoUpdateManyResult as Nt, lruCache as O, OperatorMap as On, PongoMigrationOptions as Ot, $unset as P, PongoCollectionURN as Pn, PongoUpdateResult as Pt, HandleOptions as Q, AnyPongoDriver as Qt, CollectionOperationOptions as R, pongoCollection as Rn, RootFilterOperators as Rt, PongoCacheSetEntry as S, PongoSchemaConfig as Sn, PongoDocument as St, pongoCache as T, proxyPongoDbWithSchema as Tn, PongoHandleResult as Tt, DeleteOneOptions as U, getIdsFromIdOnlyFilter as Un, WithVersion as Ut, DOCUMENT_EXISTS as V, DocumentCommandHandlerInput as Vn, WithId as Vt, Document as W, idFromFilter as Wn, WithoutId as Wt, ExpectedVersionPredicate as X, isGeneralExpectedDocumentVersion as Xt, ExpectedDocumentVersionValue as Y, expectedVersionValue as Yt, FindOptions as Z, operationResult as Zt, CacheHooks as _, PongoCollectionSchema as _n, PongoDb as _t, ConcurrencyError as a, PongoDriverRegistry as an, ObjectId as at, CacheType as b, PongoDbSchemaMetadata as bn, PongoDeleteManyResult as bt, isString as c, PongoDatabaseSchemaComponent as cn, OptionalId as ct, PongoDatabaseCache as d, PongoDatabaseURNType as dn, OptionalUnlessRequiredVersion as dt, ExtractPongoDatabaseTypeFromDriver as en, InferIdType as et, PongoTransactionCache as f, CollectionsMap as fn, OptionalVersion as ft, CacheConfig as g, PongoClientWithSchema as gn, PongoDBCollectionOptions as gt, pongoCacheWrapper as h, PongoClientSchemaMetadata as hn, PongoCollection as ht, pongoClient as i, PongoDriverOptions as in, NonObjectIdLikeDocument as it, $inc as j, isOperator as jn, PongoTransactionOptions as jt, identityMapCache as k, QueryOperators as kn, PongoReplaceManyResult as kt, PongoDatabase as l, PongoDatabaseSchemaComponentOptions as ln, OptionalUnlessRequiredId as lt, pongoTransactionCache as m, PongoClientSchema as mn, PongoClientOptions as mt, PongoSessionOptions as n, PongoDatabaseFactoryOptions as nn, InsertOneOptions as nt, PongoError as o, pongoDriverRegistry as on, ObjectIdLike as ot, PongoTransactionCacheOperationOptions as p, DBsMap as pn, PongoClient as pt, ExpectedDocumentVersion as q, expectedVersion as qt, pongoSession as r, PongoDriver as rn, NO_CONCURRENCY_CHECK as rt, isNumber as s, PongoDatabaseSQLBuilder as sn, OperationResult as st, pongoTransaction as t, ExtractPongoDriverOptions as tn, InsertManyOptions as tt, PongoDatabaseOptions as u, PongoDatabaseURN as un, OptionalUnlessRequiredIdAndVersion as ut, CacheOptions as v, PongoCollectionSchemaMetadata as vn, PongoDbOptions as vt, PongoDocumentCacheKey as w, proxyClientWithSchema as wn, PongoFilterOperator as wt, PongoCache as x, PongoDbWithSchema as xn, PongoDeleteResult as xt, CacheSettings as y, PongoDbSchema as yn, PongoDbTransaction as yt, Condition as z, transactionExecutorOrDefault as zn, UpdateManyOptions as zt };
|
|
720
|
+
//# sourceMappingURL=index-C3pnS1S_.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { In as PongoCollectionSQLBuilder } from "./index-r7V4paf_.js";
|
|
2
2
|
import * as _$_event_driven_io_dumbo0 from "@event-driven-io/dumbo";
|
|
3
3
|
import { JSONSerializer } from "@event-driven-io/dumbo";
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ declare const pongoCollectionSQLiteMigrations: (collectionName: string) => _$_ev
|
|
|
7
7
|
declare const sqliteSQLBuilder: (collectionName: string, serializer: JSONSerializer) => PongoCollectionSQLBuilder;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { sqliteSQLBuilder as n, pongoCollectionSQLiteMigrations as t };
|
|
10
|
-
//# sourceMappingURL=index-
|
|
10
|
+
//# sourceMappingURL=index-CZOmOsQt.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { In as PongoCollectionSQLBuilder } from "./index-C3pnS1S_.cjs";
|
|
2
2
|
import * as _$_event_driven_io_dumbo0 from "@event-driven-io/dumbo";
|
|
3
3
|
import { JSONSerializer } from "@event-driven-io/dumbo";
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ declare const pongoCollectionSQLiteMigrations: (collectionName: string) => _$_ev
|
|
|
7
7
|
declare const sqliteSQLBuilder: (collectionName: string, serializer: JSONSerializer) => PongoCollectionSQLBuilder;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { sqliteSQLBuilder as n, pongoCollectionSQLiteMigrations as t };
|
|
10
|
-
//# sourceMappingURL=index-
|
|
10
|
+
//# sourceMappingURL=index-FXnldVnn.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnyConnection, DatabaseDriverType, DatabaseTransaction, Dumbo, JSONSerializationOptions, JSONSerializer, MigrationStyle, QueryResult, QueryResultRow, RunSQLMigrationsResult, SQL, SQLCommandOptions, SQLExecutor, SQLQueryOptions, SchemaComponent, SchemaComponentOptions, WithDatabaseTransactionFactory } from "@event-driven-io/dumbo";
|
|
2
1
|
import { LRUCache } from "lru-cache";
|
|
2
|
+
import { AnyConnection, DatabaseDriverType, DatabaseTransaction, Dumbo, JSONSerializationOptions, JSONSerializer, MigrationStyle, QueryResult, QueryResultRow, RunSQLMigrationsResult, SQL, SQLCommandOptions, SQLExecutor, SQLQueryOptions, SchemaComponent, SchemaComponentOptions, WithDatabaseTransactionFactory } from "@event-driven-io/dumbo";
|
|
3
3
|
|
|
4
4
|
//#region src/core/typing/entries.d.ts
|
|
5
5
|
type Entry<T> = { [K in keyof Required<T>]: [K, Required<T>[K]] }[keyof Required<T>];
|
|
@@ -78,12 +78,13 @@ type PongoCollectionSQLBuilder = {
|
|
|
78
78
|
createCollection: () => SQL;
|
|
79
79
|
insertOne: <T>(document: OptionalUnlessRequiredIdAndVersion<T>) => SQL;
|
|
80
80
|
insertMany: <T>(documents: OptionalUnlessRequiredIdAndVersion<T>[]) => SQL;
|
|
81
|
+
insertOrReplace: <T>(documents: Array<WithId<T>>) => SQL;
|
|
81
82
|
updateOne: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions) => SQL;
|
|
82
83
|
replaceOne: <T>(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions) => SQL;
|
|
83
84
|
updateMany: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL) => SQL;
|
|
84
85
|
deleteOne: <T>(filter: PongoFilter<T> | SQL, options?: DeleteOneOptions) => SQL;
|
|
85
86
|
deleteMany: <T>(filter: PongoFilter<T> | SQL) => SQL;
|
|
86
|
-
replaceMany: <T>(documents: Array<WithIdAndVersion<T
|
|
87
|
+
replaceMany: <T>(documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>) => SQL;
|
|
87
88
|
deleteManyByIds: (ids: Array<{
|
|
88
89
|
_id: string;
|
|
89
90
|
_version?: bigint;
|
|
@@ -343,9 +344,11 @@ type CollectionOperationOptions = {
|
|
|
343
344
|
};
|
|
344
345
|
type InsertOneOptions = {
|
|
345
346
|
expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
|
|
347
|
+
upsert?: boolean;
|
|
346
348
|
} & CollectionOperationOptions;
|
|
347
349
|
type InsertManyOptions = {
|
|
348
350
|
expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
|
|
351
|
+
upsert?: boolean;
|
|
349
352
|
} & CollectionOperationOptions;
|
|
350
353
|
type UpdateOneOptions = {
|
|
351
354
|
expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
|
|
@@ -359,11 +362,14 @@ type BatchHandleOptions = {
|
|
|
359
362
|
} & CollectionOperationOptions;
|
|
360
363
|
type ReplaceOneOptions = {
|
|
361
364
|
expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
|
|
365
|
+
upsert?: boolean;
|
|
362
366
|
} & CollectionOperationOptions;
|
|
363
367
|
type DeleteOneOptions = {
|
|
364
368
|
expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
|
|
365
369
|
} & CollectionOperationOptions;
|
|
366
|
-
type ReplaceManyOptions =
|
|
370
|
+
type ReplaceManyOptions = {
|
|
371
|
+
upsert?: boolean;
|
|
372
|
+
} & CollectionOperationOptions;
|
|
367
373
|
type DeleteManyOptions = {
|
|
368
374
|
expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
|
|
369
375
|
} & CollectionOperationOptions;
|
|
@@ -379,7 +385,7 @@ interface PongoCollection<T extends PongoDocument> {
|
|
|
379
385
|
readonly collectionName: string;
|
|
380
386
|
createCollection(options?: CollectionOperationOptions): Promise<void>;
|
|
381
387
|
insertOne(document: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<PongoInsertOneResult>;
|
|
382
|
-
insertMany(documents: OptionalUnlessRequiredId<T>[], options?:
|
|
388
|
+
insertMany(documents: OptionalUnlessRequiredId<T>[], options?: InsertManyOptions): Promise<PongoInsertManyResult>;
|
|
383
389
|
updateOne(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions): Promise<PongoUpdateResult>;
|
|
384
390
|
replaceOne(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions): Promise<PongoUpdateResult>;
|
|
385
391
|
updateMany(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateManyOptions): Promise<PongoUpdateManyResult>;
|
|
@@ -395,7 +401,7 @@ interface PongoCollection<T extends PongoDocument> {
|
|
|
395
401
|
rename(newName: string, options?: CollectionOperationOptions): Promise<PongoCollection<T>>;
|
|
396
402
|
handle(id: string | DocumentCommandHandlerInput, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
|
|
397
403
|
handle(id: string[] | DocumentCommandHandlerInput[], handle: DocumentHandler<T>, options?: BatchHandleOptions): Promise<PongoHandleResult<T>[]>;
|
|
398
|
-
replaceMany(documents: Array<
|
|
404
|
+
replaceMany(documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>, options?: ReplaceManyOptions): Promise<PongoReplaceManyResult>;
|
|
399
405
|
readonly schema: Readonly<{
|
|
400
406
|
component: PongoCollectionSchemaComponent;
|
|
401
407
|
migrate(options?: PongoMigrationOptions): Promise<RunSQLMigrationsResult>;
|
|
@@ -454,7 +460,6 @@ declare interface ObjectIdLike {
|
|
|
454
460
|
declare type NonObjectIdLikeDocument = { [key in keyof ObjectIdLike]?: never } & Document;
|
|
455
461
|
declare type AlternativeType<T> = T extends ReadonlyArray<infer U> ? T | RegExpOrString<U> : RegExpOrString<T>;
|
|
456
462
|
declare type Condition<T> = AlternativeType<T> | PongoFilterOperator<AlternativeType<T>>;
|
|
457
|
-
declare type PongoFilter<TSchema> = { [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]> } | HasId;
|
|
458
463
|
declare interface RootFilterOperators<TSchema> extends Document {
|
|
459
464
|
$and?: PongoFilter<TSchema>[];
|
|
460
465
|
$nor?: PongoFilter<TSchema>[];
|
|
@@ -468,6 +473,7 @@ declare interface RootFilterOperators<TSchema> extends Document {
|
|
|
468
473
|
$where?: string | ((this: TSchema) => boolean);
|
|
469
474
|
$comment?: string | Document;
|
|
470
475
|
}
|
|
476
|
+
declare type PongoFilter<TSchema> = ({ [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]> } & Pick<RootFilterOperators<WithId<TSchema>>, '$and' | '$nor' | '$or'>) | (HasId & Pick<RootFilterOperators<WithId<TSchema>>, '$and' | '$nor' | '$or'>);
|
|
471
477
|
declare interface PongoFilterOperator<TValue> extends NonObjectIdLikeDocument {
|
|
472
478
|
$eq?: TValue;
|
|
473
479
|
$gt?: TValue;
|
|
@@ -494,6 +500,13 @@ declare const DOCUMENT_DOES_NOT_EXIST: ExpectedDocumentVersionGeneral;
|
|
|
494
500
|
declare const NO_CONCURRENCY_CHECK: ExpectedDocumentVersionGeneral;
|
|
495
501
|
declare const isGeneralExpectedDocumentVersion: (version: ExpectedDocumentVersion) => version is ExpectedDocumentVersionGeneral;
|
|
496
502
|
declare const expectedVersionValue: (version: ExpectedDocumentVersion | undefined) => ExpectedDocumentVersionValue | null;
|
|
503
|
+
type ExpectedVersionPredicate = {
|
|
504
|
+
operator: 'none';
|
|
505
|
+
} | {
|
|
506
|
+
operator: '=';
|
|
507
|
+
value: bigint;
|
|
508
|
+
};
|
|
509
|
+
declare const expectedVersionPredicate: (version: ExpectedDocumentVersion | undefined) => ExpectedVersionPredicate;
|
|
497
510
|
declare const expectedVersion: (version: number | bigint | string | undefined | null) => ExpectedDocumentVersion;
|
|
498
511
|
type PongoUpdate<T> = {
|
|
499
512
|
$set?: Partial<T>;
|
|
@@ -525,6 +538,8 @@ interface PongoInsertManyResult extends OperationResult {
|
|
|
525
538
|
interface PongoUpdateResult extends OperationResult {
|
|
526
539
|
matchedCount: number;
|
|
527
540
|
modifiedCount: number;
|
|
541
|
+
upsertedId: string | null;
|
|
542
|
+
upsertedCount: number;
|
|
528
543
|
nextExpectedVersion: bigint;
|
|
529
544
|
}
|
|
530
545
|
interface PongoUpdateManyResult extends OperationResult {
|
|
@@ -701,5 +716,5 @@ declare const pongoSession: (options?: PongoSessionOptions) => PongoSession;
|
|
|
701
716
|
//#region src/core/pongoTransaction.d.ts
|
|
702
717
|
declare const pongoTransaction: (options: PongoTransactionOptions) => PongoDbTransaction;
|
|
703
718
|
//#endregion
|
|
704
|
-
export {
|
|
705
|
-
//# sourceMappingURL=index-
|
|
719
|
+
export { HasId as $, AnyPongoDriverOptions as $t, MaybePromise as A, hasOperators as An, PongoSession as At, DOCUMENT_DOES_NOT_EXIST as B, DocumentCommandHandler as Bn, UpdateOneOptions as Bt, PongoCacheType as C, pongoSchema as Cn, PongoFilter as Ct, LRUCacheOptions as D, toDbSchemaMetadata as Dn, PongoInsertOneResult as Dt, noopCacheProvider as E, toClientSchemaMetadata as En, PongoInsertManyResult as Et, AlternativeType as F, PongoCollectionURNType as Fn, RegExpOrString as Ft, DocumentHandler as G, NonPartial as Gn, WithoutIdAndVersion as Gt, DeleteManyOptions as H, DocumentCommandHandlerOptions as Hn, WithIdAndVersion as Ht, AnyPongoDb as I, PongoCollectionSQLBuilder as In, ReplaceManyOptions as It, ExpectedDocumentVersionGeneral as J, expectedVersionPredicate as Jt, EnhancedOmit as K, objectEntries as Kn, WithoutVersion as Kt, BatchHandleOptions as L, PongoCollectionOptions as Ln, ReplaceOneOptions as Lt, $push as M, PongoCollectionSchemaComponent as Mn, PongoUpdate as Mt, $set as N, PongoCollectionSchemaComponentOptions as Nn, PongoUpdateManyResult as Nt, lruCache as O, OperatorMap as On, PongoMigrationOptions as Ot, $unset as P, PongoCollectionURN as Pn, PongoUpdateResult as Pt, HandleOptions as Q, AnyPongoDriver as Qt, CollectionOperationOptions as R, pongoCollection as Rn, RootFilterOperators as Rt, PongoCacheSetEntry as S, PongoSchemaConfig as Sn, PongoDocument as St, pongoCache as T, proxyPongoDbWithSchema as Tn, PongoHandleResult as Tt, DeleteOneOptions as U, getIdsFromIdOnlyFilter as Un, WithVersion as Ut, DOCUMENT_EXISTS as V, DocumentCommandHandlerInput as Vn, WithId as Vt, Document as W, idFromFilter as Wn, WithoutId as Wt, ExpectedVersionPredicate as X, isGeneralExpectedDocumentVersion as Xt, ExpectedDocumentVersionValue as Y, expectedVersionValue as Yt, FindOptions as Z, operationResult as Zt, CacheHooks as _, PongoCollectionSchema as _n, PongoDb as _t, ConcurrencyError as a, PongoDriverRegistry as an, ObjectId as at, CacheType as b, PongoDbSchemaMetadata as bn, PongoDeleteManyResult as bt, isString as c, PongoDatabaseSchemaComponent as cn, OptionalId as ct, PongoDatabaseCache as d, PongoDatabaseURNType as dn, OptionalUnlessRequiredVersion as dt, ExtractPongoDatabaseTypeFromDriver as en, InferIdType as et, PongoTransactionCache as f, CollectionsMap as fn, OptionalVersion as ft, CacheConfig as g, PongoClientWithSchema as gn, PongoDBCollectionOptions as gt, pongoCacheWrapper as h, PongoClientSchemaMetadata as hn, PongoCollection as ht, pongoClient as i, PongoDriverOptions as in, NonObjectIdLikeDocument as it, $inc as j, isOperator as jn, PongoTransactionOptions as jt, identityMapCache as k, QueryOperators as kn, PongoReplaceManyResult as kt, PongoDatabase as l, PongoDatabaseSchemaComponentOptions as ln, OptionalUnlessRequiredId as lt, pongoTransactionCache as m, PongoClientSchema as mn, PongoClientOptions as mt, PongoSessionOptions as n, PongoDatabaseFactoryOptions as nn, InsertOneOptions as nt, PongoError as o, pongoDriverRegistry as on, ObjectIdLike as ot, PongoTransactionCacheOperationOptions as p, DBsMap as pn, PongoClient as pt, ExpectedDocumentVersion as q, expectedVersion as qt, pongoSession as r, PongoDriver as rn, NO_CONCURRENCY_CHECK as rt, isNumber as s, PongoDatabaseSQLBuilder as sn, OperationResult as st, pongoTransaction as t, ExtractPongoDriverOptions as tn, InsertManyOptions as tt, PongoDatabaseOptions as u, PongoDatabaseURN as un, OptionalUnlessRequiredIdAndVersion as ut, CacheOptions as v, PongoCollectionSchemaMetadata as vn, PongoDbOptions as vt, PongoDocumentCacheKey as w, proxyClientWithSchema as wn, PongoFilterOperator as wt, PongoCache as x, PongoDbWithSchema as xn, PongoDeleteResult as xt, CacheSettings as y, PongoDbSchema as yn, PongoDbTransaction as yt, Condition as z, transactionExecutorOrDefault as zn, UpdateManyOptions as zt };
|
|
720
|
+
//# sourceMappingURL=index-r7V4paf_.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_core = require('./core-
|
|
2
|
+
const require_core = require('./core-C9SB3XMx.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
pongoDriverRegistry.register(`PostgreSQL:pg`, () => loadPongoClient("pg"));
|
|
@@ -32,6 +32,7 @@ exports.PongoError = require_core.PongoError;
|
|
|
32
32
|
exports.QueryOperators = require_core.QueryOperators;
|
|
33
33
|
exports.deepEquals = require_core.deepEquals;
|
|
34
34
|
exports.expectedVersion = require_core.expectedVersion;
|
|
35
|
+
exports.expectedVersionPredicate = require_core.expectedVersionPredicate;
|
|
35
36
|
exports.expectedVersionValue = require_core.expectedVersionValue;
|
|
36
37
|
exports.getIdsFromIdOnlyFilter = require_core.getIdsFromIdOnlyFilter;
|
|
37
38
|
exports.hasOperators = require_core.hasOperators;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as HasId, $t as AnyPongoDriverOptions, A as MaybePromise, An as hasOperators, At as PongoSession, B as DOCUMENT_DOES_NOT_EXIST, Bn as DocumentCommandHandler, Bt as UpdateOneOptions, C as PongoCacheType, Cn as pongoSchema, Ct as PongoFilter, D as LRUCacheOptions, Dn as toDbSchemaMetadata, Dt as PongoInsertOneResult, E as noopCacheProvider, En as toClientSchemaMetadata, Et as PongoInsertManyResult, F as AlternativeType, Fn as PongoCollectionURNType, Ft as RegExpOrString, G as DocumentHandler, Gn as NonPartial, Gt as WithoutIdAndVersion, H as DeleteManyOptions, Hn as DocumentCommandHandlerOptions, Ht as WithIdAndVersion, I as AnyPongoDb, In as PongoCollectionSQLBuilder, It as ReplaceManyOptions, J as ExpectedDocumentVersionGeneral, Jt as expectedVersionPredicate, K as EnhancedOmit, Kn as objectEntries, Kt as WithoutVersion, L as BatchHandleOptions, Ln as PongoCollectionOptions, Lt as ReplaceOneOptions, M as $push, Mn as PongoCollectionSchemaComponent, Mt as PongoUpdate, N as $set, Nn as PongoCollectionSchemaComponentOptions, Nt as PongoUpdateManyResult, O as lruCache, On as OperatorMap, Ot as PongoMigrationOptions, P as $unset, Pn as PongoCollectionURN, Pt as PongoUpdateResult, Q as HandleOptions, Qt as AnyPongoDriver, R as CollectionOperationOptions, Rn as pongoCollection, Rt as RootFilterOperators, S as PongoCacheSetEntry, Sn as PongoSchemaConfig, St as PongoDocument, T as pongoCache, Tn as proxyPongoDbWithSchema, Tt as PongoHandleResult, U as DeleteOneOptions, Un as getIdsFromIdOnlyFilter, Ut as WithVersion, V as DOCUMENT_EXISTS, Vn as DocumentCommandHandlerInput, Vt as WithId, W as Document, Wn as idFromFilter, Wt as WithoutId, X as ExpectedVersionPredicate, Xt as isGeneralExpectedDocumentVersion, Y as ExpectedDocumentVersionValue, Yt as expectedVersionValue, Z as FindOptions, Zt as operationResult, _ as CacheHooks, _n as PongoCollectionSchema, _t as PongoDb, a as ConcurrencyError, an as PongoDriverRegistry, at as ObjectId, b as CacheType, bn as PongoDbSchemaMetadata, bt as PongoDeleteManyResult, c as isString, cn as PongoDatabaseSchemaComponent, ct as OptionalId, d as PongoDatabaseCache, dn as PongoDatabaseURNType, dt as OptionalUnlessRequiredVersion, en as ExtractPongoDatabaseTypeFromDriver, et as InferIdType, f as PongoTransactionCache, fn as CollectionsMap, ft as OptionalVersion, g as CacheConfig, gn as PongoClientWithSchema, gt as PongoDBCollectionOptions, h as pongoCacheWrapper, hn as PongoClientSchemaMetadata, ht as PongoCollection, i as pongoClient, in as PongoDriverOptions, it as NonObjectIdLikeDocument, j as $inc, jn as isOperator, jt as PongoTransactionOptions, k as identityMapCache, kn as QueryOperators, kt as PongoReplaceManyResult, l as PongoDatabase, ln as PongoDatabaseSchemaComponentOptions, lt as OptionalUnlessRequiredId, m as pongoTransactionCache, mn as PongoClientSchema, mt as PongoClientOptions, n as PongoSessionOptions, nn as PongoDatabaseFactoryOptions, nt as InsertOneOptions, o as PongoError, on as pongoDriverRegistry, ot as ObjectIdLike, p as PongoTransactionCacheOperationOptions, pn as DBsMap, pt as PongoClient, q as ExpectedDocumentVersion, qt as expectedVersion, r as pongoSession, rn as PongoDriver, rt as NO_CONCURRENCY_CHECK, s as isNumber, sn as PongoDatabaseSQLBuilder, st as OperationResult, t as pongoTransaction, tn as ExtractPongoDriverOptions, tt as InsertManyOptions, u as PongoDatabaseOptions, un as PongoDatabaseURN, ut as OptionalUnlessRequiredIdAndVersion, v as CacheOptions, vn as PongoCollectionSchemaMetadata, vt as PongoDbOptions, w as PongoDocumentCacheKey, wn as proxyClientWithSchema, wt as PongoFilterOperator, x as PongoCache, xn as PongoDbWithSchema, xt as PongoDeleteResult, y as CacheSettings, yn as PongoDbSchema, yt as PongoDbTransaction, z as Condition, zn as transactionExecutorOrDefault, zt as UpdateManyOptions } from "./index-C3pnS1S_.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/core/utils/deepEquals.d.ts
|
|
4
4
|
declare const deepEquals: <T>(left: T, right: T) => boolean;
|
|
@@ -17,5 +17,5 @@ declare const mapAsync: <T, R>(items: T[], fn: (item: T, index: number) => Promi
|
|
|
17
17
|
//#region src/index.d.ts
|
|
18
18
|
declare const loadPongoClient: (path: "pg" | "sqlite3" | "d1") => Promise<AnyPongoDriver>;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { $inc, $push, $set, $unset, AlternativeType, AnyPongoDb, AnyPongoDriver, AnyPongoDriverOptions, BatchHandleOptions, CacheConfig, CacheHooks, CacheOptions, CacheSettings, CacheType, CollectionOperationOptions, CollectionsMap, ConcurrencyError, Condition, DBsMap, DOCUMENT_DOES_NOT_EXIST, DOCUMENT_EXISTS, DeleteManyOptions, DeleteOneOptions, Document, DocumentCommandHandler, DocumentCommandHandlerInput, DocumentCommandHandlerOptions, DocumentHandler, EnhancedOmit, Equatable, ExpectedDocumentVersion, ExpectedDocumentVersionGeneral, ExpectedDocumentVersionValue, ExtractPongoDatabaseTypeFromDriver, ExtractPongoDriverOptions, FindOptions, HandleOptions, HasId, InferIdType, InsertManyOptions, InsertOneOptions, LRUCacheOptions, MaybePromise, NO_CONCURRENCY_CHECK, NonObjectIdLikeDocument, NonPartial, ObjectId, ObjectIdLike, OperationResult, OperatorMap, OptionalId, OptionalUnlessRequiredId, OptionalUnlessRequiredIdAndVersion, OptionalUnlessRequiredVersion, OptionalVersion, PongoCache, PongoCacheSetEntry, PongoCacheType, PongoClient, PongoClientOptions, PongoClientSchema, PongoClientSchemaMetadata, PongoClientWithSchema, PongoCollection, PongoCollectionOptions, PongoCollectionSQLBuilder, PongoCollectionSchema, PongoCollectionSchemaComponent, PongoCollectionSchemaComponentOptions, PongoCollectionSchemaMetadata, PongoCollectionURN, PongoCollectionURNType, PongoDBCollectionOptions, PongoDatabase, PongoDatabaseCache, PongoDatabaseFactoryOptions, PongoDatabaseOptions, PongoDatabaseSQLBuilder, PongoDatabaseSchemaComponent, PongoDatabaseSchemaComponentOptions, PongoDatabaseURN, PongoDatabaseURNType, PongoDb, PongoDbOptions, PongoDbSchema, PongoDbSchemaMetadata, PongoDbTransaction, PongoDbWithSchema, PongoDeleteManyResult, PongoDeleteResult, PongoDocument, PongoDocumentCacheKey, PongoDriver, PongoDriverOptions, PongoDriverRegistry, PongoError, PongoFilter, PongoFilterOperator, PongoHandleResult, PongoInsertManyResult, PongoInsertOneResult, PongoMigrationOptions, PongoReplaceManyResult, PongoSchemaConfig, PongoSession, PongoSessionOptions, PongoTransactionCache, PongoTransactionCacheOperationOptions, PongoTransactionOptions, PongoUpdate, PongoUpdateManyResult, PongoUpdateResult, QueryOperators, RegExpOrString, ReplaceManyOptions, ReplaceOneOptions, RootFilterOperators, UpdateManyOptions, UpdateOneOptions, WithId, WithIdAndVersion, WithVersion, WithoutId, WithoutIdAndVersion, WithoutVersion, deepEquals, expectedVersion, expectedVersionValue, getIdsFromIdOnlyFilter, hasOperators, idFromFilter, identityMapCache, isEquatable, isGeneralExpectedDocumentVersion, isNumber, isOperator, isString, loadPongoClient, lruCache, mapAsync, mapParallel, mapSequential, noopCacheProvider, objectEntries, operationResult, pongoCache, pongoCacheWrapper, pongoClient, pongoCollection, pongoDriverRegistry, pongoSchema, pongoSession, pongoTransaction, pongoTransactionCache, proxyClientWithSchema, proxyPongoDbWithSchema, toClientSchemaMetadata, toDbSchemaMetadata, transactionExecutorOrDefault };
|
|
20
|
+
export { $inc, $push, $set, $unset, AlternativeType, AnyPongoDb, AnyPongoDriver, AnyPongoDriverOptions, BatchHandleOptions, CacheConfig, CacheHooks, CacheOptions, CacheSettings, CacheType, CollectionOperationOptions, CollectionsMap, ConcurrencyError, Condition, DBsMap, DOCUMENT_DOES_NOT_EXIST, DOCUMENT_EXISTS, DeleteManyOptions, DeleteOneOptions, Document, DocumentCommandHandler, DocumentCommandHandlerInput, DocumentCommandHandlerOptions, DocumentHandler, EnhancedOmit, Equatable, ExpectedDocumentVersion, ExpectedDocumentVersionGeneral, ExpectedDocumentVersionValue, ExpectedVersionPredicate, ExtractPongoDatabaseTypeFromDriver, ExtractPongoDriverOptions, FindOptions, HandleOptions, HasId, InferIdType, InsertManyOptions, InsertOneOptions, LRUCacheOptions, MaybePromise, NO_CONCURRENCY_CHECK, NonObjectIdLikeDocument, NonPartial, ObjectId, ObjectIdLike, OperationResult, OperatorMap, OptionalId, OptionalUnlessRequiredId, OptionalUnlessRequiredIdAndVersion, OptionalUnlessRequiredVersion, OptionalVersion, PongoCache, PongoCacheSetEntry, PongoCacheType, PongoClient, PongoClientOptions, PongoClientSchema, PongoClientSchemaMetadata, PongoClientWithSchema, PongoCollection, PongoCollectionOptions, PongoCollectionSQLBuilder, PongoCollectionSchema, PongoCollectionSchemaComponent, PongoCollectionSchemaComponentOptions, PongoCollectionSchemaMetadata, PongoCollectionURN, PongoCollectionURNType, PongoDBCollectionOptions, PongoDatabase, PongoDatabaseCache, PongoDatabaseFactoryOptions, PongoDatabaseOptions, PongoDatabaseSQLBuilder, PongoDatabaseSchemaComponent, PongoDatabaseSchemaComponentOptions, PongoDatabaseURN, PongoDatabaseURNType, PongoDb, PongoDbOptions, PongoDbSchema, PongoDbSchemaMetadata, PongoDbTransaction, PongoDbWithSchema, PongoDeleteManyResult, PongoDeleteResult, PongoDocument, PongoDocumentCacheKey, PongoDriver, PongoDriverOptions, PongoDriverRegistry, PongoError, PongoFilter, PongoFilterOperator, PongoHandleResult, PongoInsertManyResult, PongoInsertOneResult, PongoMigrationOptions, PongoReplaceManyResult, PongoSchemaConfig, PongoSession, PongoSessionOptions, PongoTransactionCache, PongoTransactionCacheOperationOptions, PongoTransactionOptions, PongoUpdate, PongoUpdateManyResult, PongoUpdateResult, QueryOperators, RegExpOrString, ReplaceManyOptions, ReplaceOneOptions, RootFilterOperators, UpdateManyOptions, UpdateOneOptions, WithId, WithIdAndVersion, WithVersion, WithoutId, WithoutIdAndVersion, WithoutVersion, deepEquals, expectedVersion, expectedVersionPredicate, expectedVersionValue, getIdsFromIdOnlyFilter, hasOperators, idFromFilter, identityMapCache, isEquatable, isGeneralExpectedDocumentVersion, isNumber, isOperator, isString, loadPongoClient, lruCache, mapAsync, mapParallel, mapSequential, noopCacheProvider, objectEntries, operationResult, pongoCache, pongoCacheWrapper, pongoClient, pongoCollection, pongoDriverRegistry, pongoSchema, pongoSession, pongoTransaction, pongoTransactionCache, proxyClientWithSchema, proxyPongoDbWithSchema, toClientSchemaMetadata, toDbSchemaMetadata, transactionExecutorOrDefault };
|
|
21
21
|
//# sourceMappingURL=index.d.cts.map
|