@ragestudio/scylla-odm 0.22.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/batch/index.d.ts +19 -21
  2. package/batch/index.d.ts.map +1 -0
  3. package/batch/index.js +41 -1
  4. package/batch/index.js.map +1 -0
  5. package/client.d.ts +24 -27
  6. package/client.d.ts.map +1 -0
  7. package/client.js +197 -1
  8. package/client.js.map +1 -0
  9. package/cql_gen/create_keyspace.d.ts +8 -9
  10. package/cql_gen/create_keyspace.d.ts.map +1 -0
  11. package/cql_gen/create_keyspace.js +17 -1
  12. package/cql_gen/create_keyspace.js.map +1 -0
  13. package/cql_gen/create_table.d.ts +3 -6
  14. package/cql_gen/create_table.d.ts.map +1 -0
  15. package/cql_gen/create_table.js +54 -1
  16. package/cql_gen/create_table.js.map +1 -0
  17. package/document/index.d.ts +11 -14
  18. package/document/index.d.ts.map +1 -0
  19. package/document/index.js +80 -1
  20. package/document/index.js.map +1 -0
  21. package/global.d.ts +6 -0
  22. package/global.d.ts.map +1 -0
  23. package/global.js +3 -0
  24. package/global.js.map +1 -0
  25. package/index.d.ts +9 -7
  26. package/index.d.ts.map +1 -0
  27. package/index.js +20 -1
  28. package/index.js.map +1 -0
  29. package/logger/index.d.ts +7 -8
  30. package/logger/index.d.ts.map +1 -0
  31. package/logger/index.js +18 -1
  32. package/logger/index.js.map +1 -0
  33. package/migrate/index.d.ts +12 -14
  34. package/migrate/index.d.ts.map +1 -0
  35. package/migrate/index.js +297 -4
  36. package/migrate/index.js.map +1 -0
  37. package/model/index.d.ts +64 -67
  38. package/model/index.d.ts.map +1 -0
  39. package/model/index.js +78 -1
  40. package/model/index.js.map +1 -0
  41. package/operations/countAll.d.ts +3 -6
  42. package/operations/countAll.d.ts.map +1 -0
  43. package/operations/countAll.js +16 -1
  44. package/operations/countAll.js.map +1 -0
  45. package/operations/delete.d.ts +5 -8
  46. package/operations/delete.d.ts.map +1 -0
  47. package/operations/delete.js +29 -1
  48. package/operations/delete.js.map +1 -0
  49. package/operations/find.d.ts +4 -7
  50. package/operations/find.d.ts.map +1 -0
  51. package/operations/find.js +25 -1
  52. package/operations/find.js.map +1 -0
  53. package/operations/findOne.d.ts +4 -7
  54. package/operations/findOne.d.ts.map +1 -0
  55. package/operations/findOne.js +27 -1
  56. package/operations/findOne.js.map +1 -0
  57. package/operations/insert.d.ts +5 -8
  58. package/operations/insert.d.ts.map +1 -0
  59. package/operations/insert.js +30 -1
  60. package/operations/insert.js.map +1 -0
  61. package/operations/sync.d.ts +3 -6
  62. package/operations/sync.d.ts.map +1 -0
  63. package/operations/sync.js +22 -1
  64. package/operations/sync.js.map +1 -0
  65. package/operations/tableExists.d.ts +3 -6
  66. package/operations/tableExists.d.ts.map +1 -0
  67. package/operations/tableExists.js +18 -2
  68. package/operations/tableExists.js.map +1 -0
  69. package/operations/update.d.ts +5 -8
  70. package/operations/update.d.ts.map +1 -0
  71. package/operations/update.js +41 -1
  72. package/operations/update.js.map +1 -0
  73. package/package.json +13 -3
  74. package/schema/index.d.ts +13 -15
  75. package/schema/index.d.ts.map +1 -0
  76. package/schema/index.js +27 -1
  77. package/schema/index.js.map +1 -0
  78. package/types.d.ts +98 -84
  79. package/types.d.ts.map +1 -0
  80. package/types.js +37 -1
  81. package/types.js.map +1 -0
  82. package/utils/buildMapper.d.ts +12 -4
  83. package/utils/buildMapper.d.ts.map +1 -0
  84. package/utils/buildMapper.js +13 -1
  85. package/utils/buildMapper.js.map +1 -0
  86. package/utils/delay.d.ts +3 -4
  87. package/utils/delay.d.ts.map +1 -0
  88. package/utils/delay.js +8 -1
  89. package/utils/delay.js.map +1 -0
  90. package/utils/fillDefaults.d.ts +2 -4
  91. package/utils/fillDefaults.d.ts.map +1 -0
  92. package/utils/fillDefaults.js +27 -1
  93. package/utils/fillDefaults.js.map +1 -0
  94. package/utils/isPlainObject.d.ts +3 -4
  95. package/utils/isPlainObject.d.ts.map +1 -0
  96. package/utils/isPlainObject.js +13 -1
  97. package/utils/isPlainObject.js.map +1 -0
  98. package/utils/loadModels.d.ts +3 -4
  99. package/utils/loadModels.d.ts.map +1 -0
  100. package/utils/loadModels.js +67 -1
  101. package/utils/loadModels.js.map +1 -0
  102. package/utils/queryParser.d.ts +5 -8
  103. package/utils/queryParser.d.ts.map +1 -0
  104. package/utils/queryParser.js +110 -1
  105. package/utils/queryParser.js.map +1 -0
  106. package/utils/typeChecker.d.ts +3 -6
  107. package/utils/typeChecker.d.ts.map +1 -0
  108. package/utils/typeChecker.js +96 -1
  109. package/utils/typeChecker.js.map +1 -0
  110. package/driver/auth/index.d.ts +0 -34
  111. package/driver/auth/index.js +0 -1
  112. package/driver/auth/no-auth-provider.js +0 -1
  113. package/driver/auth/plain-text-auth-provider.js +0 -1
  114. package/driver/auth/provider.js +0 -1
  115. package/driver/client-options.js +0 -1
  116. package/driver/client.js +0 -1
  117. package/driver/concurrent/index.d.ts +0 -1
  118. package/driver/concurrent/index.js +0 -1
  119. package/driver/connection.js +0 -1
  120. package/driver/control-connection.js +0 -1
  121. package/driver/encoder.js +0 -1
  122. package/driver/errors.js +0 -1
  123. package/driver/execution-options.js +0 -1
  124. package/driver/execution-profile.js +0 -1
  125. package/driver/host-connection-pool.js +0 -1
  126. package/driver/host.js +0 -1
  127. package/driver/index.d.ts +0 -212
  128. package/driver/index.js +0 -1
  129. package/driver/mapping/cache.js +0 -1
  130. package/driver/mapping/doc-info-adapter.js +0 -1
  131. package/driver/mapping/index.d.ts +0 -142
  132. package/driver/mapping/index.js +0 -1
  133. package/driver/mapping/mapper.js +0 -1
  134. package/driver/mapping/mapping-handler.js +0 -1
  135. package/driver/mapping/model-batch-item.js +0 -1
  136. package/driver/mapping/model-batch-mapper.js +0 -1
  137. package/driver/mapping/model-mapper.js +0 -1
  138. package/driver/mapping/model-mapping-info.js +0 -1
  139. package/driver/mapping/object-selector.js +0 -1
  140. package/driver/mapping/q.js +0 -1
  141. package/driver/mapping/query-generator.js +0 -9
  142. package/driver/mapping/result-mapper.js +0 -4
  143. package/driver/mapping/result.js +0 -1
  144. package/driver/mapping/table-mappings.js +0 -1
  145. package/driver/mapping/tree.js +0 -1
  146. package/driver/metadata/aggregate.js +0 -1
  147. package/driver/metadata/client-state.js +0 -1
  148. package/driver/metadata/data-collection.js +0 -1
  149. package/driver/metadata/event-debouncer.js +0 -1
  150. package/driver/metadata/index.d.ts +0 -184
  151. package/driver/metadata/index.js +0 -1
  152. package/driver/metadata/materialized-view.js +0 -1
  153. package/driver/metadata/schema-function.js +0 -1
  154. package/driver/metadata/schema-index.js +0 -1
  155. package/driver/metadata/schema-parser.js +0 -1
  156. package/driver/metadata/table-metadata.js +0 -1
  157. package/driver/operation-state.js +0 -1
  158. package/driver/policies/address-resolution.js +0 -1
  159. package/driver/policies/index.d.ts +0 -135
  160. package/driver/policies/index.js +0 -1
  161. package/driver/policies/load-balancing.js +0 -1
  162. package/driver/policies/reconnection.js +0 -1
  163. package/driver/policies/retry.js +0 -1
  164. package/driver/policies/speculative-execution.js +0 -1
  165. package/driver/policies/timestamp-generation.js +0 -1
  166. package/driver/prepare-handler.js +0 -1
  167. package/driver/promise-utils.js +0 -1
  168. package/driver/readers.js +0 -1
  169. package/driver/request-execution.js +0 -1
  170. package/driver/request-handler.js +0 -1
  171. package/driver/requests.js +0 -1
  172. package/driver/stream-id-stack.js +0 -1
  173. package/driver/streams.js +0 -1
  174. package/driver/token.js +0 -1
  175. package/driver/tokenizer.js +0 -1
  176. package/driver/types/big-decimal.js +0 -1
  177. package/driver/types/duration.js +0 -1
  178. package/driver/types/index.d.ts +0 -320
  179. package/driver/types/index.js +0 -1
  180. package/driver/types/inet-address.js +0 -1
  181. package/driver/types/integer.js +0 -1
  182. package/driver/types/local-date.js +0 -1
  183. package/driver/types/local-time.js +0 -1
  184. package/driver/types/mutable-long.js +0 -1
  185. package/driver/types/protocol-version.js +0 -1
  186. package/driver/types/result-set.js +0 -1
  187. package/driver/types/result-stream.js +0 -1
  188. package/driver/types/row.js +0 -1
  189. package/driver/types/time-uuid.js +0 -1
  190. package/driver/types/tuple.js +0 -1
  191. package/driver/types/uuid.js +0 -1
  192. package/driver/types/vector.js +0 -1
  193. package/driver/types/version-number.js +0 -1
  194. package/driver/utils.js +0 -4
  195. package/driver/writers.js +0 -1
  196. package/package.js +0 -1
package/model/index.js CHANGED
@@ -1 +1,78 @@
1
- import{Document as e}from"../document/index.js";import t from"../utils/fillDefaults.js";import n from"../operations/findOne.js";import r from"../operations/find.js";import i from"../operations/update.js";import a from"../operations/delete.js";import o from"../operations/countAll.js";import s from"../operations/tableExists.js";import c from"../operations/sync.js";import l from"../operations/insert.js";var Model=class{name;schema;get client(){return globalThis.__scylla_client}get mapper(){if(!globalThis.__scylla_client?.mapper)throw Error(`No mapper available`);return globalThis.__scylla_client.mapper.forModel(this.name)}constructor(e,t){if(this.name=e,this.schema=t,!Array.isArray(this.schema.keys))throw Error(`[${this.name}] model has missing "keys" array`);if(!this.schema.table_name)throw Error(`[${this.name}] model has missing "table_name"`);if(!this.schema.fields||typeof this.schema.fields!=`object`)throw Error(`[${this.name}] model has missing or invalid "fields"`)}create=e=>this._wrap(e);obj=e=>this._wrap(e);batch={update:(e,t,n={})=>{e.add(this.update(t,{...n,batch:!0}))},insert:(e,t,n={})=>{e.add(this.insert(t,{...n,batch:!0}))},delete:(e,t,n={})=>{e.add(this.delete(t,{...n,batch:!0}))}};find=r.bind(this);findOne=n.bind(this);update=i.bind(this);insert=l.bind(this);delete=a.bind(this);countAll=o.bind(this);_sync=c.bind(this);_tableExists=s.bind(this);_wrap(n){return new e(t(this.schema,n),this)}};export{Model,Model as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Model = void 0;
7
+ const document_1 = require("../document");
8
+ const fillDefaults_1 = __importDefault(require("../utils/fillDefaults"));
9
+ const findOne_1 = __importDefault(require("../operations/findOne"));
10
+ const find_1 = __importDefault(require("../operations/find"));
11
+ const update_1 = __importDefault(require("../operations/update"));
12
+ const delete_1 = __importDefault(require("../operations/delete"));
13
+ const countAll_1 = __importDefault(require("../operations/countAll"));
14
+ const tableExists_1 = __importDefault(require("../operations/tableExists"));
15
+ const sync_1 = __importDefault(require("../operations/sync"));
16
+ const insert_1 = __importDefault(require("../operations/insert"));
17
+ class Model {
18
+ name;
19
+ schema;
20
+ get client() {
21
+ return globalThis.__scylla_client;
22
+ }
23
+ get mapper() {
24
+ if (!globalThis.__scylla_client?.mapper) {
25
+ throw new Error("No mapper available");
26
+ }
27
+ return globalThis.__scylla_client.mapper.forModel(this.name);
28
+ }
29
+ constructor(name, schema) {
30
+ this.name = name;
31
+ this.schema = schema;
32
+ if (!Array.isArray(this.schema.keys)) {
33
+ throw new Error(`[${this.name}] model has missing "keys" array`);
34
+ }
35
+ if (!this.schema.table_name) {
36
+ throw new Error(`[${this.name}] model has missing "table_name"`);
37
+ }
38
+ if (!this.schema.fields || typeof this.schema.fields !== "object") {
39
+ throw new Error(`[${this.name}] model has missing or invalid "fields"`);
40
+ }
41
+ }
42
+ create = (data) => this._wrap(data);
43
+ obj = (data) => this._wrap(data);
44
+ batch = {
45
+ update: (batch, query, options = {}) => {
46
+ batch.add(this.update(query, {
47
+ ...options,
48
+ batch: true,
49
+ }));
50
+ },
51
+ insert: (batch, query, options = {}) => {
52
+ batch.add(this.insert(query, {
53
+ ...options,
54
+ batch: true,
55
+ }));
56
+ },
57
+ delete: (batch, query, options = {}) => {
58
+ batch.add(this.delete(query, {
59
+ ...options,
60
+ batch: true,
61
+ }));
62
+ },
63
+ };
64
+ find = find_1.default.bind(this);
65
+ findOne = findOne_1.default.bind(this);
66
+ update = update_1.default.bind(this);
67
+ insert = insert_1.default.bind(this);
68
+ delete = delete_1.default.bind(this);
69
+ countAll = countAll_1.default.bind(this);
70
+ _sync = sync_1.default.bind(this);
71
+ _tableExists = tableExists_1.default.bind(this);
72
+ _wrap(row) {
73
+ return new document_1.Document((0, fillDefaults_1.default)(this.schema, row), this);
74
+ }
75
+ }
76
+ exports.Model = Model;
77
+ exports.default = Model;
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"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"}
@@ -1,6 +1,3 @@
1
- import { Model } from "../model/index.js";
2
-
3
- //#region src/operations/countAll.d.ts
4
- declare function export_default(this: Model<any, any>, timeoutMs?: number): Promise<any>;
5
- //#endregion
6
- export { export_default as default };
1
+ import type Model from "../model";
2
+ export default function (this: Model<any, any>, timeoutMs?: number): Promise<any>;
3
+ //# sourceMappingURL=countAll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countAll.d.ts","sourceRoot":"","sources":["../../src/operations/countAll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,yBACC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACrB,SAAS,GAAE,MAAc,gBAgBzB"}
@@ -1 +1,16 @@
1
- async function countAll_default(e=6e4){let t=`SELECT COUNT(1) FROM ${this.client.config.keyspace}.${this.schema.table_name}`,n={prepare:!0,readTimeout:e};return this.client.executeWithRetry(async()=>(await this.client.driver.execute(t,[],n)).rows[0].count.toNumber(),`countAll on ${this.name}`)}export{countAll_default as default};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ async function default_1(timeoutMs = 60000) {
5
+ const cql = `SELECT COUNT(1) FROM ${this.client.config.keyspace}.${this.schema.table_name}`;
6
+ const queryOptions = {
7
+ prepare: true,
8
+ readTimeout: timeoutMs,
9
+ };
10
+ const operation = async () => {
11
+ const result = await this.client.driver.execute(cql, [], queryOptions);
12
+ return result.rows[0].count.toNumber();
13
+ };
14
+ return this.client.executeWithRetry(operation, `countAll on ${this.name}`);
15
+ }
16
+ //# sourceMappingURL=countAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countAll.js","sourceRoot":"","sources":["../../src/operations/countAll.ts"],"names":[],"mappings":";;;AAEe,KAAK,oBAEnB,SAAS,GAAW,KAAK;IAEzB,MAAM,GAAG,GAAG,wBAAwB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;IAE3F,MAAM,YAAY,GAAG;QACpB,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,SAAS;KACtB,CAAA;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,YAAY,CAAC,CAAA;QAEtE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC,CAAA;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,eAAe,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AAC3E,CAAC"}
@@ -1,8 +1,5 @@
1
- import { mapping } from "../driver/mapping/index.js";
2
- import { Model } from "../model/index.js";
3
- import { DeleteQueryOptions, Query } from "../types.js";
4
-
5
- //#region src/operations/delete.d.ts
6
- declare function deleteOP<T>(this: Model<any, T>, query: Query<T>, options?: DeleteQueryOptions<T>): mapping.ModelBatchItem;
7
- //#endregion
8
- export { deleteOP as default };
1
+ import { mapping } from "../driver";
2
+ import type Model from "../model";
3
+ import { DeleteQueryOptions, Query } from "../types";
4
+ export default function deleteOP<T>(this: Model<any, T>, query: Query<T>, options?: DeleteQueryOptions<T>): mapping.ModelBatchItem;
5
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/operations/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAGpD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EACjC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EACnB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,0BA2B/B"}
@@ -1 +1,29 @@
1
- import e from"../utils/queryParser.js";function deleteOP(t,n){t=e(this,t);let r={fields:n?.fields,ttl:n?.ttl,ifExists:n?.ifExists,when:n?.when,deleteOnlyColumns:n?.deleteOnlyColumns};return n?.batch?this.mapper.batching.remove(t,r):this.client.executeWithRetry(async()=>{let e=await this.mapper.remove(t,r);return n?.raw===!0?e:this._wrap(e)},`delete on ${this.name}`)}export{deleteOP as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = deleteOP;
7
+ const queryParser_1 = __importDefault(require("../utils/queryParser"));
8
+ function deleteOP(query, options) {
9
+ query = (0, queryParser_1.default)(this, query);
10
+ const mapperOptions = {
11
+ fields: options?.fields,
12
+ ttl: options?.ttl,
13
+ ifExists: options?.ifExists,
14
+ when: options?.when,
15
+ deleteOnlyColumns: options?.deleteOnlyColumns,
16
+ };
17
+ if (options?.batch) {
18
+ return this.mapper.batching.remove(query, mapperOptions);
19
+ }
20
+ const operation = async () => {
21
+ const result = await this.mapper.remove(query, mapperOptions);
22
+ if (options?.raw === true) {
23
+ return result;
24
+ }
25
+ return this._wrap(result);
26
+ };
27
+ return this.client.executeWithRetry(operation, `delete on ${this.name}`);
28
+ }
29
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/operations/delete.ts"],"names":[],"mappings":";;;;;;AAGA,uEAA8C;AAE9C,kBAEC,KAAe,EACf,OAA+B;IAE/B,KAAK,GAAG,IAAA,qBAAW,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAEhC,MAAM,aAAa,GAA0B;QAC5C,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,GAAG,EAAE,OAAO,EAAE,GAAG;QACjB,QAAQ,EAAE,OAAO,EAAE,QAAQ;QAC3B,IAAI,EAAE,OAAO,EAAE,IAAI;QACnB,iBAAiB,EAAE,OAAO,EAAE,iBAAiB;KAC7C,CAAA;IAED,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;IACzD,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAE7D,IAAI,OAAO,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAA;QACd,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC1B,CAAC,CAAA;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AACzE,CAAC"}
@@ -1,7 +1,4 @@
1
- import { Model } from "../model/index.js";
2
- import { FindQueryOptions, Query } from "../types.js";
3
-
4
- //#region src/operations/find.d.ts
5
- declare function findOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<any[]>;
6
- //#endregion
7
- export { findOP as default };
1
+ import type { Query, FindQueryOptions } from "../types";
2
+ import type Model from "../model";
3
+ export default function findOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<any[]>;
4
+ //# sourceMappingURL=find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../src/operations/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAIjC,wBAA8B,MAAM,CAAC,IAAI,EACxC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EACtB,KAAK,GAAE,KAAK,CAAC,IAAI,CAAM,EACvB,OAAO,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,kBAsBhC"}
@@ -1 +1,25 @@
1
- import e from"../utils/queryParser.js";async function findOP(t={},n){t=e(this,t);let r={fields:n?.fields,orderBy:n?.orderBy,limit:n?.limit};return this.client.executeWithRetry(async()=>{let e=(await this.mapper.find(t,r)).toArray();return n?.raw===!0?e:e.map(e=>this._wrap(e))},`find on ${this.name}`)}export{findOP as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = findOP;
7
+ const queryParser_1 = __importDefault(require("../utils/queryParser"));
8
+ async function findOP(query = {}, options) {
9
+ query = (0, queryParser_1.default)(this, query);
10
+ const mapperOptions = {
11
+ fields: options?.fields,
12
+ orderBy: options?.orderBy,
13
+ limit: options?.limit,
14
+ };
15
+ const operation = async () => {
16
+ const result = await this.mapper.find(query, mapperOptions);
17
+ const rows = result.toArray();
18
+ if (options?.raw === true) {
19
+ return rows;
20
+ }
21
+ return rows.map((row) => this._wrap(row));
22
+ };
23
+ return this.client.executeWithRetry(operation, `find on ${this.name}`);
24
+ }
25
+ //# sourceMappingURL=find.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.js","sourceRoot":"","sources":["../../src/operations/find.ts"],"names":[],"mappings":";;;;;;AAEA,uEAA8C;AAG/B,KAAK,iBAEnB,KAAK,GAAgB,EAAE,EACvB,OAAgC;IAEhC,KAAK,GAAG,IAAA,qBAAW,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAEhC,MAAM,aAAa,GAAwB;QAC1C,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,KAAK,EAAE,OAAO,EAAE,KAAK;KACrB,CAAA;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAC3D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;QAE7B,IAAI,OAAO,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAA;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AACvE,CAAC"}
@@ -1,7 +1,4 @@
1
- import { Model } from "../model/index.js";
2
- import { FindQueryOptions, Query } from "../types.js";
3
-
4
- //#region src/operations/findOne.d.ts
5
- declare function findOneOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<any>;
6
- //#endregion
7
- export { findOneOP as default };
1
+ import type { Query, FindQueryOptions } from "../types";
2
+ import type Model from "../model";
3
+ export default function findOneOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<any>;
4
+ //# sourceMappingURL=findOne.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../src/operations/findOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAIjC,wBAA8B,SAAS,CAAC,IAAI,EAC3C,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EACtB,KAAK,GAAE,KAAK,CAAC,IAAI,CAAM,EACvB,OAAO,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,gBAyBhC"}
@@ -1 +1,27 @@
1
- import e from"../utils/queryParser.js";async function findOneOP(t={},n){t=e(this,t);let r={fields:n?.fields,orderBy:n?.orderBy,limit:n?.limit};return this.client.executeWithRetry(async()=>{let e=await this.mapper.get(t,r);return e?n?.raw===!0?e:this._wrap(e):null},`findOne on ${this.name}`)}export{findOneOP as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = findOneOP;
7
+ const queryParser_1 = __importDefault(require("../utils/queryParser"));
8
+ async function findOneOP(query = {}, options) {
9
+ query = (0, queryParser_1.default)(this, query);
10
+ const mapperOptions = {
11
+ fields: options?.fields,
12
+ orderBy: options?.orderBy,
13
+ limit: options?.limit,
14
+ };
15
+ const operation = async () => {
16
+ const result = await this.mapper.get(query, mapperOptions);
17
+ if (!result) {
18
+ return null;
19
+ }
20
+ if (options?.raw === true) {
21
+ return result;
22
+ }
23
+ return this._wrap(result);
24
+ };
25
+ return this.client.executeWithRetry(operation, `findOne on ${this.name}`);
26
+ }
27
+ //# sourceMappingURL=findOne.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findOne.js","sourceRoot":"","sources":["../../src/operations/findOne.ts"],"names":[],"mappings":";;;;;;AAEA,uEAA8C;AAG/B,KAAK,oBAEnB,KAAK,GAAgB,EAAE,EACvB,OAAgC;IAEhC,KAAK,GAAG,IAAA,qBAAW,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAEhC,MAAM,aAAa,GAAwB;QAC1C,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,KAAK,EAAE,OAAO,EAAE,KAAK;KACrB,CAAA;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAE1D,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,IAAI,OAAO,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAA;QACd,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC1B,CAAC,CAAA;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,cAAc,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AAC1E,CAAC"}
@@ -1,8 +1,5 @@
1
- import { mapping } from "../driver/mapping/index.js";
2
- import { Model } from "../model/index.js";
3
- import { InsertQueryOptions, Query } from "../types.js";
4
-
5
- //#region src/operations/insert.d.ts
6
- declare function insertOP<TDoc>(this: Model<any, TDoc>, query: Query<TDoc>, options?: InsertQueryOptions<TDoc>): mapping.ModelBatchItem;
7
- //#endregion
8
- export { insertOP as default };
1
+ import { mapping } from "../driver/mapping";
2
+ import type Model from "../model";
3
+ import { InsertQueryOptions, Query } from "../types";
4
+ export default function insertOP<TDoc>(this: Model<any, TDoc>, query: Query<TDoc>, options?: InsertQueryOptions<TDoc>): mapping.ModelBatchItem;
5
+ //# sourceMappingURL=insert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../src/operations/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAIpD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EACpC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EACtB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAClB,OAAO,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,0BA2BlC"}
@@ -1 +1,30 @@
1
- import e from"../utils/fillDefaults.js";import t from"../utils/queryParser.js";function insertOP(n,r){n=e(this.schema,n),n=t(this,n);let i={fields:r?.fields,ttl:r?.ttl,ifNotExists:r?.ifNotExists};return r?.batch?this.mapper.batching.insert(n,i):this.client.executeWithRetry(async()=>{let e=(await this.mapper.insert(n,i)).toArray();return r?.raw===!0?e:e.map(e=>this._wrap(e))},`insert on ${this.name}`)}export{insertOP as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = insertOP;
7
+ const fillDefaults_1 = __importDefault(require("../utils/fillDefaults"));
8
+ const queryParser_1 = __importDefault(require("../utils/queryParser"));
9
+ function insertOP(query, options) {
10
+ query = (0, fillDefaults_1.default)(this.schema, query);
11
+ query = (0, queryParser_1.default)(this, query);
12
+ const mapperOptions = {
13
+ fields: options?.fields,
14
+ ttl: options?.ttl,
15
+ ifNotExists: options?.ifNotExists,
16
+ };
17
+ if (options?.batch) {
18
+ return this.mapper.batching.insert(query, mapperOptions);
19
+ }
20
+ const operation = async () => {
21
+ const result = await this.mapper.insert(query, mapperOptions);
22
+ const rows = result.toArray();
23
+ if (options?.raw === true) {
24
+ return rows;
25
+ }
26
+ return rows.map((row) => this._wrap(row));
27
+ };
28
+ return this.client.executeWithRetry(operation, `insert on ${this.name}`);
29
+ }
30
+ //# sourceMappingURL=insert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert.js","sourceRoot":"","sources":["../../src/operations/insert.ts"],"names":[],"mappings":";;;;;;AAGA,yEAAgD;AAChD,uEAA8C;AAE9C,kBAEC,KAAkB,EAClB,OAAkC;IAElC,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxC,KAAK,GAAG,IAAA,qBAAW,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAEhC,MAAM,aAAa,GAA0B;QAC5C,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,GAAG,EAAE,OAAO,EAAE,GAAG;QACjB,WAAW,EAAE,OAAO,EAAE,WAAW;KACjC,CAAA;IAED,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;IACzD,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;QAE7B,IAAI,OAAO,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAA;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AACzE,CAAC"}
@@ -1,6 +1,3 @@
1
- import { Model } from "../model/index.js";
2
-
3
- //#region src/operations/sync.d.ts
4
- declare function syncOP(this: Model<any, any>): Promise<void>;
5
- //#endregion
6
- export { syncOP as default };
1
+ import type Model from "../model";
2
+ export default function syncOP(this: Model<any, any>): Promise<void>;
3
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/operations/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAGjC,wBAA8B,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,iBAkBzD"}
@@ -1 +1,22 @@
1
- import e from"../cql_gen/create_table.js";async function syncOP(){if(!await this._tableExists())try{await this.client.driver.execute(e(this)),console.log(`Table "${this.schema.table_name}" created successfully`)}catch(e){throw console.error(`Failed to create table "${this.schema.table_name}":`,e),e}}export{syncOP as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = syncOP;
7
+ const create_table_1 = __importDefault(require("../cql_gen/create_table"));
8
+ async function syncOP() {
9
+ const tableExists = await this._tableExists();
10
+ if (tableExists) {
11
+ return;
12
+ }
13
+ try {
14
+ await this.client.driver.execute((0, create_table_1.default)(this));
15
+ console.log(`Table "${this.schema.table_name}" created successfully`);
16
+ }
17
+ catch (error) {
18
+ console.error(`Failed to create table "${this.schema.table_name}":`, error);
19
+ throw error;
20
+ }
21
+ }
22
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/operations/sync.ts"],"names":[],"mappings":";;;;;;AACA,2EAA4D;AAE7C,KAAK;IACnB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;IAE7C,IAAI,WAAW,EAAE,CAAC;QACjB,OAAM;IACP,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAA,sBAAsB,EAAC,IAAI,CAAC,CAAC,CAAA;QAE9D,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,UAAU,wBAAwB,CAAC,CAAA;IACtE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CACZ,2BAA2B,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,EACrD,KAAK,CACL,CAAA;QACD,MAAM,KAAK,CAAA;IACZ,CAAC;AACF,CAAC"}
@@ -1,6 +1,3 @@
1
- import { Model } from "../model/index.js";
2
-
3
- //#region src/operations/tableExists.d.ts
4
- declare function export_default(this: Model<any, any>): Promise<boolean>;
5
- //#endregion
6
- export { export_default as default };
1
+ import type Model from "../model";
2
+ export default function (this: Model<any, any>): Promise<boolean>;
3
+ //# sourceMappingURL=tableExists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableExists.d.ts","sourceRoot":"","sources":["../../src/operations/tableExists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,yBAA+B,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,oBA0BnD"}
@@ -1,6 +1,22 @@
1
- async function tableExists_default(){try{return(await this.client.driver.execute(`
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ async function default_1() {
5
+ const cql = `
2
6
  SELECT table_name
3
7
  FROM system_schema.tables
4
8
  WHERE keyspace_name = ?
5
9
  AND table_name = ?
6
- `,[this.client.config.keyspace,this.schema.table_name],{prepare:!0})).rows.length>0}catch(e){return console.error(`Failed to check if table "${this.schema.table_name}" exists:`,e),!1}}export{tableExists_default as default};
10
+ `;
11
+ try {
12
+ const result = await this.client.driver.execute(cql, [this.client.config.keyspace, this.schema.table_name], {
13
+ prepare: true,
14
+ });
15
+ return result.rows.length > 0;
16
+ }
17
+ catch (error) {
18
+ console.error(`Failed to check if table "${this.schema.table_name}" exists:`, error);
19
+ return false;
20
+ }
21
+ }
22
+ //# sourceMappingURL=tableExists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableExists.js","sourceRoot":"","sources":["../../src/operations/tableExists.ts"],"names":[],"mappings":";;;AAEe,KAAK;IACnB,MAAM,GAAG,GAAG;;;;;GAKV,CAAA;IAEF,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAC9C,GAAG,EACH,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EACrD;YACC,OAAO,EAAE,IAAI;SACb,CACD,CAAA;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CACZ,6BAA6B,IAAI,CAAC,MAAM,CAAC,UAAU,WAAW,EAC9D,KAAK,CACL,CAAA;QAED,OAAO,KAAK,CAAA;IACb,CAAC;AACF,CAAC"}
@@ -1,8 +1,5 @@
1
- import { mapping } from "../driver/mapping/index.js";
2
- import { Model } from "../model/index.js";
3
- import { Query, UpdateQueryOptions } from "../types.js";
4
-
5
- //#region src/operations/update.d.ts
6
- declare function updateOP<TDoc>(this: Model<any, TDoc>, query: Query<TDoc>, options?: UpdateQueryOptions<TDoc>): mapping.ModelBatchItem;
7
- //#endregion
8
- export { updateOP as default };
1
+ import { mapping } from "../driver/mapping";
2
+ import type Model from "../model";
3
+ import { Query, UpdateQueryOptions } from "../types";
4
+ export default function updateOP<TDoc>(this: Model<any, TDoc>, query: Query<TDoc>, options?: UpdateQueryOptions<TDoc>): mapping.ModelBatchItem;
5
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/operations/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAIpD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EACpC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,EACtB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAClB,OAAO,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,0BAuClC"}
@@ -1 +1,41 @@
1
- import e from"../utils/fillDefaults.js";import t from"../utils/queryParser.js";function updateOP(n,r){n=e(this.schema,n),n=t(this,n);let i={fields:r?.fields,orderBy:r?.orderBy,limit:r?.limit,ttl:r?.ttl,ifExists:r?.ifExists,when:r?.when,deleteOnlyColumns:r?.deleteOnlyColumns};return r?.batch?this.mapper.batching.update(n,i):this.client.executeWithRetry(async()=>{let e=(await this.mapper.update(n,i)).toArray();return r?.raw===!0?e:e.map(e=>this._wrap(e))},`update on ${this.name}`)}export{updateOP as default};
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = updateOP;
7
+ const fillDefaults_1 = __importDefault(require("../utils/fillDefaults"));
8
+ const queryParser_1 = __importDefault(require("../utils/queryParser"));
9
+ function updateOP(query, options) {
10
+ query = (0, fillDefaults_1.default)(this.schema, query);
11
+ query = (0, queryParser_1.default)(this, query);
12
+ const mapperOptions = {
13
+ fields: options?.fields,
14
+ orderBy: options?.orderBy,
15
+ limit: options?.limit,
16
+ ttl: options?.ttl,
17
+ ifExists: options?.ifExists,
18
+ when: options?.when,
19
+ deleteOnlyColumns: options?.deleteOnlyColumns,
20
+ };
21
+ // if (typeof query.__v !== "undefined") {
22
+ // if (Number.isNaN(query.__v)) {
23
+ // query.__v = 0
24
+ // } else {
25
+ // query.__v = query.__v + 1
26
+ // }
27
+ // }
28
+ if (options?.batch) {
29
+ return this.mapper.batching.update(query, mapperOptions);
30
+ }
31
+ const operation = async () => {
32
+ const result = await this.mapper.update(query, mapperOptions);
33
+ const rows = result.toArray();
34
+ if (options?.raw === true) {
35
+ return rows;
36
+ }
37
+ return rows.map((row) => this._wrap(row));
38
+ };
39
+ return this.client.executeWithRetry(operation, `update on ${this.name}`);
40
+ }
41
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/operations/update.ts"],"names":[],"mappings":";;;;;;AAGA,yEAAgD;AAChD,uEAA8C;AAE9C,kBAEC,KAAkB,EAClB,OAAkC;IAElC,KAAK,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxC,KAAK,GAAG,IAAA,qBAAW,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAEhC,MAAM,aAAa,GAA0B;QAC5C,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,GAAG,EAAE,OAAO,EAAE,GAAG;QACjB,QAAQ,EAAE,OAAO,EAAE,QAAQ;QAC3B,IAAI,EAAE,OAAO,EAAE,IAAI;QACnB,iBAAiB,EAAE,OAAO,EAAE,iBAAiB;KAC7C,CAAA;IAED,0CAA0C;IAC1C,kCAAkC;IAClC,kBAAkB;IAClB,YAAY;IACZ,8BAA8B;IAC9B,KAAK;IACL,IAAI;IAEJ,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;IACzD,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;QAE7B,IAAI,OAAO,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAA;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AACzE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ragestudio/scylla-odm",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "An ODM for ScyllaDB/Cassandra",
5
5
  "license": "MIT",
6
6
  "author": "RageStudio",
@@ -23,6 +23,16 @@
23
23
  "types": "./index.d.ts",
24
24
  "main": "./index.js",
25
25
  "module": "./index.js",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./index.d.ts",
29
+ "default": "./index.js"
30
+ },
31
+ "./types": {
32
+ "types": "./types.d.ts",
33
+ "default": "./types.js"
34
+ }
35
+ },
26
36
  "publishConfig": {
27
37
  "access": "public"
28
38
  },
@@ -30,12 +40,12 @@
30
40
  "long": "^5.3.2"
31
41
  },
32
42
  "scripts": {
33
- "build": "tsdown && cp package.json dist/package.json && cp README.md dist/README.md",
43
+ "build": "tsgo && cp package.json dist && cp README.md dist",
34
44
  "test": "vitest run"
35
45
  },
36
46
  "devDependencies": {
37
47
  "@types/node": "^25.6.0",
38
- "tsdown": "^0.21.10",
48
+ "@typescript/native-preview": "^7.0.0-dev.20260619.1",
39
49
  "typescript": "^6.0.3",
40
50
  "vitest": "^4.1.5"
41
51
  }
package/schema/index.d.ts CHANGED
@@ -1,17 +1,15 @@
1
- import { TableClusteringOrder, TableKeys } from "../types.js";
2
-
3
- //#region src/schema/index.d.ts
4
- interface SchemaParams<T> {
5
- table_name: string;
6
- keys: TableKeys<T>;
7
- clustering_order?: TableClusteringOrder<T>;
1
+ import { TableClusteringOrder, TableKeys } from "../types";
2
+ export interface SchemaParams<T> {
3
+ table_name: string;
4
+ keys: TableKeys<T>;
5
+ clustering_order?: TableClusteringOrder<T>;
8
6
  }
9
- declare class Schema<T> {
10
- readonly table_name: string;
11
- readonly keys: TableKeys<T>;
12
- readonly clustering_order: TableClusteringOrder<T> | undefined;
13
- readonly fields: T;
14
- constructor(params: SchemaParams<T>, fields: T);
7
+ export declare class Schema<T> {
8
+ readonly table_name: string;
9
+ readonly keys: TableKeys<T>;
10
+ readonly clustering_order: TableClusteringOrder<T> | undefined;
11
+ readonly fields: T;
12
+ constructor(params: SchemaParams<T>, fields: T);
15
13
  }
16
- //#endregion
17
- export { Schema, Schema as default, SchemaParams };
14
+ export default Schema;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAE1D,MAAM,WAAW,YAAY,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAClB,gBAAgB,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;CAC1C;AAED,qBAAa,MAAM,CAAC,CAAC;IACpB,SAAgB,UAAU,EAAE,MAAM,CAAA;IAClC,SAAgB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAClC,SAAgB,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAErE,SAAgB,MAAM,EAAE,CAAC,CAAA;IAEzB,YAAY,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAgB7C;CACD;eAEc,MAAM"}
package/schema/index.js CHANGED
@@ -1 +1,27 @@
1
- var Schema=class{table_name;keys;clustering_order;fields;constructor(e,t){if(typeof e!=`object`)throw Error(`params must be an object`);if(typeof e.table_name!=`string`)throw Error(`table_name is required`);if(!Array.isArray(e.keys))throw Error(`keys is required to be an array`);this.table_name=e.table_name,this.clustering_order=e.clustering_order,this.keys=e.keys,this.fields=t}};export{Schema,Schema as default};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Schema = void 0;
4
+ class Schema {
5
+ table_name;
6
+ keys;
7
+ clustering_order;
8
+ fields;
9
+ constructor(params, fields) {
10
+ if (typeof params !== "object") {
11
+ throw new Error("params must be an object");
12
+ }
13
+ if (typeof params.table_name !== "string") {
14
+ throw new Error("table_name is required");
15
+ }
16
+ if (!Array.isArray(params.keys)) {
17
+ throw new Error("keys is required to be an array");
18
+ }
19
+ this.table_name = params.table_name;
20
+ this.clustering_order = params.clustering_order;
21
+ this.keys = params.keys;
22
+ this.fields = fields;
23
+ }
24
+ }
25
+ exports.Schema = Schema;
26
+ exports.default = Schema;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";;;AAQA;IACiB,UAAU,CAAQ;IAClB,IAAI,CAAc;IAClB,gBAAgB,CAAqC;IAErD,MAAM,CAAG;IAEzB,YAAY,MAAuB,EAAE,MAAS;QAC7C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC5C,CAAC;QACD,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC1C,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;QACnD,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;QACnC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAA;QAC/C,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QAEvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;CACD;;kBAEc,MAAM"}