cradova 1.0.1 → 1.0.2

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 (66) hide show
  1. package/README.md +53 -19
  2. package/dist/index.d.ts +26 -0
  3. package/dist/index.js +468 -0
  4. package/dist/rolled-cradova.js +2366 -0
  5. package/dist/scripts/JsonDB.d.ts +287 -0
  6. package/dist/scripts/JsonDB.js +633 -0
  7. package/dist/scripts/Router.d.ts +5 -0
  8. package/dist/scripts/Router.js +170 -0
  9. package/dist/scripts/Screen.d.ts +51 -0
  10. package/dist/scripts/Screen.js +107 -0
  11. package/dist/scripts/ajax.d.ts +28 -0
  12. package/dist/scripts/ajax.js +63 -0
  13. package/dist/scripts/fns.d.ts +84 -0
  14. package/dist/scripts/fns.js +307 -0
  15. package/dist/scripts/init.d.ts +1 -0
  16. package/dist/scripts/init.js +25 -0
  17. package/dist/scripts/loadCss.d.ts +1 -0
  18. package/dist/scripts/loadCss.js +194 -0
  19. package/dist/scripts/memory.d.ts +12 -0
  20. package/dist/scripts/memory.js +46 -0
  21. package/dist/scripts/store.d.ts +12 -0
  22. package/dist/scripts/store.js +64 -0
  23. package/dist/scripts/swipe.d.ts +1 -0
  24. package/dist/scripts/swipe.js +114 -0
  25. package/dist/scripts/track.d.ts +12 -0
  26. package/dist/scripts/track.js +150 -0
  27. package/dist/scripts/widget.d.ts +8 -0
  28. package/dist/scripts/widget.js +21 -0
  29. package/dist/types.d.ts +12 -0
  30. package/dist/types.js +1 -0
  31. package/index.ts +336 -147
  32. package/package.json +18 -11
  33. package/scripts/JsonDB.ts +134 -130
  34. package/scripts/Router.ts +94 -24
  35. package/scripts/Screen.ts +99 -39
  36. package/scripts/{littleAxios.ts → ajax.ts} +44 -6
  37. package/scripts/fns.ts +341 -0
  38. package/scripts/init.ts +11 -4
  39. package/scripts/loadCss.ts +194 -0
  40. package/scripts/memory.ts +44 -0
  41. package/scripts/store.ts +32 -21
  42. package/scripts/style.css +189 -0
  43. package/scripts/swipe.ts +4 -4
  44. package/scripts/track.ts +171 -0
  45. package/scripts/widget.ts +17 -15
  46. package/tsconfig.json +18 -98
  47. package/types.ts +15 -1
  48. package/{online-only-after-initial-cache.ts → workers/online-only-after-initial-cache.ts} +14 -11
  49. package/{service-worker.ts → workers/service-worker.ts} +17 -10
  50. package/docs/README.md +0 -0
  51. package/manifest.json +0 -38
  52. package/scripts/Metrics.ts +0 -66
  53. package/scripts/animate.ts +0 -55
  54. package/scripts/createState.ts +0 -27
  55. package/scripts/css.ts +0 -47
  56. package/scripts/dispatcher.ts +0 -158
  57. package/scripts/fetcher.ts +0 -31
  58. package/scripts/file-system.ts +0 -173
  59. package/scripts/fullscreen.ts +0 -21
  60. package/scripts/localStorage.ts +0 -19
  61. package/scripts/media.ts +0 -51
  62. package/scripts/promptbeforeleave.ts +0 -10
  63. package/scripts/reuse.ts +0 -79
  64. package/scripts/speaker.ts +0 -25
  65. package/scripts/uuid.ts +0 -10
  66. package/types.d.ts +0 -0
@@ -0,0 +1,287 @@
1
+ /**
2
+ * JSON DB DataBase MIT Licence © 2022
3
+ * ************************************
4
+ * Created by Friday Candour @uiedbooker
5
+ * email > fridaymaxtour@gmail.com
6
+ * github > www.github.com/FridayCandour
7
+ * telegram > @uiedbooker
8
+ * JSONDB @version 1.0.0
9
+ * */
10
+ export declare const JSONDBversion = "1.0.0";
11
+ export declare class JSONDBTableWrapper {
12
+ put: (name: any, value: any) => Promise<void>;
13
+ get: (name: any) => Promise<unknown>;
14
+ validator: (incoming: any, tables: any) => {};
15
+ self: any;
16
+ keys: any;
17
+ constructor(self: unknown, keys?: any);
18
+ /**
19
+ * Save with relations
20
+ * ---------------------
21
+ * @type .saveWithRelations(target table, schema, schema | schema[]) => Promise(object)
22
+ * @example
23
+ * // single relation
24
+ await PollTable.saveWithRelations(MessageTable, Poll, message);
25
+ // arrays of relations
26
+ await PollTable.saveWithRelations(MessageTable, Poll, allMessages);
27
+ */
28
+ saveWithRelations(table: any, incoming: any, relations: any[]): Promise<any>;
29
+ /**
30
+ * Save table into a Jsondb instance
31
+ * -----------------------------
32
+ * @type .save(schema)=> Promise(object)
33
+ * @example
34
+ await PollTable.save(poll)
35
+ */
36
+ save(incoming: any): Promise<any>;
37
+ /**
38
+ * Save table into a Jsondb instance
39
+ * -----------------------------
40
+ * @type .remove(schema)=> Promise(object)
41
+ * @example
42
+ await PollTable.remove(poll)
43
+ */
44
+ remove(entity: {
45
+ index: string | number;
46
+ }): Promise<boolean>;
47
+ /**
48
+ * Save table into a Jsondb instance
49
+ * -----------------------------
50
+ * @type .count(schema)=> Promise(number)
51
+ * @example
52
+ await PollTable.count(poll)
53
+ */
54
+ count(): Promise<any>;
55
+ /**
56
+ * Save table into a Jsondb instance
57
+ * -----------------------------
58
+ * @type .getAll()=> Promise(object[])
59
+ * @example
60
+ await PollTable.getAll()
61
+ */
62
+ getAll(): Promise<any>;
63
+ /**
64
+ * get entities with any of the values specifiled from a Jsondb instance
65
+ * -----------------------------
66
+ * @type .getWhereAny({prop: value}, number | undefind)=> Promise(object)
67
+ * @example
68
+ await PollTable.getWhereAny({name: "friday", age: 121, class: "senior"}) // gets all
69
+ await PollTable.getWhereAny({email: "fridaymaxtour@gmail.com"}, 2) // gets 2 if they are up to two
70
+ */
71
+ getWhereAny(props: {
72
+ [s: string]: unknown;
73
+ } | ArrayLike<unknown>, number: number): Promise<any[]>;
74
+ /**
75
+ * get entities with the given prop of type "string" where the values specifiled is included
76
+ * -----------------------------
77
+ * @type .getWhereAnyPropsIncludes({prop: value}, number | undefind)=> Promise(object)
78
+ *
79
+ * @example prop must be type string!
80
+ *
81
+ await PollTable.getWhereAnyPropsIncludes({name: "fri"}) // gets all
82
+ await PollTable.getWhereAnyPropsIncludes({name: "fri"}, 2) // gets 2 if they are up to two
83
+ */
84
+ getWhereAnyPropsIncludes(props: {
85
+ [s: string]: unknown;
86
+ } | ArrayLike<unknown>, number: number): Promise<any[]>;
87
+ /**
88
+ * get an entity with the values specifiled from a Jsondb instance
89
+ * -----------------------------
90
+ * @type .getOne({prop: value})=> Promise(object)
91
+ * @example
92
+
93
+ await PollTable.getOne({email: "fridaymaxtour@gamail.com"}) // gets one
94
+
95
+ */
96
+ getOne(props: ArrayLike<unknown> | {
97
+ [s: string]: unknown;
98
+ }): Promise<any>;
99
+ }
100
+ /**
101
+ * Create a new JSONDB object
102
+ *------------------------
103
+ * @class
104
+
105
+ * const database = new JSONDB()
106
+ *
107
+ * Creates a new JSONDB object
108
+ *
109
+ * .
110
+ * */
111
+ export declare class JSONDB {
112
+ DB_NAME: string;
113
+ username: string;
114
+ encrypted: boolean;
115
+ initialised: boolean;
116
+ time_created: string;
117
+ version: string;
118
+ last_access_time: string;
119
+ visuality: string;
120
+ Entities: Record<string, any>;
121
+ tables: Record<string, any[]>;
122
+ password: any;
123
+ constructor();
124
+ getDB(name: string): Promise<any>;
125
+ /**
126
+ * Schema constructor for Jsondb
127
+ * -----------------------------
128
+ *
129
+ * name @type string
130
+ *
131
+ * columns @type object {
132
+ *
133
+ * type > @type any of number > string > boolean > blob and must be specified
134
+ *
135
+ * nullable @type bolean true > false default false
136
+ *
137
+ * unique @type bolean true > false default false
138
+ *
139
+ * }
140
+ *
141
+ * relations @type object {
142
+ *
143
+ * target: entity schema @type object,
144
+ *
145
+ * attachment_name: @type string,
146
+ *
147
+ * type : @type string should be "many" or "one"
148
+ *
149
+ * }
150
+ *
151
+ *
152
+ *
153
+ * @example
154
+ *
155
+ * const MessageSchema = database.schema({
156
+ name: "Message",
157
+ columns: {
158
+ vote: {
159
+ type: "number",
160
+ },
161
+ time: {
162
+ type: "string",
163
+ nullable: true,
164
+ },
165
+ value: {
166
+ type: "string",
167
+ },
168
+ },
169
+ });
170
+ *
171
+ * const PollSchema = new JSONDB.schema({
172
+ name: "Poll",
173
+ columns: {
174
+ value: {
175
+ type: "varchar",
176
+ },
177
+ },
178
+ relations: {
179
+ Message: {
180
+ target: Message,
181
+ type: "many-to-one",
182
+ },
183
+ },
184
+ });
185
+ */
186
+ schema(schema_configuration_object: {
187
+ columns: any;
188
+ relations?: any;
189
+ name: any;
190
+ }): {
191
+ name: any;
192
+ columns: Record<string, any>;
193
+ base_name?: string | undefined;
194
+ last_index?: number | undefined;
195
+ relations?: Record<string, any> | undefined;
196
+ };
197
+ /**
198
+ * Create a new JSONDB instance
199
+ *------------------------
200
+ * @example
201
+ * // creates a JSONDB object
202
+ * const Database = new JSONDB()
203
+ * // database configuration object
204
+ * const config = {
205
+ DB_NAME: "my db",
206
+ password: "password",
207
+ username: "jsondb_username",
208
+ encrypted: false,
209
+ }
210
+ // Creates a new JSONDB instance
211
+ * Database.init(config)
212
+ * */
213
+ init(config: {
214
+ name: string;
215
+ password: string;
216
+ username: string;
217
+ encrypted: boolean;
218
+ }): Promise<void>;
219
+ /**
220
+ * Create secure connection a Jsondb instance
221
+ * -----------------------------
222
+ * @example
223
+ *
224
+ * const details = {
225
+ password: "password",
226
+ username: "jsondb_username",
227
+ };
228
+ const connection = await database.createJSONDBConnection(details);
229
+ */
230
+ createJSONDBConnection(details: {
231
+ username: string;
232
+ password: any;
233
+ }): Promise<{
234
+ Entities: any;
235
+ keys: any;
236
+ /**
237
+ * Get a table from JSONDB
238
+ *------------------------
239
+ * @example
240
+ *
241
+ *
242
+ const details = {
243
+ password: "password",
244
+ username: "jsondb_username",
245
+ };
246
+ // getting connection instance into JSONDB
247
+ const connection = await database.createJSONDBConnection(details);
248
+ // getting a table
249
+ const MessageTable = connection.getTable("Message");
250
+ * */
251
+ getTable(table_name: string): JSONDBTableWrapper | undefined;
252
+ }>;
253
+ validateRelations(relations: {
254
+ [x: string]: any;
255
+ }): void;
256
+ validateColumns(columns: {
257
+ [x: string]: any;
258
+ }): void;
259
+ /**
260
+ * Assemble Entities into Jsondb
261
+ * -----------------------------
262
+ * @example
263
+ *
264
+ * const MessageSchema = database.schema({
265
+ name: "Message",
266
+ columns: {
267
+ vote: {
268
+ type: "number",
269
+ },
270
+ time: {
271
+ type: "string",
272
+ nullable: true,
273
+ },
274
+ value: {
275
+ type: "string",
276
+ },
277
+ },
278
+ });
279
+
280
+ database.assemble([MessageSchema]);
281
+ *
282
+ */
283
+ assemble(allEntities: any[]): Promise<void>;
284
+ }
285
+ /**
286
+ * @exports
287
+ */