@interopio/utils 1.0.1 → 1.1.1

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/changelog.md CHANGED
@@ -1,2 +1,8 @@
1
- 1.0.0.
1
+ 1.1.1
2
+ fix: Update of tsconfig.json of Utils to generate correct typings
3
+ 1.1.0
4
+ fix: Bugfix fdc3 2.0 definition decoder
5
+ 1.0.1
6
+ fix: 'localizedVersions' decoder for fdc3 2.0 definition
7
+ 1.0.0
2
8
  initial release
@@ -0,0 +1,3 @@
1
+ import { Decoder } from "decoder-validate";
2
+ export declare const nonEmptyStringDecoder: Decoder<string>;
3
+ export declare const nonNegativeNumberDecoder: Decoder<number>;
@@ -0,0 +1,7 @@
1
+ import { Decoder } from "decoder-validate";
2
+ import { FDC3DefinitionV1, FDC3DefinitionV2, IOConnectBrowserHostManifestDefinition } from "../../fdc3/types";
3
+ declare const glue42HostManifestsBrowserDecoder: Decoder<IOConnectBrowserHostManifestDefinition>;
4
+ declare const v1DefinitionDecoder: Decoder<FDC3DefinitionV1>;
5
+ declare const v2DefinitionDecoder: Decoder<FDC3DefinitionV2>;
6
+ declare const allDefinitionsDecoder: Decoder<FDC3DefinitionV1 | FDC3DefinitionV2>;
7
+ export { glue42HostManifestsBrowserDecoder, v1DefinitionDecoder, v2DefinitionDecoder, allDefinitionsDecoder };
@@ -0,0 +1,2 @@
1
+ import { Decoders } from "./types";
2
+ export declare const decoders: Decoders;
@@ -0,0 +1,16 @@
1
+ import { Decoder } from "decoder-validate";
2
+ import { FDC3DefinitionV1, FDC3DefinitionV2 } from "../fdc3/types";
3
+ interface FDC3Decoders {
4
+ allDefinitionsDecoder: Decoder<FDC3DefinitionV1 | FDC3DefinitionV2>;
5
+ v1DefinitionDecoder: Decoder<FDC3DefinitionV1>;
6
+ v2DefinitionDecoder: Decoder<FDC3DefinitionV2>;
7
+ }
8
+ interface CommonDecoders {
9
+ nonEmptyStringDecoder: Decoder<string>;
10
+ nonNegativeNumberDecoder: Decoder<number>;
11
+ }
12
+ export interface Decoders {
13
+ fdc3: FDC3Decoders;
14
+ common: CommonDecoders;
15
+ }
16
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const connectBrowserAppProps: string[];
2
+ export declare const requiredFdc3v1Props: string[];
3
+ export declare const requiredFdc3v2Props: string[];
4
+ export declare const fdc3v2AppProps: string[];
@@ -0,0 +1,14 @@
1
+ import { FDC3 } from "./types";
2
+ export declare class FDC3Service {
3
+ private readonly fdc3ToDesktopDefinitionType;
4
+ toApi(): FDC3;
5
+ private isFdc3Definition;
6
+ private parseToBrowserBaseAppData;
7
+ private parseToDesktopAppConfig;
8
+ private getUserPropertiesFromDefinition;
9
+ private getUrl;
10
+ private getIntentsFromV2AppDefinition;
11
+ private getIconFromDefinition;
12
+ private mergeBaseAppDataWithGlueManifest;
13
+ private mergeDesktopConfigWithGlueManifest;
14
+ }
@@ -0,0 +1,200 @@
1
+ export interface FDC3 {
2
+ isFdc3Definition(definition: any): IsFdc3DefinitionResult;
3
+ parseToBrowserBaseAppData(definition: any): IOConnectBrowserBaseAppData;
4
+ parseToDesktopAppConfig(definition: any): IOConnectDesktopAppConfig;
5
+ }
6
+ export interface ImageV1 {
7
+ url?: string;
8
+ }
9
+ export interface IconV1 {
10
+ icon?: string;
11
+ }
12
+ export interface Intent {
13
+ name: string;
14
+ displayName?: string;
15
+ contexts?: string[];
16
+ customConfig?: object;
17
+ resultType?: string;
18
+ }
19
+ export interface PropertiesObject {
20
+ [key: string]: unknown;
21
+ }
22
+ export interface FDC3DefinitionV1 {
23
+ name: string;
24
+ title?: string;
25
+ version?: string;
26
+ appId: string;
27
+ manifest: string;
28
+ manifestType: string;
29
+ tooltip?: string;
30
+ description?: string;
31
+ contactEmail?: string;
32
+ supportEmail?: string;
33
+ publisher?: string;
34
+ images?: ImageV1[];
35
+ icons?: IconV1[];
36
+ customConfig?: PropertiesObject;
37
+ intents?: Intent[];
38
+ }
39
+ export type FDC3v2AppDefinitionTypes = "web" | "native" | "citrix" | "onlineNative" | "other";
40
+ export type SupportedVersions = "1.2" | "2.0";
41
+ export interface IconV2 {
42
+ src: string;
43
+ size?: string;
44
+ type?: string;
45
+ }
46
+ export interface ImageV2 {
47
+ src: string;
48
+ size?: string;
49
+ type?: string;
50
+ label?: string;
51
+ }
52
+ interface FDC3Intent {
53
+ contexts: string[];
54
+ displayName?: string;
55
+ resultType?: string;
56
+ customConfig?: any;
57
+ }
58
+ export interface InteropIntentsV2 {
59
+ listensFor?: {
60
+ [intentName: string]: FDC3Intent;
61
+ };
62
+ raises?: {
63
+ [intentName: string]: string[];
64
+ };
65
+ }
66
+ export interface InteropUserChannelV2 {
67
+ broadcasts?: string[];
68
+ listensFor?: string[];
69
+ }
70
+ export interface InteropAppChannelV2 {
71
+ name: string;
72
+ description?: string;
73
+ broadcasts?: string[];
74
+ listensFor?: string[];
75
+ }
76
+ export interface InteropV2 {
77
+ intents?: InteropIntentsV2;
78
+ userChannels?: InteropUserChannelV2;
79
+ appChannels?: InteropAppChannelV2[];
80
+ }
81
+ export interface LocalizedVersionDefinition {
82
+ appId?: string;
83
+ name?: string;
84
+ type?: FDC3v2AppDefinitionTypes;
85
+ details?: {
86
+ url: string;
87
+ };
88
+ version?: string;
89
+ title?: string;
90
+ tooltip?: string;
91
+ lang?: string;
92
+ description?: string;
93
+ categories?: string[];
94
+ icons?: IconV2[];
95
+ screenshots?: ImageV2[];
96
+ contactEmail?: string;
97
+ supportEmail?: string;
98
+ moreInfo?: string;
99
+ publisher?: string;
100
+ customConfig?: PropertiesObject[];
101
+ hostManifests?: any;
102
+ interop?: InteropV2;
103
+ localizedVersions?: {
104
+ [languageTag: string]: LocalizedVersionDefinition;
105
+ };
106
+ }
107
+ export interface FDC3DefinitionV2 {
108
+ appId: string;
109
+ name: string;
110
+ type: FDC3v2AppDefinitionTypes;
111
+ details: {
112
+ url: string;
113
+ };
114
+ version?: string;
115
+ title?: string;
116
+ tooltip?: string;
117
+ lang?: string;
118
+ description?: string;
119
+ categories?: string[];
120
+ icons?: IconV2[];
121
+ screenshots?: ImageV2[];
122
+ contactEmail?: string;
123
+ supportEmail?: string;
124
+ moreInfo?: string;
125
+ publisher?: string;
126
+ customConfig?: PropertiesObject[];
127
+ hostManifests?: any;
128
+ interop?: InteropV2;
129
+ localizedVersions?: {
130
+ [languageTag: string]: LocalizedVersionDefinition;
131
+ };
132
+ }
133
+ export interface FDC3DefinitionV2Extended extends FDC3DefinitionV2 {
134
+ definitionVersion: string;
135
+ }
136
+ interface BaseApplicationFdc3Prop extends FDC3DefinitionV2 {
137
+ definitionVersion: string;
138
+ }
139
+ export interface IOConnectBrowserDefinitionDetails {
140
+ url: string;
141
+ top?: number;
142
+ left?: number;
143
+ width?: number;
144
+ height?: number;
145
+ }
146
+ export interface IOConnectBrowserBaseAppData {
147
+ name: string;
148
+ type: string;
149
+ createOptions: IOConnectBrowserDefinitionDetails;
150
+ userProperties?: any;
151
+ title?: string;
152
+ version?: string;
153
+ icon?: string;
154
+ caption?: string;
155
+ fdc3?: BaseApplicationFdc3Prop;
156
+ }
157
+ export interface IsFdc3DefinitionResult {
158
+ isFdc3: boolean;
159
+ version?: SupportedVersions;
160
+ }
161
+ export interface Fdc3Intent {
162
+ contexts: string[];
163
+ displayName?: string;
164
+ resultType?: string;
165
+ }
166
+ export interface IntentInfo {
167
+ name: string;
168
+ displayName?: string;
169
+ contexts: string[];
170
+ resultType?: string;
171
+ }
172
+ export interface IOConnectDesktopAppConfig {
173
+ name: string;
174
+ type: DesktopAppDefinitionType;
175
+ details: {
176
+ url: string;
177
+ };
178
+ version?: string;
179
+ title?: string;
180
+ tooltip?: string;
181
+ caption?: string;
182
+ icon?: string;
183
+ customProperties?: any;
184
+ intents?: Intent[];
185
+ fdc3?: FDC3DefinitionV2Extended;
186
+ }
187
+ export type DesktopAppDefinitionType = "window" | "exe" | "citrix" | "activity" | "node" | "canvas" | "workspaces" | "webGroup" | "clickonce" | "childWindow";
188
+ export interface IOConnectBrowserHostManifestDefinition {
189
+ name?: string;
190
+ type?: string;
191
+ title?: string;
192
+ version?: string;
193
+ details?: IOConnectBrowserDefinitionDetails;
194
+ customProperties?: PropertiesObject;
195
+ icon?: string;
196
+ caption?: string;
197
+ intents?: Intent[];
198
+ hidden?: boolean;
199
+ }
200
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Decoders } from "./decoders/types";
2
+ import { FDC3 } from "./fdc3/types";
3
+ export declare const fdc3: FDC3;
4
+ export declare const decoders: Decoders;
@@ -0,0 +1,8 @@
1
+ import { FDC3 } from "../fdc3/types";
2
+ import { Decoders } from "../decoders/types";
3
+ export declare class IoC {
4
+ private _fdc3;
5
+ private _decoders;
6
+ get fdc3(): FDC3;
7
+ get decoders(): Decoders;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { Decoders } from "../decoders/types";
2
+ import { FDC3 } from "../fdc3/types";
3
+ export interface Utils {
4
+ fdc3: FDC3;
5
+ decoders: Decoders;
6
+ }
@@ -0,0 +1,2 @@
1
+ import { DecoderError } from "decoder-validate";
2
+ export declare const parseDecoderErrorToStringMessage: (error: DecoderError) => string;
package/dist/utils.es.js CHANGED
@@ -780,7 +780,7 @@ Decoder.succeed;
780
780
  /** See `Decoder.fail` */
781
781
  Decoder.fail;
782
782
  /** See `Decoder.lazy` */
783
- var lazy = Decoder.lazy;
783
+ Decoder.lazy;
784
784
 
785
785
  const nonEmptyStringDecoder = string().where((s) => s.length > 0, "Expected a non-empty string");
786
786
  const nonNegativeNumberDecoder = number().where((num) => num >= 0, "Expected a non-negative number");
@@ -870,6 +870,26 @@ const v1DefinitionDecoder = object({
870
870
  customConfig: anyJson(),
871
871
  intents: optional(array(intentDefinitionDecoder))
872
872
  });
873
+ const v2LocalizedDefinitionDecoder = object({
874
+ appId: optional(nonEmptyStringDecoder),
875
+ name: optional(nonEmptyStringDecoder),
876
+ details: optional(v2DetailsDecoder),
877
+ version: optional(nonEmptyStringDecoder),
878
+ title: optional(nonEmptyStringDecoder),
879
+ tooltip: optional(nonEmptyStringDecoder),
880
+ lang: optional(nonEmptyStringDecoder),
881
+ description: optional(nonEmptyStringDecoder),
882
+ categories: optional(array(nonEmptyStringDecoder)),
883
+ icons: optional(array(v2IconDecoder)),
884
+ screenshots: optional(array(v2ScreenshotDecoder)),
885
+ contactEmail: optional(nonEmptyStringDecoder),
886
+ supportEmail: optional(nonEmptyStringDecoder),
887
+ moreInfo: optional(nonEmptyStringDecoder),
888
+ publisher: optional(nonEmptyStringDecoder),
889
+ customConfig: optional(array(anyJson())),
890
+ hostManifests: optional(hostManifestsBrowserDecoder),
891
+ interop: optional(v2InteropDecoder)
892
+ });
873
893
  const v2DefinitionDecoder = object({
874
894
  appId: nonEmptyStringDecoder,
875
895
  name: nonEmptyStringDecoder,
@@ -890,7 +910,7 @@ const v2DefinitionDecoder = object({
890
910
  customConfig: optional(array(anyJson())),
891
911
  hostManifests: optional(hostManifestsBrowserDecoder),
892
912
  interop: optional(v2InteropDecoder),
893
- localizedVersions: optional(lazy(() => dict(v2DefinitionDecoder)))
913
+ localizedVersions: optional(dict(v2LocalizedDefinitionDecoder))
894
914
  });
895
915
  const allDefinitionsDecoder = oneOf(v1DefinitionDecoder, v2DefinitionDecoder);
896
916