posthog-react-native 4.2.2 → 4.3.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 +245 -0
- package/dist/PostHogContext.js.map +1 -0
- package/dist/PostHogProvider.js +1 -0
- package/dist/PostHogProvider.js.map +1 -0
- package/dist/autocapture.js +1 -0
- package/dist/autocapture.js.map +1 -0
- package/dist/frameworks/wix-navigation.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/hooks/useFeatureFlag.d.ts +1 -1
- package/dist/hooks/useFeatureFlag.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/hooks/useFeatureFlags.d.ts +1 -1
- package/dist/hooks/useFeatureFlags.js.map +1 -0
- package/dist/hooks/useNavigationTracker.js.map +1 -0
- package/dist/hooks/usePostHog.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/native-deps.js +1 -0
- package/dist/native-deps.js.map +1 -0
- package/dist/optional/OptionalAsyncStorage.js.map +1 -0
- package/dist/optional/OptionalExpoApplication.js.map +1 -0
- package/dist/optional/OptionalExpoDevice.js.map +1 -0
- package/dist/optional/OptionalExpoFileSystem.js.map +1 -0
- package/dist/optional/OptionalExpoLocalization.js.map +1 -0
- package/dist/optional/OptionalReactNativeDeviceInfo.js.map +1 -0
- package/dist/optional/OptionalReactNativeLocalize.js.map +1 -0
- package/dist/optional/OptionalReactNativeNavigation.js.map +1 -0
- package/dist/optional/OptionalReactNativeNavigationWix.js.map +1 -0
- package/dist/optional/OptionalReactNativeSafeArea.js.map +1 -0
- package/dist/optional/OptionalSessionReplay.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/posthog-rn.d.ts +2 -1
- package/dist/posthog-rn.js +1 -0
- package/dist/posthog-rn.js.map +1 -0
- package/dist/storage.js +1 -0
- package/dist/storage.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/PostHogSurveyProvider.d.ts +1 -1
- package/dist/surveys/PostHogSurveyProvider.js +1 -0
- package/dist/surveys/PostHogSurveyProvider.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/BottomSection.d.ts +0 -1
- package/dist/surveys/components/BottomSection.js +1 -0
- package/dist/surveys/components/BottomSection.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/Cancel.d.ts +0 -1
- package/dist/surveys/components/Cancel.js +1 -0
- package/dist/surveys/components/Cancel.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/ConfirmationMessage.d.ts +1 -2
- package/dist/surveys/components/ConfirmationMessage.js +1 -0
- package/dist/surveys/components/ConfirmationMessage.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/QuestionHeader.d.ts +1 -2
- package/dist/surveys/components/QuestionHeader.js +1 -0
- package/dist/surveys/components/QuestionHeader.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/QuestionTypes.d.ts +1 -2
- package/dist/surveys/components/QuestionTypes.js +1 -0
- package/dist/surveys/components/QuestionTypes.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/SurveyModal.d.ts +1 -2
- package/dist/surveys/components/SurveyModal.js +1 -0
- package/dist/surveys/components/SurveyModal.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/components/Surveys.d.ts +1 -2
- package/dist/surveys/components/Surveys.js +1 -0
- package/dist/surveys/components/Surveys.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/getActiveMatchingSurveys.d.ts +1 -1
- package/dist/surveys/getActiveMatchingSurveys.js +1 -0
- package/dist/surveys/getActiveMatchingSurveys.js.map +1 -0
- package/dist/surveys/icons.js +1 -0
- package/dist/surveys/icons.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/index.d.ts +1 -1
- package/dist/surveys/index.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/surveys-utils.d.ts +1 -1
- package/dist/surveys/surveys-utils.js +1 -0
- package/dist/surveys/surveys-utils.js.map +1 -0
- package/{lib/posthog-react-native/src → dist}/surveys/useActivatedSurveys.d.ts +1 -1
- package/dist/surveys/useActivatedSurveys.js.map +1 -0
- package/dist/surveys/useSurveyStorage.js +1 -0
- package/dist/surveys/useSurveyStorage.js.map +1 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/dist/version.js.map +1 -0
- package/package.json +33 -19
- package/lib/posthog-core/src/eventemitter.d.ts +0 -8
- package/lib/posthog-core/src/eventemitter.js +0 -1
- package/lib/posthog-core/src/eventemitter.js.map +0 -1
- package/lib/posthog-core/src/featureFlagUtils.d.ts +0 -34
- package/lib/posthog-core/src/featureFlagUtils.js +0 -1
- package/lib/posthog-core/src/featureFlagUtils.js.map +0 -1
- package/lib/posthog-core/src/gzip.d.ts +0 -9
- package/lib/posthog-core/src/gzip.js +0 -1
- package/lib/posthog-core/src/gzip.js.map +0 -1
- package/lib/posthog-core/src/index.d.ts +0 -260
- package/lib/posthog-core/src/index.js +0 -1
- package/lib/posthog-core/src/index.js.map +0 -1
- package/lib/posthog-core/src/types.d.ts +0 -440
- package/lib/posthog-core/src/types.js +0 -1
- package/lib/posthog-core/src/types.js.map +0 -1
- package/lib/posthog-core/src/utils.d.ts +0 -23
- package/lib/posthog-core/src/utils.js +0 -1
- package/lib/posthog-core/src/utils.js.map +0 -1
- package/lib/posthog-core/src/vendor/uuidv7.d.ts +0 -179
- package/lib/posthog-core/src/vendor/uuidv7.js +0 -7
- package/lib/posthog-core/src/vendor/uuidv7.js.map +0 -1
- package/lib/posthog-react-native/index.d.ts +0 -10
- package/lib/posthog-react-native/index.js +0 -1
- package/lib/posthog-react-native/index.js.map +0 -1
- package/lib/posthog-react-native/src/PostHogContext.js.map +0 -1
- package/lib/posthog-react-native/src/PostHogProvider.js +0 -1
- package/lib/posthog-react-native/src/PostHogProvider.js.map +0 -1
- package/lib/posthog-react-native/src/autocapture.js +0 -1
- package/lib/posthog-react-native/src/autocapture.js.map +0 -1
- package/lib/posthog-react-native/src/frameworks/wix-navigation.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.js.map +0 -1
- package/lib/posthog-react-native/src/hooks/usePostHog.js.map +0 -1
- package/lib/posthog-react-native/src/legacy.d.ts +0 -4
- package/lib/posthog-react-native/src/legacy.js +0 -1
- package/lib/posthog-react-native/src/legacy.js.map +0 -1
- package/lib/posthog-react-native/src/native-deps.js +0 -1
- package/lib/posthog-react-native/src/native-deps.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoApplication.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoDevice.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeLocalize.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalReactNativeSafeArea.js.map +0 -1
- package/lib/posthog-react-native/src/optional/OptionalSessionReplay.js.map +0 -1
- package/lib/posthog-react-native/src/posthog-rn.js +0 -1
- package/lib/posthog-react-native/src/posthog-rn.js.map +0 -1
- package/lib/posthog-react-native/src/storage.js +0 -1
- package/lib/posthog-react-native/src/storage.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js +0 -1
- package/lib/posthog-react-native/src/surveys/PostHogSurveyProvider.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/BottomSection.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/Cancel.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/Cancel.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/ConfirmationMessage.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionHeader.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/QuestionTypes.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/SurveyModal.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/components/Surveys.js +0 -1
- package/lib/posthog-react-native/src/surveys/components/Surveys.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js +0 -1
- package/lib/posthog-react-native/src/surveys/getActiveMatchingSurveys.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/icons.js +0 -1
- package/lib/posthog-react-native/src/surveys/icons.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/index.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/surveys-utils.js +0 -1
- package/lib/posthog-react-native/src/surveys/surveys-utils.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/useActivatedSurveys.js.map +0 -1
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js +0 -1
- package/lib/posthog-react-native/src/surveys/useSurveyStorage.js.map +0 -1
- package/lib/posthog-react-native/src/types.js.map +0 -1
- package/lib/posthog-react-native/src/version.d.ts +0 -1
- package/lib/posthog-react-native/src/version.js +0 -1
- package/lib/posthog-react-native/src/version.js.map +0 -1
- package/lib/posthog-react-native/tsconfig.tsbuildinfo +0 -1
- /package/{lib/posthog-react-native/src → dist}/PostHogContext.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/PostHogContext.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/PostHogProvider.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/autocapture.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/frameworks/wix-navigation.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/frameworks/wix-navigation.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/hooks/useFeatureFlag.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/hooks/useFeatureFlags.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/hooks/useNavigationTracker.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/hooks/useNavigationTracker.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/hooks/usePostHog.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/hooks/usePostHog.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/native-deps.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalAsyncStorage.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalAsyncStorage.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoApplication.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoApplication.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoDevice.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoDevice.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoFileSystem.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoFileSystem.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoLocalization.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalExpoLocalization.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeDeviceInfo.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeDeviceInfo.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeLocalize.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeLocalize.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeNavigation.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeNavigation.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeNavigationWix.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeNavigationWix.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeSafeArea.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalReactNativeSafeArea.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalSessionReplay.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/optional/OptionalSessionReplay.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/storage.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/surveys/icons.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/surveys/index.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/surveys/useActivatedSurveys.js +0 -0
- /package/{lib/posthog-react-native/src → dist}/surveys/useSurveyStorage.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/types.d.ts +0 -0
- /package/{lib/posthog-react-native/src → dist}/types.js +0 -0
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
export type PostHogCoreOptions = {
|
|
2
|
-
/** PostHog API host, usually 'https://us.i.posthog.com' or 'https://eu.i.posthog.com' */
|
|
3
|
-
host?: string;
|
|
4
|
-
/** The number of events to queue before sending to PostHog (flushing) */
|
|
5
|
-
flushAt?: number;
|
|
6
|
-
/** The interval in milliseconds between periodic flushes */
|
|
7
|
-
flushInterval?: number;
|
|
8
|
-
/** The maximum number of queued messages to be flushed as part of a single batch (must be higher than `flushAt`) */
|
|
9
|
-
maxBatchSize?: number;
|
|
10
|
-
/** The maximum number of cached messages either in memory or on the local storage.
|
|
11
|
-
* Defaults to 1000, (must be higher than `flushAt`)
|
|
12
|
-
*/
|
|
13
|
-
maxQueueSize?: number;
|
|
14
|
-
/** If set to true the SDK is essentially disabled (useful for local environments where you don't want to track anything) */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** If set to false the SDK will not track until the `optIn` function is called. */
|
|
17
|
-
defaultOptIn?: boolean;
|
|
18
|
-
/** Whether to track that `getFeatureFlag` was called (used by Experiments) */
|
|
19
|
-
sendFeatureFlagEvent?: boolean;
|
|
20
|
-
/** Whether to load feature flags when initialized or not */
|
|
21
|
-
preloadFeatureFlags?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to load remote config when initialized or not
|
|
24
|
-
* Experimental support
|
|
25
|
-
* Default: false - Remote config is loaded by default
|
|
26
|
-
*/
|
|
27
|
-
disableRemoteConfig?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Whether to load surveys when initialized or not
|
|
30
|
-
* Experimental support
|
|
31
|
-
* Default: false - Surveys are loaded by default, but requires the `PostHogSurveyProvider` to be used
|
|
32
|
-
*/
|
|
33
|
-
disableSurveys?: boolean;
|
|
34
|
-
/** Option to bootstrap the library with given distinctId and feature flags */
|
|
35
|
-
bootstrap?: {
|
|
36
|
-
distinctId?: string;
|
|
37
|
-
isIdentifiedId?: boolean;
|
|
38
|
-
featureFlags?: Record<string, FeatureFlagValue>;
|
|
39
|
-
featureFlagPayloads?: Record<string, JsonType>;
|
|
40
|
-
};
|
|
41
|
-
/** How many times we will retry HTTP requests. Defaults to 3. */
|
|
42
|
-
fetchRetryCount?: number;
|
|
43
|
-
/** The delay between HTTP request retries, Defaults to 3 seconds. */
|
|
44
|
-
fetchRetryDelay?: number;
|
|
45
|
-
/** Timeout in milliseconds for any calls. Defaults to 10 seconds. */
|
|
46
|
-
requestTimeout?: number;
|
|
47
|
-
/** Timeout in milliseconds for feature flag calls. Defaults to 10 seconds for stateful clients, and 3 seconds for stateless. */
|
|
48
|
-
featureFlagsRequestTimeoutMs?: number;
|
|
49
|
-
/** Timeout in milliseconds for remote config calls. Defaults to 3 seconds. */
|
|
50
|
-
remoteConfigRequestTimeoutMs?: number;
|
|
51
|
-
/** For Session Analysis how long before we expire a session (defaults to 30 mins) */
|
|
52
|
-
sessionExpirationTimeSeconds?: number;
|
|
53
|
-
/** Whether to disable GZIP compression */
|
|
54
|
-
disableCompression?: boolean;
|
|
55
|
-
disableGeoip?: boolean;
|
|
56
|
-
/** Special flag to indicate ingested data is for a historical migration. */
|
|
57
|
-
historicalMigration?: boolean;
|
|
58
|
-
};
|
|
59
|
-
export declare enum PostHogPersistedProperty {
|
|
60
|
-
AnonymousId = "anonymous_id",
|
|
61
|
-
DistinctId = "distinct_id",
|
|
62
|
-
Props = "props",
|
|
63
|
-
FeatureFlagDetails = "feature_flag_details",
|
|
64
|
-
FeatureFlags = "feature_flags",
|
|
65
|
-
FeatureFlagPayloads = "feature_flag_payloads",
|
|
66
|
-
BootstrapFeatureFlagDetails = "bootstrap_feature_flag_details",
|
|
67
|
-
BootstrapFeatureFlags = "bootstrap_feature_flags",
|
|
68
|
-
BootstrapFeatureFlagPayloads = "bootstrap_feature_flag_payloads",
|
|
69
|
-
OverrideFeatureFlags = "override_feature_flags",
|
|
70
|
-
Queue = "queue",
|
|
71
|
-
OptedOut = "opted_out",
|
|
72
|
-
SessionId = "session_id",
|
|
73
|
-
SessionStartTimestamp = "session_start_timestamp",
|
|
74
|
-
SessionLastTimestamp = "session_timestamp",
|
|
75
|
-
PersonProperties = "person_properties",
|
|
76
|
-
GroupProperties = "group_properties",
|
|
77
|
-
InstalledAppBuild = "installed_app_build",
|
|
78
|
-
InstalledAppVersion = "installed_app_version",
|
|
79
|
-
SessionReplay = "session_replay",
|
|
80
|
-
SurveyLastSeenDate = "survey_last_seen_date",
|
|
81
|
-
SurveysSeen = "surveys_seen",
|
|
82
|
-
Surveys = "surveys",
|
|
83
|
-
RemoteConfig = "remote_config",
|
|
84
|
-
FlagsEndpointWasHit = "flags_endpoint_was_hit"
|
|
85
|
-
}
|
|
86
|
-
export type PostHogFetchOptions = {
|
|
87
|
-
method: 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
88
|
-
mode?: 'no-cors';
|
|
89
|
-
credentials?: 'omit';
|
|
90
|
-
headers: {
|
|
91
|
-
[key: string]: string;
|
|
92
|
-
};
|
|
93
|
-
body?: string | Blob;
|
|
94
|
-
signal?: AbortSignal;
|
|
95
|
-
};
|
|
96
|
-
export type PostHogCaptureOptions = {
|
|
97
|
-
/** If provided overrides the auto-generated event ID */
|
|
98
|
-
uuid?: string;
|
|
99
|
-
/** If provided overrides the auto-generated timestamp */
|
|
100
|
-
timestamp?: Date;
|
|
101
|
-
disableGeoip?: boolean;
|
|
102
|
-
};
|
|
103
|
-
export type PostHogFetchResponse = {
|
|
104
|
-
status: number;
|
|
105
|
-
text: () => Promise<string>;
|
|
106
|
-
json: () => Promise<any>;
|
|
107
|
-
};
|
|
108
|
-
export type PostHogQueueItem = {
|
|
109
|
-
message: any;
|
|
110
|
-
callback?: (err: any) => void;
|
|
111
|
-
};
|
|
112
|
-
export type PostHogEventProperties = {
|
|
113
|
-
[key: string]: JsonType;
|
|
114
|
-
};
|
|
115
|
-
export type PostHogGroupProperties = {
|
|
116
|
-
[type: string]: string | number;
|
|
117
|
-
};
|
|
118
|
-
export type PostHogAutocaptureElement = {
|
|
119
|
-
$el_text?: string;
|
|
120
|
-
tag_name: string;
|
|
121
|
-
href?: string;
|
|
122
|
-
nth_child?: number;
|
|
123
|
-
nth_of_type?: number;
|
|
124
|
-
order?: number;
|
|
125
|
-
} & PostHogEventProperties;
|
|
126
|
-
export declare enum Compression {
|
|
127
|
-
GZipJS = "gzip-js",
|
|
128
|
-
Base64 = "base64"
|
|
129
|
-
}
|
|
130
|
-
export type PostHogRemoteConfig = {
|
|
131
|
-
sessionRecording?: boolean | {
|
|
132
|
-
[key: string]: JsonType;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Supported compression algorithms
|
|
136
|
-
*/
|
|
137
|
-
supportedCompression?: Compression[];
|
|
138
|
-
/**
|
|
139
|
-
* Whether surveys are enabled
|
|
140
|
-
*/
|
|
141
|
-
surveys?: boolean | Survey[];
|
|
142
|
-
/**
|
|
143
|
-
* Indicates if the team has any flags enabled (if not we don't need to load them)
|
|
144
|
-
*/
|
|
145
|
-
hasFeatureFlags?: boolean;
|
|
146
|
-
};
|
|
147
|
-
export type FeatureFlagValue = string | boolean;
|
|
148
|
-
export type PostHogFlagsResponse = Omit<PostHogRemoteConfig, 'surveys' | 'hasFeatureFlags'> & {
|
|
149
|
-
featureFlags: {
|
|
150
|
-
[key: string]: FeatureFlagValue;
|
|
151
|
-
};
|
|
152
|
-
featureFlagPayloads: {
|
|
153
|
-
[key: string]: JsonType;
|
|
154
|
-
};
|
|
155
|
-
flags: {
|
|
156
|
-
[key: string]: FeatureFlagDetail;
|
|
157
|
-
};
|
|
158
|
-
errorsWhileComputingFlags: boolean;
|
|
159
|
-
sessionRecording?: boolean | {
|
|
160
|
-
[key: string]: JsonType;
|
|
161
|
-
};
|
|
162
|
-
quotaLimited?: string[];
|
|
163
|
-
requestId?: string;
|
|
164
|
-
};
|
|
165
|
-
export type PostHogFeatureFlagsResponse = PartialWithRequired<PostHogFlagsResponse, 'flags' | 'featureFlags' | 'featureFlagPayloads' | 'requestId'>;
|
|
166
|
-
/**
|
|
167
|
-
* Creates a type with all properties of T, but makes only K properties required while the rest remain optional.
|
|
168
|
-
*
|
|
169
|
-
* @template T - The base type containing all properties
|
|
170
|
-
* @template K - Union type of keys from T that should be required
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* interface User {
|
|
174
|
-
* id: number;
|
|
175
|
-
* name: string;
|
|
176
|
-
* email?: string;
|
|
177
|
-
* age?: number;
|
|
178
|
-
* }
|
|
179
|
-
*
|
|
180
|
-
* // Makes 'id' and 'name' required, but 'email' and 'age' optional
|
|
181
|
-
* type RequiredUser = PartialWithRequired<User, 'id' | 'name'>;
|
|
182
|
-
*
|
|
183
|
-
* const user: RequiredUser = {
|
|
184
|
-
* id: 1, // Must be provided
|
|
185
|
-
* name: "John" // Must be provided
|
|
186
|
-
* // email and age are optional
|
|
187
|
-
* };
|
|
188
|
-
*/
|
|
189
|
-
export type PartialWithRequired<T, K extends keyof T> = {
|
|
190
|
-
[P in K]: T[P];
|
|
191
|
-
} & {
|
|
192
|
-
[P in Exclude<keyof T, K>]?: T[P];
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* These are the fields we care about from PostHogFlagsResponse for feature flags.
|
|
196
|
-
*/
|
|
197
|
-
export type PostHogFeatureFlagDetails = PartialWithRequired<PostHogFlagsResponse, 'flags' | 'featureFlags' | 'featureFlagPayloads' | 'requestId'>;
|
|
198
|
-
/**
|
|
199
|
-
* Models the response from the v1 `/flags` endpoint.
|
|
200
|
-
*/
|
|
201
|
-
export type PostHogV1FlagsResponse = Omit<PostHogFlagsResponse, 'flags'>;
|
|
202
|
-
/**
|
|
203
|
-
* Models the response from the v2 `/flags` endpoint.
|
|
204
|
-
*/
|
|
205
|
-
export type PostHogV2FlagsResponse = Omit<PostHogFlagsResponse, 'featureFlags' | 'featureFlagPayloads'>;
|
|
206
|
-
/**
|
|
207
|
-
* The format of the flags object in persisted storage
|
|
208
|
-
*
|
|
209
|
-
* When we pull flags from persistence, we can normalize them to PostHogFeatureFlagDetails
|
|
210
|
-
* so that we can support v1 and v2 of the API.
|
|
211
|
-
*/
|
|
212
|
-
export type PostHogFlagsStorageFormat = Pick<PostHogFeatureFlagDetails, 'flags'>;
|
|
213
|
-
/**
|
|
214
|
-
* Models legacy flags and payloads return type for many public methods.
|
|
215
|
-
*/
|
|
216
|
-
export type PostHogFlagsAndPayloadsResponse = Partial<Pick<PostHogFlagsResponse, 'featureFlags' | 'featureFlagPayloads'>>;
|
|
217
|
-
export type JsonType = string | number | boolean | null | {
|
|
218
|
-
[key: string]: JsonType;
|
|
219
|
-
} | Array<JsonType> | JsonType[];
|
|
220
|
-
export type FetchLike = (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>;
|
|
221
|
-
export type FeatureFlagDetail = {
|
|
222
|
-
key: string;
|
|
223
|
-
enabled: boolean;
|
|
224
|
-
variant: string | undefined;
|
|
225
|
-
reason: EvaluationReason | undefined;
|
|
226
|
-
metadata: FeatureFlagMetadata | undefined;
|
|
227
|
-
};
|
|
228
|
-
export type FeatureFlagMetadata = {
|
|
229
|
-
id: number | undefined;
|
|
230
|
-
version: number | undefined;
|
|
231
|
-
description: string | undefined;
|
|
232
|
-
payload: string | undefined;
|
|
233
|
-
};
|
|
234
|
-
export type EvaluationReason = {
|
|
235
|
-
code: string | undefined;
|
|
236
|
-
condition_index: number | undefined;
|
|
237
|
-
description: string | undefined;
|
|
238
|
-
};
|
|
239
|
-
export type SurveyAppearance = {
|
|
240
|
-
backgroundColor?: string;
|
|
241
|
-
submitButtonColor?: string;
|
|
242
|
-
submitButtonText?: string;
|
|
243
|
-
submitButtonTextColor?: string;
|
|
244
|
-
ratingButtonColor?: string;
|
|
245
|
-
ratingButtonActiveColor?: string;
|
|
246
|
-
autoDisappear?: boolean;
|
|
247
|
-
displayThankYouMessage?: boolean;
|
|
248
|
-
thankYouMessageHeader?: string;
|
|
249
|
-
thankYouMessageDescription?: string;
|
|
250
|
-
thankYouMessageDescriptionContentType?: SurveyQuestionDescriptionContentType;
|
|
251
|
-
thankYouMessageCloseButtonText?: string;
|
|
252
|
-
borderColor?: string;
|
|
253
|
-
position?: SurveyPosition;
|
|
254
|
-
placeholder?: string;
|
|
255
|
-
shuffleQuestions?: boolean;
|
|
256
|
-
surveyPopupDelaySeconds?: number;
|
|
257
|
-
widgetType?: SurveyWidgetType;
|
|
258
|
-
widgetSelector?: string;
|
|
259
|
-
widgetLabel?: string;
|
|
260
|
-
widgetColor?: string;
|
|
261
|
-
};
|
|
262
|
-
export declare enum SurveyPosition {
|
|
263
|
-
TopLeft = "top_left",
|
|
264
|
-
TopCenter = "top_center",
|
|
265
|
-
TopRight = "top_right",
|
|
266
|
-
MiddleLeft = "middle_left",
|
|
267
|
-
MiddleCenter = "middle_center",
|
|
268
|
-
MiddleRight = "middle_right",
|
|
269
|
-
Left = "left",
|
|
270
|
-
Right = "right",
|
|
271
|
-
Center = "center"
|
|
272
|
-
}
|
|
273
|
-
export declare enum SurveyWidgetType {
|
|
274
|
-
Button = "button",
|
|
275
|
-
Tab = "tab",
|
|
276
|
-
Selector = "selector"
|
|
277
|
-
}
|
|
278
|
-
export declare enum SurveyType {
|
|
279
|
-
Popover = "popover",
|
|
280
|
-
API = "api",
|
|
281
|
-
Widget = "widget",
|
|
282
|
-
ExternalSurvey = "external_survey"
|
|
283
|
-
}
|
|
284
|
-
export type SurveyQuestion = BasicSurveyQuestion | LinkSurveyQuestion | RatingSurveyQuestion | MultipleSurveyQuestion;
|
|
285
|
-
export declare enum SurveyQuestionDescriptionContentType {
|
|
286
|
-
Html = "html",
|
|
287
|
-
Text = "text"
|
|
288
|
-
}
|
|
289
|
-
type SurveyQuestionBase = {
|
|
290
|
-
question: string;
|
|
291
|
-
id?: string;
|
|
292
|
-
description?: string;
|
|
293
|
-
descriptionContentType?: SurveyQuestionDescriptionContentType;
|
|
294
|
-
optional?: boolean;
|
|
295
|
-
buttonText?: string;
|
|
296
|
-
originalQuestionIndex: number;
|
|
297
|
-
branching?: NextQuestionBranching | EndBranching | ResponseBasedBranching | SpecificQuestionBranching;
|
|
298
|
-
};
|
|
299
|
-
export type BasicSurveyQuestion = SurveyQuestionBase & {
|
|
300
|
-
type: SurveyQuestionType.Open;
|
|
301
|
-
};
|
|
302
|
-
export type LinkSurveyQuestion = SurveyQuestionBase & {
|
|
303
|
-
type: SurveyQuestionType.Link;
|
|
304
|
-
link?: string;
|
|
305
|
-
};
|
|
306
|
-
export type RatingSurveyQuestion = SurveyQuestionBase & {
|
|
307
|
-
type: SurveyQuestionType.Rating;
|
|
308
|
-
display: SurveyRatingDisplay;
|
|
309
|
-
scale: 3 | 5 | 7 | 10;
|
|
310
|
-
lowerBoundLabel: string;
|
|
311
|
-
upperBoundLabel: string;
|
|
312
|
-
};
|
|
313
|
-
export declare enum SurveyRatingDisplay {
|
|
314
|
-
Number = "number",
|
|
315
|
-
Emoji = "emoji"
|
|
316
|
-
}
|
|
317
|
-
export type MultipleSurveyQuestion = SurveyQuestionBase & {
|
|
318
|
-
type: SurveyQuestionType.SingleChoice | SurveyQuestionType.MultipleChoice;
|
|
319
|
-
choices: string[];
|
|
320
|
-
hasOpenChoice?: boolean;
|
|
321
|
-
shuffleOptions?: boolean;
|
|
322
|
-
};
|
|
323
|
-
export declare enum SurveyQuestionType {
|
|
324
|
-
Open = "open",
|
|
325
|
-
MultipleChoice = "multiple_choice",
|
|
326
|
-
SingleChoice = "single_choice",
|
|
327
|
-
Rating = "rating",
|
|
328
|
-
Link = "link"
|
|
329
|
-
}
|
|
330
|
-
export declare enum SurveyQuestionBranchingType {
|
|
331
|
-
NextQuestion = "next_question",
|
|
332
|
-
End = "end",
|
|
333
|
-
ResponseBased = "response_based",
|
|
334
|
-
SpecificQuestion = "specific_question"
|
|
335
|
-
}
|
|
336
|
-
export type NextQuestionBranching = {
|
|
337
|
-
type: SurveyQuestionBranchingType.NextQuestion;
|
|
338
|
-
};
|
|
339
|
-
export type EndBranching = {
|
|
340
|
-
type: SurveyQuestionBranchingType.End;
|
|
341
|
-
};
|
|
342
|
-
export type ResponseBasedBranching = {
|
|
343
|
-
type: SurveyQuestionBranchingType.ResponseBased;
|
|
344
|
-
responseValues: Record<string, any>;
|
|
345
|
-
};
|
|
346
|
-
export type SpecificQuestionBranching = {
|
|
347
|
-
type: SurveyQuestionBranchingType.SpecificQuestion;
|
|
348
|
-
index: number;
|
|
349
|
-
};
|
|
350
|
-
export type SurveyResponse = {
|
|
351
|
-
surveys: Survey[];
|
|
352
|
-
};
|
|
353
|
-
export type SurveyCallback = (surveys: Survey[]) => void;
|
|
354
|
-
export declare enum SurveyMatchType {
|
|
355
|
-
Regex = "regex",
|
|
356
|
-
NotRegex = "not_regex",
|
|
357
|
-
Exact = "exact",
|
|
358
|
-
IsNot = "is_not",
|
|
359
|
-
Icontains = "icontains",
|
|
360
|
-
NotIcontains = "not_icontains"
|
|
361
|
-
}
|
|
362
|
-
export type SurveyElement = {
|
|
363
|
-
text?: string;
|
|
364
|
-
$el_text?: string;
|
|
365
|
-
tag_name?: string;
|
|
366
|
-
href?: string;
|
|
367
|
-
attr_id?: string;
|
|
368
|
-
attr_class?: string[];
|
|
369
|
-
nth_child?: number;
|
|
370
|
-
nth_of_type?: number;
|
|
371
|
-
attributes?: Record<string, any>;
|
|
372
|
-
event_id?: number;
|
|
373
|
-
order?: number;
|
|
374
|
-
group_id?: number;
|
|
375
|
-
};
|
|
376
|
-
export type SurveyRenderReason = {
|
|
377
|
-
visible: boolean;
|
|
378
|
-
disabledReason?: string;
|
|
379
|
-
};
|
|
380
|
-
export type Survey = {
|
|
381
|
-
id: string;
|
|
382
|
-
name: string;
|
|
383
|
-
description?: string;
|
|
384
|
-
type: SurveyType;
|
|
385
|
-
feature_flag_keys?: {
|
|
386
|
-
key: string;
|
|
387
|
-
value?: string;
|
|
388
|
-
}[];
|
|
389
|
-
linked_flag_key?: string;
|
|
390
|
-
targeting_flag_key?: string;
|
|
391
|
-
internal_targeting_flag_key?: string;
|
|
392
|
-
questions: SurveyQuestion[];
|
|
393
|
-
appearance?: SurveyAppearance;
|
|
394
|
-
conditions?: {
|
|
395
|
-
url?: string;
|
|
396
|
-
selector?: string;
|
|
397
|
-
seenSurveyWaitPeriodInDays?: number;
|
|
398
|
-
urlMatchType?: SurveyMatchType;
|
|
399
|
-
events?: {
|
|
400
|
-
repeatedActivation?: boolean;
|
|
401
|
-
values?: {
|
|
402
|
-
name: string;
|
|
403
|
-
}[];
|
|
404
|
-
};
|
|
405
|
-
actions?: {
|
|
406
|
-
values: SurveyActionType[];
|
|
407
|
-
};
|
|
408
|
-
deviceTypes?: string[];
|
|
409
|
-
deviceTypesMatchType?: SurveyMatchType;
|
|
410
|
-
};
|
|
411
|
-
start_date?: string;
|
|
412
|
-
end_date?: string;
|
|
413
|
-
current_iteration?: number;
|
|
414
|
-
current_iteration_start_date?: string;
|
|
415
|
-
};
|
|
416
|
-
export type SurveyActionType = {
|
|
417
|
-
id: number;
|
|
418
|
-
name?: string;
|
|
419
|
-
steps?: ActionStepType[];
|
|
420
|
-
};
|
|
421
|
-
/** Sync with plugin-server/src/types.ts */
|
|
422
|
-
export declare enum ActionStepStringMatching {
|
|
423
|
-
Contains = "contains",
|
|
424
|
-
Exact = "exact",
|
|
425
|
-
Regex = "regex"
|
|
426
|
-
}
|
|
427
|
-
export type ActionStepType = {
|
|
428
|
-
event?: string;
|
|
429
|
-
selector?: string;
|
|
430
|
-
text?: string;
|
|
431
|
-
/** @default StringMatching.Exact */
|
|
432
|
-
text_matching?: ActionStepStringMatching;
|
|
433
|
-
href?: string;
|
|
434
|
-
/** @default ActionStepStringMatching.Exact */
|
|
435
|
-
href_matching?: ActionStepStringMatching;
|
|
436
|
-
url?: string;
|
|
437
|
-
/** @default StringMatching.Contains */
|
|
438
|
-
url_matching?: ActionStepStringMatching;
|
|
439
|
-
};
|
|
440
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SurveyWidgetType=exports.SurveyType=exports.SurveyRatingDisplay=exports.SurveyQuestionType=exports.SurveyQuestionDescriptionContentType=exports.SurveyQuestionBranchingType=exports.SurveyPosition=exports.SurveyMatchType=exports.PostHogPersistedProperty=exports.Compression=exports.ActionStepStringMatching=void 0;var PostHogPersistedProperty;(function(PostHogPersistedProperty){PostHogPersistedProperty["AnonymousId"]="anonymous_id";PostHogPersistedProperty["DistinctId"]="distinct_id";PostHogPersistedProperty["Props"]="props";PostHogPersistedProperty["FeatureFlagDetails"]="feature_flag_details";PostHogPersistedProperty["FeatureFlags"]="feature_flags";PostHogPersistedProperty["FeatureFlagPayloads"]="feature_flag_payloads";PostHogPersistedProperty["BootstrapFeatureFlagDetails"]="bootstrap_feature_flag_details";PostHogPersistedProperty["BootstrapFeatureFlags"]="bootstrap_feature_flags";PostHogPersistedProperty["BootstrapFeatureFlagPayloads"]="bootstrap_feature_flag_payloads";PostHogPersistedProperty["OverrideFeatureFlags"]="override_feature_flags";PostHogPersistedProperty["Queue"]="queue";PostHogPersistedProperty["OptedOut"]="opted_out";PostHogPersistedProperty["SessionId"]="session_id";PostHogPersistedProperty["SessionStartTimestamp"]="session_start_timestamp";PostHogPersistedProperty["SessionLastTimestamp"]="session_timestamp";PostHogPersistedProperty["PersonProperties"]="person_properties";PostHogPersistedProperty["GroupProperties"]="group_properties";PostHogPersistedProperty["InstalledAppBuild"]="installed_app_build";PostHogPersistedProperty["InstalledAppVersion"]="installed_app_version";PostHogPersistedProperty["SessionReplay"]="session_replay";PostHogPersistedProperty["SurveyLastSeenDate"]="survey_last_seen_date";PostHogPersistedProperty["SurveysSeen"]="surveys_seen";PostHogPersistedProperty["Surveys"]="surveys";PostHogPersistedProperty["RemoteConfig"]="remote_config";PostHogPersistedProperty["FlagsEndpointWasHit"]="flags_endpoint_was_hit";})(PostHogPersistedProperty||(exports.PostHogPersistedProperty=PostHogPersistedProperty={}));var Compression;(function(Compression){Compression["GZipJS"]="gzip-js";Compression["Base64"]="base64";})(Compression||(exports.Compression=Compression={}));var SurveyPosition;(function(SurveyPosition){SurveyPosition["TopLeft"]="top_left";SurveyPosition["TopCenter"]="top_center";SurveyPosition["TopRight"]="top_right";SurveyPosition["MiddleLeft"]="middle_left";SurveyPosition["MiddleCenter"]="middle_center";SurveyPosition["MiddleRight"]="middle_right";SurveyPosition["Left"]="left";SurveyPosition["Right"]="right";SurveyPosition["Center"]="center";})(SurveyPosition||(exports.SurveyPosition=SurveyPosition={}));var SurveyWidgetType;(function(SurveyWidgetType){SurveyWidgetType["Button"]="button";SurveyWidgetType["Tab"]="tab";SurveyWidgetType["Selector"]="selector";})(SurveyWidgetType||(exports.SurveyWidgetType=SurveyWidgetType={}));var SurveyType;(function(SurveyType){SurveyType["Popover"]="popover";SurveyType["API"]="api";SurveyType["Widget"]="widget";SurveyType["ExternalSurvey"]="external_survey";})(SurveyType||(exports.SurveyType=SurveyType={}));var SurveyQuestionDescriptionContentType;(function(SurveyQuestionDescriptionContentType){SurveyQuestionDescriptionContentType["Html"]="html";SurveyQuestionDescriptionContentType["Text"]="text";})(SurveyQuestionDescriptionContentType||(exports.SurveyQuestionDescriptionContentType=SurveyQuestionDescriptionContentType={}));var SurveyRatingDisplay;(function(SurveyRatingDisplay){SurveyRatingDisplay["Number"]="number";SurveyRatingDisplay["Emoji"]="emoji";})(SurveyRatingDisplay||(exports.SurveyRatingDisplay=SurveyRatingDisplay={}));var SurveyQuestionType;(function(SurveyQuestionType){SurveyQuestionType["Open"]="open";SurveyQuestionType["MultipleChoice"]="multiple_choice";SurveyQuestionType["SingleChoice"]="single_choice";SurveyQuestionType["Rating"]="rating";SurveyQuestionType["Link"]="link";})(SurveyQuestionType||(exports.SurveyQuestionType=SurveyQuestionType={}));var SurveyQuestionBranchingType;(function(SurveyQuestionBranchingType){SurveyQuestionBranchingType["NextQuestion"]="next_question";SurveyQuestionBranchingType["End"]="end";SurveyQuestionBranchingType["ResponseBased"]="response_based";SurveyQuestionBranchingType["SpecificQuestion"]="specific_question";})(SurveyQuestionBranchingType||(exports.SurveyQuestionBranchingType=SurveyQuestionBranchingType={}));var SurveyMatchType;(function(SurveyMatchType){SurveyMatchType["Regex"]="regex";SurveyMatchType["NotRegex"]="not_regex";SurveyMatchType["Exact"]="exact";SurveyMatchType["IsNot"]="is_not";SurveyMatchType["Icontains"]="icontains";SurveyMatchType["NotIcontains"]="not_icontains";})(SurveyMatchType||(exports.SurveyMatchType=SurveyMatchType={}));var ActionStepStringMatching;(function(ActionStepStringMatching){ActionStepStringMatching["Contains"]="contains";ActionStepStringMatching["Exact"]="exact";ActionStepStringMatching["Regex"]="regex";})(ActionStepStringMatching||(exports.ActionStepStringMatching=ActionStepStringMatching={}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../posthog-core/src/types.ts"],"names":[],"mappings":"AA2DA,MAAM,CAAN,IAAY,wBA0BX;AA1BD,WAAY,wBAAwB;IAClC,wDAA4B,CAAA;IAC5B,sDAA0B,CAAA;IAC1B,2CAAe,CAAA;IACf,uEAA2C,CAAA;IAC3C,0DAA8B,CAAA;IAC9B,yEAA6C,CAAA;IAC7C,0FAA8D,CAAA;IAC9D,6EAAiD,CAAA;IACjD,4FAAgE,CAAA;IAChE,2EAA+C,CAAA;IAC/C,2CAAe,CAAA;IACf,kDAAsB,CAAA;IACtB,oDAAwB,CAAA;IACxB,6EAAiD,CAAA;IACjD,sEAA0C,CAAA;IAC1C,kEAAsC,CAAA;IACtC,gEAAoC,CAAA;IACpC,qEAAyC,CAAA;IACzC,yEAA6C,CAAA;IAC7C,4DAAgC,CAAA;IAChC,wEAA4C,CAAA;IAC5C,wDAA4B,CAAA;IAC5B,+CAAmB,CAAA;IACnB,0DAA8B,CAAA;IAC9B,0EAA8C,CAAA;AAChD,CAAC,EA1BW,wBAAwB,KAAxB,wBAAwB,QA0BnC;AA+CD,8CAA8C;AAE9C,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,iCAAkB,CAAA;IAClB,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAwKD,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB,sCAAoB,CAAA;IACpB,0CAAwB,CAAA;IACxB,wCAAsB,CAAA;IACtB,4CAA0B,CAAA;IAC1B,gDAA8B,CAAA;IAC9B,8CAA4B,CAAA;IAC5B,+BAAa,CAAA;IACb,iCAAe,CAAA;IACf,mCAAiB,CAAA;AACnB,CAAC,E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A2C;AAC3C,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,iDAAqB,CAAA;IACrB,2CAAe,CAAA;IACf,2CAAe,CAAA;AACjB,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FetchLike } from './types';
|
|
2
|
-
export declare const STRING_FORMAT = "utf8";
|
|
3
|
-
export declare function assert(truthyValue: any, message: string): void;
|
|
4
|
-
export declare function removeTrailingSlash(url: string): string;
|
|
5
|
-
export interface RetriableOptions {
|
|
6
|
-
retryCount: number;
|
|
7
|
-
retryDelay: number;
|
|
8
|
-
retryCheck: (err: unknown) => boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function retriable<T>(fn: () => Promise<T>, props: RetriableOptions): Promise<T>;
|
|
11
|
-
export declare function currentTimestamp(): number;
|
|
12
|
-
export declare function currentISOTime(): string;
|
|
13
|
-
export declare function safeSetTimeout(fn: () => void, timeout: number): any;
|
|
14
|
-
export declare const isPromise: (obj: any) => obj is Promise<any>;
|
|
15
|
-
export declare const isError: (x: unknown) => x is Error;
|
|
16
|
-
export declare function getFetch(): FetchLike | undefined;
|
|
17
|
-
export declare function allSettled<T>(promises: (Promise<T> | null | undefined)[]): Promise<({
|
|
18
|
-
status: 'fulfilled';
|
|
19
|
-
value: T;
|
|
20
|
-
} | {
|
|
21
|
-
status: 'rejected';
|
|
22
|
-
reason: any;
|
|
23
|
-
})[]>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.STRING_FORMAT=void 0;exports.allSettled=allSettled;exports.assert=assert;exports.currentISOTime=currentISOTime;exports.currentTimestamp=currentTimestamp;exports.getFetch=getFetch;exports.isPromise=exports.isError=void 0;exports.removeTrailingSlash=removeTrailingSlash;exports.retriable=retriable;exports.safeSetTimeout=safeSetTimeout;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var STRING_FORMAT=exports.STRING_FORMAT='utf8';function assert(truthyValue,message){if(!truthyValue||typeof truthyValue!=='string'||isEmpty(truthyValue)){throw new Error(message);}}function isEmpty(truthyValue){if(truthyValue.trim().length===0){return true;}return false;}function removeTrailingSlash(url){return url===null||url===void 0?void 0:url.replace(/\/+$/,'');}function retriable(_x,_x2){return _retriable.apply(this,arguments);}function _retriable(){_retriable=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(fn,props){var lastError,i,res;return _regenerator["default"].wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:lastError=null;i=0;case 2:if(!(i<props.retryCount+1)){_context.next=21;break;}if(!(i>0)){_context.next=6;break;}_context.next=6;return new Promise(function(r){return setTimeout(r,props.retryDelay);});case 6:_context.prev=6;_context.next=9;return fn();case 9:res=_context.sent;return _context.abrupt("return",res);case 13:_context.prev=13;_context.t0=_context["catch"](6);lastError=_context.t0;if(props.retryCheck(_context.t0)){_context.next=18;break;}throw _context.t0;case 18:i++;_context.next=2;break;case 21:throw lastError;case 22:case"end":return _context.stop();}},_callee,null,[[6,13]]);}));return _retriable.apply(this,arguments);}function currentTimestamp(){return new Date().getTime();}function currentISOTime(){return new Date().toISOString();}function safeSetTimeout(fn,timeout){var t=setTimeout(fn,timeout);(t===null||t===void 0?void 0:t.unref)&&(t===null||t===void 0?void 0:t.unref());return t;}var isPromise=exports.isPromise=function isPromise(obj){return obj&&typeof obj.then==='function';};var isError=exports.isError=function isError(x){return x instanceof Error;};function getFetch(){return typeof fetch!=='undefined'?fetch:typeof globalThis.fetch!=='undefined'?globalThis.fetch:undefined;}function allSettled(promises){return Promise.all(promises.map(function(p){return(p!==null&&p!==void 0?p:Promise.resolve()).then(function(value){return{status:'fulfilled',value:value};},function(reason){return{status:'rejected',reason:reason};});}));}
|
|
@@ -1 +0,0 @@
|
|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OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAC3B,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAoB,EAAE,KAAK,EAAE,CAAC,EACzD,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,UAAmB,EAAE,MAAM,EAAE,CAAC,CAC3D,CACF,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/** Represents a UUID as a 16-byte byte array. */
|
|
2
|
-
export declare class UUID {
|
|
3
|
-
readonly bytes: Readonly<Uint8Array>;
|
|
4
|
-
/** @param bytes - The 16-byte byte array representation. */
|
|
5
|
-
private constructor();
|
|
6
|
-
/**
|
|
7
|
-
* Creates an object from the internal representation, a 16-byte byte array
|
|
8
|
-
* containing the binary UUID representation in the big-endian byte order.
|
|
9
|
-
*
|
|
10
|
-
* This method does NOT shallow-copy the argument, and thus the created object
|
|
11
|
-
* holds the reference to the underlying buffer.
|
|
12
|
-
*
|
|
13
|
-
* @throws TypeError if the length of the argument is not 16.
|
|
14
|
-
*/
|
|
15
|
-
static ofInner(bytes: Readonly<Uint8Array>): UUID;
|
|
16
|
-
/**
|
|
17
|
-
* Builds a byte array from UUIDv7 field values.
|
|
18
|
-
*
|
|
19
|
-
* @param unixTsMs - A 48-bit `unix_ts_ms` field value.
|
|
20
|
-
* @param randA - A 12-bit `rand_a` field value.
|
|
21
|
-
* @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
|
|
22
|
-
* @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
|
|
23
|
-
* @throws RangeError if any field value is out of the specified range.
|
|
24
|
-
*/
|
|
25
|
-
static fromFieldsV7(unixTsMs: number, randA: number, randBHi: number, randBLo: number): UUID;
|
|
26
|
-
/**
|
|
27
|
-
* Builds a byte array from a string representation.
|
|
28
|
-
*
|
|
29
|
-
* This method accepts the following formats:
|
|
30
|
-
*
|
|
31
|
-
* - 32-digit hexadecimal format without hyphens: `0189dcd553117d408db09496a2eef37b`
|
|
32
|
-
* - 8-4-4-4-12 hyphenated format: `0189dcd5-5311-7d40-8db0-9496a2eef37b`
|
|
33
|
-
* - Hyphenated format with surrounding braces: `{0189dcd5-5311-7d40-8db0-9496a2eef37b}`
|
|
34
|
-
* - RFC 4122 URN format: `urn:uuid:0189dcd5-5311-7d40-8db0-9496a2eef37b`
|
|
35
|
-
*
|
|
36
|
-
* Leading and trailing whitespaces represents an error.
|
|
37
|
-
*
|
|
38
|
-
* @throws SyntaxError if the argument could not parse as a valid UUID string.
|
|
39
|
-
*/
|
|
40
|
-
static parse(uuid: string): UUID;
|
|
41
|
-
/**
|
|
42
|
-
* @returns The 8-4-4-4-12 canonical hexadecimal string representation
|
|
43
|
-
* (`0189dcd5-5311-7d40-8db0-9496a2eef37b`).
|
|
44
|
-
*/
|
|
45
|
-
toString(): string;
|
|
46
|
-
/**
|
|
47
|
-
* @returns The 32-digit hexadecimal representation without hyphens
|
|
48
|
-
* (`0189dcd553117d408db09496a2eef37b`).
|
|
49
|
-
*/
|
|
50
|
-
toHex(): string;
|
|
51
|
-
/** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
|
|
52
|
-
toJSON(): string;
|
|
53
|
-
/**
|
|
54
|
-
* Reports the variant field value of the UUID or, if appropriate, "NIL" or
|
|
55
|
-
* "MAX".
|
|
56
|
-
*
|
|
57
|
-
* For convenience, this method reports "NIL" or "MAX" if `this` represents
|
|
58
|
-
* the Nil or Max UUID, although the Nil and Max UUIDs are technically
|
|
59
|
-
* subsumed under the variants `0b0` and `0b111`, respectively.
|
|
60
|
-
*/
|
|
61
|
-
getVariant(): "VAR_0" | "VAR_10" | "VAR_110" | "VAR_RESERVED" | "NIL" | "MAX";
|
|
62
|
-
/**
|
|
63
|
-
* Returns the version field value of the UUID or `undefined` if the UUID does
|
|
64
|
-
* not have the variant field value of `0b10`.
|
|
65
|
-
*/
|
|
66
|
-
getVersion(): number | undefined;
|
|
67
|
-
/** Creates an object from `this`. */
|
|
68
|
-
clone(): UUID;
|
|
69
|
-
/** Returns true if `this` is equivalent to `other`. */
|
|
70
|
-
equals(other: UUID): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Returns a negative integer, zero, or positive integer if `this` is less
|
|
73
|
-
* than, equal to, or greater than `other`, respectively.
|
|
74
|
-
*/
|
|
75
|
-
compareTo(other: UUID): number;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Encapsulates the monotonic counter state.
|
|
79
|
-
*
|
|
80
|
-
* This class provides APIs to utilize a separate counter state from that of the
|
|
81
|
-
* global generator used by {@link uuidv7} and {@link uuidv7obj}. In addition to
|
|
82
|
-
* the default {@link generate} method, this class has {@link generateOrAbort}
|
|
83
|
-
* that is useful to absolutely guarantee the monotonically increasing order of
|
|
84
|
-
* generated UUIDs. See their respective documentation for details.
|
|
85
|
-
*/
|
|
86
|
-
export declare class V7Generator {
|
|
87
|
-
private timestamp;
|
|
88
|
-
private counter;
|
|
89
|
-
/** The random number generator used by the generator. */
|
|
90
|
-
private readonly random;
|
|
91
|
-
/**
|
|
92
|
-
* Creates a generator object with the default random number generator, or
|
|
93
|
-
* with the specified one if passed as an argument. The specified random
|
|
94
|
-
* number generator should be cryptographically strong and securely seeded.
|
|
95
|
-
*/
|
|
96
|
-
constructor(randomNumberGenerator?: {
|
|
97
|
-
/** Returns a 32-bit random unsigned integer. */
|
|
98
|
-
nextUint32(): number;
|
|
99
|
-
});
|
|
100
|
-
/**
|
|
101
|
-
* Generates a new UUIDv7 object from the current timestamp, or resets the
|
|
102
|
-
* generator upon significant timestamp rollback.
|
|
103
|
-
*
|
|
104
|
-
* This method returns a monotonically increasing UUID by reusing the previous
|
|
105
|
-
* timestamp even if the up-to-date timestamp is smaller than the immediately
|
|
106
|
-
* preceding UUID's. However, when such a clock rollback is considered
|
|
107
|
-
* significant (i.e., by more than ten seconds), this method resets the
|
|
108
|
-
* generator and returns a new UUID based on the given timestamp, breaking the
|
|
109
|
-
* increasing order of UUIDs.
|
|
110
|
-
*
|
|
111
|
-
* See {@link generateOrAbort} for the other mode of generation and
|
|
112
|
-
* {@link generateOrResetCore} for the low-level primitive.
|
|
113
|
-
*/
|
|
114
|
-
generate(): UUID;
|
|
115
|
-
/**
|
|
116
|
-
* Generates a new UUIDv7 object from the current timestamp, or returns
|
|
117
|
-
* `undefined` upon significant timestamp rollback.
|
|
118
|
-
*
|
|
119
|
-
* This method returns a monotonically increasing UUID by reusing the previous
|
|
120
|
-
* timestamp even if the up-to-date timestamp is smaller than the immediately
|
|
121
|
-
* preceding UUID's. However, when such a clock rollback is considered
|
|
122
|
-
* significant (i.e., by more than ten seconds), this method aborts and
|
|
123
|
-
* returns `undefined` immediately.
|
|
124
|
-
*
|
|
125
|
-
* See {@link generate} for the other mode of generation and
|
|
126
|
-
* {@link generateOrAbortCore} for the low-level primitive.
|
|
127
|
-
*/
|
|
128
|
-
generateOrAbort(): UUID | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
|
|
131
|
-
* generator upon significant timestamp rollback.
|
|
132
|
-
*
|
|
133
|
-
* This method is equivalent to {@link generate} except that it takes a custom
|
|
134
|
-
* timestamp and clock rollback allowance.
|
|
135
|
-
*
|
|
136
|
-
* @param rollbackAllowance - The amount of `unixTsMs` rollback that is
|
|
137
|
-
* considered significant. A suggested value is `10_000` (milliseconds).
|
|
138
|
-
* @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
|
|
139
|
-
*/
|
|
140
|
-
generateOrResetCore(unixTsMs: number, rollbackAllowance: number): UUID;
|
|
141
|
-
/**
|
|
142
|
-
* Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
|
|
143
|
-
* `undefined` upon significant timestamp rollback.
|
|
144
|
-
*
|
|
145
|
-
* This method is equivalent to {@link generateOrAbort} except that it takes a
|
|
146
|
-
* custom timestamp and clock rollback allowance.
|
|
147
|
-
*
|
|
148
|
-
* @param rollbackAllowance - The amount of `unixTsMs` rollback that is
|
|
149
|
-
* considered significant. A suggested value is `10_000` (milliseconds).
|
|
150
|
-
* @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
|
|
151
|
-
*/
|
|
152
|
-
generateOrAbortCore(unixTsMs: number, rollbackAllowance: number): UUID | undefined;
|
|
153
|
-
/** Initializes the counter at a 42-bit random integer. */
|
|
154
|
-
private resetCounter;
|
|
155
|
-
/**
|
|
156
|
-
* Generates a new UUIDv4 object utilizing the random number generator inside.
|
|
157
|
-
*
|
|
158
|
-
* @internal
|
|
159
|
-
*/
|
|
160
|
-
generateV4(): UUID;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Generates a UUIDv7 string.
|
|
164
|
-
*
|
|
165
|
-
* @returns The 8-4-4-4-12 canonical hexadecimal string representation
|
|
166
|
-
* ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
|
|
167
|
-
*/
|
|
168
|
-
export declare const uuidv7: () => string;
|
|
169
|
-
/** Generates a UUIDv7 object. */
|
|
170
|
-
export declare const uuidv7obj: () => UUID;
|
|
171
|
-
/**
|
|
172
|
-
* Generates a UUIDv4 string.
|
|
173
|
-
*
|
|
174
|
-
* @returns The 8-4-4-4-12 canonical hexadecimal string representation
|
|
175
|
-
* ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
|
|
176
|
-
*/
|
|
177
|
-
export declare const uuidv4: () => string;
|
|
178
|
-
/** Generates a UUIDv4 object. */
|
|
179
|
-
export declare const uuidv4obj: () => UUID;
|