@sudoplatform/sudo-notification 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 +14 -0
- package/README.md +20 -0
- package/cjs/gen/graphqlTypes.js +34 -0
- package/cjs/gen/graphqlTypes.js.map +1 -0
- package/cjs/index.js +10 -0
- package/cjs/index.js.map +1 -0
- package/cjs/private/apiClient.js +139 -0
- package/cjs/private/apiClient.js.map +1 -0
- package/cjs/private/codecs/sudoPlatformPayloadCodec.js +21 -0
- package/cjs/private/codecs/sudoPlatformPayloadCodec.js.map +1 -0
- package/cjs/private/constants.js +10 -0
- package/cjs/private/constants.js.map +1 -0
- package/cjs/private/transformers/buildTypeTransformer.js +30 -0
- package/cjs/private/transformers/buildTypeTransformer.js.map +1 -0
- package/cjs/private/transformers/errorTransformer.js +34 -0
- package/cjs/private/transformers/errorTransformer.js.map +1 -0
- package/cjs/private/transformers/notificationConfigurationTransformer.js +21 -0
- package/cjs/private/transformers/notificationConfigurationTransformer.js.map +1 -0
- package/cjs/private/transformers/notificationEnableStatusTransformer.js +32 -0
- package/cjs/private/transformers/notificationEnableStatusTransformer.js.map +1 -0
- package/cjs/private/transformers/notificationMetadataTransformer.js +17 -0
- package/cjs/private/transformers/notificationMetadataTransformer.js.map +1 -0
- package/cjs/private/types/canonicalPushSubscriptionJSON.js +8 -0
- package/cjs/private/types/canonicalPushSubscriptionJSON.js.map +1 -0
- package/cjs/private/types/notifiableServiceConfig.js +12 -0
- package/cjs/private/types/notifiableServiceConfig.js.map +1 -0
- package/cjs/private/types/notificationServiceConfig.js +17 -0
- package/cjs/private/types/notificationServiceConfig.js.map +1 -0
- package/cjs/private/types/sudoNotificationClientPrivateOptions.js +3 -0
- package/cjs/private/types/sudoNotificationClientPrivateOptions.js.map +1 -0
- package/cjs/public/errors.js +131 -0
- package/cjs/public/errors.js.map +1 -0
- package/cjs/public/index.js +13 -0
- package/cjs/public/index.js.map +1 -0
- package/cjs/public/sudoNotifiableClient.js +106 -0
- package/cjs/public/sudoNotifiableClient.js.map +1 -0
- package/cjs/public/sudoNotificationClient.js +164 -0
- package/cjs/public/sudoNotificationClient.js.map +1 -0
- package/cjs/public/types/buildType.js +18 -0
- package/cjs/public/types/buildType.js.map +1 -0
- package/cjs/public/types/index.js +20 -0
- package/cjs/public/types/index.js.map +1 -0
- package/cjs/public/types/notificationConfiguration.js +13 -0
- package/cjs/public/types/notificationConfiguration.js.map +1 -0
- package/cjs/public/types/notificationDeviceInfo.js +3 -0
- package/cjs/public/types/notificationDeviceInfo.js.map +1 -0
- package/cjs/public/types/notificationEnabledStatus.js +14 -0
- package/cjs/public/types/notificationEnabledStatus.js.map +1 -0
- package/cjs/public/types/notificationFilterItem.js +35 -0
- package/cjs/public/types/notificationFilterItem.js.map +1 -0
- package/cjs/public/types/notificationMetadata.js +22 -0
- package/cjs/public/types/notificationMetadata.js.map +1 -0
- package/cjs/public/types/notificationSchemaEntry.js +26 -0
- package/cjs/public/types/notificationSchemaEntry.js.map +1 -0
- package/cjs/public/types/sudoNotification.js +29 -0
- package/cjs/public/types/sudoNotification.js.map +1 -0
- package/cjs/public/types/sudoNotificationClientOptions.js +8 -0
- package/cjs/public/types/sudoNotificationClientOptions.js.map +1 -0
- package/cjs/public/types/sudoNotificationData.js +25 -0
- package/cjs/public/types/sudoNotificationData.js.map +1 -0
- package/cjs/public/types/sudoNotificationFilterClient.js +8 -0
- package/cjs/public/types/sudoNotificationFilterClient.js.map +1 -0
- package/lib/gen/graphqlTypes.js +31 -0
- package/lib/gen/graphqlTypes.js.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/private/apiClient.js +135 -0
- package/lib/private/apiClient.js.map +1 -0
- package/lib/private/codecs/sudoPlatformPayloadCodec.js +17 -0
- package/lib/private/codecs/sudoPlatformPayloadCodec.js.map +1 -0
- package/lib/private/constants.js +7 -0
- package/lib/private/constants.js.map +1 -0
- package/lib/private/transformers/buildTypeTransformer.js +26 -0
- package/lib/private/transformers/buildTypeTransformer.js.map +1 -0
- package/lib/private/transformers/errorTransformer.js +30 -0
- package/lib/private/transformers/errorTransformer.js.map +1 -0
- package/lib/private/transformers/notificationConfigurationTransformer.js +17 -0
- package/lib/private/transformers/notificationConfigurationTransformer.js.map +1 -0
- package/lib/private/transformers/notificationEnableStatusTransformer.js +28 -0
- package/lib/private/transformers/notificationEnableStatusTransformer.js.map +1 -0
- package/lib/private/transformers/notificationMetadataTransformer.js +13 -0
- package/lib/private/transformers/notificationMetadataTransformer.js.map +1 -0
- package/lib/private/types/canonicalPushSubscriptionJSON.js +7 -0
- package/lib/private/types/canonicalPushSubscriptionJSON.js.map +1 -0
- package/lib/private/types/notifiableServiceConfig.js +8 -0
- package/lib/private/types/notifiableServiceConfig.js.map +1 -0
- package/lib/private/types/notificationServiceConfig.js +13 -0
- package/lib/private/types/notificationServiceConfig.js.map +1 -0
- package/lib/private/types/sudoNotificationClientPrivateOptions.js +2 -0
- package/lib/private/types/sudoNotificationClientPrivateOptions.js.map +1 -0
- package/lib/public/errors.js +116 -0
- package/lib/public/errors.js.map +1 -0
- package/lib/public/index.js +10 -0
- package/lib/public/index.js.map +1 -0
- package/lib/public/sudoNotifiableClient.js +102 -0
- package/lib/public/sudoNotifiableClient.js.map +1 -0
- package/lib/public/sudoNotificationClient.js +160 -0
- package/lib/public/sudoNotificationClient.js.map +1 -0
- package/lib/public/types/buildType.js +15 -0
- package/lib/public/types/buildType.js.map +1 -0
- package/lib/public/types/index.js +17 -0
- package/lib/public/types/index.js.map +1 -0
- package/lib/public/types/notificationConfiguration.js +9 -0
- package/lib/public/types/notificationConfiguration.js.map +1 -0
- package/lib/public/types/notificationDeviceInfo.js +2 -0
- package/lib/public/types/notificationDeviceInfo.js.map +1 -0
- package/lib/public/types/notificationEnabledStatus.js +11 -0
- package/lib/public/types/notificationEnabledStatus.js.map +1 -0
- package/lib/public/types/notificationFilterItem.js +31 -0
- package/lib/public/types/notificationFilterItem.js.map +1 -0
- package/lib/public/types/notificationMetadata.js +18 -0
- package/lib/public/types/notificationMetadata.js.map +1 -0
- package/lib/public/types/notificationSchemaEntry.js +22 -0
- package/lib/public/types/notificationSchemaEntry.js.map +1 -0
- package/lib/public/types/sudoNotification.js +25 -0
- package/lib/public/types/sudoNotification.js.map +1 -0
- package/lib/public/types/sudoNotificationClientOptions.js +7 -0
- package/lib/public/types/sudoNotificationClientOptions.js.map +1 -0
- package/lib/public/types/sudoNotificationData.js +21 -0
- package/lib/public/types/sudoNotificationData.js.map +1 -0
- package/lib/public/types/sudoNotificationFilterClient.js +7 -0
- package/lib/public/types/sudoNotificationFilterClient.js.map +1 -0
- package/package.json +107 -0
- package/types/gen/graphqlTypes.d.ts +229 -0
- package/types/index.d.ts +1 -0
- package/types/private/apiClient.d.ts +20 -0
- package/types/private/codecs/sudoPlatformPayloadCodec.d.ts +12 -0
- package/types/private/constants.d.ts +1 -0
- package/types/private/transformers/buildTypeTransformer.d.ts +6 -0
- package/types/private/transformers/errorTransformer.d.ts +4 -0
- package/types/private/transformers/notificationConfigurationTransformer.d.ts +6 -0
- package/types/private/transformers/notificationEnableStatusTransformer.d.ts +6 -0
- package/types/private/transformers/notificationMetadataTransformer.d.ts +5 -0
- package/types/private/types/canonicalPushSubscriptionJSON.d.ts +17 -0
- package/types/private/types/notifiableServiceConfig.d.ts +5 -0
- package/types/private/types/notificationServiceConfig.d.ts +7 -0
- package/types/private/types/sudoNotificationClientPrivateOptions.d.ts +13 -0
- package/types/public/errors.d.ts +81 -0
- package/types/public/index.d.ts +4 -0
- package/types/public/sudoNotifiableClient.d.ts +69 -0
- package/types/public/sudoNotificationClient.d.ts +109 -0
- package/types/public/types/buildType.d.ts +8 -0
- package/types/public/types/index.d.ts +11 -0
- package/types/public/types/notificationConfiguration.d.ts +6 -0
- package/types/public/types/notificationDeviceInfo.d.ts +41 -0
- package/types/public/types/notificationEnabledStatus.d.ts +4 -0
- package/types/public/types/notificationFilterItem.d.ts +13 -0
- package/types/public/types/notificationMetadata.d.ts +22 -0
- package/types/public/types/notificationSchemaEntry.d.ts +18 -0
- package/types/public/types/sudoNotification.d.ts +25 -0
- package/types/public/types/sudoNotificationClientOptions.d.ts +11 -0
- package/types/public/types/sudoNotificationData.d.ts +14 -0
- package/types/public/types/sudoNotificationFilterClient.d.ts +17 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sudoNotificationFilterClient.js","sourceRoot":"","sources":["../../../src/public/types/sudoNotificationFilterClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sudoplatform/sudo-notification",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "Anonyome Labs, Inc.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/sudoplatform/sudo-notification-web.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"prepare": "husky",
|
|
12
|
+
"lint": "yarn lint:eslint && yarn lint:prettier",
|
|
13
|
+
"lint:eslint": "eslint \"{bin,test,src}/**/*.{js,ts,tsx}\"",
|
|
14
|
+
"lint:prettier": "prettier -l \"{bin,test,src}/**/*.{js,json,jsx,ts,tsx}\"",
|
|
15
|
+
"codegen": "graphql-codegen -c codegen.yml",
|
|
16
|
+
"verify": "yarn audit-with-suppressions && yarn lint && yarn unit-test",
|
|
17
|
+
"unit-test": "jest --coverage test/unit",
|
|
18
|
+
"integration-test": "jest test/integration",
|
|
19
|
+
"clean": "rm -rf esm lib docs",
|
|
20
|
+
"build": "yarn codegen && yarn build:transpile && yarn build:docs",
|
|
21
|
+
"build:transpile": "concurrently \"yarn build:transpile:declarations\" \"yarn build:transpile:cjs\" \"yarn build:transpile:esm\"",
|
|
22
|
+
"build:transpile:cjs": "tsc --project tsconfig.commonjs.json",
|
|
23
|
+
"build:transpile:esm": "tsc",
|
|
24
|
+
"build:transpile:declarations": "tsc --project tsconfig.declarations.json",
|
|
25
|
+
"build:docs": "typedoc --treatWarningsAsErrors --excludePrivate --out docs src/index.ts"
|
|
26
|
+
},
|
|
27
|
+
"main": "./cjs/index.js",
|
|
28
|
+
"types": "./types/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./types/index.d.ts",
|
|
32
|
+
"import": "./lib/index.js",
|
|
33
|
+
"require": "./cjs/index.js",
|
|
34
|
+
"default": "./lib/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"sideEffects": false,
|
|
38
|
+
"files": [
|
|
39
|
+
"cjs",
|
|
40
|
+
"lib",
|
|
41
|
+
"types"
|
|
42
|
+
],
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@sudoplatform/sudo-api-client": "^15.0.0",
|
|
45
|
+
"@sudoplatform/sudo-common": "^10.0.4",
|
|
46
|
+
"@sudoplatform/sudo-user": "^15.1.1"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"fp-ts": "^2.16.8",
|
|
50
|
+
"graphql": "^15.9.0",
|
|
51
|
+
"io-ts": "^2.2.21",
|
|
52
|
+
"monocle-ts": "^2.3.13",
|
|
53
|
+
"newtype-ts": "^0.3.5",
|
|
54
|
+
"tslib": "^2.6.3"
|
|
55
|
+
},
|
|
56
|
+
"resolutions": {
|
|
57
|
+
"**/apollo-link": "^1.2.14",
|
|
58
|
+
"**/apollo-cache-inmemory": "^1.6.6"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@eslint/compat": "^1.2.7",
|
|
62
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
63
|
+
"@eslint/js": "^9.22.0",
|
|
64
|
+
"@graphql-codegen/add": "^5.0.3",
|
|
65
|
+
"@graphql-codegen/cli": "^5.0.2",
|
|
66
|
+
"@graphql-codegen/typed-document-node": "^5.1.0",
|
|
67
|
+
"@graphql-codegen/typescript": "^4.0.9",
|
|
68
|
+
"@graphql-codegen/typescript-operations": "^4.2.3",
|
|
69
|
+
"@graphql-typed-document-node/apollo-client-2": "^1.0.0",
|
|
70
|
+
"@sudoplatform/sudo-api-client": "^15.0.0",
|
|
71
|
+
"@sudoplatform/sudo-common": "^10.0.4",
|
|
72
|
+
"@sudoplatform/sudo-user": "^15.1.1",
|
|
73
|
+
"@types/jest": "^29.5.14",
|
|
74
|
+
"@types/lodash": "^4.17.16",
|
|
75
|
+
"@types/node": "^20.17.24",
|
|
76
|
+
"@types/uuid": "^10.0.0",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
78
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
79
|
+
"apollo-client": "^2.6.10",
|
|
80
|
+
"aws-appsync": "^4.1.10",
|
|
81
|
+
"concurrently": "^9.1.2",
|
|
82
|
+
"eslint": "^9.22.0",
|
|
83
|
+
"eslint-config-prettier": "^10.1.1",
|
|
84
|
+
"eslint-plugin-import": "^2.29.1",
|
|
85
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
86
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
87
|
+
"eslint-plugin-tree-shaking": "^1.12.2",
|
|
88
|
+
"husky": "^9.1.7",
|
|
89
|
+
"isomorphic-fetch": "^3.0.0",
|
|
90
|
+
"jest": "^29.7.0",
|
|
91
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
92
|
+
"lodash": "^4.17.21",
|
|
93
|
+
"prettier": "^3.5.3",
|
|
94
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
95
|
+
"ts-jest": "^29.2.6",
|
|
96
|
+
"ts-mockito": "^2.6.1",
|
|
97
|
+
"ts-node": "^10.9.2",
|
|
98
|
+
"typedoc": "^0.28.0",
|
|
99
|
+
"typescript": "^5.8.2",
|
|
100
|
+
"uuid": "^11.1.0",
|
|
101
|
+
"wait-for-expect": "^3.0.2"
|
|
102
|
+
},
|
|
103
|
+
"engines": {
|
|
104
|
+
"node": ">=20"
|
|
105
|
+
},
|
|
106
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
107
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
export type Maybe<T> = T | null;
|
|
3
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
4
|
+
export type Exact<T extends {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}> = {
|
|
7
|
+
[K in keyof T]: T[K];
|
|
8
|
+
};
|
|
9
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
10
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
11
|
+
};
|
|
12
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
13
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
14
|
+
};
|
|
15
|
+
export type MakeEmpty<T extends {
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}, K extends keyof T> = {
|
|
18
|
+
[_ in K]?: never;
|
|
19
|
+
};
|
|
20
|
+
export type Incremental<T> = T | {
|
|
21
|
+
[P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
|
|
22
|
+
};
|
|
23
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
24
|
+
export type Scalars = {
|
|
25
|
+
ID: {
|
|
26
|
+
input: string;
|
|
27
|
+
output: string;
|
|
28
|
+
};
|
|
29
|
+
String: {
|
|
30
|
+
input: string;
|
|
31
|
+
output: string;
|
|
32
|
+
};
|
|
33
|
+
Boolean: {
|
|
34
|
+
input: boolean;
|
|
35
|
+
output: boolean;
|
|
36
|
+
};
|
|
37
|
+
Int: {
|
|
38
|
+
input: number;
|
|
39
|
+
output: number;
|
|
40
|
+
};
|
|
41
|
+
Float: {
|
|
42
|
+
input: number;
|
|
43
|
+
output: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type DeleteAppFromDeviceInput = {
|
|
47
|
+
bundleId: Scalars['String']['input'];
|
|
48
|
+
deviceId: Scalars['String']['input'];
|
|
49
|
+
};
|
|
50
|
+
export type Filter = {
|
|
51
|
+
actionType: FilterAction;
|
|
52
|
+
enableMeta?: InputMaybe<Scalars['String']['input']>;
|
|
53
|
+
rule: Scalars['String']['input'];
|
|
54
|
+
serviceName: Scalars['String']['input'];
|
|
55
|
+
};
|
|
56
|
+
export declare enum FilterAction {
|
|
57
|
+
Disable = "DISABLE",
|
|
58
|
+
Enable = "ENABLE"
|
|
59
|
+
}
|
|
60
|
+
export type FilterOutputEntry = {
|
|
61
|
+
__typename?: 'FilterOutputEntry';
|
|
62
|
+
actionType: FilterAction;
|
|
63
|
+
enableMeta?: Maybe<Scalars['String']['output']>;
|
|
64
|
+
rule: Scalars['String']['output'];
|
|
65
|
+
serviceName: Scalars['String']['output'];
|
|
66
|
+
};
|
|
67
|
+
export type GetSettingsInput = {
|
|
68
|
+
bundleId: Scalars['String']['input'];
|
|
69
|
+
deviceId: Scalars['String']['input'];
|
|
70
|
+
};
|
|
71
|
+
export type Mutation = {
|
|
72
|
+
__typename?: 'Mutation';
|
|
73
|
+
deleteAppFromDevice?: Maybe<Scalars['Boolean']['output']>;
|
|
74
|
+
registerAppOnDevice?: Maybe<Scalars['Boolean']['output']>;
|
|
75
|
+
sendTestNotification: Scalars['Boolean']['output'];
|
|
76
|
+
updateDeviceInfo?: Maybe<Scalars['Boolean']['output']>;
|
|
77
|
+
updateNotificationSettings?: Maybe<Scalars['Boolean']['output']>;
|
|
78
|
+
};
|
|
79
|
+
export type MutationDeleteAppFromDeviceArgs = {
|
|
80
|
+
input: DeleteAppFromDeviceInput;
|
|
81
|
+
};
|
|
82
|
+
export type MutationRegisterAppOnDeviceArgs = {
|
|
83
|
+
input: RegisterAppOnDeviceInput;
|
|
84
|
+
};
|
|
85
|
+
export type MutationSendTestNotificationArgs = {
|
|
86
|
+
input?: InputMaybe<SendTestNotificationInput>;
|
|
87
|
+
};
|
|
88
|
+
export type MutationUpdateDeviceInfoArgs = {
|
|
89
|
+
input: UpdateInfoInput;
|
|
90
|
+
};
|
|
91
|
+
export type MutationUpdateNotificationSettingsArgs = {
|
|
92
|
+
input: UpdateSettingsInput;
|
|
93
|
+
};
|
|
94
|
+
export type NotifiableServiceSchema = {
|
|
95
|
+
schema?: InputMaybe<Array<SchemaEntry>>;
|
|
96
|
+
serviceName: Scalars['String']['input'];
|
|
97
|
+
};
|
|
98
|
+
export type NotificationSettingsOutput = {
|
|
99
|
+
__typename?: 'NotificationSettingsOutput';
|
|
100
|
+
filter: Array<FilterOutputEntry>;
|
|
101
|
+
};
|
|
102
|
+
export type Query = {
|
|
103
|
+
__typename?: 'Query';
|
|
104
|
+
getNotificationSettings: NotificationSettingsOutput;
|
|
105
|
+
};
|
|
106
|
+
export type QueryGetNotificationSettingsArgs = {
|
|
107
|
+
input: GetSettingsInput;
|
|
108
|
+
};
|
|
109
|
+
export type RegisterAppOnDeviceInput = {
|
|
110
|
+
build: BuildType;
|
|
111
|
+
bundleId: Scalars['String']['input'];
|
|
112
|
+
clientEnv: ClientEnvType;
|
|
113
|
+
deviceId: Scalars['String']['input'];
|
|
114
|
+
locale?: InputMaybe<Scalars['String']['input']>;
|
|
115
|
+
standardToken?: InputMaybe<Scalars['String']['input']>;
|
|
116
|
+
version?: InputMaybe<Scalars['String']['input']>;
|
|
117
|
+
voipToken?: InputMaybe<Scalars['String']['input']>;
|
|
118
|
+
};
|
|
119
|
+
export type SchemaEntry = {
|
|
120
|
+
description: Scalars['String']['input'];
|
|
121
|
+
fieldName: Scalars['String']['input'];
|
|
122
|
+
type: Scalars['String']['input'];
|
|
123
|
+
};
|
|
124
|
+
export type SendTestNotificationInput = {
|
|
125
|
+
body?: InputMaybe<Scalars['String']['input']>;
|
|
126
|
+
data: Scalars['String']['input'];
|
|
127
|
+
filter: Scalars['String']['input'];
|
|
128
|
+
purpose?: InputMaybe<TestNotificationPurpose>;
|
|
129
|
+
serviceName: Scalars['String']['input'];
|
|
130
|
+
title?: InputMaybe<Scalars['String']['input']>;
|
|
131
|
+
};
|
|
132
|
+
export declare enum TestNotificationPurpose {
|
|
133
|
+
Standard = "STANDARD",
|
|
134
|
+
Voip = "VOIP"
|
|
135
|
+
}
|
|
136
|
+
export type UpdateInfoInput = {
|
|
137
|
+
build: BuildType;
|
|
138
|
+
bundleId: Scalars['String']['input'];
|
|
139
|
+
deviceId: Scalars['String']['input'];
|
|
140
|
+
locale?: InputMaybe<Scalars['String']['input']>;
|
|
141
|
+
standardToken?: InputMaybe<Scalars['String']['input']>;
|
|
142
|
+
version?: InputMaybe<Scalars['String']['input']>;
|
|
143
|
+
voipToken?: InputMaybe<Scalars['String']['input']>;
|
|
144
|
+
};
|
|
145
|
+
export type UpdateSettingsInput = {
|
|
146
|
+
bundleId: Scalars['String']['input'];
|
|
147
|
+
deviceId: Scalars['String']['input'];
|
|
148
|
+
filter: Array<InputMaybe<Filter>>;
|
|
149
|
+
services: Array<NotifiableServiceSchema>;
|
|
150
|
+
};
|
|
151
|
+
export declare enum BuildType {
|
|
152
|
+
Debug = "DEBUG",
|
|
153
|
+
Release = "RELEASE"
|
|
154
|
+
}
|
|
155
|
+
export declare enum ClientEnvType {
|
|
156
|
+
Android = "ANDROID",
|
|
157
|
+
Ios = "IOS",
|
|
158
|
+
Test = "TEST",
|
|
159
|
+
Web = "WEB",
|
|
160
|
+
Webhook = "WEBHOOK"
|
|
161
|
+
}
|
|
162
|
+
export type DeleteAppFromDeviceMutationVariables = Exact<{
|
|
163
|
+
input: DeleteAppFromDeviceInput;
|
|
164
|
+
}>;
|
|
165
|
+
export type DeleteAppFromDeviceMutation = {
|
|
166
|
+
__typename?: 'Mutation';
|
|
167
|
+
deleteAppFromDevice?: boolean | null;
|
|
168
|
+
};
|
|
169
|
+
export type GetNotificationSettingsQueryVariables = Exact<{
|
|
170
|
+
input: GetSettingsInput;
|
|
171
|
+
}>;
|
|
172
|
+
export type GetNotificationSettingsQuery = {
|
|
173
|
+
__typename?: 'Query';
|
|
174
|
+
getNotificationSettings: {
|
|
175
|
+
__typename?: 'NotificationSettingsOutput';
|
|
176
|
+
filter: Array<{
|
|
177
|
+
__typename?: 'FilterOutputEntry';
|
|
178
|
+
serviceName: string;
|
|
179
|
+
actionType: FilterAction;
|
|
180
|
+
rule: string;
|
|
181
|
+
enableMeta?: string | null;
|
|
182
|
+
}>;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export type NotificationSettingsOutputFragment = {
|
|
186
|
+
__typename?: 'NotificationSettingsOutput';
|
|
187
|
+
filter: Array<{
|
|
188
|
+
__typename?: 'FilterOutputEntry';
|
|
189
|
+
serviceName: string;
|
|
190
|
+
actionType: FilterAction;
|
|
191
|
+
rule: string;
|
|
192
|
+
enableMeta?: string | null;
|
|
193
|
+
}>;
|
|
194
|
+
};
|
|
195
|
+
export type RegisterAppOnDeviceMutationVariables = Exact<{
|
|
196
|
+
input: RegisterAppOnDeviceInput;
|
|
197
|
+
}>;
|
|
198
|
+
export type RegisterAppOnDeviceMutation = {
|
|
199
|
+
__typename?: 'Mutation';
|
|
200
|
+
registerAppOnDevice?: boolean | null;
|
|
201
|
+
};
|
|
202
|
+
export type SendTestNotificationMutationVariables = Exact<{
|
|
203
|
+
input: SendTestNotificationInput;
|
|
204
|
+
}>;
|
|
205
|
+
export type SendTestNotificationMutation = {
|
|
206
|
+
__typename?: 'Mutation';
|
|
207
|
+
sendTestNotification: boolean;
|
|
208
|
+
};
|
|
209
|
+
export type UpdateDeviceInfoMutationVariables = Exact<{
|
|
210
|
+
input: UpdateInfoInput;
|
|
211
|
+
}>;
|
|
212
|
+
export type UpdateDeviceInfoMutation = {
|
|
213
|
+
__typename?: 'Mutation';
|
|
214
|
+
updateDeviceInfo?: boolean | null;
|
|
215
|
+
};
|
|
216
|
+
export type UpdateNotificationSettingsMutationVariables = Exact<{
|
|
217
|
+
input: UpdateSettingsInput;
|
|
218
|
+
}>;
|
|
219
|
+
export type UpdateNotificationSettingsMutation = {
|
|
220
|
+
__typename?: 'Mutation';
|
|
221
|
+
updateNotificationSettings?: boolean | null;
|
|
222
|
+
};
|
|
223
|
+
export declare const NotificationSettingsOutputFragmentDoc: DocumentNode<NotificationSettingsOutputFragment, unknown>;
|
|
224
|
+
export declare const DeleteAppFromDeviceDocument: DocumentNode<DeleteAppFromDeviceMutation, DeleteAppFromDeviceMutationVariables>;
|
|
225
|
+
export declare const GetNotificationSettingsDocument: DocumentNode<GetNotificationSettingsQuery, GetNotificationSettingsQueryVariables>;
|
|
226
|
+
export declare const RegisterAppOnDeviceDocument: DocumentNode<RegisterAppOnDeviceMutation, RegisterAppOnDeviceMutationVariables>;
|
|
227
|
+
export declare const SendTestNotificationDocument: DocumentNode<SendTestNotificationMutation, SendTestNotificationMutationVariables>;
|
|
228
|
+
export declare const UpdateDeviceInfoDocument: DocumentNode<UpdateDeviceInfoMutation, UpdateDeviceInfoMutationVariables>;
|
|
229
|
+
export declare const UpdateNotificationSettingsDocument: DocumentNode<UpdateNotificationSettingsMutation, UpdateNotificationSettingsMutationVariables>;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public/index';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ApiClientManager } from '@sudoplatform/sudo-api-client';
|
|
2
|
+
import { MutationOptions, QueryOptions } from 'apollo-client/core/watchQueryOptions';
|
|
3
|
+
import { DeleteAppFromDeviceInput, GetSettingsInput, NotificationSettingsOutput, RegisterAppOnDeviceInput, SendTestNotificationInput, UpdateInfoInput, UpdateSettingsInput } from '../gen/graphqlTypes';
|
|
4
|
+
export declare class ApiClient {
|
|
5
|
+
private readonly log;
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(apiClientManager?: ApiClientManager);
|
|
8
|
+
registerAppOnDevice(input: RegisterAppOnDeviceInput): Promise<boolean>;
|
|
9
|
+
deleteAppFromDevice(input: DeleteAppFromDeviceInput): Promise<boolean>;
|
|
10
|
+
updateDeviceInfo(input: UpdateInfoInput): Promise<boolean>;
|
|
11
|
+
getNotificationSettings(input: GetSettingsInput): Promise<NotificationSettingsOutput>;
|
|
12
|
+
updateNotificationSettings(input: UpdateSettingsInput): Promise<boolean>;
|
|
13
|
+
sendTestNotification(input: SendTestNotificationInput): Promise<boolean>;
|
|
14
|
+
performQuery<Q>({ variables, fetchPolicy, query, calleeName, }: QueryOptions & {
|
|
15
|
+
calleeName?: string;
|
|
16
|
+
}): Promise<Q>;
|
|
17
|
+
performMutation<M>({ mutation, variables, calleeName, }: Omit<MutationOptions<M>, 'fetchPolicy'> & {
|
|
18
|
+
calleeName?: string;
|
|
19
|
+
}): Promise<M>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
/**
|
|
3
|
+
* Decode Sudo Platform notification payload
|
|
4
|
+
*/
|
|
5
|
+
export declare const SudoPlatformPayloadCodec: t.TypeC<{
|
|
6
|
+
sudoplatform: t.IntersectionC<[t.TypeC<{
|
|
7
|
+
servicename: t.StringC;
|
|
8
|
+
}>, t.PartialC<{
|
|
9
|
+
data: t.StringC;
|
|
10
|
+
}>, t.RecordC<t.StringC, t.UnknownC>]>;
|
|
11
|
+
}>;
|
|
12
|
+
export type SudoPlatformPayload = t.TypeOf<typeof SudoPlatformPayloadCodec>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SERVICE_NAME = "notificationService";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BuildType as BuildTypeGraphQL } from '../../gen/graphqlTypes';
|
|
2
|
+
import { BuildType as BuildTypeAPI } from '../../public/types/buildType';
|
|
3
|
+
export declare class BuildTypeTransformer {
|
|
4
|
+
static toGraphQL(api: BuildTypeAPI): BuildTypeGraphQL;
|
|
5
|
+
static toAPI(graphql: BuildTypeGraphQL): BuildTypeAPI;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Filter, NotificationSettingsOutput } from '../../gen/graphqlTypes';
|
|
2
|
+
import { NotificationConfiguration } from '../../public/types/notificationConfiguration';
|
|
3
|
+
export declare class NotificationConfigurationTransformer {
|
|
4
|
+
static toAPI(graphql: NotificationSettingsOutput): NotificationConfiguration;
|
|
5
|
+
static toGraphQLFilters(api: NotificationConfiguration): Filter[];
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FilterAction } from '../../gen/graphqlTypes';
|
|
2
|
+
import { NotificationEnableStatus } from '../../public/types/notificationEnabledStatus';
|
|
3
|
+
export declare class NotificationEnableStatusTransformer {
|
|
4
|
+
static toGraphQL(api: NotificationEnableStatus | boolean): FilterAction;
|
|
5
|
+
static toBoolean(graphql: FilterAction): boolean;
|
|
6
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NotifiableServiceSchema } from '../../gen/graphqlTypes';
|
|
2
|
+
import { NotificationMetadata } from '../../public/types/notificationMetadata';
|
|
3
|
+
export declare class NotificationMetadataTransformer {
|
|
4
|
+
static toGraphQL(api: NotificationMetadata): NotifiableServiceSchema;
|
|
5
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical form of PushSubscriptionJSON.
|
|
3
|
+
*
|
|
4
|
+
* Adds the following constraints:
|
|
5
|
+
* * endpoint must be defined
|
|
6
|
+
* * expiration cannot be null
|
|
7
|
+
* * auth key must be provided
|
|
8
|
+
* * p256dh key must be provided
|
|
9
|
+
*/
|
|
10
|
+
export interface CanonicalPushSubscriptionJSON {
|
|
11
|
+
endpoint: string;
|
|
12
|
+
expirationTime?: number;
|
|
13
|
+
keys: {
|
|
14
|
+
auth: string;
|
|
15
|
+
p256dh: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export declare const NotificationServiceConfigCodec: t.IntersectionC<[t.TypeC<{
|
|
3
|
+
apiUrl: t.StringC;
|
|
4
|
+
}>, t.PartialC<{
|
|
5
|
+
testNotificationsAvailable: t.BooleanC;
|
|
6
|
+
}>]>;
|
|
7
|
+
export type NotificationServiceConfig = t.TypeOf<typeof NotificationServiceConfigCodec>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConfigurationManager } from '@sudoplatform/sudo-common';
|
|
2
|
+
import { SudoNotificationClientOptions } from '../../public/types/sudoNotificationClientOptions';
|
|
3
|
+
import { ApiClient } from '../apiClient';
|
|
4
|
+
/**
|
|
5
|
+
* Private extension to SudoNotificationClientOptions for describing private options
|
|
6
|
+
* for supporting unit testing.
|
|
7
|
+
*/
|
|
8
|
+
export interface SudoNotificationClientPrivateOptions extends SudoNotificationClientOptions {
|
|
9
|
+
/** Override ApiClient construction */
|
|
10
|
+
apiClient?: ApiClient;
|
|
11
|
+
/** Override ConfigurationManager construction */
|
|
12
|
+
configurationManager?: ConfigurationManager;
|
|
13
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare class NotificationError extends Error {
|
|
2
|
+
constructor(msg?: string);
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* The configuration has not been initialized for the Notification Client.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NotificationServiceConfigNotFoundError extends NotificationError {
|
|
8
|
+
constructor(msg?: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A specified notifiable service is not configured as notifiable.
|
|
12
|
+
*/
|
|
13
|
+
export declare class InvalidConfigurationError extends NotificationError {
|
|
14
|
+
constructor(serviceName: string);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The PushSubscription passed to the SDK when calling registerPushSubscription
|
|
18
|
+
* or updatePushSubscription is not formed as expected. The PushSubscription
|
|
19
|
+
* must have an endpoint and auth and p256dh keys.
|
|
20
|
+
*/
|
|
21
|
+
export declare class InvalidPushSubscriptionError extends NotificationError {
|
|
22
|
+
constructor(property: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The device or push subscription is already registered.
|
|
26
|
+
*/
|
|
27
|
+
export declare class DeviceAlreadyRegisteredError extends NotificationError {
|
|
28
|
+
constructor(msg?: string);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The device or push subscription could not be found
|
|
32
|
+
*/
|
|
33
|
+
export declare class DeviceNotFoundError extends NotificationError {
|
|
34
|
+
constructor(msg?: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The device or push subscription could not be registered
|
|
38
|
+
*/
|
|
39
|
+
export declare class DeviceCreateError extends NotificationError {
|
|
40
|
+
constructor(msg?: string);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The device or push subscription could not be read
|
|
44
|
+
*/
|
|
45
|
+
export declare class DeviceReadError extends NotificationError {
|
|
46
|
+
constructor(msg?: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The device or push subscription could not be updated
|
|
50
|
+
*/
|
|
51
|
+
export declare class DeviceUpdateError extends NotificationError {
|
|
52
|
+
constructor(msg?: string);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The device or push subscription could not be deleted
|
|
56
|
+
*/
|
|
57
|
+
export declare class DeviceDeleteError extends NotificationError {
|
|
58
|
+
constructor(msg?: string);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* More than one SudoNotificationFilterClient for the given service name is
|
|
62
|
+
* being registered. At most one is permitted per service.
|
|
63
|
+
*/
|
|
64
|
+
export declare class DuplicateNotificationFilterClientError extends NotificationError {
|
|
65
|
+
constructor(serviceName: string);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* More than one SudoNotifiableClient for the given service name is
|
|
69
|
+
* being registered. At most one is permitted per service.
|
|
70
|
+
*/
|
|
71
|
+
export declare class DuplicateNotifiableClientError extends NotificationError {
|
|
72
|
+
constructor(serviceName: string);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The metadata schema information passed when setting notification configuration
|
|
76
|
+
* setting is not valid.
|
|
77
|
+
*/
|
|
78
|
+
export declare class SchemaValidationError extends NotificationError {
|
|
79
|
+
constructor(message?: string);
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DefaultLogger } from '@sudoplatform/sudo-common';
|
|
2
|
+
import { SudoNotification } from './types/sudoNotification';
|
|
3
|
+
import { SudoNotificationData } from './types/sudoNotificationData';
|
|
4
|
+
/**
|
|
5
|
+
* Client used to decode service specific notification data. Each Sudo Platform
|
|
6
|
+
* service SDK that has notifications provides an implementation of this protocol
|
|
7
|
+
* that must be passed to {@link DefaultSudoNotifiableClient} on construction.
|
|
8
|
+
*/
|
|
9
|
+
export interface SudoNotifiableClient {
|
|
10
|
+
/**
|
|
11
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding service's configuration
|
|
12
|
+
* section within sudoplatformconfig.json
|
|
13
|
+
*/
|
|
14
|
+
serviceName: string;
|
|
15
|
+
/**
|
|
16
|
+
* Decode opaque, serialized service specific notification data
|
|
17
|
+
*
|
|
18
|
+
* @param data Opaque, serialized service specific notification data
|
|
19
|
+
*
|
|
20
|
+
* @returns
|
|
21
|
+
* Service specific implementation of {@link SudoNotification}
|
|
22
|
+
* decoded from the data
|
|
23
|
+
*/
|
|
24
|
+
decode(data: string): SudoNotification;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Client used to decode notification payload data specific to Sudo Platform services used by an application
|
|
28
|
+
*
|
|
29
|
+
* This client is light weight and suitable for use within a Notification Extension
|
|
30
|
+
*/
|
|
31
|
+
export declare class DefaultSudoNotifiableClient {
|
|
32
|
+
private readonly logger;
|
|
33
|
+
private readonly notifiableClients;
|
|
34
|
+
/**
|
|
35
|
+
* Construct a new instance
|
|
36
|
+
*
|
|
37
|
+
* @param notifiableClients
|
|
38
|
+
* Array of SudoNotifiableClient implementations. Provide one for each Sudo Platform
|
|
39
|
+
* notification emitting service consumed by your application.
|
|
40
|
+
*
|
|
41
|
+
* @throws {@link DuplicateNotifiableClientError}
|
|
42
|
+
* if more than one {@link SudoNotifiableClient} is provided for a particular
|
|
43
|
+
* Sudo Platform service.
|
|
44
|
+
*/
|
|
45
|
+
constructor(notifiableClients: SudoNotifiableClient[], logger?: DefaultLogger);
|
|
46
|
+
/**
|
|
47
|
+
* Extract encoded Sudo Platform notification specific data from a Web Push API PushEvent
|
|
48
|
+
* if it is present.
|
|
49
|
+
*
|
|
50
|
+
* @param event PushEvent to extract data from
|
|
51
|
+
*
|
|
52
|
+
* @returns If the notification payload contains Sudo Platform notification specific data, a
|
|
53
|
+
* {@link SudoNotificationData} is returned that should then be passed to {@link decodeData}.
|
|
54
|
+
* If no Sudo Platform notification specific data is present, then undefined is returned.
|
|
55
|
+
*/
|
|
56
|
+
extractData(event: PushEvent): SudoNotificationData | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Decode Sudo Notification specific data to a service specific instance of a SudoNotification
|
|
59
|
+
* Calls the {@link SudoNotifiableClient.decode} method of the service specific
|
|
60
|
+
* {@link SudoNotifiableClient}
|
|
61
|
+
*
|
|
62
|
+
* @param data {@link SudoNotificationData} to decode
|
|
63
|
+
*
|
|
64
|
+
* @returns
|
|
65
|
+
* Service specific implementation of {@link SudoNotification} or undefined if
|
|
66
|
+
* data contains no data to decode
|
|
67
|
+
*/
|
|
68
|
+
decodeData(data: SudoNotificationData): SudoNotification | undefined;
|
|
69
|
+
}
|