@novasamatech/host-api 0.7.9-4 → 0.7.9-5

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/dist/hostApi.js CHANGED
@@ -8,6 +8,7 @@ import { DeriveEntropyErr } from './protocol/v1/deriveEntropy.js';
8
8
  import { HandshakeErr } from './protocol/v1/handshake.js';
9
9
  import { StorageErr } from './protocol/v1/localStorage.js';
10
10
  import { NavigateToErr } from './protocol/v1/navigation.js';
11
+ import { PushNotificationError } from './protocol/v1/notification.js';
11
12
  import { PaymentRequestErr, PaymentTopUpErr } from './protocol/v1/payments.js';
12
13
  import { PreimageSubmitErr } from './protocol/v1/preimage.js';
13
14
  import { ResourceAllocationErr } from './protocol/v1/resourceAllocation.js';
@@ -44,6 +45,12 @@ export function createHostApi(transport) {
44
45
  },
45
46
  pushNotification(payload) {
46
47
  return makeRequest(transport.request('host_push_notification', payload), reason => ({
48
+ tag: payload.tag,
49
+ value: new PushNotificationError.Unknown({ reason }),
50
+ }));
51
+ },
52
+ pushNotificationCancel(payload) {
53
+ return makeRequest(transport.request('host_push_notification_cancel', payload), reason => ({
47
54
  tag: payload.tag,
48
55
  value: new GenericError({ reason }),
49
56
  }));
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ export { SignedStatement, SignedStatementsPage, Statement, StatementProofErr, To
21
21
  export { StorageErr } from './protocol/v1/localStorage.js';
22
22
  export { DevicePermission } from './protocol/v1/devicePermission.js';
23
23
  export { RemotePermission } from './protocol/v1/remotePermission.js';
24
- export { PushNotification } from './protocol/v1/notification.js';
24
+ export { NotificationId, PushNotification, PushNotificationError } from './protocol/v1/notification.js';
25
25
  export { NavigateToErr } from './protocol/v1/navigation.js';
26
26
  export { PreimageKey, PreimageSubmitErr, PreimageValue } from './protocol/v1/preimage.js';
27
27
  export { AllocatableResource, AllocationOutcome, ResourceAllocationErr } from './protocol/v1/resourceAllocation.js';
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ export { SignedStatement, SignedStatementsPage, Statement, StatementProofErr, To
16
16
  export { StorageErr } from './protocol/v1/localStorage.js';
17
17
  export { DevicePermission } from './protocol/v1/devicePermission.js';
18
18
  export { RemotePermission } from './protocol/v1/remotePermission.js';
19
- export { PushNotification } from './protocol/v1/notification.js';
19
+ export { NotificationId, PushNotification, PushNotificationError } from './protocol/v1/notification.js';
20
20
  export { NavigateToErr } from './protocol/v1/navigation.js';
21
21
  export { PreimageKey, PreimageSubmitErr, PreimageValue } from './protocol/v1/preimage.js';
22
22
  export { AllocatableResource, AllocationOutcome, ResourceAllocationErr } from './protocol/v1/resourceAllocation.js';
@@ -36,9 +36,10 @@ export declare const hostApiProtocol: {
36
36
  readonly v1: [Codec<{
37
37
  text: string;
38
38
  deeplink: string | undefined;
39
- }>, Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
39
+ scheduledAt: bigint | undefined;
40
+ }>, Codec<import("scale-ts").ResultPayload<number, import("@novasamatech/scale").CodecError<{
40
41
  reason: string;
41
- }, "GenericError">>>];
42
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>>];
42
43
  }>;
43
44
  readonly host_navigate_to: VersionedProtocolRequest<{
44
45
  readonly v1: [Codec<string>, Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
@@ -982,5 +983,10 @@ export declare const hostApiProtocol: {
982
983
  reason: string;
983
984
  }, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>>];
984
985
  }>;
986
+ readonly host_push_notification_cancel: VersionedProtocolRequest<{
987
+ readonly v1: [Codec<number>, Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
988
+ reason: string;
989
+ }, "GenericError">>>];
990
+ }>;
985
991
  };
986
992
  export {};
@@ -10,7 +10,7 @@ import { FeatureV1_request, FeatureV1_response } from './v1/feature.js';
10
10
  import { HandshakeV1_request, HandshakeV1_response } from './v1/handshake.js';
11
11
  import { StorageClearV1_request, StorageClearV1_response, StorageReadV1_request, StorageReadV1_response, StorageWriteV1_request, StorageWriteV1_response, } from './v1/localStorage.js';
12
12
  import { NavigateToV1_request, NavigateToV1_response } from './v1/navigation.js';
13
- import { PushNotificationV1_request, PushNotificationV1_response } from './v1/notification.js';
13
+ import { PushNotificationCancelV1_request, PushNotificationCancelV1_response, PushNotificationV1_request, PushNotificationV1_response, } from './v1/notification.js';
14
14
  import { PaymentBalanceSubscribeV1_interrupt, PaymentBalanceSubscribeV1_receive, PaymentBalanceSubscribeV1_start, PaymentRequestV1_request, PaymentRequestV1_response, PaymentStatusSubscribeV1_interrupt, PaymentStatusSubscribeV1_receive, PaymentStatusSubscribeV1_start, PaymentTopUpV1_request, PaymentTopUpV1_response, } from './v1/payments.js';
15
15
  import { PreimageLookupSubscribeV1_interrupt, PreimageLookupSubscribeV1_receive, PreimageLookupSubscribeV1_start, PreimageSubmitV1_request, PreimageSubmitV1_response, } from './v1/preimage.js';
16
16
  import { RemotePermissionV1_request, RemotePermissionV1_response } from './v1/remotePermission.js';
@@ -211,4 +211,7 @@ export const hostApiProtocol = {
211
211
  remote_statement_store_create_proof_authorized: versionedRequest({
212
212
  v1: [StatementStoreCreateProofAuthorizedV1_request, StatementStoreCreateProofAuthorizedV1_response],
213
213
  }),
214
+ host_push_notification_cancel: versionedRequest({
215
+ v1: [PushNotificationCancelV1_request, PushNotificationCancelV1_response],
216
+ }),
214
217
  };
@@ -28,11 +28,12 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
28
28
  readonly v1: Codec<{
29
29
  text: string;
30
30
  deeplink: string | undefined;
31
+ scheduledAt: bigint | undefined;
31
32
  }>;
32
33
  }>> & Record<"host_push_notification_response", EnumCodec<{
33
- readonly v1: Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
34
+ readonly v1: Codec<import("scale-ts").ResultPayload<number, import("@novasamatech/scale").CodecError<{
34
35
  reason: string;
35
- }, "GenericError">>>;
36
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>>;
36
37
  }>> & Record<"host_navigate_to_request", EnumCodec<{
37
38
  readonly v1: Codec<string>;
38
39
  }>> & Record<"host_navigate_to_response", EnumCodec<{
@@ -1050,6 +1051,12 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
1050
1051
  }, import("@novasamatech/scale").CodecError<{
1051
1052
  reason: string;
1052
1053
  }, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>>;
1054
+ }>> & Record<"host_push_notification_cancel_request", EnumCodec<{
1055
+ readonly v1: Codec<number>;
1056
+ }>> & Record<"host_push_notification_cancel_response", EnumCodec<{
1057
+ readonly v1: Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
1058
+ reason: string;
1059
+ }, "GenericError">>>;
1053
1060
  }>>>;
1054
1061
  export declare const Message: Codec<{
1055
1062
  requestId: string;
@@ -1091,15 +1098,16 @@ export declare const Message: Codec<{
1091
1098
  value: {
1092
1099
  text: string;
1093
1100
  deeplink: string | undefined;
1101
+ scheduledAt: bigint | undefined;
1094
1102
  };
1095
1103
  };
1096
1104
  } | {
1097
1105
  tag: "host_push_notification_response";
1098
1106
  value: {
1099
1107
  tag: "v1";
1100
- value: import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
1108
+ value: import("scale-ts").ResultPayload<number, import("@novasamatech/scale").CodecError<{
1101
1109
  reason: string;
1102
- }, "GenericError">>;
1110
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>;
1103
1111
  };
1104
1112
  } | {
1105
1113
  tag: "host_navigate_to_request";
@@ -2583,6 +2591,20 @@ export declare const Message: Codec<{
2583
2591
  reason: string;
2584
2592
  }, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>;
2585
2593
  };
2594
+ } | {
2595
+ tag: "host_push_notification_cancel_request";
2596
+ value: {
2597
+ tag: "v1";
2598
+ value: number;
2599
+ };
2600
+ } | {
2601
+ tag: "host_push_notification_cancel_response";
2602
+ value: {
2603
+ tag: "v1";
2604
+ value: import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
2605
+ reason: string;
2606
+ }, "GenericError">>;
2607
+ };
2586
2608
  };
2587
2609
  }>;
2588
2610
  export type MessageAction = MessagePayloadSchema['tag'];
@@ -1,11 +1,39 @@
1
+ export declare const NotificationId: import("scale-ts").Codec<number>;
1
2
  export declare const PushNotification: import("scale-ts").Codec<{
2
3
  text: string;
3
4
  deeplink: string | undefined;
5
+ scheduledAt: bigint | undefined;
4
6
  }>;
7
+ export declare const PushNotificationError: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
8
+ reason: string;
9
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
10
+ reason: string;
11
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>] & {
12
+ enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
13
+ reason: string;
14
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>;
15
+ dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
16
+ reason: string;
17
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>;
18
+ } & {
19
+ readonly ScheduleLimitReached: import("@novasamatech/scale").ErrCodec<undefined, "PushNotificationError::ScheduleLimitReached">;
20
+ readonly Unknown: import("@novasamatech/scale").ErrCodec<{
21
+ reason: string;
22
+ }, "PushNotificationError::Unknown">;
23
+ } & {
24
+ [Symbol.hasInstance](v: unknown): v is import("@novasamatech/scale").CodecError<{
25
+ reason: string;
26
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">;
27
+ };
5
28
  export declare const PushNotificationV1_request: import("scale-ts").Codec<{
6
29
  text: string;
7
30
  deeplink: string | undefined;
31
+ scheduledAt: bigint | undefined;
8
32
  }>;
9
- export declare const PushNotificationV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
33
+ export declare const PushNotificationV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<number, import("@novasamatech/scale").CodecError<{
34
+ reason: string;
35
+ }, "PushNotificationError::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PushNotificationError::ScheduleLimitReached">>>;
36
+ export declare const PushNotificationCancelV1_request: import("scale-ts").Codec<number>;
37
+ export declare const PushNotificationCancelV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
10
38
  reason: string;
11
39
  }, "GenericError">>>;
@@ -1,8 +1,17 @@
1
- import { Option, Result, Struct, _void, str } from 'scale-ts';
2
- import { GenericError } from '../commonCodecs.js';
1
+ import { ErrEnum } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, _void, str, u32, u64 } from 'scale-ts';
3
+ import { GenericErr, GenericError } from '../commonCodecs.js';
4
+ export const NotificationId = u32;
3
5
  export const PushNotification = Struct({
4
6
  text: str,
5
7
  deeplink: Option(str),
8
+ scheduledAt: Option(u64),
9
+ });
10
+ export const PushNotificationError = ErrEnum('PushNotificationError', {
11
+ ScheduleLimitReached: [_void, 'Schedule limit reached'],
12
+ Unknown: [GenericErr, 'Unknown error'],
6
13
  });
7
14
  export const PushNotificationV1_request = PushNotification;
8
- export const PushNotificationV1_response = Result(_void, GenericError);
15
+ export const PushNotificationV1_response = Result(NotificationId, PushNotificationError);
16
+ export const PushNotificationCancelV1_request = NotificationId;
17
+ export const PushNotificationCancelV1_response = Result(_void, GenericError);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-api",
3
3
  "type": "module",
4
- "version": "0.7.9-4",
4
+ "version": "0.7.9-5",
5
5
  "description": "Host API: transport implementation for host - product integration.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "README.md"
23
23
  ],
24
24
  "dependencies": {
25
- "@novasamatech/scale": "0.7.9-4",
25
+ "@novasamatech/scale": "0.7.9-5",
26
26
  "nanoevents": "9.1.0",
27
27
  "nanoid": "5.1.9",
28
28
  "neverthrow": "^8.2.0",