@thisisagile/easy 15.14.4 → 15.15.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.
@@ -1,5 +1,6 @@
1
- import { Enum, Text } from '../types';
1
+ import { Enum, IdName, Text } from '../types';
2
2
  export declare class Scope extends Enum {
3
3
  readonly name: string;
4
4
  protected constructor(name: string, id?: Text);
5
+ for(item: string | IdName): Scope;
5
6
  }
@@ -30,6 +30,9 @@ class Scope extends import_types.Enum {
30
30
  super(name, id.toString());
31
31
  this.name = name;
32
32
  }
33
+ for(item) {
34
+ return new Scope(`${this.name} ${(0, import_types.isString)(item) ? (0, import_types.text)(item).title : item.name}`, (0, import_types.kebab)(`${this.id} ${(0, import_types.isString)(item) ? item : item.id}`));
35
+ }
33
36
  }
34
37
  // Annotate the CommonJS export names for ESM import in node:
35
38
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/process/Scope.ts"],"sourcesContent":["import { Enum, Text, text } from '../types';\n\nexport class Scope extends Enum {\n // static readonly Basic = new Scope('Basic');\n // static readonly Auth = new Scope('Authorization', 'auth');\n // static readonly Admin = new Scope('Administration', 'admin');\n\n protected constructor(readonly name: string, id: Text = text(name).kebab) {\n super(name, id.toString());\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAE1B,MAAM,cAAc,kBAAK;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAqB,MAAc,SAAW,mBAAK,IAAI,EAAE,OAAO;AACxE,UAAM,MAAM,GAAG,SAAS,CAAC;AADI;AAAA,EAE/B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/process/Scope.ts"],"sourcesContent":["import { Enum, IdName, isString, kebab, Text, text } from '../types';\n\nexport class Scope extends Enum {\n // static readonly Basic = new Scope('Basic');\n // static readonly Auth = new Scope('Authorization', 'auth');\n // static readonly Admin = new Scope('Administration', 'admin');\n\n protected constructor(readonly name: string, id: Text = text(name).kebab) {\n super(name, id.toString());\n }\n\n for(item: string | IdName): Scope {\n return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0D;AAEnD,MAAM,cAAc,kBAAK;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAqB,MAAc,SAAW,mBAAK,IAAI,EAAE,OAAO;AACxE,UAAM,MAAM,GAAG,SAAS,CAAC;AADI;AAAA,EAE/B;AAAA,EAEA,IAAI,MAA8B;AAChC,WAAO,IAAI,MAAM,GAAG,KAAK,IAAI,QAAI,uBAAS,IAAI,QAAI,mBAAK,IAAI,EAAE,QAAQ,KAAK,IAAI,QAAI,oBAAM,GAAG,KAAK,EAAE,QAAI,uBAAS,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;AAAA,EAC1I;AACF;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import "../chunk-4N72FQFX.mjs";
2
- import { Enum, text } from "../types";
2
+ import { Enum, isString, kebab, text } from "../types";
3
3
  class Scope extends Enum {
4
4
  // static readonly Basic = new Scope('Basic');
5
5
  // static readonly Auth = new Scope('Authorization', 'auth');
@@ -8,6 +8,9 @@ class Scope extends Enum {
8
8
  super(name, id.toString());
9
9
  this.name = name;
10
10
  }
11
+ for(item) {
12
+ return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));
13
+ }
11
14
  }
12
15
  export {
13
16
  Scope
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/process/Scope.ts"],"sourcesContent":["import { Enum, Text, text } from '../types';\n\nexport class Scope extends Enum {\n // static readonly Basic = new Scope('Basic');\n // static readonly Auth = new Scope('Authorization', 'auth');\n // static readonly Admin = new Scope('Administration', 'admin');\n\n protected constructor(readonly name: string, id: Text = text(name).kebab) {\n super(name, id.toString());\n }\n}\n"],"mappings":";AAAA,SAAS,MAAY,YAAY;AAE1B,MAAM,cAAc,KAAK;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAqB,MAAc,KAAW,KAAK,IAAI,EAAE,OAAO;AACxE,UAAM,MAAM,GAAG,SAAS,CAAC;AADI;AAAA,EAE/B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/process/Scope.ts"],"sourcesContent":["import { Enum, IdName, isString, kebab, Text, text } from '../types';\n\nexport class Scope extends Enum {\n // static readonly Basic = new Scope('Basic');\n // static readonly Auth = new Scope('Authorization', 'auth');\n // static readonly Admin = new Scope('Administration', 'admin');\n\n protected constructor(readonly name: string, id: Text = text(name).kebab) {\n super(name, id.toString());\n }\n\n for(item: string | IdName): Scope {\n return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n }\n}\n"],"mappings":";AAAA,SAAS,MAAc,UAAU,OAAa,YAAY;AAEnD,MAAM,cAAc,KAAK;AAAA;AAAA;AAAA;AAAA,EAKpB,YAAqB,MAAc,KAAW,KAAK,IAAI,EAAE,OAAO;AACxE,UAAM,MAAM,GAAG,SAAS,CAAC;AADI;AAAA,EAE/B;AAAA,EAEA,IAAI,MAA8B;AAChC,WAAO,IAAI,MAAM,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,QAAQ,KAAK,IAAI,IAAI,MAAM,GAAG,KAAK,EAAE,IAAI,SAAS,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;AAAA,EAC1I;AACF;","names":[]}
@@ -3,3 +3,8 @@ export type Identity = {
3
3
  id: Id;
4
4
  user?: string;
5
5
  };
6
+ export type IdName = {
7
+ id: Id;
8
+ name: string;
9
+ slug?: string;
10
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/Identity.ts"],"sourcesContent":["import { Id } from './Id';\n\nexport type Identity = {\n id: Id;\n user?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/Identity.ts"],"sourcesContent":["import { Id } from './Id';\n\nexport type Identity = {\n id: Id;\n user?: string;\n};\n\nexport type IdName = { id: Id; name: string, slug?: string };\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,2 +1,4 @@
1
+ import { Optional } from '../types';
1
2
  export declare function log<T>(t: T): T;
2
3
  export declare function log<T>(label: string, t: T): T;
4
+ export declare function dir<T>(t?: T): Optional<T>;
package/dist/utils/Log.js CHANGED
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var Log_exports = {};
20
20
  __export(Log_exports, {
21
+ dir: () => dir,
21
22
  log: () => log
22
23
  });
23
24
  module.exports = __toCommonJS(Log_exports);
@@ -30,8 +31,13 @@ function log(labelOrT, t) {
30
31
  return labelOrT;
31
32
  }
32
33
  }
34
+ function dir(t) {
35
+ console.dir(t, { depth: 200 });
36
+ return t;
37
+ }
33
38
  // Annotate the CommonJS export names for ESM import in node:
34
39
  0 && (module.exports = {
40
+ dir,
35
41
  log
36
42
  });
37
43
  //# sourceMappingURL=Log.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/Log.ts"],"sourcesContent":["export function log<T>(t: T): T;\nexport function log<T>(label: string, t: T): T;\nexport function log<T>(labelOrT: string | T, t?: T): T {\n if (t) {\n console.log(labelOrT as string, t);\n return t;\n } else {\n console.log(labelOrT);\n return labelOrT as T;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,IAAO,UAAsB,GAAU;AACrD,MAAI,GAAG;AACL,YAAQ,IAAI,UAAoB,CAAC;AACjC,WAAO;AAAA,EACT,OAAO;AACL,YAAQ,IAAI,QAAQ;AACpB,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/Log.ts"],"sourcesContent":["import { Optional } from '../types';\n\nexport function log<T>(t: T): T;\nexport function log<T>(label: string, t: T): T;\nexport function log<T>(labelOrT: string | T, t?: T): T {\n if (t) {\n console.log(labelOrT as string, t);\n return t;\n } else {\n console.log(labelOrT);\n return labelOrT as T;\n }\n}\nexport function dir<T>(t?: T): Optional<T> {\n console.dir(t, { depth: 200 });\n return t;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,IAAO,UAAsB,GAAU;AACrD,MAAI,GAAG;AACL,YAAQ,IAAI,UAAoB,CAAC;AACjC,WAAO;AAAA,EACT,OAAO;AACL,YAAQ,IAAI,QAAQ;AACpB,WAAO;AAAA,EACT;AACF;AACO,SAAS,IAAO,GAAoB;AACzC,UAAQ,IAAI,GAAG,EAAE,OAAO,IAAI,CAAC;AAC7B,SAAO;AACT;","names":[]}
@@ -8,7 +8,12 @@ function log(labelOrT, t) {
8
8
  return labelOrT;
9
9
  }
10
10
  }
11
+ function dir(t) {
12
+ console.dir(t, { depth: 200 });
13
+ return t;
14
+ }
11
15
  export {
16
+ dir,
12
17
  log
13
18
  };
14
19
  //# sourceMappingURL=Log.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/Log.ts"],"sourcesContent":["export function log<T>(t: T): T;\nexport function log<T>(label: string, t: T): T;\nexport function log<T>(labelOrT: string | T, t?: T): T {\n if (t) {\n console.log(labelOrT as string, t);\n return t;\n } else {\n console.log(labelOrT);\n return labelOrT as T;\n }\n}\n"],"mappings":";AAEO,SAAS,IAAO,UAAsB,GAAU;AACrD,MAAI,GAAG;AACL,YAAQ,IAAI,UAAoB,CAAC;AACjC,WAAO;AAAA,EACT,OAAO;AACL,YAAQ,IAAI,QAAQ;AACpB,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/Log.ts"],"sourcesContent":["import { Optional } from '../types';\n\nexport function log<T>(t: T): T;\nexport function log<T>(label: string, t: T): T;\nexport function log<T>(labelOrT: string | T, t?: T): T {\n if (t) {\n console.log(labelOrT as string, t);\n return t;\n } else {\n console.log(labelOrT);\n return labelOrT as T;\n }\n}\nexport function dir<T>(t?: T): Optional<T> {\n console.dir(t, { depth: 200 });\n return t;\n}\n"],"mappings":";AAIO,SAAS,IAAO,UAAsB,GAAU;AACrD,MAAI,GAAG;AACL,YAAQ,IAAI,UAAoB,CAAC;AACjC,WAAO;AAAA,EACT,OAAO;AACL,YAAQ,IAAI,QAAQ;AACpB,WAAO;AAAA,EACT;AACF;AACO,SAAS,IAAO,GAAoB;AACzC,UAAQ,IAAI,GAAG,EAAE,OAAO,IAAI,CAAC;AAC7B,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "15.14.4",
3
+ "version": "15.15.2",
4
4
  "description": "Straightforward library for building domain-driven microservice architectures",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "access": "public"
34
34
  },
35
35
  "devDependencies": {
36
- "@thisisagile/easy-test": "15.14.4",
36
+ "@thisisagile/easy-test": "15.15.2",
37
37
  "@types/form-urlencoded": "^4.4.0",
38
38
  "@types/jsonwebtoken": "^9.0.2",
39
39
  "@types/luxon": "3.2.0",
@@ -1,4 +1,4 @@
1
- import { Enum, Text, text } from '../types';
1
+ import { Enum, IdName, isString, kebab, Text, text } from '../types';
2
2
 
3
3
  export class Scope extends Enum {
4
4
  // static readonly Basic = new Scope('Basic');
@@ -8,4 +8,8 @@ export class Scope extends Enum {
8
8
  protected constructor(readonly name: string, id: Text = text(name).kebab) {
9
9
  super(name, id.toString());
10
10
  }
11
+
12
+ for(item: string | IdName): Scope {
13
+ return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));
14
+ }
11
15
  }
@@ -4,3 +4,5 @@ export type Identity = {
4
4
  id: Id;
5
5
  user?: string;
6
6
  };
7
+
8
+ export type IdName = { id: Id; name: string, slug?: string };
package/src/utils/Log.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Optional } from '../types';
2
+
1
3
  export function log<T>(t: T): T;
2
4
  export function log<T>(label: string, t: T): T;
3
5
  export function log<T>(labelOrT: string | T, t?: T): T {
@@ -9,3 +11,7 @@ export function log<T>(labelOrT: string | T, t?: T): T {
9
11
  return labelOrT as T;
10
12
  }
11
13
  }
14
+ export function dir<T>(t?: T): Optional<T> {
15
+ console.dir(t, { depth: 200 });
16
+ return t;
17
+ }