@deenruv/common 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ # License 1
2
+
3
+ The MIT License
4
+
5
+ Copyright (c) 2025-present Aexol
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+
13
+ # License 2
14
+
15
+ The MIT License
16
+
17
+ Copyright (c) 2018-2025 Michael Bromley
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @deenruv/common
2
+
3
+ This package contains a set of common utility functions and TypeScript types used by multiple Deenruv packages. It is not intended to be directly depended upon by an end-user project.
@@ -0,0 +1,67 @@
1
+ export type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | "standby";
2
+ export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network";
3
+ export interface BaseExtensionMessage {
4
+ requestId: string;
5
+ type: string;
6
+ data: any;
7
+ }
8
+ export interface ActiveRouteData {
9
+ url: string;
10
+ origin: string;
11
+ pathname: string;
12
+ params: {
13
+ [key: string]: any;
14
+ };
15
+ queryParams: {
16
+ [key: string]: any;
17
+ };
18
+ fragment: string | null;
19
+ }
20
+ export interface ActivatedRouteMessage extends BaseExtensionMessage {
21
+ type: "active-route";
22
+ }
23
+ export interface QueryMessage extends BaseExtensionMessage {
24
+ type: "graphql-query";
25
+ data: {
26
+ document: string;
27
+ variables?: {
28
+ [key: string]: any;
29
+ };
30
+ fetchPolicy?: WatchQueryFetchPolicy;
31
+ };
32
+ }
33
+ export interface MutationMessage extends BaseExtensionMessage {
34
+ type: "graphql-mutation";
35
+ data: {
36
+ document: string;
37
+ variables?: {
38
+ [key: string]: any;
39
+ };
40
+ };
41
+ }
42
+ export interface NotificationMessage extends BaseExtensionMessage {
43
+ type: "notification";
44
+ data: {
45
+ message: string;
46
+ translationVars?: {
47
+ [key: string]: string | number;
48
+ };
49
+ type?: "info" | "success" | "error" | "warning";
50
+ duration?: number;
51
+ };
52
+ }
53
+ export interface CancellationMessage extends BaseExtensionMessage {
54
+ type: "cancellation";
55
+ data: null;
56
+ }
57
+ export interface DestroyMessage extends BaseExtensionMessage {
58
+ type: "destroy";
59
+ data: null;
60
+ }
61
+ export type ExtensionMessage = ActivatedRouteMessage | QueryMessage | MutationMessage | NotificationMessage | CancellationMessage | DestroyMessage;
62
+ export interface MessageResponse {
63
+ requestId: string;
64
+ data: any;
65
+ complete: boolean;
66
+ error: boolean;
67
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=extension-host-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-host-types.js","sourceRoot":"","sources":["../src/extension-host-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Performs a filter operation where the predicate is an async function returning a Promise.
3
+ */
4
+ export declare function filterAsync<T>(arr: T[], predicate: (item: T, index: number) => Promise<boolean> | boolean): Promise<T[]>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterAsync = void 0;
4
+ /**
5
+ * Performs a filter operation where the predicate is an async function returning a Promise.
6
+ */
7
+ async function filterAsync(arr, predicate) {
8
+ const results = await Promise.all(arr.map(async (value, index) => predicate(value, index)));
9
+ return arr.filter((_, i) => results[i]);
10
+ }
11
+ exports.filterAsync = filterAsync;
12
+ //# sourceMappingURL=filter-async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-async.js","sourceRoot":"","sources":["../src/filter-async.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,KAAK,UAAU,WAAW,CAC/B,GAAQ,EACR,SAAiE;IAEjE,MAAM,OAAO,GAAc,MAAM,OAAO,CAAC,GAAG,CAC1C,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CACzD,CAAC;IACF,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AARD,kCAQC"}