@api.global/typedsocket 5.1.2 → 6.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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/index.d.ts +7 -0
- package/dist_ts/index.js +5 -1
- package/dist_ts/nativebytes.codec.d.ts +8 -0
- package/dist_ts/nativebytes.codec.js +328 -0
- package/dist_ts/nativebytes.constants.d.ts +59 -0
- package/dist_ts/nativebytes.constants.js +58 -0
- package/dist_ts/nativebytes.errors.d.ts +13 -0
- package/dist_ts/nativebytes.errors.js +26 -0
- package/dist_ts/nativebytes.manager.d.ts +322 -0
- package/dist_ts/nativebytes.manager.js +2308 -0
- package/dist_ts/nativebytes.types.d.ts +187 -0
- package/dist_ts/nativebytes.types.js +2 -0
- package/dist_ts/typedsocket.classes.typedsocket.d.ts +120 -11
- package/dist_ts/typedsocket.classes.typedsocket.js +1093 -160
- package/dist_ts/typedsocket.plugins.d.ts +3 -2
- package/dist_ts/typedsocket.plugins.js +3 -2
- package/dist_ts/typedsocket.tags.d.ts +105 -0
- package/dist_ts/typedsocket.tags.js +521 -0
- package/{license → license.md} +2 -2
- package/package.json +22 -18
- package/readme.hints.md +27 -11
- package/readme.md +461 -46
- package/npmextra.json +0 -35
- package/ts/00_commitinfo_data.ts +0 -8
- package/ts/index.ts +0 -1
- package/ts/typedsocket.classes.typedsocket.ts +0 -1156
- package/ts/typedsocket.plugins.ts +0 -18
|
@@ -2,10 +2,11 @@ import * as typedrequest from '@api.global/typedrequest';
|
|
|
2
2
|
import * as typedrequestInterfaces from '@api.global/typedrequest-interfaces';
|
|
3
3
|
export { typedrequest, typedrequestInterfaces };
|
|
4
4
|
import * as smartdelay from '@push.rocks/smartdelay';
|
|
5
|
+
import * as smarthash from '@push.rocks/smarthash/web';
|
|
5
6
|
import * as smartjson from '@push.rocks/smartjson';
|
|
6
7
|
import * as smartpromise from '@push.rocks/smartpromise';
|
|
7
8
|
import * as smartrx from '@push.rocks/smartrx';
|
|
8
9
|
import * as smartstring from '@push.rocks/smartstring';
|
|
9
10
|
import * as smarturl from '@push.rocks/smarturl';
|
|
10
|
-
export { smartdelay, smartjson, smartpromise, smartrx, smartstring, smarturl };
|
|
11
|
-
export type { SmartServe, IWebSocketPeer } from '@push.rocks/smartserve';
|
|
11
|
+
export { smartdelay, smarthash, smartjson, smartpromise, smartrx, smartstring, smarturl };
|
|
12
|
+
export type { SmartServe, IWebSocketPeer, IWebSocketTransportOwner, TWebSocketOutboundRawFrame, IWebSocketRawFrameSettlement, } from '@push.rocks/smartserve';
|
|
@@ -4,10 +4,11 @@ import * as typedrequestInterfaces from '@api.global/typedrequest-interfaces';
|
|
|
4
4
|
export { typedrequest, typedrequestInterfaces };
|
|
5
5
|
// @pushrocks scope
|
|
6
6
|
import * as smartdelay from '@push.rocks/smartdelay';
|
|
7
|
+
import * as smarthash from '@push.rocks/smarthash/web';
|
|
7
8
|
import * as smartjson from '@push.rocks/smartjson';
|
|
8
9
|
import * as smartpromise from '@push.rocks/smartpromise';
|
|
9
10
|
import * as smartrx from '@push.rocks/smartrx';
|
|
10
11
|
import * as smartstring from '@push.rocks/smartstring';
|
|
11
12
|
import * as smarturl from '@push.rocks/smarturl';
|
|
12
|
-
export { smartdelay, smartjson, smartpromise, smartrx, smartstring, smarturl };
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export { smartdelay, smarthash, smartjson, smartpromise, smartrx, smartstring, smarturl };
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZWRzb2NrZXQucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3R5cGVkc29ja2V0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsbUJBQW1CO0FBQ25CLE9BQU8sS0FBSyxZQUFZLE1BQU0sMEJBQTBCLENBQUM7QUFDekQsT0FBTyxLQUFLLHNCQUFzQixNQUFNLHFDQUFxQyxDQUFDO0FBRTlFLE9BQU8sRUFBRSxZQUFZLEVBQUUsc0JBQXNCLEVBQUUsQ0FBQztBQUVoRCxtQkFBbUI7QUFDbkIsT0FBTyxLQUFLLFVBQVUsTUFBTSx3QkFBd0IsQ0FBQztBQUNyRCxPQUFPLEtBQUssU0FBUyxNQUFNLDJCQUEyQixDQUFDO0FBQ3ZELE9BQU8sS0FBSyxTQUFTLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxLQUFLLFlBQVksTUFBTSwwQkFBMEIsQ0FBQztBQUN6RCxPQUFPLEtBQUssT0FBTyxNQUFNLHFCQUFxQixDQUFDO0FBQy9DLE9BQU8sS0FBSyxXQUFXLE1BQU0seUJBQXlCLENBQUM7QUFDdkQsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUVqRCxPQUFPLEVBQUUsVUFBVSxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLE9BQU8sRUFBRSxXQUFXLEVBQUUsUUFBUSxFQUFFLENBQUMifQ==
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as plugins from './typedsocket.plugins.js';
|
|
2
|
+
export declare const TYPEDSOCKET_MAX_TAG_NAME_BYTES = 128;
|
|
3
|
+
export declare const TYPEDSOCKET_MAX_TAG_PAYLOAD_BYTES: number;
|
|
4
|
+
export declare const TYPEDSOCKET_MAX_CLIENT_TAGS_PER_PEER = 16;
|
|
5
|
+
export declare const TYPEDSOCKET_MAX_CLIENT_TAG_RETAINED_BYTES_PER_PEER: number;
|
|
6
|
+
export declare const TYPEDSOCKET_MAX_RETAINED_TAG_MUTATIONS_PER_PEER = 8;
|
|
7
|
+
export declare const TYPEDSOCKET_MAX_RETAINED_TAG_MUTATIONS_PER_RULE = 32;
|
|
8
|
+
export declare const TYPEDSOCKET_MAX_RETAINED_TAG_MUTATIONS_PER_SERVER = 256;
|
|
9
|
+
export declare const TYPEDSOCKET_MAX_TAG_AUTHORIZATION_TIMEOUT_MS = 5000;
|
|
10
|
+
export declare const TYPEDSOCKET_MAX_SERVER_TAG_NAMES_PER_PEER = 64;
|
|
11
|
+
export declare const TYPEDSOCKET_MAX_SERVER_TAG_RETAINED_BYTES_PER_PEER: number;
|
|
12
|
+
export type TTypedSocketTagOwner = 'server' | 'client';
|
|
13
|
+
export type TTypedSocketTagMutationOperation = 'set' | 'remove';
|
|
14
|
+
export type TTypedSocketTagDenialCode = 'CLIENT_TAGS_DISABLED' | 'INVALID_TAG_NAME' | 'TAG_NAME_TOO_LARGE' | 'TAG_NOT_ALLOWED' | 'INVALID_TAG_PAYLOAD' | 'TAG_PAYLOAD_TOO_LARGE' | 'TAG_AUTHORIZATION_DENIED' | 'TAG_AUTHORIZATION_TIMEOUT' | 'TAG_MUTATION_CAPACITY_EXCEEDED' | 'TAG_COUNT_LIMIT_EXCEEDED' | 'TAG_RETAINED_BYTES_EXCEEDED' | 'TAG_SERVER_OWNED' | 'TAG_CONNECTION_CLOSED' | 'MALFORMED_TAG_RESPONSE';
|
|
15
|
+
export interface ITypedSocketTagConnectionAuthority {
|
|
16
|
+
/** Opaque identity for the exact physical peer object. */
|
|
17
|
+
readonly connectionId: string;
|
|
18
|
+
/** Opaque identity for the exact TypedRouter object selected at upgrade. */
|
|
19
|
+
readonly routingSurfaceId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ITypedSocketClientTagExistingState {
|
|
22
|
+
readonly owner: 'client';
|
|
23
|
+
readonly payload: unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface ITypedSocketClientTagValidationContext {
|
|
26
|
+
readonly operation: TTypedSocketTagMutationOperation;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly payload: unknown;
|
|
29
|
+
readonly existing?: ITypedSocketClientTagExistingState;
|
|
30
|
+
readonly authority: ITypedSocketTagConnectionAuthority;
|
|
31
|
+
readonly abortSignal: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
export interface ITypedSocketClientTagRule {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly owner: TTypedSocketTagOwner;
|
|
36
|
+
readonly validateAndAuthorize: (contextArg: ITypedSocketClientTagValidationContext) => boolean | Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
export interface ITypedSocketClientTagPolicy {
|
|
39
|
+
readonly rules: readonly ITypedSocketClientTagRule[];
|
|
40
|
+
/** May lower, but never raise, the package authorization deadline. */
|
|
41
|
+
readonly authorizationTimeoutMs?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ITypedSocketTagMutationSuccess {
|
|
44
|
+
readonly success: true;
|
|
45
|
+
readonly connectionId: string;
|
|
46
|
+
readonly tagRevision: number;
|
|
47
|
+
readonly code?: never;
|
|
48
|
+
readonly message?: never;
|
|
49
|
+
}
|
|
50
|
+
export interface ITypedSocketTagMutationDenial {
|
|
51
|
+
readonly success: false;
|
|
52
|
+
readonly code: TTypedSocketTagDenialCode;
|
|
53
|
+
readonly message: string;
|
|
54
|
+
readonly connectionId?: never;
|
|
55
|
+
readonly tagRevision?: never;
|
|
56
|
+
}
|
|
57
|
+
export type TTypedSocketTagMutationResponse = ITypedSocketTagMutationSuccess | ITypedSocketTagMutationDenial;
|
|
58
|
+
export declare class TypedSocketClientTagDeniedError extends Error {
|
|
59
|
+
readonly code: TTypedSocketTagDenialCode;
|
|
60
|
+
constructor(codeArg: TTypedSocketTagDenialCode, messageArg: string);
|
|
61
|
+
}
|
|
62
|
+
interface ITagPayloadSnapshot {
|
|
63
|
+
readonly payload: unknown;
|
|
64
|
+
readonly encoded: string;
|
|
65
|
+
readonly byteLength: number;
|
|
66
|
+
}
|
|
67
|
+
export declare function createTypedSocketTagPayloadSnapshot(payloadArg: unknown): ITagPayloadSnapshot;
|
|
68
|
+
export declare class TypedSocketTagPolicyManager {
|
|
69
|
+
private readonly rules;
|
|
70
|
+
private readonly authorizationTimeoutMs;
|
|
71
|
+
private readonly peerStates;
|
|
72
|
+
private readonly ruleStates;
|
|
73
|
+
private readonly connectionAuthorityIds;
|
|
74
|
+
private readonly routingSurfaceAuthorityIds;
|
|
75
|
+
private readonly closedPeers;
|
|
76
|
+
private attachedPeersProvider;
|
|
77
|
+
private retainedMutationWork;
|
|
78
|
+
private stopping;
|
|
79
|
+
constructor(policyArg?: ITypedSocketClientTagPolicy);
|
|
80
|
+
setClientTag(peerArg: plugins.IWebSocketPeer | undefined, nameArg: unknown, payloadArg: unknown): Promise<TTypedSocketTagMutationResponse>;
|
|
81
|
+
removeClientTag(peerArg: plugins.IWebSocketPeer | undefined, nameArg: unknown): Promise<TTypedSocketTagMutationResponse>;
|
|
82
|
+
setServerTag(peerArg: plugins.IWebSocketPeer, nameArg: string, payloadArg?: unknown): void;
|
|
83
|
+
removeServerTag(peerArg: plugins.IWebSocketPeer, nameArg: string): void;
|
|
84
|
+
handlePeerClose(peerArg: plugins.IWebSocketPeer): void;
|
|
85
|
+
setAttachedPeersProvider(providerArg: (() => readonly plugins.IWebSocketPeer[]) | undefined): void;
|
|
86
|
+
stop(peersArg: readonly plugins.IWebSocketPeer[]): void;
|
|
87
|
+
getRetainedMutationWork(): number;
|
|
88
|
+
getRetainedMutationWorkForRule(nameArg: string): number;
|
|
89
|
+
private validateClientMutation;
|
|
90
|
+
private enqueueMutation;
|
|
91
|
+
private executeSet;
|
|
92
|
+
private executeRemove;
|
|
93
|
+
private authorize;
|
|
94
|
+
private reconcileName;
|
|
95
|
+
private releaseAdmission;
|
|
96
|
+
private createFingerprint;
|
|
97
|
+
private createSuccess;
|
|
98
|
+
private getPeerState;
|
|
99
|
+
private isPeerLive;
|
|
100
|
+
private getConnectionAuthorityId;
|
|
101
|
+
private getRoutingSurfaceAuthorityId;
|
|
102
|
+
private assertServerMutationName;
|
|
103
|
+
private retainServerTag;
|
|
104
|
+
}
|
|
105
|
+
export {};
|