@rushdb/javascript-sdk 0.9.4 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/{types → dist}/api/create-api.d.ts +6 -6
  2. package/{types → dist}/api/types.d.ts +17 -17
  3. package/dist/index.cjs +1 -0
  4. package/dist/index.mjs +1 -0
  5. package/dist/index.node.d.ts +137 -0
  6. package/dist/index.worker.d.ts +137 -0
  7. package/{types → dist}/sdk/model.d.ts +19 -15
  8. package/{types → dist}/sdk/record.d.ts +15 -12
  9. package/{types → dist}/sdk/sdk.d.ts +27 -27
  10. package/{types → dist}/sdk/transaction.d.ts +2 -2
  11. package/{types → dist}/types/query.d.ts +15 -8
  12. package/package.json +36 -39
  13. package/CHANGELOG.md +0 -180
  14. package/cjs/api/api.js +0 -328
  15. package/cjs/api/constants.js +0 -7
  16. package/cjs/api/create-api.js +0 -323
  17. package/cjs/api/index.js +0 -8
  18. package/cjs/api/rest-api-proxy.js +0 -22
  19. package/cjs/api/types.js +0 -2
  20. package/cjs/api/utils.js +0 -155
  21. package/cjs/common/constants.js +0 -10
  22. package/cjs/common/utils.js +0 -46
  23. package/cjs/index.cjs.node.js +0 -24
  24. package/cjs/index.cjs.worker.js +0 -24
  25. package/cjs/network/FetchHttpClient.js +0 -138
  26. package/cjs/network/HttpClient.js +0 -59
  27. package/cjs/network/NodeHttpClient.js +0 -103
  28. package/cjs/network/index.js +0 -28
  29. package/cjs/network/types.js +0 -2
  30. package/cjs/package.json +0 -4
  31. package/cjs/sdk/constants.js +0 -13
  32. package/cjs/sdk/errors.js +0 -27
  33. package/cjs/sdk/index.js +0 -23
  34. package/cjs/sdk/model.js +0 -147
  35. package/cjs/sdk/record.js +0 -122
  36. package/cjs/sdk/sdk.js +0 -46
  37. package/cjs/sdk/transaction.js +0 -17
  38. package/cjs/sdk/types.js +0 -2
  39. package/cjs/sdk/utils.js +0 -103
  40. package/cjs/types/expressions.js +0 -2
  41. package/cjs/types/index.js +0 -21
  42. package/cjs/types/query.js +0 -2
  43. package/cjs/types/schema.js +0 -2
  44. package/cjs/types/utils.js +0 -2
  45. package/cjs/types/value.js +0 -2
  46. package/esm/api/api.js +0 -324
  47. package/esm/api/constants.js +0 -4
  48. package/esm/api/create-api.js +0 -319
  49. package/esm/api/index.js +0 -2
  50. package/esm/api/rest-api-proxy.js +0 -18
  51. package/esm/api/types.js +0 -1
  52. package/esm/api/utils.js +0 -139
  53. package/esm/common/constants.js +0 -7
  54. package/esm/common/utils.js +0 -37
  55. package/esm/index.esm.node.js +0 -6
  56. package/esm/index.esm.worker.js +0 -6
  57. package/esm/network/FetchHttpClient.js +0 -133
  58. package/esm/network/HttpClient.js +0 -53
  59. package/esm/network/NodeHttpClient.js +0 -98
  60. package/esm/network/index.js +0 -24
  61. package/esm/network/types.js +0 -1
  62. package/esm/package.json +0 -4
  63. package/esm/sdk/constants.js +0 -10
  64. package/esm/sdk/errors.js +0 -21
  65. package/esm/sdk/index.js +0 -7
  66. package/esm/sdk/model.js +0 -143
  67. package/esm/sdk/record.js +0 -115
  68. package/esm/sdk/sdk.js +0 -42
  69. package/esm/sdk/transaction.js +0 -13
  70. package/esm/sdk/types.js +0 -1
  71. package/esm/sdk/utils.js +0 -93
  72. package/esm/types/expressions.js +0 -1
  73. package/esm/types/index.js +0 -5
  74. package/esm/types/query.js +0 -1
  75. package/esm/types/schema.js +0 -1
  76. package/esm/types/utils.js +0 -1
  77. package/esm/types/value.js +0 -1
  78. package/types/index.d.ts +0 -60
  79. /package/{types → dist}/api/api.d.ts +0 -0
  80. /package/{types → dist}/api/constants.d.ts +0 -0
  81. /package/{types → dist}/api/index.d.ts +0 -0
  82. /package/{types → dist}/api/rest-api-proxy.d.ts +0 -0
  83. /package/{types → dist}/api/utils.d.ts +0 -0
  84. /package/{types → dist}/common/constants.d.ts +0 -0
  85. /package/{types → dist}/common/utils.d.ts +0 -0
  86. /package/{types → dist}/network/FetchHttpClient.d.ts +0 -0
  87. /package/{types → dist}/network/HttpClient.d.ts +0 -0
  88. /package/{types → dist}/network/NodeHttpClient.d.ts +0 -0
  89. /package/{types → dist}/network/index.d.ts +0 -0
  90. /package/{types → dist}/network/types.d.ts +0 -0
  91. /package/{types → dist}/sdk/constants.d.ts +0 -0
  92. /package/{types → dist}/sdk/errors.d.ts +0 -0
  93. /package/{types → dist}/sdk/index.d.ts +0 -0
  94. /package/{types → dist}/sdk/types.d.ts +0 -0
  95. /package/{types → dist}/sdk/utils.d.ts +0 -0
  96. /package/{types → dist}/types/expressions.d.ts +0 -0
  97. /package/{types → dist}/types/index.d.ts +0 -0
  98. /package/{types → dist}/types/schema.d.ts +0 -0
  99. /package/{types → dist}/types/utils.d.ts +0 -0
  100. /package/{types → dist}/types/value.d.ts +0 -0
package/cjs/sdk/index.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./sdk.js"), exports);
18
- __exportStar(require("./types.js"), exports);
19
- __exportStar(require("./errors.js"), exports);
20
- __exportStar(require("./transaction.js"), exports);
21
- __exportStar(require("./utils.js"), exports);
22
- __exportStar(require("./record.js"), exports);
23
- __exportStar(require("./model.js"), exports);
package/cjs/sdk/model.js DELETED
@@ -1,147 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Model = void 0;
4
- const rest_api_proxy_js_1 = require("../api/rest-api-proxy.js");
5
- const utils_js_1 = require("../common/utils.js");
6
- const errors_js_1 = require("./errors.js");
7
- const utils_js_2 = require("./utils.js");
8
- class Model extends rest_api_proxy_js_1.RestApiProxy {
9
- constructor(modelName, schema, RushDBInstance) {
10
- super();
11
- this.label = modelName;
12
- this.schema = schema;
13
- RushDBInstance === null || RushDBInstance === void 0 ? void 0 : RushDBInstance.registerModel(this);
14
- }
15
- getLabel() {
16
- return this.label;
17
- }
18
- async find(params = {}, transaction) {
19
- var _a;
20
- return (_a = this.apiProxy) === null || _a === void 0 ? void 0 : _a.records.find(this.label, params, transaction);
21
- }
22
- async findOne(params = {}, transaction) {
23
- var _a;
24
- return (_a = this.apiProxy) === null || _a === void 0 ? void 0 : _a.records.findOne(this.label, Object.assign({}, params), transaction);
25
- }
26
- async findById(id, transaction) {
27
- return this.findOne({ where: { $id: id } }, transaction);
28
- }
29
- async findUniq(params = {}, transaction) {
30
- var _a;
31
- return (_a = this.apiProxy) === null || _a === void 0 ? void 0 : _a.records.findUniq(this.label, Object.assign({}, params), transaction);
32
- }
33
- async create(record, transaction) {
34
- var _a;
35
- const data = await (0, utils_js_2.mergeDefaultsWithPayload)(this.schema, record);
36
- const uniqFields = (0, utils_js_2.pickUniqFieldsFromRecord)(this.schema, data);
37
- if (!(0, utils_js_1.isEmptyObject)(uniqFields)) {
38
- const tx = transaction !== null && transaction !== void 0 ? transaction : (await this.apiProxy.tx.begin());
39
- const matchingRecords = await this.find({ where: uniqFields }, tx);
40
- const hasOwnTransaction = typeof transaction !== 'undefined';
41
- const canCreate = !((_a = matchingRecords === null || matchingRecords === void 0 ? void 0 : matchingRecords.data) === null || _a === void 0 ? void 0 : _a.length);
42
- if (canCreate) {
43
- const result = await this.apiProxy.records.create(this.label, data, tx);
44
- if (!hasOwnTransaction) {
45
- await tx.commit();
46
- }
47
- return result;
48
- }
49
- else {
50
- if (!hasOwnTransaction) {
51
- await tx.commit();
52
- }
53
- // @TODO: Make it optional
54
- throw new errors_js_1.UniquenessError(this.label, uniqFields);
55
- }
56
- }
57
- return await this.apiProxy.records.create(this.label, data, transaction);
58
- }
59
- attach(sourceId, target, options, transaction) {
60
- return this.apiProxy.records.attach(sourceId, target, options, transaction);
61
- }
62
- detach(sourceId, target, options, transaction) {
63
- return this.apiProxy.records.detach(sourceId, target, options, transaction);
64
- }
65
- async handleSetOrUpdate(id, record, method, transaction) {
66
- var _a;
67
- const data = await (0, utils_js_2.mergeDefaultsWithPayload)(this.schema, record);
68
- const uniqFields = (0, utils_js_2.pickUniqFieldsFromRecord)(this.schema, data);
69
- if (!(0, utils_js_1.isEmptyObject)(uniqFields)) {
70
- const tx = transaction !== null && transaction !== void 0 ? transaction : (await this.apiProxy.tx.begin());
71
- const matchingRecords = await this.find({ where: uniqFields }, tx);
72
- const hasOwnTransaction = typeof transaction !== 'undefined';
73
- const canUpdate = !((_a = matchingRecords === null || matchingRecords === void 0 ? void 0 : matchingRecords.data) === null || _a === void 0 ? void 0 : _a.length) ||
74
- (matchingRecords.data.length === 1 && matchingRecords.data[0].__id === id);
75
- if (canUpdate) {
76
- const result = await this.apiProxy.records[method](id, data, tx);
77
- if (!hasOwnTransaction) {
78
- await tx.commit();
79
- }
80
- return result;
81
- }
82
- else {
83
- if (!hasOwnTransaction) {
84
- await tx.commit();
85
- }
86
- throw new errors_js_1.UniquenessError(this.label, uniqFields);
87
- }
88
- }
89
- return await this.apiProxy.records[method](id, data, transaction);
90
- }
91
- async set(id, record, transaction) {
92
- return await this.handleSetOrUpdate(id, record, 'set', transaction);
93
- }
94
- async update(id, record, transaction) {
95
- return await this.handleSetOrUpdate(id, record, 'update', transaction);
96
- }
97
- async createMany(records, transaction) {
98
- var _a;
99
- // Begin a transaction if one isn't provided.
100
- const hasOwnTransaction = typeof transaction !== 'undefined';
101
- const tx = transaction !== null && transaction !== void 0 ? transaction : (await this.apiProxy.tx.begin());
102
- try {
103
- // Apply defaults in parallel
104
- const recordsToStore = await Promise.all(records.map(async (record) => {
105
- return await (0, utils_js_2.mergeDefaultsWithPayload)(this.schema, record);
106
- }));
107
- // Check uniqueness
108
- const uniqProperties = (0, utils_js_2.pickUniqFieldsFromRecords)(recordsToStore, this.schema, this.label);
109
- if (!(0, utils_js_1.isEmptyObject)(uniqProperties)) {
110
- const criteria = Object.entries(uniqProperties).map(([key, values]) => ({
111
- [key]: { $in: values }
112
- }));
113
- const matchingRecords = await this.find({
114
- where: {
115
- $or: criteria
116
- }
117
- }, tx);
118
- if ((_a = matchingRecords === null || matchingRecords === void 0 ? void 0 : matchingRecords.data) === null || _a === void 0 ? void 0 : _a.length) {
119
- throw new errors_js_1.UniquenessError(this.label, Object.keys(uniqProperties));
120
- }
121
- }
122
- // Create records in the database
123
- const createdRecords = await this.apiProxy.records.createMany(this.label, recordsToStore, tx);
124
- // Commit the transaction if it was created internally
125
- if (!hasOwnTransaction) {
126
- await tx.commit();
127
- }
128
- return createdRecords;
129
- }
130
- catch (error) {
131
- if (!hasOwnTransaction) {
132
- await tx.rollback();
133
- }
134
- throw error;
135
- }
136
- }
137
- async delete(searchParams, transaction) {
138
- if ((0, utils_js_1.isEmptyObject)(searchParams.where)) {
139
- throw new errors_js_1.EmptyTargetError(`You must specify criteria to delete records of type '${this.label}'. Empty criteria are not allowed. If this was intentional, use the Dashboard instead.`);
140
- }
141
- return await this.apiProxy.records.delete(Object.assign(Object.assign({}, searchParams), { labels: [this.label] }), transaction);
142
- }
143
- async deleteById(idOrIds, transaction) {
144
- return await this.apiProxy.records.deleteById(idOrIds, transaction);
145
- }
146
- }
147
- exports.Model = Model;
package/cjs/sdk/record.js DELETED
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DBRecordsArrayInstance = exports.DBRecordInstance = exports.DBRecordDraft = exports.DBRecordsBatchDraft = void 0;
4
- const rest_api_proxy_js_1 = require("../api/rest-api-proxy.js");
5
- const utils_js_1 = require("./utils.js");
6
- class DBRecordsBatchDraft {
7
- constructor({ label, options = {
8
- returnResult: true,
9
- suggestTypes: true
10
- }, payload }) {
11
- this.label = label;
12
- this.options = options;
13
- this.payload = payload;
14
- }
15
- toJson() {
16
- return {
17
- label: this.label,
18
- options: this.options,
19
- payload: this.payload
20
- };
21
- }
22
- }
23
- exports.DBRecordsBatchDraft = DBRecordsBatchDraft;
24
- class DBRecordDraft {
25
- constructor({ label, properties = [] }) {
26
- this.label = label;
27
- this.properties = properties;
28
- }
29
- toJson() {
30
- return {
31
- label: this.label,
32
- properties: this.properties
33
- };
34
- }
35
- }
36
- exports.DBRecordDraft = DBRecordDraft;
37
- class DBRecordInstance extends rest_api_proxy_js_1.RestApiProxy {
38
- constructor(data) {
39
- super();
40
- this.data = data;
41
- }
42
- get id() {
43
- try {
44
- return this.data.__id;
45
- }
46
- catch (_a) {
47
- throw new Error(`DBRecordInstance: Unable to access 'id'. The Record data is undefined.`);
48
- }
49
- }
50
- get label() {
51
- try {
52
- return this.data.__label;
53
- }
54
- catch (_a) {
55
- throw new Error(`DBRecordInstance: Unable to access 'label'. The Record data is undefined.`);
56
- }
57
- }
58
- get proptypes() {
59
- try {
60
- return this.data.__proptypes;
61
- }
62
- catch (_a) {
63
- throw new Error(`DBRecordInstance: Unable to access 'proptypes'. The Record data' is undefined.`);
64
- }
65
- }
66
- get date() {
67
- try {
68
- return (0, utils_js_1.idToDate)(this.data.__id);
69
- }
70
- catch (_a) {
71
- throw new Error(`DBRecordInstance: Unable to access 'date'. The Record data is undefined.`);
72
- }
73
- }
74
- get timestamp() {
75
- try {
76
- return (0, utils_js_1.idToTimestamp)(this.data.__id);
77
- }
78
- catch (_a) {
79
- throw new Error(`DBRecordInstance: Unable to access 'timestamp'. The Record data is undefined.`);
80
- }
81
- }
82
- async delete(transaction) {
83
- if (!this.data) {
84
- throw new Error('DBRecordInstance: Unable to delete Record. The Record data is undefined.');
85
- }
86
- return await this.apiProxy.records.deleteById(this.data.__id, transaction);
87
- }
88
- async update(partialData, transaction) {
89
- if (!this.data) {
90
- throw new Error('DBRecordInstance: Unable to update Record. The Record data is undefined.');
91
- }
92
- return this.apiProxy.records.update(this.data.__id, partialData, transaction);
93
- }
94
- async set(data, transaction) {
95
- if (!this.data) {
96
- throw new Error('DBRecordInstance: Unable to set. The Record data is undefined.');
97
- }
98
- return this.apiProxy.records.set(this.data.__id, data, transaction);
99
- }
100
- async attach(target, options, transaction) {
101
- if (!this.data) {
102
- throw new Error('DBRecordInstance: Unable to attach Record. The Record data is undefined.');
103
- }
104
- return this.apiProxy.records.attach(this.data.__id, target, options, transaction);
105
- }
106
- async detach(target, options, transaction) {
107
- if (!this.data) {
108
- throw new Error('DBRecordInstance: Unable to detach Record. The Record data is undefined.');
109
- }
110
- return this.apiProxy.records.detach(this.data.__id, target, options, transaction);
111
- }
112
- }
113
- exports.DBRecordInstance = DBRecordInstance;
114
- class DBRecordsArrayInstance extends rest_api_proxy_js_1.RestApiProxy {
115
- constructor(data, total, searchParams) {
116
- super();
117
- this.data = data;
118
- this.total = total;
119
- this.searchParams = searchParams;
120
- }
121
- }
122
- exports.DBRecordsArrayInstance = DBRecordsArrayInstance;
package/cjs/sdk/sdk.js DELETED
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initSDK = void 0;
4
- const api_js_1 = require("../api/api.js");
5
- const constants_js_1 = require("../common/constants.js");
6
- const record_js_1 = require("./record.js");
7
- const utils_js_1 = require("./utils.js");
8
- const initSDK = (httpClient) => {
9
- class RushDB extends api_js_1.RestAPI {
10
- constructor(token, config) {
11
- var _a;
12
- const props = (0, utils_js_1.parseConfig)(config);
13
- super(token, Object.assign(Object.assign({}, props), { httpClient: (_a = props.httpClient) !== null && _a !== void 0 ? _a : httpClient }));
14
- this.state = {
15
- debug: false,
16
- timeout: (0, utils_js_1.validateInteger)('timeout', props.timeout, constants_js_1.DEFAULT_TIMEOUT),
17
- token
18
- };
19
- this.models = new Map();
20
- RushDB.instance = this;
21
- }
22
- static getInstance() {
23
- return RushDB.instance;
24
- }
25
- registerModel(model) {
26
- const label = model.getLabel();
27
- // Inject the API into the model
28
- model.init(this);
29
- this.models.set(label, model);
30
- return model; //as unknown as Model<T['schema']> & Omit<RestAPI, 'find'>
31
- }
32
- getModels() {
33
- return this.models;
34
- }
35
- getModel(label) {
36
- return this.models.get(label);
37
- }
38
- toInstance(record) {
39
- const result = new record_js_1.DBRecordInstance(record);
40
- result.init(this);
41
- return result;
42
- }
43
- }
44
- return RushDB;
45
- };
46
- exports.initSDK = initSDK;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Transaction = void 0;
4
- const rest_api_proxy_js_1 = require("../api/rest-api-proxy.js");
5
- class Transaction extends rest_api_proxy_js_1.RestApiProxy {
6
- constructor(id) {
7
- super();
8
- this.id = id;
9
- }
10
- async rollback() {
11
- return await this.apiProxy.tx.rollback(this.id);
12
- }
13
- async commit() {
14
- return await this.apiProxy.tx.commit(this.id);
15
- }
16
- }
17
- exports.Transaction = Transaction;
package/cjs/sdk/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/sdk/utils.js DELETED
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseConfig = exports.pickUniqFieldsFromRecords = exports.pickUniqFieldsFromRecord = exports.mergeDefaultsWithPayload = void 0;
4
- exports.validateInteger = validateInteger;
5
- exports.idToTimestamp = idToTimestamp;
6
- exports.idToDate = idToDate;
7
- const utils_js_1 = require("../common/utils.js");
8
- const constants_js_1 = require("./constants.js");
9
- const errors_js_1 = require("./errors.js");
10
- const mergeDefaultsWithPayload = async (schema, payload) => {
11
- const defaultPromises = Object.entries(schema).map(async ([key, prop]) => {
12
- if (prop.default &&
13
- typeof prop.default !== 'undefined' &&
14
- typeof payload[key] === 'undefined') {
15
- return {
16
- key,
17
- value: typeof prop.default === 'function' ? await prop.default() : prop.default
18
- };
19
- }
20
- else {
21
- return { key, value: undefined };
22
- }
23
- });
24
- const resolvedDefaults = await Promise.all(defaultPromises);
25
- const defaults = resolvedDefaults.reduce((acc, { key, value }) => {
26
- if (value !== undefined) {
27
- acc[key] = value;
28
- }
29
- return acc;
30
- }, {});
31
- return Object.assign(Object.assign({}, defaults), payload);
32
- };
33
- exports.mergeDefaultsWithPayload = mergeDefaultsWithPayload;
34
- const pickUniqFieldsFromRecord = (schema, data) => {
35
- return Object.entries(data)
36
- .filter(([key]) => { var _a; return (_a = schema[key]) === null || _a === void 0 ? void 0 : _a.uniq; })
37
- .reduce((acc, [key, value]) => {
38
- if (key in schema) {
39
- acc[key] = value;
40
- }
41
- return acc;
42
- }, {});
43
- };
44
- exports.pickUniqFieldsFromRecord = pickUniqFieldsFromRecord;
45
- const pickUniqFieldsFromRecords = (data, schema, label) => {
46
- const properties = {};
47
- const uniqFields = Object.entries(schema)
48
- .filter(([_, config]) => config.uniq)
49
- .reduce((acc, [key]) => {
50
- acc[key] = true;
51
- return acc;
52
- }, {});
53
- data.forEach((record) => {
54
- Object.entries(record).forEach(([key, value]) => {
55
- if (key in uniqFields) {
56
- if (properties[key]) {
57
- if (properties[key].includes(value)) {
58
- throw new errors_js_1.UniquenessError(label, { [key]: value });
59
- }
60
- properties[key] = [...properties[key], value];
61
- }
62
- else {
63
- properties[key] = [value];
64
- }
65
- }
66
- });
67
- });
68
- return properties;
69
- };
70
- exports.pickUniqFieldsFromRecords = pickUniqFieldsFromRecords;
71
- const parseConfig = (config) => {
72
- if (!config) {
73
- return {};
74
- }
75
- if (!(0, utils_js_1.isObject)(config)) {
76
- throw new Error('Config must be an object');
77
- }
78
- const values = Object.keys(config).filter((value) => !constants_js_1.ALLOWED_CONFIG_PROPERTIES.includes(value));
79
- if (values.length > 0) {
80
- throw new Error(`Config object may only contain the following: ${constants_js_1.ALLOWED_CONFIG_PROPERTIES.join(', ')}`);
81
- }
82
- return config;
83
- };
84
- exports.parseConfig = parseConfig;
85
- function validateInteger(name, n, defaultVal) {
86
- if (!Number.isInteger(n)) {
87
- if (defaultVal !== undefined) {
88
- return defaultVal;
89
- }
90
- else {
91
- throw new Error(`${name} must be an integer`);
92
- }
93
- }
94
- return n;
95
- }
96
- function idToTimestamp(id) {
97
- const parts = id.split('-');
98
- const highBitsHex = parts[0] + parts[1].slice(0, 4);
99
- return parseInt(highBitsHex, 16);
100
- }
101
- function idToDate(id) {
102
- return new Date(idToTimestamp(id));
103
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./value.js"), exports);
18
- __exportStar(require("./query.js"), exports);
19
- __exportStar(require("./utils.js"), exports);
20
- __exportStar(require("./schema.js"), exports);
21
- __exportStar(require("./expressions.js"), exports);
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });