@alwatr/nitrobase-types 7.10.1 → 9.1.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 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,oBAAY,MAAM;IAChB;;OAEG;IACH,MAAM,MAAM;IAEZ;;OAEG;IACH,aAAa,MAAM;IAEnB;;OAEG;IACH,QAAQ,MAAM;IAEd;;OAEG;IACH,OAAO,MAAM;IAEb;;OAEG;IACH,QAAQ,MAAM;IAEd;;;OAGG;IACH,MAAM,OAAO;CACd;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB;;OAEG;IACH,QAAQ,QAAQ;IAEhB;;OAEG;IACH,UAAU,QAAQ;IAElB;;OAEG;IACH,oBAAoB,QAAQ;CAC7B;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,IAAI,QAAQ;CACb;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAExC;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAM/B,CAAC;AAE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OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,IAAI;IAClE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI,gBAAgB,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
package/dist/main.js ADDED
@@ -0,0 +1,5 @@
1
+ /* 📦 @alwatr/nitrobase-types v9.1.0 */
2
+ var f;((a)=>{a.Public="p";a.Authenticated="a";a.Managers="m";a.PerUser="u";a.PerOwner="o";a.Secret=".s"})(f||={});var h;((b)=>{b.Document="doc";b.Collection="col";b.AppendOnlyCollection="aoc"})(h||={});var j;((d)=>d.Json="asj")(j||={});export{h as StoreFileType,j as StoreFileExtension,f as Region};
3
+
4
+ //# debugId=254008C60655E0FB64756E2164756E21
5
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": [
5
+ "\n// *** Nitrobase File ***\n\n/**\n * The subdirectory location for each nitrobase file.\n */\nexport enum Region {\n /**\n * Nitrobase file location that can be accessed by anyone. e.g. Product list.\n */\n Public = 'p',\n\n /**\n * Nitrobase file location that can be accessed by authenticated users. e.g. Special price list for dealers\n */\n Authenticated = 'a',\n\n /**\n * Nitrobase file location that can be accessed by admins and managers only. e.g. User list.\n */\n Managers = 'm',\n\n /**\n * Nitrobase file location specific to each user id. Can be accessed using the user token. e.g. User profile and User orders.\n */\n PerUser = 'u',\n\n /**\n * Nitrobase file location specific to each owner id. e.g. user token or device id.\n */\n PerOwner = 'o',\n\n /**\n * Private nitrobase file location. Cannot be accessed publicly and must be directly accessed by the admin API only.\n * e.g. User secret data.\n */\n Secret = '.s',\n}\n\n/**\n * The different types of nitrobase file formats.\n */\nexport enum StoreFileType {\n /**\n * Type used for `single document` storage.\n */\n Document = 'doc',\n\n /**\n * Type used for storing a `collection` of simpler documents, referred to as collection items.\n */\n Collection = 'col',\n\n /**\n * Type used for storing a collection of items that are `append-only`.\n */\n AppendOnlyCollection = 'aoc',\n}\n\n/**\n * Nitrobase file extension (encode).\n */\nexport enum StoreFileExtension {\n /**\n * AlwatrNitrobase JSON format.\n */\n Json = 'asj',\n}\n\n/**\n * Unique identifier of the nitrobase file.\n *\n * Get from user for select nitrobase file.\n */\nexport type StoreFileId = {\n /**\n * The nitrobase filename.\n */\n readonly name: string;\n\n /**\n * The region where the nitrobase file is located.\n * @see {@link Region}\n */\n readonly region: Region;\n\n /**\n * The owner of the nitrobase file.\n * If the region is `Region.PerX` then this is the user id, device id, or token id etc.\n * @see {@link Region}\n *\n */\n readonly ownerId?: string;\n\n /**\n * The schema version for easy migration by user.\n * If not specified, the default value is `1`.\n */\n schemaVer?: number;\n};\n\n/**\n * Nitrobase the complete metadata of the file in the root database.\n */\nexport type StoreFileStat = StoreFileId & {\n /**\n * The type of the nitrobase file.\n *\n * @see {@link StoreFileType}\n */\n readonly type: StoreFileType;\n\n /**\n * The extension used for the nitrobase file.\n *\n * @see {@link StoreFileExtension}\n */\n readonly extension?: StoreFileExtension;\n\n /**\n * The save debounce timeout in milliseconds for minimal disk I/O usage.\n * This is used to limit the frequency of disk writes for performance reasons.\n * The recommended value is `40`.\n * If not specified, the default value get from AlwatrNitrobase `defaultChangeDebounce`.\n */\n readonly changeDebounce?: number;\n\n /**\n * The name of the migration process.\n * This is used to migrate the nitrobase file to a new schema version.\n */\n readonly migrateName?: string;\n\n /**\n * The time-to-live (TTL) of the nitrobase file in memory.\n */\n // readonly ttl?: number;\n};\n\n/**\n * Represents the metadata of a nitrobase file.\n */\nexport type StoreFileMeta = StoreFileStat & {\n /**\n * Nitrobase file format version.\n */\n fv: number;\n\n /**\n * The revision number of the nitrobase file.\n *\n * This number is incremented every time the nitrobase file is updated.\n */\n rev: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was created.\n */\n readonly created: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was updated.\n */\n updated: number;\n\n /**\n * Last auto increment id.\n */\n lastAutoId?: number;\n\n /**\n * The extra metadata for the nitrobase file.\n */\n extra: JsonObject;\n};\n\nexport type StoreFileData<T extends JsonObject = JsonObject> = T;\n\n/**\n * Represents the context of a nitrobase file.\n * @template TData The type of the data content in the nitrobase file.\n */\nexport type StoreFileContext<TData extends JsonObject = JsonObject> = {\n /**\n * The status of the nitrobase file.\n *\n * if false, the Alwatr nitrobase throws an error.\n */\n readonly ok: true;\n\n /**\n * The metadata of the nitrobase file.\n * @see {@link StoreFileMeta}\n */\n readonly meta: StoreFileMeta;\n\n /**\n * The data content of the nitrobase file.\n */\n readonly data: TData;\n};\n\n/**\n * Nitrobase file meta only content type.\n */\nexport type StoreFileMetaOnlyContext = Omit<StoreFileContext<never>, 'data'>;\n\n// *** Documents ***\n\n/**\n * StoreFileContext for document type.\n */\nexport type DocumentContext<T extends JsonObject = JsonObject> = StoreFileContext<T>;\n\n// *** Collections ***\n\n/**\n * The metadata of an item in a collection.\n */\nexport type CollectionItemMeta = {\n /**\n * The unique identifier for the collection item.\n */\n readonly id: string | number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the collection item was created.\n */\n readonly created: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the collection item was updated.\n */\n updated: number;\n\n /**\n * The revision number for the collection item.\n *\n * This number is incremented each time the item is updated.\n */\n rev: number;\n};\n\n/**\n * Collection item context type.\n */\nexport type CollectionItem<TData extends JsonObject = JsonObject> = {\n /**\n * Collection item's metadata.\n */\n readonly meta: CollectionItemMeta;\n\n /**\n * Collection item data.\n */\n readonly data: TData;\n};\n\n/**\n * Collection item context type.\n */\nexport type CollectionContext<T extends JsonObject = JsonObject> = StoreFileContext<DictionaryReq<CollectionItem<T>>>;\n\nexport type AlwatrAuth = {\n userId: string;\n userToken: string;\n};\n"
6
+ ],
7
+ "mappings": ";AAMO,IAAK,GAAL,CAAK,IAAL,CAIL,SAAS,IAKT,gBAAgB,IAKhB,WAAW,IAKX,UAAU,IAKV,WAAW,IAMX,SAAS,OA9BC,QAoCL,IAAK,GAAL,CAAK,IAAL,CAIL,WAAW,MAKX,aAAa,MAKb,uBAAuB,QAdb,QAoBL,IAAK,GAAL,CAAK,IAIV,OAAO,OAJG",
8
+ "debugId": "254008C60655E0FB64756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,29 +1,61 @@
1
1
  {
2
2
  "name": "@alwatr/nitrobase-types",
3
+ "version": "9.1.0",
3
4
  "description": "Nitrobase is a blazingly fast, lightweight database built on JSON. It stores data entirely in memory for lightning-quick access, while also providing a JSON file backup for persistence. You can easily serve your data over the web using our high-performance accelerated Nginx server.",
4
- "version": "7.10.1",
5
- "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
- "bugs": "https://github.com/Alwatr/nitrobase/issues",
7
- "dependencies": {
8
- "@alwatr/type-helper": "^7.0.0"
9
- },
10
- "devDependencies": {
11
- "@alwatr/nanolib": "^7.3.4",
12
- "@types/node": "^24.10.4",
13
- "typescript": "^5.9.3"
5
+ "license": "MPL-2.0",
6
+ "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Alwatr/alwatr",
11
+ "directory": "pkg/nitrobase-old/types"
14
12
  },
13
+ "homepage": "https://github.com/Alwatr/alwatr/tree/main/pkg/nitrobase-old/types#readme",
14
+ "bugs": "https://github.com/Alwatr/alwatr/issues",
15
15
  "exports": {
16
16
  ".": {
17
17
  "types": "./dist/main.d.ts",
18
- "import": "./dist/main.mjs",
19
- "require": "./dist/main.cjs"
18
+ "import": "./dist/main.js",
19
+ "default": "./dist/main.js"
20
20
  }
21
21
  },
22
+ "sideEffects": false,
23
+ "dependencies": {
24
+ "@alwatr/type-helper": "9.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@alwatr/nano-build": "9.1.0",
28
+ "@alwatr/tsconfig-base": "9.1.0",
29
+ "@alwatr/type-helper": "workspace:*",
30
+ "@types/node": "^25.5.0",
31
+ "typescript": "^6.0.2"
32
+ },
33
+ "scripts": {
34
+ "b": "bun run build",
35
+ "build": "bun run build:ts && bun run build:es",
36
+ "build:es": "nano-build --preset=module src/main.ts",
37
+ "build:ts": "tsc --build",
38
+ "cl": "bun run clean",
39
+ "clean": "rm -rfv dist *.tsbuildinfo",
40
+ "format": "prettier --write \"src/**/*.ts\"",
41
+ "lint": "eslint src/ --ext .ts",
42
+ "t": "bun run test",
43
+ "test": "ALWATR_DEBUG=0 bun test",
44
+ "w": "bun run watch",
45
+ "watch": "bun run watch:ts & bun run watch:es",
46
+ "watch:es": "bun run build:es --watch",
47
+ "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
48
+ },
22
49
  "files": [
23
- "**/*.{js,mjs,cjs,map,d.ts,html,md}",
24
- "!demo/**/*"
50
+ "dist",
51
+ "src/**/*.ts",
52
+ "!src/**/*.test.ts",
53
+ "README.md",
54
+ "LICENSE"
25
55
  ],
26
- "homepage": "https://github.com/Alwatr/nitrobase#readme",
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
27
59
  "keywords": [
28
60
  "alwatr",
29
61
  "data",
@@ -37,34 +69,6 @@
37
69
  "storage",
38
70
  "typescript"
39
71
  ],
40
- "license": "MPL-2.0",
41
- "main": "./dist/main.cjs",
42
- "module": "./dist/main.mjs",
43
72
  "prettier": "@alwatr/nanolib/prettier-config",
44
- "publishConfig": {
45
- "access": "public"
46
- },
47
- "repository": {
48
- "type": "git",
49
- "url": "https://github.com/Alwatr/nitrobase",
50
- "directory": "packages/types"
51
- },
52
- "scripts": {
53
- "b": "yarn run build",
54
- "build": "yarn run build:ts & yarn run build:es",
55
- "build:es": "nano-build --preset=module",
56
- "build:ts": "tsc --build",
57
- "c": "yarn run clean",
58
- "cb": "yarn run clean && yarn run build",
59
- "clean": "rm -rfv dist *.tsbuildinfo",
60
- "d": "yarn run build:es && yarn node",
61
- "w": "yarn run watch",
62
- "watch": "yarn run watch:ts & yarn run watch:es",
63
- "watch:es": "yarn run build:es --watch",
64
- "watch:ts": "yarn run build:ts --watch --preserveWatchOutput"
65
- },
66
- "sideEffects": false,
67
- "type": "module",
68
- "types": "./dist/main.d.ts",
69
- "gitHead": "e23943a279d6b0905b205c0c17b2b3249efab226"
73
+ "gitHead": "4a25cd3e0499cf61dd761e87d3711abf9b0cd208"
70
74
  }
package/src/main.ts ADDED
@@ -0,0 +1,267 @@
1
+
2
+ // *** Nitrobase File ***
3
+
4
+ /**
5
+ * The subdirectory location for each nitrobase file.
6
+ */
7
+ export enum Region {
8
+ /**
9
+ * Nitrobase file location that can be accessed by anyone. e.g. Product list.
10
+ */
11
+ Public = 'p',
12
+
13
+ /**
14
+ * Nitrobase file location that can be accessed by authenticated users. e.g. Special price list for dealers
15
+ */
16
+ Authenticated = 'a',
17
+
18
+ /**
19
+ * Nitrobase file location that can be accessed by admins and managers only. e.g. User list.
20
+ */
21
+ Managers = 'm',
22
+
23
+ /**
24
+ * Nitrobase file location specific to each user id. Can be accessed using the user token. e.g. User profile and User orders.
25
+ */
26
+ PerUser = 'u',
27
+
28
+ /**
29
+ * Nitrobase file location specific to each owner id. e.g. user token or device id.
30
+ */
31
+ PerOwner = 'o',
32
+
33
+ /**
34
+ * Private nitrobase file location. Cannot be accessed publicly and must be directly accessed by the admin API only.
35
+ * e.g. User secret data.
36
+ */
37
+ Secret = '.s',
38
+ }
39
+
40
+ /**
41
+ * The different types of nitrobase file formats.
42
+ */
43
+ export enum StoreFileType {
44
+ /**
45
+ * Type used for `single document` storage.
46
+ */
47
+ Document = 'doc',
48
+
49
+ /**
50
+ * Type used for storing a `collection` of simpler documents, referred to as collection items.
51
+ */
52
+ Collection = 'col',
53
+
54
+ /**
55
+ * Type used for storing a collection of items that are `append-only`.
56
+ */
57
+ AppendOnlyCollection = 'aoc',
58
+ }
59
+
60
+ /**
61
+ * Nitrobase file extension (encode).
62
+ */
63
+ export enum StoreFileExtension {
64
+ /**
65
+ * AlwatrNitrobase JSON format.
66
+ */
67
+ Json = 'asj',
68
+ }
69
+
70
+ /**
71
+ * Unique identifier of the nitrobase file.
72
+ *
73
+ * Get from user for select nitrobase file.
74
+ */
75
+ export type StoreFileId = {
76
+ /**
77
+ * The nitrobase filename.
78
+ */
79
+ readonly name: string;
80
+
81
+ /**
82
+ * The region where the nitrobase file is located.
83
+ * @see {@link Region}
84
+ */
85
+ readonly region: Region;
86
+
87
+ /**
88
+ * The owner of the nitrobase file.
89
+ * If the region is `Region.PerX` then this is the user id, device id, or token id etc.
90
+ * @see {@link Region}
91
+ *
92
+ */
93
+ readonly ownerId?: string;
94
+
95
+ /**
96
+ * The schema version for easy migration by user.
97
+ * If not specified, the default value is `1`.
98
+ */
99
+ schemaVer?: number;
100
+ };
101
+
102
+ /**
103
+ * Nitrobase the complete metadata of the file in the root database.
104
+ */
105
+ export type StoreFileStat = StoreFileId & {
106
+ /**
107
+ * The type of the nitrobase file.
108
+ *
109
+ * @see {@link StoreFileType}
110
+ */
111
+ readonly type: StoreFileType;
112
+
113
+ /**
114
+ * The extension used for the nitrobase file.
115
+ *
116
+ * @see {@link StoreFileExtension}
117
+ */
118
+ readonly extension?: StoreFileExtension;
119
+
120
+ /**
121
+ * The save debounce timeout in milliseconds for minimal disk I/O usage.
122
+ * This is used to limit the frequency of disk writes for performance reasons.
123
+ * The recommended value is `40`.
124
+ * If not specified, the default value get from AlwatrNitrobase `defaultChangeDebounce`.
125
+ */
126
+ readonly changeDebounce?: number;
127
+
128
+ /**
129
+ * The name of the migration process.
130
+ * This is used to migrate the nitrobase file to a new schema version.
131
+ */
132
+ readonly migrateName?: string;
133
+
134
+ /**
135
+ * The time-to-live (TTL) of the nitrobase file in memory.
136
+ */
137
+ // readonly ttl?: number;
138
+ };
139
+
140
+ /**
141
+ * Represents the metadata of a nitrobase file.
142
+ */
143
+ export type StoreFileMeta = StoreFileStat & {
144
+ /**
145
+ * Nitrobase file format version.
146
+ */
147
+ fv: number;
148
+
149
+ /**
150
+ * The revision number of the nitrobase file.
151
+ *
152
+ * This number is incremented every time the nitrobase file is updated.
153
+ */
154
+ rev: number;
155
+
156
+ /**
157
+ * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was created.
158
+ */
159
+ readonly created: number;
160
+
161
+ /**
162
+ * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was updated.
163
+ */
164
+ updated: number;
165
+
166
+ /**
167
+ * Last auto increment id.
168
+ */
169
+ lastAutoId?: number;
170
+
171
+ /**
172
+ * The extra metadata for the nitrobase file.
173
+ */
174
+ extra: JsonObject;
175
+ };
176
+
177
+ export type StoreFileData<T extends JsonObject = JsonObject> = T;
178
+
179
+ /**
180
+ * Represents the context of a nitrobase file.
181
+ * @template TData The type of the data content in the nitrobase file.
182
+ */
183
+ export type StoreFileContext<TData extends JsonObject = JsonObject> = {
184
+ /**
185
+ * The status of the nitrobase file.
186
+ *
187
+ * if false, the Alwatr nitrobase throws an error.
188
+ */
189
+ readonly ok: true;
190
+
191
+ /**
192
+ * The metadata of the nitrobase file.
193
+ * @see {@link StoreFileMeta}
194
+ */
195
+ readonly meta: StoreFileMeta;
196
+
197
+ /**
198
+ * The data content of the nitrobase file.
199
+ */
200
+ readonly data: TData;
201
+ };
202
+
203
+ /**
204
+ * Nitrobase file meta only content type.
205
+ */
206
+ export type StoreFileMetaOnlyContext = Omit<StoreFileContext<never>, 'data'>;
207
+
208
+ // *** Documents ***
209
+
210
+ /**
211
+ * StoreFileContext for document type.
212
+ */
213
+ export type DocumentContext<T extends JsonObject = JsonObject> = StoreFileContext<T>;
214
+
215
+ // *** Collections ***
216
+
217
+ /**
218
+ * The metadata of an item in a collection.
219
+ */
220
+ export type CollectionItemMeta = {
221
+ /**
222
+ * The unique identifier for the collection item.
223
+ */
224
+ readonly id: string | number;
225
+
226
+ /**
227
+ * The Unix timestamp (in milliseconds since the epoch) for when the collection item was created.
228
+ */
229
+ readonly created: number;
230
+
231
+ /**
232
+ * The Unix timestamp (in milliseconds since the epoch) for when the collection item was updated.
233
+ */
234
+ updated: number;
235
+
236
+ /**
237
+ * The revision number for the collection item.
238
+ *
239
+ * This number is incremented each time the item is updated.
240
+ */
241
+ rev: number;
242
+ };
243
+
244
+ /**
245
+ * Collection item context type.
246
+ */
247
+ export type CollectionItem<TData extends JsonObject = JsonObject> = {
248
+ /**
249
+ * Collection item's metadata.
250
+ */
251
+ readonly meta: CollectionItemMeta;
252
+
253
+ /**
254
+ * Collection item data.
255
+ */
256
+ readonly data: TData;
257
+ };
258
+
259
+ /**
260
+ * Collection item context type.
261
+ */
262
+ export type CollectionContext<T extends JsonObject = JsonObject> = StoreFileContext<DictionaryReq<CollectionItem<T>>>;
263
+
264
+ export type AlwatrAuth = {
265
+ userId: string;
266
+ userToken: string;
267
+ };
package/CHANGELOG.md DELETED
@@ -1,282 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [7.10.1](https://github.com/Alwatr/nitrobase/compare/v7.10.0...v7.10.1) (2025-12-14)
7
-
8
- ### 🧹 Miscellaneous Chores
9
-
10
- * update tsconfig extends to use @alwatr/nanolib ([ffbc8ce](https://github.com/Alwatr/nitrobase/commit/ffbc8ce74d47d7f4e1ff0061722df10f68af11cc))
11
-
12
- ### 🔗 Dependencies update
13
-
14
- * replace '@alwatr/nano-build' with '@alwatr/nanolib' in logger imports ([9a355b9](https://github.com/Alwatr/nitrobase/commit/9a355b92b27434a3cd132e7e52df5c2e112ca97e))
15
- * update `@alwatr/nanolib` and `@types/node` dependencies across all packages. ([bc6d96f](https://github.com/Alwatr/nitrobase/commit/bc6d96f4fd423bcfb817d74b526596669d8a8aed))
16
- * update dependencies and switch prettier config to @alwatr/nanolib ([b9d4abb](https://github.com/Alwatr/nitrobase/commit/b9d4abbba9d56b0210cf838aa4e002145d11a205))
17
-
18
- ## [7.10.0](https://github.com/Alwatr/nitrobase/compare/v7.9.0...v7.10.0) (2025-09-21)
19
-
20
- ### 🐛 Bug Fixes
21
-
22
- * add "sideEffects": false to package.json files for better tree-shaking ([cb6f75b](https://github.com/Alwatr/nitrobase/commit/cb6f75b86eb7dba6812aaad5136fcd867e885562))
23
- * remove packageTracer import and add type imports for nano-build and type-helper ([d684cdb](https://github.com/Alwatr/nitrobase/commit/d684cdb0db227f8df18aa1cf76ef7285bb4a6f72))
24
-
25
- ### 🧹 Miscellaneous Chores
26
-
27
- * remove Exir Studio sponsorship logo from multiple README files ([506459f](https://github.com/Alwatr/nitrobase/commit/506459fea7d29b97e478da562590dd202ce7e833))
28
- * remove unused types from tsconfig.json files and update references ([b504ced](https://github.com/Alwatr/nitrobase/commit/b504ced4a8f98de4fe79a2c974937278bd4e46cb))
29
- * Update license from AGPL-3.0 to MPL-2.0 ([af1746e](https://github.com/Alwatr/nitrobase/commit/af1746ee9a3786c1cb2e0014f138e9f3b7086b8d))
30
- * update package.json files across all packages for consistency and improved metadata ([647900d](https://github.com/Alwatr/nitrobase/commit/647900d9966f8df275c4e2ef0550c501be38ece0))
31
-
32
- ### 🔗 Dependencies update
33
-
34
- * update dependencies in package.json files across all packages to latest versions ([72c20ef](https://github.com/Alwatr/nitrobase/commit/72c20efbc1cac9825fb4880772e3fad797d74a23))
35
-
36
- ## [7.8.0](https://github.com/Alwatr/nitrobase/compare/v7.7.0...v7.8.0) (2025-03-06)
37
-
38
- ### Dependencies update
39
-
40
- * **deps-dev:** bump the dependencies group across 1 directory with 5 updates ([fe6ab37](https://github.com/Alwatr/nitrobase/commit/fe6ab37263f609f8bce8398462b7105b8e5a55fe)) by @dependabot[bot]
41
- * update @alwatr/nanolib, @alwatr/nano-build, and @alwatr/type-helper to latest versions ([5f3f89b](https://github.com/Alwatr/nitrobase/commit/5f3f89b1236f66e9167957d60d43c8d0abff108d)) by @
42
-
43
- ## [7.7.0](https://github.com/Alwatr/nitrobase/compare/v7.6.1...v7.7.0) (2025-02-26)
44
-
45
- **Note:** Version bump only for package @alwatr/nitrobase-types
46
-
47
- ## [7.6.0](https://github.com/Alwatr/nitrobase/compare/v7.5.9...v7.6.0) (2025-02-26)
48
-
49
- ### Miscellaneous Chores
50
-
51
- * rollback all versions ([9ff6c11](https://github.com/Alwatr/nitrobase/commit/9ff6c11ef3e44ea669a814da73ed39ddc2c8e971)) by @alimd
52
-
53
- ## [7.5.8](https://github.com/Alwatr/nitrobase/compare/v7.5.7...v7.5.8) (2025-02-18)
54
-
55
- ### Dependencies update
56
-
57
- * bump @alwatr/nanolib, @alwatr/nano-build, and @types/node to latest versions across multiple packages ([3e89c62](https://github.com/Alwatr/nitrobase/commit/3e89c62ad20f3afe0c38c6ae36d91bcb6199b231)) by @
58
- * **deps-dev:** bump the dependencies group across 1 directory with 2 updates ([03715d0](https://github.com/Alwatr/nitrobase/commit/03715d0b5534b127dfb57ffe0ea713fb168eefe6)) by @dependabot[bot]
59
-
60
- ## [7.5.7](https://github.com/Alwatr/nitrobase/compare/v7.5.6...v7.5.7) (2025-02-03)
61
-
62
- ### Dependencies update
63
-
64
- * update [@alwatr](https://github.com/alwatr) dependencies to latest versions ([f8bb10f](https://github.com/Alwatr/nitrobase/commit/f8bb10fa3343f25e2a442e80fbddb88c55fac813)) by @
65
-
66
- ## [7.5.5](https://github.com/Alwatr/nitrobase/compare/v7.5.4...v7.5.5) (2025-02-02)
67
-
68
- ### Dependencies update
69
-
70
- * **deps-dev:** bump @types/node ([d60ee96](https://github.com/Alwatr/nitrobase/commit/d60ee96716b8df7837b3d7f9fe4b8705c94e5af0)) by @dependabot[bot]
71
- * update ([0b9eccd](https://github.com/Alwatr/nitrobase/commit/0b9eccd3b54dade17e3eeb94bd08612c57356801)) by @alimd
72
-
73
- ## [7.5.4](https://github.com/Alwatr/nitrobase/compare/v7.5.3...v7.5.4) (2025-01-12)
74
-
75
- ### Dependencies update
76
-
77
- * **deps-dev:** bump the dependencies group across 1 directory with 11 updates ([fdd30a6](https://github.com/Alwatr/nitrobase/commit/fdd30a6639ae7ead4e8dbfaca0295cb2bf0e6649)) by @dependabot[bot]
78
-
79
- ## [7.5.0](https://github.com/Alwatr/nitrobase/compare/v7.4.1...v7.5.0) (2024-11-09)
80
-
81
- ### Features
82
-
83
- * **types:** add `AlwatrAuth` ([bff7ab6](https://github.com/Alwatr/nitrobase/commit/bff7ab6cc3850173c30cf3b0408cfda9584df185)) by @mohammadhonarvar
84
-
85
- ## [7.4.0](https://github.com/Alwatr/nitrobase/compare/v7.3.1...v7.4.0) (2024-11-08)
86
-
87
- ### Dependencies update
88
-
89
- * bump @alwatr/nanolib from 5.2.0 to 5.2.1 across multiple packages ([e1f87b0](https://github.com/Alwatr/nitrobase/commit/e1f87b07d33e8227440256a70f012aa63410f153)) by @
90
- * **deps-dev:** bump @types/node in the dependencies group ([67ffbad](https://github.com/Alwatr/nitrobase/commit/67ffbad06c95c304d47acbe46fd137fb4cf69f95)) by @dependabot[bot]
91
- * **deps:** bump @alwatr/nanolib from 5.0.0 to 5.2.0 in the alwatr group ([dfa1eef](https://github.com/Alwatr/nitrobase/commit/dfa1eefb191bbaac2ff2fff410bb1d3ec615d959)) by @dependabot[bot]
92
-
93
- ## [7.3.1](https://github.com/Alwatr/nitrobase/compare/v7.3.0...v7.3.1) (2024-11-02)
94
-
95
- ### Miscellaneous Chores
96
-
97
- * **deps-dev:** bump the development-dependencies group with 8 updates ([63f7adc](https://github.com/Alwatr/nitrobase/commit/63f7adc5ff83d4876f34d4f089a4be9b95b711a6)) by @dependabot[bot]
98
- * **deps:** bump the alwatr-dependencies group with 2 updates ([20fb436](https://github.com/Alwatr/nitrobase/commit/20fb436b9f146d5ec7452a693c7af8faa32bedff)) by @dependabot[bot]
99
-
100
- ### Dependencies update
101
-
102
- * **deps-dev:** bump @types/node in the dependencies group ([dd3e94a](https://github.com/Alwatr/nitrobase/commit/dd3e94a4c007da8fddda4cfeffe5f0763d74952e)) by @dependabot[bot]
103
- * **deps:** bump the alwatr group with 6 updates ([eb9eeb1](https://github.com/Alwatr/nitrobase/commit/eb9eeb1901f7947cde783bf6f06340c984d6f59d)) by @dependabot[bot]
104
-
105
- ## [7.3.0](https://github.com/Alwatr/nitrobase/compare/v7.2.1...v7.3.0) (2024-10-11)
106
-
107
- ### Features
108
-
109
- * update `import`s & packages based on the latest changes of `nanolib` & prevent side-effects ([0d66f89](https://github.com/Alwatr/nitrobase/commit/0d66f894dc4ff615ab73ebd27c275f98dc384fbe)) by @mohammadhonarvar
110
-
111
- ### Code Refactoring
112
-
113
- * update `import`s & packages based on the latest changes of `nanolib` ([ce990a2](https://github.com/Alwatr/nitrobase/commit/ce990a2fedc5545e971c3bb6e58b55bfba8c0bd9)) by @mohammadhonarvar
114
-
115
- ### Miscellaneous Chores
116
-
117
- * **deps-dev:** bump the development-dependencies group with 10 updates ([7bdcf3f](https://github.com/Alwatr/nitrobase/commit/7bdcf3f47ddb8e1376a1c7ae6e221811182bae58)) by @dependabot[bot]
118
- * **deps:** bump the alwatr-dependencies group with 10 updates ([60afdde](https://github.com/Alwatr/nitrobase/commit/60afdde98562f3023e6624ee0579d6bdee80bc32)) by @dependabot[bot]
119
- * **deps:** bump the alwatr-dependencies group with 6 updates ([1cf29b2](https://github.com/Alwatr/nitrobase/commit/1cf29b20055554945cd669ea9d022ab7c503d9fc)) by @dependabot[bot]
120
-
121
- ## [7.2.1](https://github.com/Alwatr/nitrobase/compare/v7.2.0...v7.2.1) (2024-09-29)
122
-
123
- ### Miscellaneous Chores
124
-
125
- * **deps-dev:** bump @types/node in the development-dependencies group ([9b146d2](https://github.com/Alwatr/nitrobase/commit/9b146d2f6cf7d1d79a2a6f46a5e8f50e7fb2ac75)) by @dependabot[bot]
126
- * **types:** change the license to AGPL-3.0 ([b45e0a4](https://github.com/Alwatr/nitrobase/commit/b45e0a417b5d00735bc893236e72111e4caac63d)) by @ArmanAsadian
127
-
128
- ### Dependencies update
129
-
130
- * update ([90a0fe1](https://github.com/Alwatr/nitrobase/commit/90a0fe146eb703c183c116776d7c5748918282da)) by @
131
-
132
- ## [7.2.0](https://github.com/Alwatr/nitrobase/compare/v7.1.1...v7.2.0) (2024-09-24)
133
-
134
- ### Code Refactoring
135
-
136
- * rename all store to nitrobase ([0928420](https://github.com/Alwatr/nitrobase/commit/0928420d8751e16ff1e8d91e1d3048a5895885a6)) by @AliMD
137
- * rename all store to nitrobase ([9e31765](https://github.com/Alwatr/nitrobase/commit/9e31765b63ecd94bcf600cb44cfd9e341dd11a4e)) by @AliMD
138
-
139
- ## [7.1.1](https://github.com/Alwatr/nitrobase/compare/v7.1.0...v7.1.1) (2024-09-24)
140
-
141
- ### Miscellaneous Chores
142
-
143
- * **deps-dev:** bump the development-dependencies group across 1 directory with 3 updates ([122251c](https://github.com/Alwatr/nitrobase/commit/122251c315c422b7e9c2d5aba827f27b321194bb)) by @dependabot[bot]
144
- * **deps:** bump the alwatr-dependencies group with 9 updates ([2a94694](https://github.com/Alwatr/nitrobase/commit/2a94694b2ec12c2915aa77934023328751d13837)) by @dependabot[bot]
145
-
146
- ### Dependencies update
147
-
148
- * update ([82c475e](https://github.com/Alwatr/nitrobase/commit/82c475e29bd7f42ad03660556f40f180b3b6c9c6)) by @AliMD
149
-
150
- ## [7.1.0](https://github.com/Alwatr/nitrobase/compare/v7.0.0...v7.1.0) (2024-09-08)
151
-
152
- ### Miscellaneous Chores
153
-
154
- * **deps-dev:** bump the development-dependencies group with 2 updates ([f6d8374](https://github.com/Alwatr/nitrobase/commit/f6d837417886ccf3719100570194434455fda365)) by @dependabot[bot]
155
-
156
- ## [7.0.0](https://github.com/Alwatr/nitrobase/compare/v7.0.0-beta.1...v7.0.0) (2024-09-02)
157
-
158
- ### ⚠ BREAKING CHANGES
159
-
160
- * The ver property has been removed from the StoreFileMeta interface. Developers should update their code to remove any references to the ver property.
161
-
162
- ### Features
163
-
164
- * add `extra` property to StoreFileMeta ([5cdb573](https://github.com/Alwatr/nitrobase/commit/5cdb5735c2faf888a3fcea466ec3fd848e60148e)) by @AliMD
165
- * Add migrateName property to StoreFileStat ([f5b4f39](https://github.com/Alwatr/nitrobase/commit/f5b4f3904cec69ad96089daa800ed4243bd0f33e)) by @AliMD
166
- * Update type imports in alwatr-nitrobase.ts ([68064c4](https://github.com/Alwatr/nitrobase/commit/68064c4430c5aad8bca49d1f2a9270d6e64b051e)) by @AliMD
167
-
168
- ### Code Refactoring
169
-
170
- * Remove unused "ALWATR_DEBUG" environment variable from build script ([26e7642](https://github.com/Alwatr/nitrobase/commit/26e764280e0a2827904762ed3de21a9966ddfc63)) by @AliMD
171
- * Remove ver property from StoreFileMeta ([3c27903](https://github.com/Alwatr/nitrobase/commit/3c2790330c71857ffafd41495610abdd691c5486)) by @AliMD
172
-
173
- ### Dependencies update
174
-
175
- * update ([6411ff7](https://github.com/Alwatr/nitrobase/commit/6411ff7d49323b8bbf0dbb03fbc3c640b433a8bb)) by @
176
-
177
- ## [7.0.0-beta.1](https://github.com/Alwatr/nitrobase/compare/v7.0.0-beta.0...v7.0.0-beta.1) (2024-08-31)
178
-
179
- ### Code Refactoring
180
-
181
- * move schemaVer to storeId ([322b76d](https://github.com/Alwatr/nitrobase/commit/322b76d8432752f979e1d4fc3c2250e22945fd36)) by @
182
-
183
- ## [7.0.0-beta.0](https://github.com/Alwatr/nitrobase/compare/v6.2.1...v7.0.0-beta.0) (2024-08-31)
184
-
185
- ### Code Refactoring
186
-
187
- * update StoreFileStat type to make extension property optional ([e75a186](https://github.com/Alwatr/nitrobase/commit/e75a186fbafd30a3d745467a973bec06e1d8109e)) by @AliMD
188
-
189
- ### Dependencies update
190
-
191
- * update ([2657638](https://github.com/Alwatr/nitrobase/commit/26576384c4a8ffcf35776f19008432e194fb39de)) by @AliMD
192
-
193
- ## [6.2.1](https://github.com/Alwatr/nitrobase/compare/v6.2.0...v6.2.1) (2024-08-31)
194
-
195
- ### Miscellaneous Chores
196
-
197
- * **deps-dev:** bump the development-dependencies group across 1 directory with 13 updates ([7e6aa11](https://github.com/Alwatr/nitrobase/commit/7e6aa11e1b4507111993a6070b481ebc95e534c7)) by @dependabot[bot]
198
- * **deps:** bump the alwatr-dependencies group with 10 updates ([faf1fc1](https://github.com/Alwatr/nitrobase/commit/faf1fc15f8b4c9c4c451dd5fa1d564eb3bf3d9a3)) by @dependabot[bot]
199
- * **deps:** bump the alwatr-dependencies group with 9 updates ([64ac4f2](https://github.com/Alwatr/nitrobase/commit/64ac4f239c0f0a8ccdadbd736c16973bd684f811)) by @dependabot[bot]
200
-
201
- ## [6.1.0](https://github.com/Alwatr/nitrobase/compare/v6.0.5...v6.1.0) (2024-07-03)
202
-
203
- ### Features
204
-
205
- * schema version ([2590674](https://github.com/Alwatr/nitrobase/commit/259067435512b71f1f0aaea07566441cbb85e539)) by @AliMD
206
-
207
- ### Dependencies update
208
-
209
- * bump the development-dependencies ([546ca1b](https://github.com/Alwatr/nitrobase/commit/546ca1be049090eb3c8304fcb75e98ac0b984510)) by @AliMD
210
-
211
- ## [6.0.5](https://github.com/Alwatr/nitrobase/compare/v6.0.4...v6.0.5) (2024-05-12)
212
-
213
- ### Miscellaneous Chores
214
-
215
- * **deps-dev:** bump the development-dependencies group across 1 directory with 3 updates ([f97552d](https://github.com/Alwatr/nitrobase/commit/f97552d0e8e85bc2e2f0863da17502b8e55799e8)) by @dependabot[bot]
216
- * **deps:** bump the alwatr-dependencies group with 8 updates ([1aa95ca](https://github.com/Alwatr/nitrobase/commit/1aa95ca232a7b706eda4b0eb537316d38b27aa28)) by @dependabot[bot]
217
-
218
- ## [6.0.4](https://github.com/Alwatr/nitrobase/compare/v6.0.3...v6.0.4) (2024-04-25)
219
-
220
- **Note:** Version bump only for package @alwatr/nitrobase-types
221
-
222
- ## [6.0.3](https://github.com/Alwatr/nitrobase/compare/v6.0.2...v6.0.3) (2024-03-28)
223
-
224
- ### Miscellaneous Chores
225
-
226
- * **deps-dev:** bump the development-dependencies group with 13 updates ([23fb121](https://github.com/Alwatr/nitrobase/commit/23fb1217470593d386b658f2a1d85fe4ef6e55df)) by @dependabot[bot]
227
- * **deps:** bump the alwatr-dependencies group with 10 updates ([ce6ee74](https://github.com/Alwatr/nitrobase/commit/ce6ee7495aaa67a8d3bb0a3f2b2ea8389e161552)) by @dependabot[bot]
228
- * **deps:** bump the alwatr-dependencies group with 9 updates ([686e155](https://github.com/Alwatr/nitrobase/commit/686e155d4c0ccab6daf81d280cf91299152b8583)) by @dependabot[bot]
229
-
230
- ## [6.0.0](https://github.com/Alwatr/nitrobase/compare/v6.0.0-alpha.0...v6.0.0) (2024-01-24)
231
-
232
- ### Features
233
-
234
- * Enhance types, add Jsonifiable type and update method signatures ([57502d2](https://github.com/Alwatr/nitrobase/commit/57502d230f0c9cb88aa9a9e71a3460f1219955b0)) by @AliMD
235
-
236
- ### Miscellaneous Chores
237
-
238
- * **deps-dev:** bump the development-dependencies group with 4 updates ([7d71044](https://github.com/Alwatr/nitrobase/commit/7d71044165583f9d56fb61a05bdf51ccb104f422)) by @dependabot[bot]
239
- * **deps:** bump the alwatr-dependencies group with 10 updates ([cc42e89](https://github.com/Alwatr/nitrobase/commit/cc42e895179c53ee2dd60802d994ba84f5a37fde)) by @dependabot[bot]
240
- * **deps:** update ([0e85743](https://github.com/Alwatr/nitrobase/commit/0e85743f76f0efdd0f6cd4001eebc4550b43f43f)) by @AliMD
241
- * **deps:** update ([a894bfc](https://github.com/Alwatr/nitrobase/commit/a894bfc62124a3eb027cad4e8d1c974761e22dad)) by @AliMD
242
-
243
- ## [6.0.0-alpha.0](https://github.com/Alwatr/nitrobase/compare/v5.1.0...v6.0.0-alpha.0) (2024-01-15)
244
-
245
- ### ⚠ BREAKING CHANGES
246
-
247
- * **types:** `PerDevice` and `PerToken` in Region removed
248
-
249
- ### Code Refactoring
250
-
251
- * **types:** replace `PerDevice` and `PerToken` in Region enum with `PerOwner` ([2b47b5d](https://github.com/Alwatr/nitrobase/commit/2b47b5dd81e59ee33b17e4ae01253ea2cde5f9ab)) by @AliMD
252
-
253
- ### Miscellaneous Chores
254
-
255
- * **deps:** update ([8f3edcf](https://github.com/Alwatr/nitrobase/commit/8f3edcf8a489927a6c43dfcaa5db88a579ecac80)) by @
256
-
257
- ## [5.1.0](https://github.com/Alwatr/nitrobase/compare/v5.0.0...v5.1.0) (2024-01-13)
258
-
259
- ### Code Refactoring
260
-
261
- * Update nitrobaseRegionSecret value in Dockerfile and types file ([a0b13c6](https://github.com/Alwatr/nitrobase/commit/a0b13c6ff07599a425fa666437c0ebf167ccf6c8)) by @AliMD
262
-
263
- # [5.0.0](https://github.com/Alwatr/nitrobase/compare/v5.0.0-beta...v5.0.0) (2024-01-12)
264
-
265
- ### Code Refactoring
266
-
267
- * rename region SuperAdmin to Managers ([7c3ece8](https://github.com/Alwatr/nitrobase/commit/7c3ece8a24a88ea12a82966e41ea1ad7362159f4)) by @AliMD
268
-
269
- ### BREAKING CHANGES
270
-
271
- * region `SuperAdmin` renamed to `Managers`
272
-
273
- # [5.0.0-beta](https://github.com/Alwatr/nitrobase/compare/v4.1.0...v5.0.0-beta) (2023-12-31)
274
-
275
- ### Bug Fixes
276
-
277
- * **types:** StoreFileId interface ([d7b0f61](https://github.com/Alwatr/nitrobase/commit/d7b0f61d673e6c70c139454aae03f1472f6f7c31)) by @AliMD
278
-
279
- ### Features
280
-
281
- * **type/storeFileId:** change debounce ([0f459b6](https://github.com/Alwatr/nitrobase/commit/0f459b6bf51ef2ab79b35a738f7a58dd67686527)) by @AliMD
282
- * **types:** new package for nitrobase share types ([8487d02](https://github.com/Alwatr/nitrobase/commit/8487d0255b21ab02eecb0b6216e438fe0d0ca852)) by @AliMD
package/dist/main.cjs DELETED
@@ -1,4 +0,0 @@
1
- /** 📦 @alwatr/nitrobase-types v7.10.1 */
2
- __dev_mode__: console.debug("📦 @alwatr/nitrobase-types v7.10.1");
3
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{Region:()=>Region,StoreFileExtension:()=>StoreFileExtension,StoreFileType:()=>StoreFileType});module.exports=__toCommonJS(main_exports);var Region=(Region2=>{Region2["Public"]="p";Region2["Authenticated"]="a";Region2["Managers"]="m";Region2["PerUser"]="u";Region2["PerOwner"]="o";Region2["Secret"]=".s";return Region2})(Region||{});var StoreFileType=(StoreFileType2=>{StoreFileType2["Document"]="doc";StoreFileType2["Collection"]="col";StoreFileType2["AppendOnlyCollection"]="aoc";return StoreFileType2})(StoreFileType||{});var StoreFileExtension=(StoreFileExtension2=>{StoreFileExtension2["Json"]="asj";return StoreFileExtension2})(StoreFileExtension||{});0&&(module.exports={Region,StoreFileExtension,StoreFileType});
4
- //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["import type {} from '@alwatr/type-helper';\n\n// *** Nitrobase File ***\n\n/**\n * The subdirectory location for each nitrobase file.\n */\nexport enum Region {\n /**\n * Nitrobase file location that can be accessed by anyone. e.g. Product list.\n */\n Public = 'p',\n\n /**\n * Nitrobase file location that can be accessed by authenticated users. e.g. Special price list for dealers\n */\n Authenticated = 'a',\n\n /**\n * Nitrobase file location that can be accessed by admins and managers only. e.g. User list.\n */\n Managers = 'm',\n\n /**\n * Nitrobase file location specific to each user id. Can be accessed using the user token. e.g. User profile and User orders.\n */\n PerUser = 'u',\n\n /**\n * Nitrobase file location specific to each owner id. e.g. user token or device id.\n */\n PerOwner = 'o',\n\n /**\n * Private nitrobase file location. Cannot be accessed publicly and must be directly accessed by the admin API only.\n * e.g. User secret data.\n */\n Secret = '.s',\n}\n\n/**\n * The different types of nitrobase file formats.\n */\nexport enum StoreFileType {\n /**\n * Type used for `single document` storage.\n */\n Document = 'doc',\n\n /**\n * Type used for storing a `collection` of simpler documents, referred to as collection items.\n */\n Collection = 'col',\n\n /**\n * Type used for storing a collection of items that are `append-only`.\n */\n AppendOnlyCollection = 'aoc',\n}\n\n/**\n * Nitrobase file extension (encode).\n */\nexport enum StoreFileExtension {\n /**\n * AlwatrNitrobase JSON format.\n */\n Json = 'asj',\n}\n\n/**\n * Unique identifier of the nitrobase file.\n *\n * Get from user for select nitrobase file.\n */\nexport type StoreFileId = {\n /**\n * The nitrobase filename.\n */\n readonly name: string;\n\n /**\n * The region where the nitrobase file is located.\n * @see {@link Region}\n */\n readonly region: Region;\n\n /**\n * The owner of the nitrobase file.\n * If the region is `Region.PerX` then this is the user id, device id, or token id etc.\n * @see {@link Region}\n *\n */\n readonly ownerId?: string;\n\n /**\n * The schema version for easy migration by user.\n * If not specified, the default value is `1`.\n */\n schemaVer?: number;\n};\n\n/**\n * Nitrobase the complete metadata of the file in the root database.\n */\nexport type StoreFileStat = StoreFileId & {\n /**\n * The type of the nitrobase file.\n *\n * @see {@link StoreFileType}\n */\n readonly type: StoreFileType;\n\n /**\n * The extension used for the nitrobase file.\n *\n * @see {@link StoreFileExtension}\n */\n readonly extension?: StoreFileExtension;\n\n /**\n * The save debounce timeout in milliseconds for minimal disk I/O usage.\n * This is used to limit the frequency of disk writes for performance reasons.\n * The recommended value is `40`.\n * If not specified, the default value get from AlwatrNitrobase `defaultChangeDebounce`.\n */\n readonly changeDebounce?: number;\n\n /**\n * The name of the migration process.\n * This is used to migrate the nitrobase file to a new schema version.\n */\n readonly migrateName?: string;\n\n /**\n * The time-to-live (TTL) of the nitrobase file in memory.\n */\n // readonly ttl?: number;\n};\n\n/**\n * Represents the metadata of a nitrobase file.\n */\nexport type StoreFileMeta = StoreFileStat & {\n /**\n * Nitrobase file format version.\n */\n fv: number;\n\n /**\n * The revision number of the nitrobase file.\n *\n * This number is incremented every time the nitrobase file is updated.\n */\n rev: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was created.\n */\n readonly created: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was updated.\n */\n updated: number;\n\n /**\n * Last auto increment id.\n */\n lastAutoId?: number;\n\n /**\n * The extra metadata for the nitrobase file.\n */\n extra: JsonObject;\n};\n\nexport type StoreFileData<T extends JsonObject = JsonObject> = T;\n\n/**\n * Represents the context of a nitrobase file.\n * @template TData The type of the data content in the nitrobase file.\n */\nexport type StoreFileContext<TData extends JsonObject = JsonObject> = {\n /**\n * The status of the nitrobase file.\n *\n * if false, the Alwatr nitrobase throws an error.\n */\n readonly ok: true;\n\n /**\n * The metadata of the nitrobase file.\n * @see {@link StoreFileMeta}\n */\n readonly meta: StoreFileMeta;\n\n /**\n * The data content of the nitrobase file.\n */\n readonly data: TData;\n};\n\n/**\n * Nitrobase file meta only content type.\n */\nexport type StoreFileMetaOnlyContext = Omit<StoreFileContext<never>, 'data'>;\n\n// *** Documents ***\n\n/**\n * StoreFileContext for document type.\n */\nexport type DocumentContext<T extends JsonObject = JsonObject> = StoreFileContext<T>;\n\n// *** Collections ***\n\n/**\n * The metadata of an item in a collection.\n */\nexport type CollectionItemMeta = {\n /**\n * The unique identifier for the collection item.\n */\n readonly id: string | number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the collection item was created.\n */\n readonly created: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the collection item was updated.\n */\n updated: number;\n\n /**\n * The revision number for the collection item.\n *\n * This number is incremented each time the item is updated.\n */\n rev: number;\n};\n\n/**\n * Collection item context type.\n */\nexport type CollectionItem<TData extends JsonObject = JsonObject> = {\n /**\n * Collection item's metadata.\n */\n readonly meta: CollectionItemMeta;\n\n /**\n * Collection item data.\n */\n readonly data: TData;\n};\n\n/**\n * Collection item context type.\n */\nexport type CollectionContext<T extends JsonObject = JsonObject> = StoreFileContext<DictionaryReq<CollectionItem<T>>>;\n\nexport type AlwatrAuth = {\n userId: string;\n userToken: string;\n};\n"],
5
- "mappings": ";;qqBAAA,mLAOO,IAAK,QAAAA,SAAL,CAILA,QAAA,UAAS,IAKTA,QAAA,iBAAgB,IAKhBA,QAAA,YAAW,IAKXA,QAAA,WAAU,IAKVA,QAAA,YAAW,IAMXA,QAAA,UAAS,KA9BC,OAAAA,UAAA,YAoCL,IAAK,eAAAC,gBAAL,CAILA,eAAA,YAAW,MAKXA,eAAA,cAAa,MAKbA,eAAA,wBAAuB,MAdb,OAAAA,iBAAA,mBAoBL,IAAK,oBAAAC,qBAAL,CAILA,oBAAA,QAAO,MAJG,OAAAA,sBAAA",
6
- "names": ["Region", "StoreFileType", "StoreFileExtension"]
7
- }
package/dist/main.mjs DELETED
@@ -1,4 +0,0 @@
1
- /** 📦 @alwatr/nitrobase-types v7.10.1 */
2
- __dev_mode__: console.debug("📦 @alwatr/nitrobase-types v7.10.1");
3
- var Region=(Region2=>{Region2["Public"]="p";Region2["Authenticated"]="a";Region2["Managers"]="m";Region2["PerUser"]="u";Region2["PerOwner"]="o";Region2["Secret"]=".s";return Region2})(Region||{});var StoreFileType=(StoreFileType2=>{StoreFileType2["Document"]="doc";StoreFileType2["Collection"]="col";StoreFileType2["AppendOnlyCollection"]="aoc";return StoreFileType2})(StoreFileType||{});var StoreFileExtension=(StoreFileExtension2=>{StoreFileExtension2["Json"]="asj";return StoreFileExtension2})(StoreFileExtension||{});export{Region,StoreFileExtension,StoreFileType};
4
- //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["import type {} from '@alwatr/type-helper';\n\n// *** Nitrobase File ***\n\n/**\n * The subdirectory location for each nitrobase file.\n */\nexport enum Region {\n /**\n * Nitrobase file location that can be accessed by anyone. e.g. Product list.\n */\n Public = 'p',\n\n /**\n * Nitrobase file location that can be accessed by authenticated users. e.g. Special price list for dealers\n */\n Authenticated = 'a',\n\n /**\n * Nitrobase file location that can be accessed by admins and managers only. e.g. User list.\n */\n Managers = 'm',\n\n /**\n * Nitrobase file location specific to each user id. Can be accessed using the user token. e.g. User profile and User orders.\n */\n PerUser = 'u',\n\n /**\n * Nitrobase file location specific to each owner id. e.g. user token or device id.\n */\n PerOwner = 'o',\n\n /**\n * Private nitrobase file location. Cannot be accessed publicly and must be directly accessed by the admin API only.\n * e.g. User secret data.\n */\n Secret = '.s',\n}\n\n/**\n * The different types of nitrobase file formats.\n */\nexport enum StoreFileType {\n /**\n * Type used for `single document` storage.\n */\n Document = 'doc',\n\n /**\n * Type used for storing a `collection` of simpler documents, referred to as collection items.\n */\n Collection = 'col',\n\n /**\n * Type used for storing a collection of items that are `append-only`.\n */\n AppendOnlyCollection = 'aoc',\n}\n\n/**\n * Nitrobase file extension (encode).\n */\nexport enum StoreFileExtension {\n /**\n * AlwatrNitrobase JSON format.\n */\n Json = 'asj',\n}\n\n/**\n * Unique identifier of the nitrobase file.\n *\n * Get from user for select nitrobase file.\n */\nexport type StoreFileId = {\n /**\n * The nitrobase filename.\n */\n readonly name: string;\n\n /**\n * The region where the nitrobase file is located.\n * @see {@link Region}\n */\n readonly region: Region;\n\n /**\n * The owner of the nitrobase file.\n * If the region is `Region.PerX` then this is the user id, device id, or token id etc.\n * @see {@link Region}\n *\n */\n readonly ownerId?: string;\n\n /**\n * The schema version for easy migration by user.\n * If not specified, the default value is `1`.\n */\n schemaVer?: number;\n};\n\n/**\n * Nitrobase the complete metadata of the file in the root database.\n */\nexport type StoreFileStat = StoreFileId & {\n /**\n * The type of the nitrobase file.\n *\n * @see {@link StoreFileType}\n */\n readonly type: StoreFileType;\n\n /**\n * The extension used for the nitrobase file.\n *\n * @see {@link StoreFileExtension}\n */\n readonly extension?: StoreFileExtension;\n\n /**\n * The save debounce timeout in milliseconds for minimal disk I/O usage.\n * This is used to limit the frequency of disk writes for performance reasons.\n * The recommended value is `40`.\n * If not specified, the default value get from AlwatrNitrobase `defaultChangeDebounce`.\n */\n readonly changeDebounce?: number;\n\n /**\n * The name of the migration process.\n * This is used to migrate the nitrobase file to a new schema version.\n */\n readonly migrateName?: string;\n\n /**\n * The time-to-live (TTL) of the nitrobase file in memory.\n */\n // readonly ttl?: number;\n};\n\n/**\n * Represents the metadata of a nitrobase file.\n */\nexport type StoreFileMeta = StoreFileStat & {\n /**\n * Nitrobase file format version.\n */\n fv: number;\n\n /**\n * The revision number of the nitrobase file.\n *\n * This number is incremented every time the nitrobase file is updated.\n */\n rev: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was created.\n */\n readonly created: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the nitrobase file was updated.\n */\n updated: number;\n\n /**\n * Last auto increment id.\n */\n lastAutoId?: number;\n\n /**\n * The extra metadata for the nitrobase file.\n */\n extra: JsonObject;\n};\n\nexport type StoreFileData<T extends JsonObject = JsonObject> = T;\n\n/**\n * Represents the context of a nitrobase file.\n * @template TData The type of the data content in the nitrobase file.\n */\nexport type StoreFileContext<TData extends JsonObject = JsonObject> = {\n /**\n * The status of the nitrobase file.\n *\n * if false, the Alwatr nitrobase throws an error.\n */\n readonly ok: true;\n\n /**\n * The metadata of the nitrobase file.\n * @see {@link StoreFileMeta}\n */\n readonly meta: StoreFileMeta;\n\n /**\n * The data content of the nitrobase file.\n */\n readonly data: TData;\n};\n\n/**\n * Nitrobase file meta only content type.\n */\nexport type StoreFileMetaOnlyContext = Omit<StoreFileContext<never>, 'data'>;\n\n// *** Documents ***\n\n/**\n * StoreFileContext for document type.\n */\nexport type DocumentContext<T extends JsonObject = JsonObject> = StoreFileContext<T>;\n\n// *** Collections ***\n\n/**\n * The metadata of an item in a collection.\n */\nexport type CollectionItemMeta = {\n /**\n * The unique identifier for the collection item.\n */\n readonly id: string | number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the collection item was created.\n */\n readonly created: number;\n\n /**\n * The Unix timestamp (in milliseconds since the epoch) for when the collection item was updated.\n */\n updated: number;\n\n /**\n * The revision number for the collection item.\n *\n * This number is incremented each time the item is updated.\n */\n rev: number;\n};\n\n/**\n * Collection item context type.\n */\nexport type CollectionItem<TData extends JsonObject = JsonObject> = {\n /**\n * Collection item's metadata.\n */\n readonly meta: CollectionItemMeta;\n\n /**\n * Collection item data.\n */\n readonly data: TData;\n};\n\n/**\n * Collection item context type.\n */\nexport type CollectionContext<T extends JsonObject = JsonObject> = StoreFileContext<DictionaryReq<CollectionItem<T>>>;\n\nexport type AlwatrAuth = {\n userId: string;\n userToken: string;\n};\n"],
5
- "mappings": ";;AAOO,IAAK,QAAAA,SAAL,CAILA,QAAA,UAAS,IAKTA,QAAA,iBAAgB,IAKhBA,QAAA,YAAW,IAKXA,QAAA,WAAU,IAKVA,QAAA,YAAW,IAMXA,QAAA,UAAS,KA9BC,OAAAA,UAAA,YAoCL,IAAK,eAAAC,gBAAL,CAILA,eAAA,YAAW,MAKXA,eAAA,cAAa,MAKbA,eAAA,wBAAuB,MAdb,OAAAA,iBAAA,mBAoBL,IAAK,oBAAAC,qBAAL,CAILA,oBAAA,QAAO,MAJG,OAAAA,sBAAA",
6
- "names": ["Region", "StoreFileType", "StoreFileExtension"]
7
- }