@flumens/models 0.6.0 → 0.7.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.
@@ -1,310 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var drizzleOrm = require('drizzle-orm');
7
- var casing = require('drizzle-orm/casing');
8
- var sqliteCore = require('drizzle-orm/sqlite-core');
9
- var utils$1 = require('@flumens/utils');
10
- var utils = require('./utils.js');
11
-
12
- // From https://github.com/drizzle-team/drizzle-orm/issues/1728
13
- function conflictUpdateAllExcept(table, except) {
14
- var columns = drizzleOrm.getTableColumns(table);
15
- var updateColumns = Object.entries(columns).filter(function (_a) {
16
- var col = _a[0];
17
- return !except.includes(col);
18
- });
19
- return updateColumns.reduce(function (acc, _a) {
20
- var _b;
21
- var colName = _a[0], tbl = _a[1];
22
- return (tslib.__assign(tslib.__assign({}, acc), (_b = {}, _b[colName] = drizzleOrm.sql.raw("excluded.".concat(tbl.name)), _b)));
23
- }, {});
24
- }
25
- var jsonb = function (name) {
26
- return sqliteCore.customType({
27
- dataType: function () { return 'jsonb'; },
28
- toDriver: function (value) { return JSON.stringify(value); },
29
- })(name);
30
- };
31
- var dialect = new sqliteCore.SQLiteSyncDialect();
32
- var defaultCols = function () { return ({
33
- id: sqliteCore.text(),
34
- cid: sqliteCore.text().primaryKey().notNull().default('id'),
35
- data: jsonb('data').notNull(),
36
- createdAt: sqliteCore.integer('created_at').notNull(),
37
- updatedAt: sqliteCore.integer('updated_at').notNull(),
38
- syncedAt: sqliteCore.integer('synced_at'),
39
- }); };
40
- var SQLiteStore = /** @class */ (function () {
41
- function SQLiteStore(_a) {
42
- var db = _a.db, name = _a.name, debug = _a.debug, _b = _a.columns, columns = _b === void 0 ? defaultCols() : _b;
43
- this.ready = new utils$1.Deferred();
44
- this.db = db;
45
- this.name = name;
46
- this.debug = debug || false;
47
- this.table = sqliteCore.sqliteTable(this.name, columns);
48
- this.init();
49
- }
50
- SQLiteStore.prototype.init = function () {
51
- return tslib.__awaiter(this, void 0, void 0, function () {
52
- var getColumn, cols;
53
- return tslib.__generator(this, function (_a) {
54
- switch (_a.label) {
55
- case 0: return [4 /*yield*/, this.db.ready];
56
- case 1:
57
- _a.sent();
58
- getColumn = function (col) {
59
- return "".concat(col.name, " ").concat(col.getSQLType()).concat(col.primary ? ' primary key' : '').concat(col.notNull ? ' not null' : '').concat(col.default ? " default ".concat(col.default) : '');
60
- };
61
- cols = sqliteCore.getTableConfig(this.table).columns.map(getColumn).join(',\n');
62
- return [4 /*yield*/, this.db.query({
63
- sql: "CREATE TABLE IF NOT EXISTS ".concat(this.name, " (").concat(cols, ");"),
64
- })];
65
- case 2:
66
- _a.sent();
67
- this.ready.resolve(true);
68
- return [2 /*return*/];
69
- }
70
- });
71
- });
72
- };
73
- SQLiteStore.prototype.save = function (values) {
74
- return tslib.__awaiter(this, void 0, void 0, function () {
75
- var hasValues, currentVal, query, primary;
76
- return tslib.__generator(this, function (_a) {
77
- switch (_a.label) {
78
- case 0: return [4 /*yield*/, this.ready];
79
- case 1:
80
- _a.sent();
81
- hasValues = Array.isArray(values) ? values.length : values;
82
- if (!hasValues)
83
- return [2 /*return*/];
84
- if (!(this.debug && values.cid)) return [3 /*break*/, 3];
85
- return [4 /*yield*/, this.find({ cid: values.cid })];
86
- case 2:
87
- currentVal = _a.sent();
88
- utils.printDiff(currentVal, values, values.cid, this.name);
89
- _a.label = 3;
90
- case 3:
91
- query = new sqliteCore.SQLiteInsertBuilder(this.table, {}, dialect).values(values);
92
- primary = this._getPrimaryCol();
93
- if (primary)
94
- query = query.onConflictDoUpdate({
95
- target: primary,
96
- set: conflictUpdateAllExcept(this.table, []),
97
- });
98
- return [4 /*yield*/, this.db.query(query.toSQL())];
99
- case 4:
100
- _a.sent();
101
- return [2 /*return*/];
102
- }
103
- });
104
- });
105
- };
106
- SQLiteStore.prototype.find = function (q) {
107
- return tslib.__awaiter(this, void 0, void 0, function () {
108
- var findOne, value;
109
- var _this = this;
110
- return tslib.__generator(this, function (_a) {
111
- switch (_a.label) {
112
- case 0: return [4 /*yield*/, this.ready];
113
- case 1:
114
- _a.sent();
115
- findOne = function (query) {
116
- if (typeof q === 'function')
117
- return q(query).limit(1);
118
- if (typeof q === 'string') {
119
- var primary = _this._getPrimaryCol();
120
- if (!primary)
121
- throw new Error('Primary col is missing');
122
- return query.where(drizzleOrm.eq(primary, q)).limit(1);
123
- }
124
- var where = Object.entries(q).map(function (_a) {
125
- var col = _a[0], val = _a[1];
126
- return drizzleOrm.eq(_this.table[col], val);
127
- });
128
- return query.where(drizzleOrm.and.apply(void 0, where)).limit(1);
129
- };
130
- return [4 /*yield*/, this.findAll(findOne)];
131
- case 2:
132
- value = (_a.sent())[0];
133
- return [2 /*return*/, value];
134
- }
135
- });
136
- });
137
- };
138
- SQLiteStore.prototype.findAll = function (q) {
139
- return tslib.__awaiter(this, void 0, void 0, function () {
140
- var query, values, getCamelCaseAndParseJSON;
141
- var _this = this;
142
- return tslib.__generator(this, function (_a) {
143
- switch (_a.label) {
144
- case 0: return [4 /*yield*/, this.ready];
145
- case 1:
146
- _a.sent();
147
- query = new sqliteCore.QueryBuilder()
148
- .select()
149
- .from(this.table);
150
- if (q)
151
- query = q(query);
152
- return [4 /*yield*/, this.db.query(query.toSQL())];
153
- case 2:
154
- values = _a.sent();
155
- getCamelCaseAndParseJSON = function (val) {
156
- return Object.entries(val).reduce(function (agg, _a) {
157
- var _b;
158
- var key = _a[0], v = _a[1];
159
- var isJSONType = ((_b = drizzleOrm.getTableColumns(_this.table)[key]) === null || _b === void 0 ? void 0 : _b.sqlName) === 'jsonb';
160
- if (isJSONType) {
161
- agg[casing.toCamelCase(key)] = JSON.parse(v);
162
- }
163
- else {
164
- agg[casing.toCamelCase(key)] = v;
165
- }
166
- return agg;
167
- }, {});
168
- };
169
- return [2 /*return*/, values.map(getCamelCaseAndParseJSON)];
170
- }
171
- });
172
- });
173
- };
174
- SQLiteStore.prototype.delete = function (q) {
175
- return tslib.__awaiter(this, void 0, void 0, function () {
176
- var deleteOne;
177
- var _this = this;
178
- return tslib.__generator(this, function (_a) {
179
- switch (_a.label) {
180
- case 0: return [4 /*yield*/, this.ready];
181
- case 1:
182
- _a.sent();
183
- deleteOne = function (query) {
184
- // TODO: to delete only one https://stackoverflow.com/questions/1824490/how-do-you-enable-limit-for-delete-in-sqlite
185
- if (typeof q === 'function')
186
- return q(query);
187
- if (typeof q === 'string') {
188
- var primary = _this._getPrimaryCol();
189
- if (!primary)
190
- throw new Error('Primary col is missing');
191
- return query.where(drizzleOrm.eq(primary, q));
192
- }
193
- var where = Object.entries(q).map(function (_a) {
194
- var col = _a[0], val = _a[1];
195
- return drizzleOrm.eq(_this.table[col], val);
196
- });
197
- return query.where(drizzleOrm.and.apply(void 0, where));
198
- };
199
- return [4 /*yield*/, this.deleteAll(deleteOne)];
200
- case 2:
201
- _a.sent();
202
- return [2 /*return*/];
203
- }
204
- });
205
- });
206
- };
207
- SQLiteStore.prototype.deleteAll = function (q) {
208
- return tslib.__awaiter(this, void 0, void 0, function () {
209
- var query;
210
- return tslib.__generator(this, function (_a) {
211
- switch (_a.label) {
212
- case 0: return [4 /*yield*/, this.ready];
213
- case 1:
214
- _a.sent();
215
- query = new sqliteCore.SQLiteDeleteBase(this.table, {}, dialect);
216
- if (q)
217
- query = q(query);
218
- return [4 /*yield*/, this.db.query(query.toSQL())];
219
- case 2:
220
- _a.sent();
221
- return [2 /*return*/];
222
- }
223
- });
224
- });
225
- };
226
- /**
227
- * Exports all objects from the store.
228
- */
229
- SQLiteStore.prototype.export = function () {
230
- return tslib.__awaiter(this, void 0, void 0, function () {
231
- var addCIDs;
232
- return tslib.__generator(this, function (_a) {
233
- switch (_a.label) {
234
- case 0: return [4 /*yield*/, this.ready];
235
- case 1:
236
- _a.sent();
237
- addCIDs = function (agg, val) {
238
- var _a;
239
- return (tslib.__assign(tslib.__assign({}, agg), (_a = {}, _a[val.cid] = val, _a)));
240
- };
241
- return [4 /*yield*/, this.findAll()];
242
- case 2: return [2 /*return*/, (_a.sent()).reduce(addCIDs, {})];
243
- }
244
- });
245
- });
246
- };
247
- /**
248
- * Imports objects to store.
249
- */
250
- SQLiteStore.prototype.import = function (obj) {
251
- return tslib.__awaiter(this, void 0, void 0, function () {
252
- var getBackwardsCompVal, savingAll;
253
- var _this = this;
254
- return tslib.__generator(this, function (_a) {
255
- switch (_a.label) {
256
- case 0: return [4 /*yield*/, this.ready];
257
- case 1:
258
- _a.sent();
259
- return [4 /*yield*/, this.deleteAll()];
260
- case 2:
261
- _a.sent();
262
- if (typeof obj !== 'object')
263
- throw new Error('Invalid obj passed to store');
264
- getBackwardsCompVal = function (val) {
265
- var _a, _b, _c, _d, _e, _f;
266
- if (!val.createdAt && ((_a = val.metadata) === null || _a === void 0 ? void 0 : _a.createdOn)) {
267
- val.createdAt = (_b = val.metadata) === null || _b === void 0 ? void 0 : _b.createdOn;
268
- }
269
- if (!val.updatedAt && ((_c = val.metadata) === null || _c === void 0 ? void 0 : _c.updatedOn)) {
270
- val.updatedAt = (_d = val.metadata) === null || _d === void 0 ? void 0 : _d.updatedOn;
271
- }
272
- if (!val.syncedAt && ((_e = val.metadata) === null || _e === void 0 ? void 0 : _e.syncedOn)) {
273
- val.syncedAt = (_f = val.metadata) === null || _f === void 0 ? void 0 : _f.syncedOn;
274
- }
275
- if (val.samples) {
276
- var id = val.id, cid = val.cid, createdAt = val.createdAt, updatedAt = val.updatedAt, syncedAt = val.syncedAt, restVal = tslib.__rest(val, ["id", "cid", "createdAt", "updatedAt", "syncedAt"]);
277
- val = {
278
- id: id,
279
- cid: cid,
280
- createdAt: createdAt,
281
- updatedAt: updatedAt,
282
- syncedAt: syncedAt,
283
- data: tslib.__assign({}, restVal),
284
- };
285
- }
286
- return val;
287
- };
288
- savingAll = Object.entries(obj).map(function (_a) {
289
- var val = _a[1];
290
- return _this.save(getBackwardsCompVal(val));
291
- });
292
- Promise.all(savingAll);
293
- return [2 /*return*/];
294
- }
295
- });
296
- });
297
- };
298
- SQLiteStore.prototype._getPrimaryCol = function () {
299
- return Object.values(drizzleOrm.getTableColumns(this.table)).find(function (_a) {
300
- var primary = _a.primary;
301
- return !!primary;
302
- });
303
- };
304
- return SQLiteStore;
305
- }());
306
-
307
- exports.conflictUpdateAllExcept = conflictUpdateAllExcept;
308
- exports["default"] = SQLiteStore;
309
- exports.defaultCols = defaultCols;
310
- exports.jsonb = jsonb;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),e=require("drizzle-orm"),r=require("drizzle-orm/casing"),n=require("drizzle-orm/sqlite-core"),i=require("@flumens/utils"),a=require("./utils.js");function s(r,n){var i=e.getTableColumns(r);return Object.entries(i).filter((function(t){var e=t[0];return!n.includes(e)})).reduce((function(r,n){var i,a=n[0],s=n[1];return t.__assign(t.__assign({},r),((i={})[a]=e.sql.raw("excluded.".concat(s.name)),i))}),{})}var o=function(t){return n.customType({dataType:function(){return"jsonb"},toDriver:function(t){return JSON.stringify(t)}})(t)},u=new n.SQLiteSyncDialect,c=function(){return{id:n.text(),cid:n.text().primaryKey().notNull().default("id"),data:o("data").notNull(),createdAt:n.integer("created_at").notNull(),updatedAt:n.integer("updated_at").notNull(),syncedAt:n.integer("synced_at")}},d=function(){function o(t){var e=t.db,r=t.name,a=t.debug,s=t.columns,o=void 0===s?c():s;this.ready=new i.Deferred,this.db=e,this.name=r,this.debug=a||!1,this.table=n.sqliteTable(this.name,o),this.init()}return o.prototype.init=function(){return t.__awaiter(this,void 0,void 0,(function(){var e,r;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.db.ready];case 1:return t.sent(),e=function(t){return"".concat(t.name," ").concat(t.getSQLType()).concat(t.primary?" primary key":"").concat(t.notNull?" not null":"").concat(t.default?" default ".concat(t.default):"")},r=n.getTableConfig(this.table).columns.map(e).join(",\n"),[4,this.db.query({sql:"CREATE TABLE IF NOT EXISTS ".concat(this.name," (").concat(r,");")})];case 2:return t.sent(),this.ready.resolve(!0),[2]}}))}))},o.prototype.save=function(e){return t.__awaiter(this,void 0,void 0,(function(){var r,i,o;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.ready];case 1:return t.sent(),(Array.isArray(e)?e.length:e)?this.debug&&e.cid?[4,this.find({cid:e.cid})]:[3,3]:[2];case 2:r=t.sent(),a.printDiff(r,e,e.cid,this.name),t.label=3;case 3:return i=new n.SQLiteInsertBuilder(this.table,{},u).values(e),(o=this._getPrimaryCol())&&(i=i.onConflictDoUpdate({target:o,set:s(this.table,[])})),[4,this.db.query(i.toSQL())];case 4:return t.sent(),[2]}}))}))},o.prototype.find=function(r){return t.__awaiter(this,void 0,void 0,(function(){var n,i=this;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.ready];case 1:return t.sent(),n=function(t){if("function"==typeof r)return r(t).limit(1);if("string"==typeof r){var n=i._getPrimaryCol();if(!n)throw new Error("Primary col is missing");return t.where(e.eq(n,r)).limit(1)}var a=Object.entries(r).map((function(t){var r=t[0],n=t[1];return e.eq(i.table[r],n)}));return t.where(e.and.apply(void 0,a)).limit(1)},[4,this.findAll(n)];case 2:return[2,t.sent()[0]]}}))}))},o.prototype.findAll=function(i){return t.__awaiter(this,void 0,void 0,(function(){var a,s,o,u=this;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.ready];case 1:return t.sent(),a=(new n.QueryBuilder).select().from(this.table),i&&(a=i(a)),[4,this.db.query(a.toSQL())];case 2:return s=t.sent(),o=function(t){return Object.entries(t).reduce((function(t,n){var i,a=n[0],s=n[1],o="jsonb"===(null===(i=e.getTableColumns(u.table)[a])||void 0===i?void 0:i.sqlName);return t[r.toCamelCase(a)]=o?JSON.parse(s):s,t}),{})},[2,s.map(o)]}}))}))},o.prototype.delete=function(r){return t.__awaiter(this,void 0,void 0,(function(){var n,i=this;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.ready];case 1:return t.sent(),n=function(t){if("function"==typeof r)return r(t);if("string"==typeof r){var n=i._getPrimaryCol();if(!n)throw new Error("Primary col is missing");return t.where(e.eq(n,r))}var a=Object.entries(r).map((function(t){var r=t[0],n=t[1];return e.eq(i.table[r],n)}));return t.where(e.and.apply(void 0,a))},[4,this.deleteAll(n)];case 2:return t.sent(),[2]}}))}))},o.prototype.deleteAll=function(e){return t.__awaiter(this,void 0,void 0,(function(){var r;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.ready];case 1:return t.sent(),r=new n.SQLiteDeleteBase(this.table,{},u),e&&(r=e(r)),[4,this.db.query(r.toSQL())];case 2:return t.sent(),[2]}}))}))},o.prototype.export=function(){return t.__awaiter(this,void 0,void 0,(function(){var e;return t.__generator(this,(function(r){switch(r.label){case 0:return[4,this.ready];case 1:return r.sent(),e=function(e,r){var n;return t.__assign(t.__assign({},e),((n={})[r.cid]=r,n))},[4,this.findAll()];case 2:return[2,r.sent().reduce(e,{})]}}))}))},o.prototype.import=function(e){return t.__awaiter(this,void 0,void 0,(function(){var r,n,i=this;return t.__generator(this,(function(a){switch(a.label){case 0:return[4,this.ready];case 1:return a.sent(),[4,this.deleteAll()];case 2:if(a.sent(),"object"!=typeof e)throw new Error("Invalid obj passed to store");return r=function(e){var r,n,i,a,s,o;if(!e.createdAt&&(null===(r=e.metadata)||void 0===r?void 0:r.createdOn)&&(e.createdAt=null===(n=e.metadata)||void 0===n?void 0:n.createdOn),!e.updatedAt&&(null===(i=e.metadata)||void 0===i?void 0:i.updatedOn)&&(e.updatedAt=null===(a=e.metadata)||void 0===a?void 0:a.updatedOn),!e.syncedAt&&(null===(s=e.metadata)||void 0===s?void 0:s.syncedOn)&&(e.syncedAt=null===(o=e.metadata)||void 0===o?void 0:o.syncedOn),e.samples){var u=e.id,c=e.cid,d=e.createdAt,l=e.updatedAt,f=e.syncedAt,h=t.__rest(e,["id","cid","createdAt","updatedAt","syncedAt"]);e={id:u,cid:c,createdAt:d,updatedAt:l,syncedAt:f,data:t.__assign({},h)}}return e},n=Object.entries(e).map((function(t){var e=t[1];return i.save(r(e))})),Promise.all(n),[2]}}))}))},o.prototype._getPrimaryCol=function(){return Object.values(e.getTableColumns(this.table)).find((function(t){return!!t.primary}))},o}();exports.conflictUpdateAllExcept=s,exports.default=d,exports.defaultCols=c,exports.jsonb=o;
@@ -1,11 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var Store = /** @class */ (function () {
6
- function Store() {
7
- }
8
- return Store;
9
- }());
10
-
11
- exports["default"] = Store;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){};exports.default=e;
@@ -1,60 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var deepDiff = require('deep-diff');
6
- var lodash = require('lodash');
7
-
8
- // DEVELOPMENT ONLY
9
- /* eslint-disable */
10
- function printDiff(currentVal, val, cid, name) {
11
- if (name === void 0) { name = ''; }
12
- var delta = deepDiff.diff(currentVal, val);
13
- if (!delta) {
14
- return;
15
- }
16
- var allAggs = {};
17
- var diffDetected = 0;
18
- var lastDiffStr = '';
19
- delta.forEach(function (difference) {
20
- var _a, _b;
21
- var agg = (_a = {},
22
- _a[name] = (_b = {},
23
- _b[cid] = {},
24
- _b),
25
- _a);
26
- if (!difference.path) {
27
- agg[name][cid] = difference.rhs;
28
- console.groupCollapsed("\u0394 + ".concat(cid));
29
- console.log(agg);
30
- console.groupEnd();
31
- return;
32
- }
33
- difference.path.reduce(function (a, aKey, i) {
34
- if (difference.path.length - 1 > i) {
35
- a[aKey] = {};
36
- return a[aKey];
37
- }
38
- var leftStr = JSON.stringify(difference.lhs, null, 2);
39
- var rightStr = JSON.stringify(difference.rhs, null, 2);
40
- if (leftStr === rightStr) {
41
- return a[aKey];
42
- }
43
- diffDetected++;
44
- a[aKey] = "".concat(leftStr, " -> ").concat(rightStr);
45
- lastDiffStr = "".concat(aKey, ": ").concat(leftStr, " -> ").concat(rightStr);
46
- }, agg[name][cid]);
47
- allAggs = lodash.merge(allAggs, agg);
48
- });
49
- if (diffDetected) {
50
- var groudName = "\u0394 ".concat(cid);
51
- if (diffDetected === 1) {
52
- groudName += " ".concat(lastDiffStr);
53
- }
54
- console.groupCollapsed(groudName);
55
- console.log(allAggs);
56
- console.groupEnd();
57
- }
58
- }
59
-
60
- exports.printDiff = printDiff;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("deep-diff"),r=require("lodash");exports.printDiff=function(e,n,c,t){void 0===t&&(t="");var a=o.diff(e,n);if(a){var i={},l=0,s="";if(a.forEach((function(o){var e,n,a=((e={})[t]=((n={})[c]={},n),e);if(!o.path)return a[t][c]=o.rhs,console.groupCollapsed("Δ + ".concat(c)),console.log(a),void console.groupEnd();o.path.reduce((function(r,e,n){if(o.path.length-1>n)return r[e]={},r[e];var c=JSON.stringify(o.lhs,null,2),t=JSON.stringify(o.rhs,null,2);if(c===t)return r[e];l++,r[e]="".concat(c," -> ").concat(t),s="".concat(e,": ").concat(c," -> ").concat(t)}),a[t][c]),i=r.merge(i,a)})),l){var f="Δ ".concat(c);1===l&&(f+=" ".concat(s)),console.groupCollapsed(f),console.log(i),console.groupEnd()}}};
package/dist/index.js CHANGED
@@ -1,29 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var User = require('./Drupal/User.js');
6
- var SQLiteDatabase = require('./Stores/SQLiteDatabase.js');
7
- var LocalForageStore = require('./Stores/LocalForageStore.js');
8
- var SQLiteStore = require('./Stores/SQLiteStore.js');
9
- var Store = require('./Stores/Store.js');
10
- var Model = require('./Model.js');
11
- var Collection = require('./Collection.js');
12
- var Media = require('./Indicia/Media.js');
13
- var Occurrence = require('./Indicia/Occurrence.js');
14
- var Sample = require('./Indicia/Sample.js');
15
- var SampleCollection = require('./Indicia/SampleCollection.js');
16
-
17
-
18
-
19
- exports.DrupalUserModel = User["default"];
20
- exports.SQLiteDatabase = SQLiteDatabase["default"];
21
- exports.LocalForageStore = LocalForageStore["default"];
22
- exports.SQLiteStore = SQLiteStore["default"];
23
- exports.IStore = Store["default"];
24
- exports.Model = Model["default"];
25
- exports.Collection = Collection["default"];
26
- exports.IndiciaMedia = Media["default"];
27
- exports.IndiciaOccurrence = Occurrence["default"];
28
- exports.IndiciaSample = Sample["default"];
29
- exports.IndiciaSampleCollection = SampleCollection["default"];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Drupal/User.js"),r=require("./Stores/SQLiteDatabase.js"),t=require("./Stores/LocalForageStore.js"),a=require("./Stores/SQLiteStore.js"),i=require("./Stores/Store.js"),o=require("./Model.js"),s=require("./Collection.js"),l=require("./Indicia/Media.js"),u=require("./Indicia/Occurrence.js"),d=require("./Indicia/Sample.js"),c=require("./Indicia/SampleCollection.js");exports.DrupalUserModel=e.default,exports.SQLiteDatabase=r.default,exports.LocalForageStore=t.default,exports.SQLiteStore=a.default,exports.IStore=i.default,exports.Model=o.default,exports.Collection=s.default,exports.IndiciaMedia=l.default,exports.IndiciaOccurrence=u.default,exports.IndiciaSample=d.default,exports.IndiciaSampleCollection=c.default;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@flumens/models",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
7
7
  "build": "rollup -c",
8
8
  "build:watch": "rollup -c -w",
9
9
  "test:eslint": "eslint src --quiet --ext .jsx --ext .ts --ext .tsx --ext .js && echo '\\033[37;42;1m PASS \\033[00m'",
10
+ "prepare": "npm run build",
10
11
  "postpublish": "TAG_NAME=models-v\"$npm_package_version\" && git tag $TAG_NAME && git push origin \"$TAG_NAME\"",
11
12
  "test": "jest --passWithNoTests",
12
13
  "test:watch": "jest --watchAll"
@@ -18,6 +19,7 @@
18
19
  "@rollup/plugin-node-resolve": "16.0.0",
19
20
  "@rollup/plugin-typescript": "12.1.2",
20
21
  "@trivago/prettier-plugin-sort-imports": "5.2.2",
22
+ "@types/wellknown": "^0.5.8",
21
23
  "prettier": "3.5.0",
22
24
  "rollup-plugin-clear": "2.0.7",
23
25
  "rollup-plugin-copy": "3.5.0",
@@ -39,7 +41,8 @@
39
41
  "localforage": "^1",
40
42
  "localforage-cordovasqlitedriver": "^1",
41
43
  "mobx-utils": "^6",
42
- "zod": "^3"
44
+ "zod": "^3",
45
+ "wellknown": "^0.5.0"
43
46
  },
44
47
  "jest": {
45
48
  "testEnvironment": "jsdom",