@webority-technologies/mobile-core 0.0.6 → 0.0.8

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 (95) hide show
  1. package/android/build.gradle +65 -0
  2. package/android/src/newarch/java/com/webority/mobilecore/smsretriever/AppSignatureHelper.kt +57 -0
  3. package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModule.kt +20 -0
  4. package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt +146 -0
  5. package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverPackage.kt +33 -0
  6. package/lib/commonjs/formatters/dateMath.js +4 -4
  7. package/lib/commonjs/formatters/windowsToIanaTable.js +164 -0
  8. package/lib/commonjs/geolocation/index.js +9 -1
  9. package/lib/commonjs/permissions/calendar.js +14 -0
  10. package/lib/commonjs/permissions/camera.js +14 -0
  11. package/lib/commonjs/permissions/contacts.js +10 -0
  12. package/lib/commonjs/permissions/index.js +60 -150
  13. package/lib/commonjs/permissions/location.js +14 -0
  14. package/lib/commonjs/permissions/mediaLibrary.js +10 -0
  15. package/lib/commonjs/permissions/notifications.js +10 -0
  16. package/lib/commonjs/permissions/photos.js +14 -0
  17. package/lib/commonjs/smsRetriever/index.js +91 -0
  18. package/lib/commonjs/specs/NativeSmsRetriever.js +15 -0
  19. package/lib/commonjs/sqlite/index.js +12 -30
  20. package/lib/module/formatters/dateMath.js +4 -4
  21. package/lib/module/formatters/windowsToIanaTable.js +160 -0
  22. package/lib/module/geolocation/index.js +8 -1
  23. package/lib/module/index.js +3 -2
  24. package/lib/module/permissions/calendar.js +15 -0
  25. package/lib/module/permissions/camera.js +15 -0
  26. package/lib/module/permissions/contacts.js +11 -0
  27. package/lib/module/permissions/index.js +59 -150
  28. package/lib/module/permissions/location.js +15 -0
  29. package/lib/module/permissions/mediaLibrary.js +11 -0
  30. package/lib/module/permissions/notifications.js +11 -0
  31. package/lib/module/permissions/photos.js +15 -0
  32. package/lib/module/smsRetriever/index.js +86 -0
  33. package/lib/module/specs/NativeSmsRetriever.js +13 -0
  34. package/lib/module/sqlite/index.js +12 -30
  35. package/lib/typescript/commonjs/formatters/windowsToIanaTable.d.ts +18 -0
  36. package/lib/typescript/commonjs/geolocation/index.d.ts +1 -0
  37. package/lib/typescript/commonjs/index.d.ts +3 -2
  38. package/lib/typescript/commonjs/permissions/calendar.d.ts +2 -0
  39. package/lib/typescript/commonjs/permissions/camera.d.ts +2 -0
  40. package/lib/typescript/commonjs/permissions/contacts.d.ts +2 -0
  41. package/lib/typescript/commonjs/permissions/index.d.ts +29 -36
  42. package/lib/typescript/commonjs/permissions/location.d.ts +2 -0
  43. package/lib/typescript/commonjs/permissions/mediaLibrary.d.ts +2 -0
  44. package/lib/typescript/commonjs/permissions/notifications.d.ts +2 -0
  45. package/lib/typescript/commonjs/permissions/photos.d.ts +2 -0
  46. package/lib/typescript/commonjs/smsRetriever/index.d.ts +30 -0
  47. package/lib/typescript/commonjs/specs/NativeSmsRetriever.d.ts +15 -0
  48. package/lib/typescript/commonjs/sqlite/index.d.ts +10 -18
  49. package/lib/typescript/module/formatters/windowsToIanaTable.d.ts +18 -0
  50. package/lib/typescript/module/geolocation/index.d.ts +1 -0
  51. package/lib/typescript/module/index.d.ts +3 -2
  52. package/lib/typescript/module/permissions/calendar.d.ts +2 -0
  53. package/lib/typescript/module/permissions/camera.d.ts +2 -0
  54. package/lib/typescript/module/permissions/contacts.d.ts +2 -0
  55. package/lib/typescript/module/permissions/index.d.ts +29 -36
  56. package/lib/typescript/module/permissions/location.d.ts +2 -0
  57. package/lib/typescript/module/permissions/mediaLibrary.d.ts +2 -0
  58. package/lib/typescript/module/permissions/notifications.d.ts +2 -0
  59. package/lib/typescript/module/permissions/photos.d.ts +2 -0
  60. package/lib/typescript/module/smsRetriever/index.d.ts +30 -0
  61. package/lib/typescript/module/specs/NativeSmsRetriever.d.ts +15 -0
  62. package/lib/typescript/module/sqlite/index.d.ts +10 -18
  63. package/package.json +101 -49
  64. package/lib/commonjs/sqlite/adapters/op.js +0 -43
  65. package/lib/commonjs/sqlite/adapters/rows.js +0 -33
  66. package/lib/commonjs/sqlite/adapters/storage.js +0 -50
  67. package/lib/commonjs/sqlite/adapters/sync.js +0 -45
  68. package/lib/commonjs/sqlite/nitro.js +0 -17
  69. package/lib/commonjs/sqlite/op.js +0 -18
  70. package/lib/commonjs/sqlite/quick.js +0 -14
  71. package/lib/commonjs/sqlite/storage.js +0 -14
  72. package/lib/module/sqlite/adapters/op.js +0 -38
  73. package/lib/module/sqlite/adapters/rows.js +0 -28
  74. package/lib/module/sqlite/adapters/storage.js +0 -46
  75. package/lib/module/sqlite/adapters/sync.js +0 -41
  76. package/lib/module/sqlite/nitro.js +0 -12
  77. package/lib/module/sqlite/op.js +0 -13
  78. package/lib/module/sqlite/quick.js +0 -9
  79. package/lib/module/sqlite/storage.js +0 -9
  80. package/lib/typescript/commonjs/sqlite/adapters/op.d.ts +0 -27
  81. package/lib/typescript/commonjs/sqlite/adapters/rows.d.ts +0 -7
  82. package/lib/typescript/commonjs/sqlite/adapters/storage.d.ts +0 -30
  83. package/lib/typescript/commonjs/sqlite/adapters/sync.d.ts +0 -31
  84. package/lib/typescript/commonjs/sqlite/nitro.d.ts +0 -7
  85. package/lib/typescript/commonjs/sqlite/op.d.ts +0 -8
  86. package/lib/typescript/commonjs/sqlite/quick.d.ts +0 -4
  87. package/lib/typescript/commonjs/sqlite/storage.d.ts +0 -4
  88. package/lib/typescript/module/sqlite/adapters/op.d.ts +0 -27
  89. package/lib/typescript/module/sqlite/adapters/rows.d.ts +0 -7
  90. package/lib/typescript/module/sqlite/adapters/storage.d.ts +0 -30
  91. package/lib/typescript/module/sqlite/adapters/sync.d.ts +0 -31
  92. package/lib/typescript/module/sqlite/nitro.d.ts +0 -7
  93. package/lib/typescript/module/sqlite/op.d.ts +0 -8
  94. package/lib/typescript/module/sqlite/quick.d.ts +0 -4
  95. package/lib/typescript/module/sqlite/storage.d.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority-technologies/mobile-core",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage and version checks. No UI.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -41,74 +41,114 @@
41
41
  "default": "./lib/commonjs/permissions/index.js"
42
42
  }
43
43
  },
44
- "./geolocation": {
44
+ "./permissions/camera": {
45
45
  "import": {
46
- "types": "./lib/typescript/module/geolocation/index.d.ts",
47
- "default": "./lib/module/geolocation/index.js"
46
+ "types": "./lib/typescript/module/permissions/camera.d.ts",
47
+ "default": "./lib/module/permissions/camera.js"
48
48
  },
49
49
  "require": {
50
- "types": "./lib/typescript/commonjs/geolocation/index.d.ts",
51
- "default": "./lib/commonjs/geolocation/index.js"
50
+ "types": "./lib/typescript/commonjs/permissions/camera.d.ts",
51
+ "default": "./lib/commonjs/permissions/camera.js"
52
52
  }
53
53
  },
54
- "./sqlite": {
54
+ "./permissions/photos": {
55
55
  "import": {
56
- "types": "./lib/typescript/module/sqlite/index.d.ts",
57
- "default": "./lib/module/sqlite/index.js"
56
+ "types": "./lib/typescript/module/permissions/photos.d.ts",
57
+ "default": "./lib/module/permissions/photos.js"
58
58
  },
59
59
  "require": {
60
- "types": "./lib/typescript/commonjs/sqlite/index.d.ts",
61
- "default": "./lib/commonjs/sqlite/index.js"
60
+ "types": "./lib/typescript/commonjs/permissions/photos.d.ts",
61
+ "default": "./lib/commonjs/permissions/photos.js"
62
62
  }
63
63
  },
64
- "./download": {
64
+ "./permissions/mediaLibrary": {
65
65
  "import": {
66
- "types": "./lib/typescript/module/download/index.d.ts",
67
- "default": "./lib/module/download/index.js"
66
+ "types": "./lib/typescript/module/permissions/mediaLibrary.d.ts",
67
+ "default": "./lib/module/permissions/mediaLibrary.js"
68
68
  },
69
69
  "require": {
70
- "types": "./lib/typescript/commonjs/download/index.d.ts",
71
- "default": "./lib/commonjs/download/index.js"
70
+ "types": "./lib/typescript/commonjs/permissions/mediaLibrary.d.ts",
71
+ "default": "./lib/commonjs/permissions/mediaLibrary.js"
72
+ }
73
+ },
74
+ "./permissions/location": {
75
+ "import": {
76
+ "types": "./lib/typescript/module/permissions/location.d.ts",
77
+ "default": "./lib/module/permissions/location.js"
78
+ },
79
+ "require": {
80
+ "types": "./lib/typescript/commonjs/permissions/location.d.ts",
81
+ "default": "./lib/commonjs/permissions/location.js"
82
+ }
83
+ },
84
+ "./permissions/contacts": {
85
+ "import": {
86
+ "types": "./lib/typescript/module/permissions/contacts.d.ts",
87
+ "default": "./lib/module/permissions/contacts.js"
88
+ },
89
+ "require": {
90
+ "types": "./lib/typescript/commonjs/permissions/contacts.d.ts",
91
+ "default": "./lib/commonjs/permissions/contacts.js"
92
+ }
93
+ },
94
+ "./permissions/calendar": {
95
+ "import": {
96
+ "types": "./lib/typescript/module/permissions/calendar.d.ts",
97
+ "default": "./lib/module/permissions/calendar.js"
98
+ },
99
+ "require": {
100
+ "types": "./lib/typescript/commonjs/permissions/calendar.d.ts",
101
+ "default": "./lib/commonjs/permissions/calendar.js"
72
102
  }
73
103
  },
74
- "./sqlite/op": {
104
+ "./permissions/notifications": {
75
105
  "import": {
76
- "types": "./lib/typescript/module/sqlite/op.d.ts",
77
- "default": "./lib/module/sqlite/op.js"
106
+ "types": "./lib/typescript/module/permissions/notifications.d.ts",
107
+ "default": "./lib/module/permissions/notifications.js"
78
108
  },
79
109
  "require": {
80
- "types": "./lib/typescript/commonjs/sqlite/op.d.ts",
81
- "default": "./lib/commonjs/sqlite/op.js"
110
+ "types": "./lib/typescript/commonjs/permissions/notifications.d.ts",
111
+ "default": "./lib/commonjs/permissions/notifications.js"
82
112
  }
83
113
  },
84
- "./sqlite/nitro": {
114
+ "./geolocation": {
85
115
  "import": {
86
- "types": "./lib/typescript/module/sqlite/nitro.d.ts",
87
- "default": "./lib/module/sqlite/nitro.js"
116
+ "types": "./lib/typescript/module/geolocation/index.d.ts",
117
+ "default": "./lib/module/geolocation/index.js"
88
118
  },
89
119
  "require": {
90
- "types": "./lib/typescript/commonjs/sqlite/nitro.d.ts",
91
- "default": "./lib/commonjs/sqlite/nitro.js"
120
+ "types": "./lib/typescript/commonjs/geolocation/index.d.ts",
121
+ "default": "./lib/commonjs/geolocation/index.js"
92
122
  }
93
123
  },
94
- "./sqlite/quick": {
124
+ "./sqlite": {
95
125
  "import": {
96
- "types": "./lib/typescript/module/sqlite/quick.d.ts",
97
- "default": "./lib/module/sqlite/quick.js"
126
+ "types": "./lib/typescript/module/sqlite/index.d.ts",
127
+ "default": "./lib/module/sqlite/index.js"
98
128
  },
99
129
  "require": {
100
- "types": "./lib/typescript/commonjs/sqlite/quick.d.ts",
101
- "default": "./lib/commonjs/sqlite/quick.js"
130
+ "types": "./lib/typescript/commonjs/sqlite/index.d.ts",
131
+ "default": "./lib/commonjs/sqlite/index.js"
102
132
  }
103
133
  },
104
- "./sqlite/storage": {
134
+ "./download": {
105
135
  "import": {
106
- "types": "./lib/typescript/module/sqlite/storage.d.ts",
107
- "default": "./lib/module/sqlite/storage.js"
136
+ "types": "./lib/typescript/module/download/index.d.ts",
137
+ "default": "./lib/module/download/index.js"
108
138
  },
109
139
  "require": {
110
- "types": "./lib/typescript/commonjs/sqlite/storage.d.ts",
111
- "default": "./lib/commonjs/sqlite/storage.js"
140
+ "types": "./lib/typescript/commonjs/download/index.d.ts",
141
+ "default": "./lib/commonjs/download/index.js"
142
+ }
143
+ },
144
+ "./smsRetriever": {
145
+ "import": {
146
+ "types": "./lib/typescript/module/smsRetriever/index.d.ts",
147
+ "default": "./lib/module/smsRetriever/index.js"
148
+ },
149
+ "require": {
150
+ "types": "./lib/typescript/commonjs/smsRetriever/index.d.ts",
151
+ "default": "./lib/commonjs/smsRetriever/index.js"
112
152
  }
113
153
  },
114
154
  "./package.json": "./package.json"
@@ -119,11 +159,20 @@
119
159
  "types": "./lib/typescript/commonjs/index.d.ts",
120
160
  "files": [
121
161
  "lib",
162
+ "android",
122
163
  "!**/__tests__",
123
164
  "!**/*.test.*",
124
165
  "!**/*.spec.*",
125
166
  "!**/*.map"
126
167
  ],
168
+ "codegenConfig": {
169
+ "name": "RNMobileCoreSmsRetrieverSpec",
170
+ "type": "modules",
171
+ "jsSrcsDir": "./src/specs",
172
+ "android": {
173
+ "javaPackageName": "com.webority.mobilecore.smsretriever"
174
+ }
175
+ },
127
176
  "scripts": {
128
177
  "build": "bob build",
129
178
  "clean": "rimraf lib",
@@ -134,40 +183,43 @@
134
183
  },
135
184
  "dependencies": {
136
185
  "axios": "^1.19.0",
137
- "libphonenumber-js": "^1.12.41",
138
- "windows-iana": "^5.1.0"
186
+ "libphonenumber-js": "^1.12.41"
139
187
  },
140
188
  "peerDependencies": {
141
- "@op-engineering/op-sqlite": "*",
142
189
  "expo": ">=57.0.0",
143
190
  "expo-application": ">=57.0.0",
191
+ "expo-calendar": ">=57.0.0",
192
+ "expo-camera": ">=57.0.0",
193
+ "expo-contacts": ">=57.0.0",
144
194
  "expo-file-system": ">=57.0.0",
145
195
  "expo-image-manipulator": ">=57.0.0",
196
+ "expo-image-picker": ">=57.0.0",
146
197
  "expo-location": ">=57.0.0",
198
+ "expo-media-library": ">=57.0.0",
147
199
  "expo-network": ">=57.0.0",
200
+ "expo-notifications": ">=57.0.0",
148
201
  "expo-secure-store": ">=57.0.0",
149
202
  "expo-sqlite": ">=57.0.0",
150
203
  "react": "^19.1.0",
151
- "react-native": ">=0.81.0",
152
- "react-native-nitro-sqlite": "*",
153
- "react-native-permissions": ">=4.0.0",
154
- "react-native-quick-sqlite": "*",
155
- "react-native-sqlite-storage": "*"
204
+ "react-native": ">=0.81.0"
156
205
  },
157
206
  "peerDependenciesMeta": {
158
- "@op-engineering/op-sqlite": {
207
+ "expo-calendar": {
208
+ "optional": true
209
+ },
210
+ "expo-camera": {
159
211
  "optional": true
160
212
  },
161
- "react-native-nitro-sqlite": {
213
+ "expo-contacts": {
162
214
  "optional": true
163
215
  },
164
- "react-native-permissions": {
216
+ "expo-image-picker": {
165
217
  "optional": true
166
218
  },
167
- "react-native-quick-sqlite": {
219
+ "expo-media-library": {
168
220
  "optional": true
169
221
  },
170
- "react-native-sqlite-storage": {
222
+ "expo-notifications": {
171
223
  "optional": true
172
224
  }
173
225
  },
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.adaptOpSqlite = void 0;
7
- /**
8
- * @op-engineering/op-sqlite. Shape verified against 18.1.4 rather than assumed:
9
- * `open({ name, location })` is synchronous and returns a DB whose `execute` is
10
- * ASYNC, and whose `rows` is already a plain array of objects rather than the
11
- * `{ _array, item() }` shape the older drivers use. Both differences are why it
12
- * cannot share the sync adapter.
13
- *
14
- * The REQUIRE lives in the driver entry point beside this file, never here.
15
- */
16
-
17
- const adaptOpSqlite = mod => ({
18
- open: async (name, options) => {
19
- const db = mod.open({
20
- name,
21
- location: options?.location
22
- });
23
- return {
24
- execute: async (sql, params) => {
25
- const result = await db.execute(sql, params ? [...params] : undefined);
26
- return {
27
- rows: result.rows ?? [],
28
- rowsAffected: result.rowsAffected ?? 0,
29
- insertId: result.insertId
30
- };
31
- },
32
- close: async () => {
33
- if (db.closeAsync) {
34
- await db.closeAsync();
35
- return;
36
- }
37
- db.close();
38
- }
39
- };
40
- }
41
- });
42
- exports.adaptOpSqlite = adaptOpSqlite;
43
- //# sourceMappingURL=op.js.map
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.rowsToArray = void 0;
7
- /**
8
- * Row shapes differ per driver: a plain array, `{ _array, length, item() }`, or
9
- * `{ length, item() }` alone. Every adapter normalises to a plain array here so
10
- * nothing driver-specific escapes into the Db layer.
11
- */
12
- const rowsToArray = rows => {
13
- if (Array.isArray(rows)) {
14
- return rows;
15
- }
16
- const shaped = rows;
17
- if (!shaped) {
18
- return [];
19
- }
20
- if (Array.isArray(shaped._array)) {
21
- return shaped._array;
22
- }
23
- if (typeof shaped.item === 'function' && typeof shaped.length === 'number') {
24
- const out = [];
25
- for (let i = 0; i < shaped.length; i += 1) {
26
- out.push(shaped.item(i));
27
- }
28
- return out;
29
- }
30
- return [];
31
- };
32
- exports.rowsToArray = rowsToArray;
33
- //# sourceMappingURL=rows.js.map
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.adaptSqliteStorage = void 0;
7
- var _rows = require("./rows.js");
8
- /** react-native-sqlite-storage: callback-based by default, promise-based once
9
- * `enablePromise(true)` is called; `executeSql` resolves an array whose first
10
- * element is the result set. */
11
-
12
- /**
13
- * Adapt an already-required `react-native-sqlite-storage` module. Exported for
14
- * the same reason as the filesystem adapters: the library cannot name a package
15
- * the app did not install without breaking the app's bundle.
16
- */
17
- const adaptSqliteStorage = mod => ({
18
- open: async (name, options) => {
19
- // This is a GLOBAL side effect, not a per-connection setting: the vendor
20
- // implements it by rewriting SQLitePlugin and SQLiteFactory prototype
21
- // methods. An app that also uses react-native-sqlite-storage directly in
22
- // callback mode will find its own callbacks converted to promises from the
23
- // moment this adapter opens a database. Unavoidable, since the adapter
24
- // cannot work otherwise, and worth knowing before mixing the two.
25
- mod.enablePromise(true);
26
- const db = await mod.openDatabase({
27
- name,
28
- location: options?.location ?? 'default'
29
- });
30
- return {
31
- execute: async (sql, params) => {
32
- const [result] = await db.executeSql(sql, params ? [...params] : undefined);
33
- return {
34
- rows: (0, _rows.rowsToArray)(result.rows),
35
- rowsAffected: result.rowsAffected ?? 0,
36
- insertId: result.insertId
37
- };
38
- },
39
- // Not `() => db.close()`: in promise mode this driver resolves the
40
- // success-callback ARGUMENTS array rather than void, so returning it
41
- // directly would make SqliteDatabase.close() resolve an array while
42
- // typed as void. Awaiting and discarding makes the type honest.
43
- close: async () => {
44
- await db.close();
45
- }
46
- };
47
- }
48
- });
49
- exports.adaptSqliteStorage = adaptSqliteStorage;
50
- //# sourceMappingURL=storage.js.map
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.adaptSyncSqlite = void 0;
7
- var _rows = require("./rows.js");
8
- /**
9
- * nitro-sqlite and quick-sqlite share one synchronous shape, so one adapter
10
- * serves both. The REQUIRE lives in the driver entry points beside this file,
11
- * never here and never in the core: Metro resolves requires statically, so a
12
- * package named anywhere reachable becomes mandatory for every consumer.
13
- */
14
-
15
- /** Shape shared by react-native-nitro-sqlite and react-native-quick-sqlite: a
16
- * synchronous `open({ name, location })` whose `db.execute()` and `db.close()`
17
- * are also synchronous. Both are wrapped in Promise.resolve to fit SqliteDriver. */
18
-
19
- /**
20
- * Adapt an already-required nitro-sqlite or quick-sqlite module. Both expose the
21
- * same synchronous shape. Exported so an app on quick-sqlite can inject it.
22
- */
23
- const adaptSyncSqlite = mod => ({
24
- open: async (name, options) => {
25
- const db = mod.open({
26
- name,
27
- location: options?.location
28
- });
29
- return {
30
- execute: async (sql, params) => {
31
- const result = db.execute(sql, params ? [...params] : undefined);
32
- return {
33
- rows: (0, _rows.rowsToArray)(result.rows),
34
- rowsAffected: result.rowsAffected ?? 0,
35
- insertId: result.insertId
36
- };
37
- },
38
- close: async () => {
39
- db.close();
40
- }
41
- };
42
- }
43
- });
44
- exports.adaptSyncSqlite = adaptSyncSqlite;
45
- //# sourceMappingURL=sync.js.map
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.nitroSqliteDriver = void 0;
7
- var _sync = require("./adapters/sync.js");
8
- /**
9
- * The one place `react-native-nitro-sqlite` is named. Import this module only if
10
- * you installed it; nothing else in the library reaches it.
11
- */
12
- const nitroSqliteDriver = () => {
13
- const mod = require('react-native-nitro-sqlite');
14
- return (0, _sync.adaptSyncSqlite)(mod.default ?? mod);
15
- };
16
- exports.nitroSqliteDriver = nitroSqliteDriver;
17
- //# sourceMappingURL=nitro.js.map
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.opSqliteDriver = void 0;
7
- var _op = require("./adapters/op.js");
8
- /**
9
- * The one place `@op-engineering/op-sqlite` is named. It is the driver we
10
- * recommend: the most actively maintained of the four, and the only one already
11
- * proven in one of our apps. Import this module only if you installed it.
12
- */
13
- const opSqliteDriver = () => {
14
- const mod = require('@op-engineering/op-sqlite');
15
- return (0, _op.adaptOpSqlite)(mod.default ?? mod);
16
- };
17
- exports.opSqliteDriver = opSqliteDriver;
18
- //# sourceMappingURL=op.js.map
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.quickSqliteDriver = void 0;
7
- var _sync = require("./adapters/sync.js");
8
- /** The one place `react-native-quick-sqlite` is named. */
9
- const quickSqliteDriver = () => {
10
- const mod = require('react-native-quick-sqlite');
11
- return (0, _sync.adaptSyncSqlite)(mod.default ?? mod);
12
- };
13
- exports.quickSqliteDriver = quickSqliteDriver;
14
- //# sourceMappingURL=quick.js.map
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.sqliteStorageDriver = void 0;
7
- var _storage = require("./adapters/storage.js");
8
- /** The one place `react-native-sqlite-storage` is named. */
9
- const sqliteStorageDriver = () => {
10
- const mod = require('react-native-sqlite-storage');
11
- return (0, _storage.adaptSqliteStorage)(mod.default ?? mod);
12
- };
13
- exports.sqliteStorageDriver = sqliteStorageDriver;
14
- //# sourceMappingURL=storage.js.map
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * @op-engineering/op-sqlite. Shape verified against 18.1.4 rather than assumed:
5
- * `open({ name, location })` is synchronous and returns a DB whose `execute` is
6
- * ASYNC, and whose `rows` is already a plain array of objects rather than the
7
- * `{ _array, item() }` shape the older drivers use. Both differences are why it
8
- * cannot share the sync adapter.
9
- *
10
- * The REQUIRE lives in the driver entry point beside this file, never here.
11
- */
12
-
13
- export const adaptOpSqlite = mod => ({
14
- open: async (name, options) => {
15
- const db = mod.open({
16
- name,
17
- location: options?.location
18
- });
19
- return {
20
- execute: async (sql, params) => {
21
- const result = await db.execute(sql, params ? [...params] : undefined);
22
- return {
23
- rows: result.rows ?? [],
24
- rowsAffected: result.rowsAffected ?? 0,
25
- insertId: result.insertId
26
- };
27
- },
28
- close: async () => {
29
- if (db.closeAsync) {
30
- await db.closeAsync();
31
- return;
32
- }
33
- db.close();
34
- }
35
- };
36
- }
37
- });
38
- //# sourceMappingURL=op.js.map
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * Row shapes differ per driver: a plain array, `{ _array, length, item() }`, or
5
- * `{ length, item() }` alone. Every adapter normalises to a plain array here so
6
- * nothing driver-specific escapes into the Db layer.
7
- */
8
- export const rowsToArray = rows => {
9
- if (Array.isArray(rows)) {
10
- return rows;
11
- }
12
- const shaped = rows;
13
- if (!shaped) {
14
- return [];
15
- }
16
- if (Array.isArray(shaped._array)) {
17
- return shaped._array;
18
- }
19
- if (typeof shaped.item === 'function' && typeof shaped.length === 'number') {
20
- const out = [];
21
- for (let i = 0; i < shaped.length; i += 1) {
22
- out.push(shaped.item(i));
23
- }
24
- return out;
25
- }
26
- return [];
27
- };
28
- //# sourceMappingURL=rows.js.map
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- import { rowsToArray } from "./rows.js";
4
-
5
- /** react-native-sqlite-storage: callback-based by default, promise-based once
6
- * `enablePromise(true)` is called; `executeSql` resolves an array whose first
7
- * element is the result set. */
8
-
9
- /**
10
- * Adapt an already-required `react-native-sqlite-storage` module. Exported for
11
- * the same reason as the filesystem adapters: the library cannot name a package
12
- * the app did not install without breaking the app's bundle.
13
- */
14
- export const adaptSqliteStorage = mod => ({
15
- open: async (name, options) => {
16
- // This is a GLOBAL side effect, not a per-connection setting: the vendor
17
- // implements it by rewriting SQLitePlugin and SQLiteFactory prototype
18
- // methods. An app that also uses react-native-sqlite-storage directly in
19
- // callback mode will find its own callbacks converted to promises from the
20
- // moment this adapter opens a database. Unavoidable, since the adapter
21
- // cannot work otherwise, and worth knowing before mixing the two.
22
- mod.enablePromise(true);
23
- const db = await mod.openDatabase({
24
- name,
25
- location: options?.location ?? 'default'
26
- });
27
- return {
28
- execute: async (sql, params) => {
29
- const [result] = await db.executeSql(sql, params ? [...params] : undefined);
30
- return {
31
- rows: rowsToArray(result.rows),
32
- rowsAffected: result.rowsAffected ?? 0,
33
- insertId: result.insertId
34
- };
35
- },
36
- // Not `() => db.close()`: in promise mode this driver resolves the
37
- // success-callback ARGUMENTS array rather than void, so returning it
38
- // directly would make SqliteDatabase.close() resolve an array while
39
- // typed as void. Awaiting and discarding makes the type honest.
40
- close: async () => {
41
- await db.close();
42
- }
43
- };
44
- }
45
- });
46
- //# sourceMappingURL=storage.js.map
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- import { rowsToArray } from "./rows.js";
4
-
5
- /**
6
- * nitro-sqlite and quick-sqlite share one synchronous shape, so one adapter
7
- * serves both. The REQUIRE lives in the driver entry points beside this file,
8
- * never here and never in the core: Metro resolves requires statically, so a
9
- * package named anywhere reachable becomes mandatory for every consumer.
10
- */
11
-
12
- /** Shape shared by react-native-nitro-sqlite and react-native-quick-sqlite: a
13
- * synchronous `open({ name, location })` whose `db.execute()` and `db.close()`
14
- * are also synchronous. Both are wrapped in Promise.resolve to fit SqliteDriver. */
15
-
16
- /**
17
- * Adapt an already-required nitro-sqlite or quick-sqlite module. Both expose the
18
- * same synchronous shape. Exported so an app on quick-sqlite can inject it.
19
- */
20
- export const adaptSyncSqlite = mod => ({
21
- open: async (name, options) => {
22
- const db = mod.open({
23
- name,
24
- location: options?.location
25
- });
26
- return {
27
- execute: async (sql, params) => {
28
- const result = db.execute(sql, params ? [...params] : undefined);
29
- return {
30
- rows: rowsToArray(result.rows),
31
- rowsAffected: result.rowsAffected ?? 0,
32
- insertId: result.insertId
33
- };
34
- },
35
- close: async () => {
36
- db.close();
37
- }
38
- };
39
- }
40
- });
41
- //# sourceMappingURL=sync.js.map
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- import { adaptSyncSqlite } from "./adapters/sync.js";
4
- /**
5
- * The one place `react-native-nitro-sqlite` is named. Import this module only if
6
- * you installed it; nothing else in the library reaches it.
7
- */
8
- export const nitroSqliteDriver = () => {
9
- const mod = require('react-native-nitro-sqlite');
10
- return adaptSyncSqlite(mod.default ?? mod);
11
- };
12
- //# sourceMappingURL=nitro.js.map
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- import { adaptOpSqlite } from "./adapters/op.js";
4
- /**
5
- * The one place `@op-engineering/op-sqlite` is named. It is the driver we
6
- * recommend: the most actively maintained of the four, and the only one already
7
- * proven in one of our apps. Import this module only if you installed it.
8
- */
9
- export const opSqliteDriver = () => {
10
- const mod = require('@op-engineering/op-sqlite');
11
- return adaptOpSqlite(mod.default ?? mod);
12
- };
13
- //# sourceMappingURL=op.js.map