@ztimson/utils 0.19.1 → 0.19.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.
@@ -10,20 +10,20 @@
10
10
  */
11
11
  export type Method = '*' | 'n' | 'c' | 'r' | 'u' | 'd' | 'x';
12
12
  /**
13
- * Shorthand for creating PathedEvent from a string
13
+ * Shorthand for creating Event from a string
14
14
  *
15
15
  * @example
16
16
  * ```ts
17
- * const event: PathedEvent = PE`users/system:*`;
17
+ * const event: Event = PE`users/system:*`;
18
18
  * ```
19
19
  *
20
- * @param {TemplateStringsArray} str String that will be parsed into PathedEvent
20
+ * @param {TemplateStringsArray} str String that will be parsed into Event
21
21
  * @param {string} args
22
- * @return {PathEvent} PathedEvent object
22
+ * @return {PathEvent} Event object
23
23
  */
24
24
  export declare function PE(str: TemplateStringsArray, ...args: string[]): PathEvent;
25
25
  /**
26
- * Shorthand for creating PathedEvent strings, ensures paths are correct
26
+ * Shorthand for creating Event strings, ensures paths are correct
27
27
  *
28
28
  * @param {TemplateStringsArray} str
29
29
  * @param {string} args
@@ -32,8 +32,8 @@ export declare function PE(str: TemplateStringsArray, ...args: string[]): PathEv
32
32
  */
33
33
  export declare function PES(str: TemplateStringsArray, ...args: any[]): string;
34
34
  /**
35
- * A pathed event broken down into its core components for easy processing
36
- * PathedEvent Structure: `module/path/name:property:method`
35
+ * A event broken down into its core components for easy processing
36
+ * Event Structure: `module/path/name:property:method`
37
37
  * Example: `users/system:crud` or `storage/some/path/file.txt:r`
38
38
  */
39
39
  export declare class PathEvent {
@@ -59,19 +59,19 @@ export declare class PathEvent {
59
59
  update: boolean;
60
60
  /** Delete method specified */
61
61
  delete: boolean;
62
- constructor(pathedEvent: string | PathEvent);
62
+ constructor(Event: string | PathEvent);
63
63
  /**
64
- * Combine multiple pathed events into one parsed object. Longest path takes precedent, but all subsequent methods are
64
+ * Combine multiple events into one parsed object. Longest path takes precedent, but all subsequent methods are
65
65
  * combined until a "none" is reached
66
66
  *
67
- * @param {string | PathEvent} paths PathedEvents as strings or pre-parsed
67
+ * @param {string | PathEvent} paths Events as strings or pre-parsed
68
68
  * @return {PathEvent} Final combined permission
69
69
  */
70
70
  static combine(paths: (string | PathEvent)[]): PathEvent;
71
71
  /**
72
72
  * Squash 2 sets of paths & return true if any overlap is found
73
73
  *
74
- * @param {string | PathEvent | (string | PathEvent)[]} target Array of PathedEvents as strings or pre-parsed
74
+ * @param {string | PathEvent | (string | PathEvent)[]} target Array of Events as strings or pre-parsed
75
75
  * @param has Target must have at least one of these path
76
76
  * @return {boolean} Whether there is any overlap
77
77
  */
@@ -79,7 +79,7 @@ export declare class PathEvent {
79
79
  /**
80
80
  * Squash 2 sets of paths & return true if the target has all paths
81
81
  *
82
- * @param {string | PathEvent | (string | PathEvent)[]} target Array of PathedEvents as strings or pre-parsed
82
+ * @param {string | PathEvent | (string | PathEvent)[]} target Array of Events as strings or pre-parsed
83
83
  * @param has Target must have all these paths
84
84
  * @return {boolean} Whether there is any overlap
85
85
  */
@@ -87,35 +87,35 @@ export declare class PathEvent {
87
87
  /**
88
88
  * Same as `has` but raises an error if there is no overlap
89
89
  *
90
- * @param {string | string[]} target Array of PathedEvents as strings or pre-parsed
90
+ * @param {string | string[]} target Array of Events as strings or pre-parsed
91
91
  * @param has Target must have at least one of these path
92
92
  */
93
93
  static hasFatal(target: string | PathEvent | (string | PathEvent)[], ...has: (string | PathEvent)[]): void;
94
94
  /**
95
95
  * Same as `hasAll` but raises an error if the target is missing any paths
96
96
  *
97
- * @param {string | string[]} target Array of PathedEvents as strings or pre-parsed
97
+ * @param {string | string[]} target Array of Events as strings or pre-parsed
98
98
  * @param has Target must have all these paths
99
99
  */
100
100
  static hasAllFatal(target: string | PathEvent | (string | PathEvent)[], ...has: (string | PathEvent)[]): void;
101
101
  /**
102
- * Create pathed event string from its components
102
+ * Create event string from its components
103
103
  *
104
104
  * @param {string | string[]} path Event path
105
105
  * @param {Method} methods Event method
106
- * @return {string} String representation of PathedEvent
106
+ * @return {string} String representation of Event
107
107
  */
108
108
  static toString(path: string | string[], methods: Method | Method[]): string;
109
109
  /**
110
- * Create pathed event string from its components
110
+ * Create event string from its components
111
111
  *
112
- * @return {string} String representation of PathedEvent
112
+ * @return {string} String representation of Event
113
113
  */
114
114
  toString(): string;
115
115
  }
116
116
  export type PathListener = (event: PathEvent, ...args: any[]) => any;
117
117
  export type PathUnsubscribe = () => void;
118
- export interface IPathedEventEmitter {
118
+ export interface IPathEventEmitter {
119
119
  emit(event: string, ...args: any[]): void;
120
120
  off(listener: PathListener): void;
121
121
  on(event: string, listener: PathListener): PathUnsubscribe;
@@ -125,11 +125,11 @@ export interface IPathedEventEmitter {
125
125
  /**
126
126
  * Event emitter that uses paths allowing listeners to listen to different combinations of modules, paths & methods
127
127
  */
128
- export declare class PathEventEmitter implements IPathedEventEmitter {
128
+ export declare class PathEventEmitter implements IPathEventEmitter {
129
129
  private listeners;
130
130
  emit(event: string | PathEvent, ...args: any[]): void;
131
131
  off(listener: PathListener): void;
132
132
  on(event: string | string[], listener: PathListener): PathUnsubscribe;
133
133
  once(event: string | string[], listener?: PathListener): Promise<any>;
134
- relayEvents(emitter: IPathedEventEmitter): void;
134
+ relayEvents(emitter: IPathEventEmitter): void;
135
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztimson/utils",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Utility library",
5
5
  "author": "Zak Timson",
6
6
  "license": "MIT",