corebasic 1.0.247 → 1.0.249

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.
@@ -15,6 +15,31 @@ import * as Messaging from './messaging.js';
15
15
  import axios from 'axios';
16
16
  // @ts-ignore
17
17
  import jwt from 'jsonwebtoken';
18
+ // ===================================
19
+ function deepFreeze(obj) {
20
+ if (obj && typeof obj === "object" && !Object.isFrozen(obj)) {
21
+ Object.freeze(obj);
22
+ for (const key of Object.keys(obj)) {
23
+ deepFreeze(obj[key]);
24
+ }
25
+ }
26
+ return obj;
27
+ }
28
+ class FMeta {
29
+ // declare staff?: string,
30
+ // declare user?: string,
31
+ // declare app?: string,
32
+ // declare client?: string,
33
+ // declare version?: string,
34
+ // invoiceTxn?: string // TODO: Must also include invoiceTxn
35
+ constructor(obj) {
36
+ Object.assign(this, deepFreeze(obj));
37
+ Object.freeze(this);
38
+ }
39
+ }
40
+ export function noMeta() {
41
+ return new FMeta({});
42
+ }
18
43
  let features = {};
19
44
  let apis = {
20
45
  // <api>: {<feature>: FeatureEntry}
package/libs/features.ts CHANGED
@@ -9,6 +9,36 @@ import axios from 'axios'
9
9
  import jwt from 'jsonwebtoken'
10
10
 
11
11
 
12
+ // ===================================
13
+ function deepFreeze(obj: Record<string, any>) {
14
+ if (obj && typeof obj === "object" && !Object.isFrozen(obj)) {
15
+ Object.freeze(obj);
16
+
17
+ for (const key of Object.keys(obj)) {
18
+ deepFreeze(obj[key]);
19
+ }
20
+ }
21
+ return obj;
22
+ }
23
+ class FMeta {
24
+ declare company?: string;
25
+ declare outlet?: string
26
+ // declare staff?: string,
27
+ // declare user?: string,
28
+ // declare app?: string,
29
+ // declare client?: string,
30
+ // declare version?: string,
31
+ // invoiceTxn?: string // TODO: Must also include invoiceTxn
32
+
33
+ constructor(obj: Record<string, unknown>) {
34
+ Object.assign(this, deepFreeze(obj));
35
+ Object.freeze(this);
36
+ }
37
+ }
38
+ export function noMeta(): FMeta {
39
+ return new FMeta({})
40
+ }
41
+
12
42
  // ===================================
13
43
 
14
44
  type HttpMethod = "get" | "post" | "put" | "delete" | "patch" | "head" | "options" | "connect" | "trace"
package/libs/schemas.ts CHANGED
@@ -12,7 +12,7 @@ g_this.Types ??= {Remotes: {}};
12
12
 
13
13
  // ================
14
14
 
15
- function init(partial: Partial<DefaultSchema>): DefaultSchema {
15
+ function init(partial?: Partial<DefaultSchema>): DefaultSchema {
16
16
  return {
17
17
  created: 0,
18
18
  updated: 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.247",
4
+ "version": "1.0.249",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "./index.ts",