livekit-client 1.9.2 → 1.9.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/dist/livekit-client.esm.mjs +8251 -8123
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/AsyncQueue.d.ts +23 -0
- package/dist/src/AsyncQueue.d.ts.map +1 -0
- package/dist/src/api/SignalClient.d.ts +98 -98
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +25 -24
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts +58 -58
- package/dist/src/connectionHelper/checks/publishAudio.d.ts +5 -5
- package/dist/src/connectionHelper/checks/publishVideo.d.ts +5 -5
- package/dist/src/connectionHelper/checks/reconnect.d.ts +5 -5
- package/dist/src/connectionHelper/checks/turn.d.ts +5 -5
- package/dist/src/connectionHelper/checks/webrtc.d.ts +5 -5
- package/dist/src/connectionHelper/checks/websocket.d.ts +5 -5
- package/dist/src/index.d.ts +34 -31
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +25 -25
- package/dist/src/options.d.ts +98 -98
- package/dist/src/proto/google/protobuf/timestamp.d.ts +145 -145
- package/dist/src/proto/livekit_models.d.ts +2300 -2300
- package/dist/src/proto/livekit_rtc.d.ts +14032 -14032
- package/dist/src/room/DefaultReconnectPolicy.d.ts +7 -7
- package/dist/src/room/DeviceManager.d.ts +8 -8
- package/dist/src/room/PCTransport.d.ts +36 -37
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +126 -121
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/ReconnectPolicy.d.ts +23 -23
- package/dist/src/room/RegionUrlProvider.d.ts +13 -13
- package/dist/src/room/Room.d.ts +232 -232
- package/dist/src/room/defaults.d.ts +7 -7
- package/dist/src/room/defaults.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +42 -42
- package/dist/src/room/events.d.ts +455 -455
- package/dist/src/room/participant/LocalParticipant.d.ts +170 -170
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +93 -93
- package/dist/src/room/participant/ParticipantTrackPermission.d.ts +25 -25
- package/dist/src/room/participant/RemoteParticipant.d.ts +52 -51
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts +19 -18
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/stats.d.ts +66 -66
- package/dist/src/room/timers.d.ts +11 -12
- package/dist/src/room/timers.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts +24 -24
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +43 -43
- package/dist/src/room/track/LocalTrackPublication.d.ts +37 -37
- package/dist/src/room/track/LocalVideoTrack.d.ts +53 -53
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +52 -52
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrack.d.ts +14 -14
- package/dist/src/room/track/RemoteTrackPublication.d.ts +60 -60
- package/dist/src/room/track/RemoteVideoTrack.d.ts +52 -52
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +124 -124
- package/dist/src/room/track/TrackPublication.d.ts +67 -67
- package/dist/src/room/track/create.d.ts +23 -23
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +255 -247
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/types.d.ts +22 -22
- package/dist/src/room/track/utils.d.ts +13 -13
- package/dist/src/room/types.d.ts +25 -25
- package/dist/src/room/utils.d.ts +86 -85
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/MockMediaStreamTrack.d.ts +25 -25
- package/dist/src/test/mocks.d.ts +10 -10
- package/dist/src/version.d.ts +2 -2
- package/dist/ts4.2/src/AsyncQueue.d.ts +23 -0
- package/dist/ts4.2/src/api/SignalClient.d.ts +2 -2
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -1
- package/dist/ts4.2/src/index.d.ts +8 -6
- package/dist/ts4.2/src/room/PCTransport.d.ts +2 -3
- package/dist/ts4.2/src/room/RTCEngine.d.ts +6 -1
- package/dist/ts4.2/src/room/defaults.d.ts +1 -1
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +4 -4
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +2 -1
- package/dist/ts4.2/src/room/participant/publishUtils.d.ts +2 -1
- package/dist/ts4.2/src/room/timers.d.ts +4 -5
- package/dist/ts4.2/src/room/track/LocalAudioTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/create.d.ts +1 -1
- package/dist/ts4.2/src/room/track/options.d.ts +10 -2
- package/dist/ts4.2/src/room/utils.d.ts +1 -0
- package/package.json +18 -31
- package/src/AsyncQueue.test.ts +99 -0
- package/src/AsyncQueue.ts +57 -0
- package/src/api/SignalClient.ts +14 -15
- package/src/connectionHelper/ConnectionCheck.ts +3 -2
- package/src/index.ts +13 -8
- package/src/room/PCTransport.ts +10 -6
- package/src/room/RTCEngine.ts +10 -3
- package/src/room/defaults.ts +6 -4
- package/src/room/participant/LocalParticipant.ts +10 -9
- package/src/room/participant/RemoteParticipant.ts +2 -1
- package/src/room/participant/publishUtils.ts +7 -5
- package/src/room/track/LocalAudioTrack.ts +2 -1
- package/src/room/track/LocalVideoTrack.ts +3 -2
- package/src/room/track/RemoteAudioTrack.ts +2 -1
- package/src/room/track/RemoteVideoTrack.ts +4 -8
- package/src/room/track/create.ts +2 -2
- package/src/room/track/options.ts +23 -7
- package/src/room/utils.ts +15 -2
package/dist/src/logger.d.ts
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
export declare enum LogLevel {
|
2
|
-
trace = 0,
|
3
|
-
debug = 1,
|
4
|
-
info = 2,
|
5
|
-
warn = 3,
|
6
|
-
error = 4,
|
7
|
-
silent = 5
|
8
|
-
}
|
9
|
-
type LogLevelString = keyof typeof LogLevel;
|
10
|
-
type StructuredLogger = {
|
11
|
-
trace: (msg: string, context?: object) => void;
|
12
|
-
debug: (msg: string, context?: object) => void;
|
13
|
-
info: (msg: string, context?: object) => void;
|
14
|
-
warn: (msg: string, context?: object) => void;
|
15
|
-
error: (msg: string, context?: object) => void;
|
16
|
-
};
|
17
|
-
declare const _default: StructuredLogger;
|
18
|
-
export default _default;
|
19
|
-
export declare function setLogLevel(level: LogLevel | LogLevelString): void;
|
20
|
-
export type LogExtension = (level: LogLevel, msg: string, context?: object) => void;
|
21
|
-
/**
|
22
|
-
* use this to hook into the logging function to allow sending internal livekit logs to third party services
|
23
|
-
* if set, the browser logs will lose their stacktrace information (see https://github.com/pimterry/loglevel#writing-plugins)
|
24
|
-
*/
|
25
|
-
export declare function setLogExtension(extension: LogExtension): void;
|
1
|
+
export declare enum LogLevel {
|
2
|
+
trace = 0,
|
3
|
+
debug = 1,
|
4
|
+
info = 2,
|
5
|
+
warn = 3,
|
6
|
+
error = 4,
|
7
|
+
silent = 5
|
8
|
+
}
|
9
|
+
type LogLevelString = keyof typeof LogLevel;
|
10
|
+
type StructuredLogger = {
|
11
|
+
trace: (msg: string, context?: object) => void;
|
12
|
+
debug: (msg: string, context?: object) => void;
|
13
|
+
info: (msg: string, context?: object) => void;
|
14
|
+
warn: (msg: string, context?: object) => void;
|
15
|
+
error: (msg: string, context?: object) => void;
|
16
|
+
};
|
17
|
+
declare const _default: StructuredLogger;
|
18
|
+
export default _default;
|
19
|
+
export declare function setLogLevel(level: LogLevel | LogLevelString): void;
|
20
|
+
export type LogExtension = (level: LogLevel, msg: string, context?: object) => void;
|
21
|
+
/**
|
22
|
+
* use this to hook into the logging function to allow sending internal livekit logs to third party services
|
23
|
+
* if set, the browser logs will lose their stacktrace information (see https://github.com/pimterry/loglevel#writing-plugins)
|
24
|
+
*/
|
25
|
+
export declare function setLogExtension(extension: LogExtension): void;
|
26
26
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/src/options.d.ts
CHANGED
@@ -1,99 +1,99 @@
|
|
1
|
-
import type { ReconnectPolicy } from './room/ReconnectPolicy';
|
2
|
-
import type { AudioCaptureOptions, AudioOutputOptions, TrackPublishDefaults, VideoCaptureOptions } from './room/track/options';
|
3
|
-
import type { AdaptiveStreamSettings } from './room/track/types';
|
4
|
-
export interface WebAudioSettings {
|
5
|
-
audioContext: AudioContext;
|
6
|
-
}
|
7
|
-
/**
|
8
|
-
* @internal
|
9
|
-
*/
|
10
|
-
export interface InternalRoomOptions {
|
11
|
-
/**
|
12
|
-
* AdaptiveStream lets LiveKit automatically manage quality of subscribed
|
13
|
-
* video tracks to optimize for bandwidth and CPU.
|
14
|
-
* When attached video elements are visible, it'll choose an appropriate
|
15
|
-
* resolution based on the size of largest video element it's attached to.
|
16
|
-
*
|
17
|
-
* When none of the video elements are visible, it'll temporarily pause
|
18
|
-
* the data flow until they are visible again.
|
19
|
-
*/
|
20
|
-
adaptiveStream: AdaptiveStreamSettings | boolean;
|
21
|
-
/**
|
22
|
-
* enable Dynacast, off by default. With Dynacast dynamically pauses
|
23
|
-
* video layers that are not being consumed by any subscribers, significantly
|
24
|
-
* reducing publishing CPU and bandwidth usage.
|
25
|
-
*/
|
26
|
-
dynacast: boolean;
|
27
|
-
/**
|
28
|
-
* default options to use when capturing user's audio
|
29
|
-
*/
|
30
|
-
audioCaptureDefaults?: AudioCaptureOptions;
|
31
|
-
/**
|
32
|
-
* default options to use when capturing user's video
|
33
|
-
*/
|
34
|
-
videoCaptureDefaults?: VideoCaptureOptions;
|
35
|
-
/**
|
36
|
-
* default options to use when publishing tracks
|
37
|
-
*/
|
38
|
-
publishDefaults?: TrackPublishDefaults;
|
39
|
-
/**
|
40
|
-
* audio output for the room
|
41
|
-
*/
|
42
|
-
audioOutput?: AudioOutputOptions;
|
43
|
-
/**
|
44
|
-
* should local tracks be stopped when they are unpublished. defaults to true
|
45
|
-
* set this to false if you would prefer to clean up unpublished local tracks manually.
|
46
|
-
*/
|
47
|
-
stopLocalTrackOnUnpublish: boolean;
|
48
|
-
/**
|
49
|
-
* policy to use when attempting to reconnect
|
50
|
-
*/
|
51
|
-
reconnectPolicy: ReconnectPolicy;
|
52
|
-
/**
|
53
|
-
* specifies whether the sdk should automatically disconnect the room
|
54
|
-
* on 'pagehide' and 'beforeunload' events
|
55
|
-
*/
|
56
|
-
disconnectOnPageLeave: boolean;
|
57
|
-
/**
|
58
|
-
* @internal
|
59
|
-
* experimental flag, introduce a delay before sending signaling messages
|
60
|
-
*/
|
61
|
-
expSignalLatency?: number;
|
62
|
-
/**
|
63
|
-
* @internal
|
64
|
-
* @experimental
|
65
|
-
* experimental flag, mix all audio tracks in web audio
|
66
|
-
*/
|
67
|
-
expWebAudioMix: boolean | WebAudioSettings;
|
68
|
-
}
|
69
|
-
/**
|
70
|
-
* Options for when creating a new room
|
71
|
-
*/
|
72
|
-
export interface RoomOptions extends Partial<InternalRoomOptions> {
|
73
|
-
}
|
74
|
-
/**
|
75
|
-
* @internal
|
76
|
-
*/
|
77
|
-
export interface InternalRoomConnectOptions {
|
78
|
-
/** autosubscribe to room tracks after joining, defaults to true */
|
79
|
-
autoSubscribe: boolean;
|
80
|
-
/** amount of time for PeerConnection to be established, defaults to 15s */
|
81
|
-
peerConnectionTimeout: number;
|
82
|
-
/**
|
83
|
-
* use to override any RTCConfiguration options.
|
84
|
-
*/
|
85
|
-
rtcConfig?: RTCConfiguration;
|
86
|
-
/**
|
87
|
-
* @deprecated
|
88
|
-
* publish only mode
|
89
|
-
*/
|
90
|
-
publishOnly?: string;
|
91
|
-
/** specifies how often an initial join connection is allowed to retry (only applicable if server is not reachable) */
|
92
|
-
maxRetries: number;
|
93
|
-
}
|
94
|
-
/**
|
95
|
-
* Options for Room.connect()
|
96
|
-
*/
|
97
|
-
export interface RoomConnectOptions extends Partial<InternalRoomConnectOptions> {
|
98
|
-
}
|
1
|
+
import type { ReconnectPolicy } from './room/ReconnectPolicy';
|
2
|
+
import type { AudioCaptureOptions, AudioOutputOptions, TrackPublishDefaults, VideoCaptureOptions } from './room/track/options';
|
3
|
+
import type { AdaptiveStreamSettings } from './room/track/types';
|
4
|
+
export interface WebAudioSettings {
|
5
|
+
audioContext: AudioContext;
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* @internal
|
9
|
+
*/
|
10
|
+
export interface InternalRoomOptions {
|
11
|
+
/**
|
12
|
+
* AdaptiveStream lets LiveKit automatically manage quality of subscribed
|
13
|
+
* video tracks to optimize for bandwidth and CPU.
|
14
|
+
* When attached video elements are visible, it'll choose an appropriate
|
15
|
+
* resolution based on the size of largest video element it's attached to.
|
16
|
+
*
|
17
|
+
* When none of the video elements are visible, it'll temporarily pause
|
18
|
+
* the data flow until they are visible again.
|
19
|
+
*/
|
20
|
+
adaptiveStream: AdaptiveStreamSettings | boolean;
|
21
|
+
/**
|
22
|
+
* enable Dynacast, off by default. With Dynacast dynamically pauses
|
23
|
+
* video layers that are not being consumed by any subscribers, significantly
|
24
|
+
* reducing publishing CPU and bandwidth usage.
|
25
|
+
*/
|
26
|
+
dynacast: boolean;
|
27
|
+
/**
|
28
|
+
* default options to use when capturing user's audio
|
29
|
+
*/
|
30
|
+
audioCaptureDefaults?: AudioCaptureOptions;
|
31
|
+
/**
|
32
|
+
* default options to use when capturing user's video
|
33
|
+
*/
|
34
|
+
videoCaptureDefaults?: VideoCaptureOptions;
|
35
|
+
/**
|
36
|
+
* default options to use when publishing tracks
|
37
|
+
*/
|
38
|
+
publishDefaults?: TrackPublishDefaults;
|
39
|
+
/**
|
40
|
+
* audio output for the room
|
41
|
+
*/
|
42
|
+
audioOutput?: AudioOutputOptions;
|
43
|
+
/**
|
44
|
+
* should local tracks be stopped when they are unpublished. defaults to true
|
45
|
+
* set this to false if you would prefer to clean up unpublished local tracks manually.
|
46
|
+
*/
|
47
|
+
stopLocalTrackOnUnpublish: boolean;
|
48
|
+
/**
|
49
|
+
* policy to use when attempting to reconnect
|
50
|
+
*/
|
51
|
+
reconnectPolicy: ReconnectPolicy;
|
52
|
+
/**
|
53
|
+
* specifies whether the sdk should automatically disconnect the room
|
54
|
+
* on 'pagehide' and 'beforeunload' events
|
55
|
+
*/
|
56
|
+
disconnectOnPageLeave: boolean;
|
57
|
+
/**
|
58
|
+
* @internal
|
59
|
+
* experimental flag, introduce a delay before sending signaling messages
|
60
|
+
*/
|
61
|
+
expSignalLatency?: number;
|
62
|
+
/**
|
63
|
+
* @internal
|
64
|
+
* @experimental
|
65
|
+
* experimental flag, mix all audio tracks in web audio
|
66
|
+
*/
|
67
|
+
expWebAudioMix: boolean | WebAudioSettings;
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Options for when creating a new room
|
71
|
+
*/
|
72
|
+
export interface RoomOptions extends Partial<InternalRoomOptions> {
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* @internal
|
76
|
+
*/
|
77
|
+
export interface InternalRoomConnectOptions {
|
78
|
+
/** autosubscribe to room tracks after joining, defaults to true */
|
79
|
+
autoSubscribe: boolean;
|
80
|
+
/** amount of time for PeerConnection to be established, defaults to 15s */
|
81
|
+
peerConnectionTimeout: number;
|
82
|
+
/**
|
83
|
+
* use to override any RTCConfiguration options.
|
84
|
+
*/
|
85
|
+
rtcConfig?: RTCConfiguration;
|
86
|
+
/**
|
87
|
+
* @deprecated
|
88
|
+
* publish only mode
|
89
|
+
*/
|
90
|
+
publishOnly?: string;
|
91
|
+
/** specifies how often an initial join connection is allowed to retry (only applicable if server is not reachable) */
|
92
|
+
maxRetries: number;
|
93
|
+
}
|
94
|
+
/**
|
95
|
+
* Options for Room.connect()
|
96
|
+
*/
|
97
|
+
export interface RoomConnectOptions extends Partial<InternalRoomConnectOptions> {
|
98
|
+
}
|
99
99
|
//# sourceMappingURL=options.d.ts.map
|
@@ -1,146 +1,146 @@
|
|
1
|
-
import _m0 from "protobufjs/minimal";
|
2
|
-
export declare const protobufPackage = "google.protobuf";
|
3
|
-
/**
|
4
|
-
* A Timestamp represents a point in time independent of any time zone or local
|
5
|
-
* calendar, encoded as a count of seconds and fractions of seconds at
|
6
|
-
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
7
|
-
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
8
|
-
* Gregorian calendar backwards to year one.
|
9
|
-
*
|
10
|
-
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
11
|
-
* second table is needed for interpretation, using a [24-hour linear
|
12
|
-
* smear](https://developers.google.com/time/smear).
|
13
|
-
*
|
14
|
-
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
15
|
-
* restricting to that range, we ensure that we can convert to and from [RFC
|
16
|
-
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
17
|
-
*
|
18
|
-
* # Examples
|
19
|
-
*
|
20
|
-
* Example 1: Compute Timestamp from POSIX `time()`.
|
21
|
-
*
|
22
|
-
* Timestamp timestamp;
|
23
|
-
* timestamp.set_seconds(time(NULL));
|
24
|
-
* timestamp.set_nanos(0);
|
25
|
-
*
|
26
|
-
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
27
|
-
*
|
28
|
-
* struct timeval tv;
|
29
|
-
* gettimeofday(&tv, NULL);
|
30
|
-
*
|
31
|
-
* Timestamp timestamp;
|
32
|
-
* timestamp.set_seconds(tv.tv_sec);
|
33
|
-
* timestamp.set_nanos(tv.tv_usec * 1000);
|
34
|
-
*
|
35
|
-
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
36
|
-
*
|
37
|
-
* FILETIME ft;
|
38
|
-
* GetSystemTimeAsFileTime(&ft);
|
39
|
-
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
40
|
-
*
|
41
|
-
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
42
|
-
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
43
|
-
* Timestamp timestamp;
|
44
|
-
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
45
|
-
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
46
|
-
*
|
47
|
-
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
48
|
-
*
|
49
|
-
* long millis = System.currentTimeMillis();
|
50
|
-
*
|
51
|
-
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
52
|
-
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
53
|
-
*
|
54
|
-
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
55
|
-
*
|
56
|
-
* Instant now = Instant.now();
|
57
|
-
*
|
58
|
-
* Timestamp timestamp =
|
59
|
-
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
60
|
-
* .setNanos(now.getNano()).build();
|
61
|
-
*
|
62
|
-
* Example 6: Compute Timestamp from current time in Python.
|
63
|
-
*
|
64
|
-
* timestamp = Timestamp()
|
65
|
-
* timestamp.GetCurrentTime()
|
66
|
-
*
|
67
|
-
* # JSON Mapping
|
68
|
-
*
|
69
|
-
* In JSON format, the Timestamp type is encoded as a string in the
|
70
|
-
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
71
|
-
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
72
|
-
* where {year} is always expressed using four digits while {month}, {day},
|
73
|
-
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
74
|
-
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
75
|
-
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
76
|
-
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
77
|
-
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
78
|
-
* able to accept both UTC and other timezones (as indicated by an offset).
|
79
|
-
*
|
80
|
-
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
81
|
-
* 01:30 UTC on January 15, 2017.
|
82
|
-
*
|
83
|
-
* In JavaScript, one can convert a Date object to this format using the
|
84
|
-
* standard
|
85
|
-
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
86
|
-
* method. In Python, a standard `datetime.datetime` object can be converted
|
87
|
-
* to this format using
|
88
|
-
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
89
|
-
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
90
|
-
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
91
|
-
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
92
|
-
* ) to obtain a formatter capable of generating timestamps in this format.
|
93
|
-
*/
|
94
|
-
export interface Timestamp {
|
95
|
-
/**
|
96
|
-
* Represents seconds of UTC time since Unix epoch
|
97
|
-
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
98
|
-
* 9999-12-31T23:59:59Z inclusive.
|
99
|
-
*/
|
100
|
-
seconds: number;
|
101
|
-
/**
|
102
|
-
* Non-negative fractions of a second at nanosecond resolution. Negative
|
103
|
-
* second values with fractions must still have non-negative nanos values
|
104
|
-
* that count forward in time. Must be from 0 to 999,999,999
|
105
|
-
* inclusive.
|
106
|
-
*/
|
107
|
-
nanos: number;
|
108
|
-
}
|
109
|
-
export declare const Timestamp: {
|
110
|
-
encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer;
|
111
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp;
|
112
|
-
fromJSON(object: any): Timestamp;
|
113
|
-
toJSON(message: Timestamp): unknown;
|
114
|
-
create<I extends {
|
115
|
-
seconds?: number | undefined;
|
116
|
-
nanos?: number | undefined;
|
117
|
-
} & {
|
118
|
-
seconds?: number | undefined;
|
119
|
-
nanos?: number | undefined;
|
120
|
-
} & { [K in Exclude<keyof I, keyof Timestamp>]: never; }>(base?: I | undefined): Timestamp;
|
121
|
-
fromPartial<I_1 extends {
|
122
|
-
seconds?: number | undefined;
|
123
|
-
nanos?: number | undefined;
|
124
|
-
} & {
|
125
|
-
seconds?: number | undefined;
|
126
|
-
nanos?: number | undefined;
|
127
|
-
} & { [K_1 in Exclude<keyof I_1, keyof Timestamp>]: never; }>(object: I_1): Timestamp;
|
128
|
-
};
|
129
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
130
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
131
|
-
$case: string;
|
132
|
-
} ? {
|
133
|
-
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
134
|
-
} & {
|
135
|
-
$case: T["$case"];
|
136
|
-
} : T extends {} ? {
|
137
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
138
|
-
} : Partial<T>;
|
139
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
140
|
-
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
141
|
-
[K in keyof P]: Exact<P[K], I[K]>;
|
142
|
-
} & {
|
143
|
-
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
144
|
-
};
|
145
|
-
export {};
|
1
|
+
import _m0 from "protobufjs/minimal";
|
2
|
+
export declare const protobufPackage = "google.protobuf";
|
3
|
+
/**
|
4
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
5
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
6
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
7
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
8
|
+
* Gregorian calendar backwards to year one.
|
9
|
+
*
|
10
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
11
|
+
* second table is needed for interpretation, using a [24-hour linear
|
12
|
+
* smear](https://developers.google.com/time/smear).
|
13
|
+
*
|
14
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
15
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
16
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
17
|
+
*
|
18
|
+
* # Examples
|
19
|
+
*
|
20
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
21
|
+
*
|
22
|
+
* Timestamp timestamp;
|
23
|
+
* timestamp.set_seconds(time(NULL));
|
24
|
+
* timestamp.set_nanos(0);
|
25
|
+
*
|
26
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
27
|
+
*
|
28
|
+
* struct timeval tv;
|
29
|
+
* gettimeofday(&tv, NULL);
|
30
|
+
*
|
31
|
+
* Timestamp timestamp;
|
32
|
+
* timestamp.set_seconds(tv.tv_sec);
|
33
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
34
|
+
*
|
35
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
36
|
+
*
|
37
|
+
* FILETIME ft;
|
38
|
+
* GetSystemTimeAsFileTime(&ft);
|
39
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
40
|
+
*
|
41
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
42
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
43
|
+
* Timestamp timestamp;
|
44
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
45
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
46
|
+
*
|
47
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
48
|
+
*
|
49
|
+
* long millis = System.currentTimeMillis();
|
50
|
+
*
|
51
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
52
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
53
|
+
*
|
54
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
55
|
+
*
|
56
|
+
* Instant now = Instant.now();
|
57
|
+
*
|
58
|
+
* Timestamp timestamp =
|
59
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
60
|
+
* .setNanos(now.getNano()).build();
|
61
|
+
*
|
62
|
+
* Example 6: Compute Timestamp from current time in Python.
|
63
|
+
*
|
64
|
+
* timestamp = Timestamp()
|
65
|
+
* timestamp.GetCurrentTime()
|
66
|
+
*
|
67
|
+
* # JSON Mapping
|
68
|
+
*
|
69
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
70
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
71
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
72
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
73
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
74
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
75
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
76
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
77
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
78
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
79
|
+
*
|
80
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
81
|
+
* 01:30 UTC on January 15, 2017.
|
82
|
+
*
|
83
|
+
* In JavaScript, one can convert a Date object to this format using the
|
84
|
+
* standard
|
85
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
86
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
87
|
+
* to this format using
|
88
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
89
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
90
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
91
|
+
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
92
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
93
|
+
*/
|
94
|
+
export interface Timestamp {
|
95
|
+
/**
|
96
|
+
* Represents seconds of UTC time since Unix epoch
|
97
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
98
|
+
* 9999-12-31T23:59:59Z inclusive.
|
99
|
+
*/
|
100
|
+
seconds: number;
|
101
|
+
/**
|
102
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
103
|
+
* second values with fractions must still have non-negative nanos values
|
104
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
105
|
+
* inclusive.
|
106
|
+
*/
|
107
|
+
nanos: number;
|
108
|
+
}
|
109
|
+
export declare const Timestamp: {
|
110
|
+
encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer;
|
111
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp;
|
112
|
+
fromJSON(object: any): Timestamp;
|
113
|
+
toJSON(message: Timestamp): unknown;
|
114
|
+
create<I extends {
|
115
|
+
seconds?: number | undefined;
|
116
|
+
nanos?: number | undefined;
|
117
|
+
} & {
|
118
|
+
seconds?: number | undefined;
|
119
|
+
nanos?: number | undefined;
|
120
|
+
} & { [K in Exclude<keyof I, keyof Timestamp>]: never; }>(base?: I | undefined): Timestamp;
|
121
|
+
fromPartial<I_1 extends {
|
122
|
+
seconds?: number | undefined;
|
123
|
+
nanos?: number | undefined;
|
124
|
+
} & {
|
125
|
+
seconds?: number | undefined;
|
126
|
+
nanos?: number | undefined;
|
127
|
+
} & { [K_1 in Exclude<keyof I_1, keyof Timestamp>]: never; }>(object: I_1): Timestamp;
|
128
|
+
};
|
129
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
130
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
131
|
+
$case: string;
|
132
|
+
} ? {
|
133
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
134
|
+
} & {
|
135
|
+
$case: T["$case"];
|
136
|
+
} : T extends {} ? {
|
137
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
138
|
+
} : Partial<T>;
|
139
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
140
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
141
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
142
|
+
} & {
|
143
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
144
|
+
};
|
145
|
+
export {};
|
146
146
|
//# sourceMappingURL=timestamp.d.ts.map
|