init claude-code
This commit is contained in:
@@ -0,0 +1,865 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: events_mono/claude_code/v1/claude_code_internal_event.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { Timestamp } from '../../../google/protobuf/timestamp.js'
|
||||
import { PublicApiAuth } from '../../common/v1/auth.js'
|
||||
|
||||
/** GitHubActionsMetadata contains GitHub Actions-specific environment information */
|
||||
export interface GitHubActionsMetadata {
|
||||
actor_id?: string | undefined
|
||||
repository_id?: string | undefined
|
||||
repository_owner_id?: string | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* EnvironmentMetadata contains environment and runtime information
|
||||
* See claude-cli-internal/src/services/statsig.ts for the source of these fields
|
||||
*/
|
||||
export interface EnvironmentMetadata {
|
||||
platform?: string | undefined
|
||||
node_version?: string | undefined
|
||||
terminal?: string | undefined
|
||||
package_managers?: string | undefined
|
||||
runtimes?: string | undefined
|
||||
is_running_with_bun?: boolean | undefined
|
||||
is_ci?: boolean | undefined
|
||||
is_claubbit?: boolean | undefined
|
||||
is_github_action?: boolean | undefined
|
||||
is_claude_code_action?: boolean | undefined
|
||||
is_claude_ai_auth?: boolean | undefined
|
||||
version?: string | undefined
|
||||
/** GitHub Actions specific fields (only present when is_github_action is true) */
|
||||
github_event_name?: string | undefined
|
||||
github_actions_runner_environment?: string | undefined
|
||||
github_actions_runner_os?: string | undefined
|
||||
github_action_ref?: string | undefined
|
||||
/** WSL specific field */
|
||||
wsl_version?: string | undefined
|
||||
/** GitHub metadata (only present when is_github_action is true) */
|
||||
github_actions_metadata?: GitHubActionsMetadata | undefined
|
||||
arch?: string | undefined
|
||||
is_claude_code_remote?: boolean | undefined
|
||||
remote_environment_type?: string | undefined
|
||||
claude_code_container_id?: string | undefined
|
||||
claude_code_remote_session_id?: string | undefined
|
||||
tags?: string[] | undefined
|
||||
deployment_environment?: string | undefined
|
||||
is_conductor?: boolean | undefined
|
||||
version_base?: string | undefined
|
||||
coworker_type?: string | undefined
|
||||
build_time?: string | undefined
|
||||
is_local_agent_mode?: boolean | undefined
|
||||
linux_distro_id?: string | undefined
|
||||
linux_distro_version?: string | undefined
|
||||
linux_kernel?: string | undefined
|
||||
vcs?: string | undefined
|
||||
platform_raw?: string | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* SlackContext contains context fields present on every Claude-in-Slack (CIS) event.
|
||||
* Event-specific fields (errorType, durationMs, httpStatus, etc.) go in
|
||||
* ClaudeCodeInternalEvent.additional_metadata as JSON.
|
||||
*/
|
||||
export interface SlackContext {
|
||||
slack_team_id?: string | undefined
|
||||
is_enterprise_install?: boolean | undefined
|
||||
trigger?: string | undefined
|
||||
creation_method?: string | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* ClaudeCodeInternalEvent represents events logged from Claude Code via Statsig
|
||||
* This schema matches the structure in claude-cli-internal/src/services/statsig.ts
|
||||
* Source table: proj-product-data-nhme.raw_statsig_internal_tools.events
|
||||
*/
|
||||
export interface ClaudeCodeInternalEvent {
|
||||
/** Event name (e.g., "tengu_binary_feedback", "tengu_api_success") */
|
||||
event_name?: string | undefined
|
||||
/** Event timestamp */
|
||||
client_timestamp?: Date | undefined
|
||||
model?: string | undefined
|
||||
session_id?: string | undefined
|
||||
user_type?: string | undefined
|
||||
betas?: string | undefined
|
||||
/** Environment and runtime information */
|
||||
env?: EnvironmentMetadata | undefined
|
||||
entrypoint?: string | undefined
|
||||
agent_sdk_version?: string | undefined
|
||||
is_interactive?: boolean | undefined
|
||||
client_type?: string | undefined
|
||||
/**
|
||||
* Process metrics as JSON string (ant-only)
|
||||
* Contains: uptime, rss, heapTotal, heapUsed, external, arrayBuffers,
|
||||
* constrainedMemory, cpuUsage
|
||||
*/
|
||||
process?: string | undefined
|
||||
/**
|
||||
* Additional metadata passed to logEvent (event-specific)
|
||||
* This includes fields like msg_id_A, msg_id_B, gitBranch, gitHead, etc.
|
||||
* that vary per event type
|
||||
*/
|
||||
additional_metadata?: string | undefined
|
||||
/** Authentication context automatically injected by the API */
|
||||
auth?: PublicApiAuth | undefined
|
||||
/** Server timestamp automatically injected by the API */
|
||||
server_timestamp?: Date | undefined
|
||||
/** Unique identifier for this event (automatically generated by API endpoint) */
|
||||
event_id?: string | undefined
|
||||
/** Device identifier for the client */
|
||||
device_id?: string | undefined
|
||||
/** SWE-bench fields */
|
||||
swe_bench_run_id?: string | undefined
|
||||
swe_bench_instance_id?: string | undefined
|
||||
swe_bench_task_id?: string | undefined
|
||||
email?: string | undefined
|
||||
/** Swarm/team agent identification for analytics attribution */
|
||||
agent_id?: string | undefined
|
||||
parent_session_id?: string | undefined
|
||||
agent_type?: string | undefined
|
||||
/** Claude-in-Slack context (only present for cis_* events) */
|
||||
slack?: SlackContext | undefined
|
||||
team_name?: string | undefined
|
||||
skill_name?: string | undefined
|
||||
plugin_name?: string | undefined
|
||||
marketplace_name?: string | undefined
|
||||
}
|
||||
|
||||
function createBaseGitHubActionsMetadata(): GitHubActionsMetadata {
|
||||
return { actor_id: '', repository_id: '', repository_owner_id: '' }
|
||||
}
|
||||
|
||||
export const GitHubActionsMetadata: MessageFns<GitHubActionsMetadata> = {
|
||||
fromJSON(object: any): GitHubActionsMetadata {
|
||||
return {
|
||||
actor_id: isSet(object.actor_id)
|
||||
? globalThis.String(object.actor_id)
|
||||
: '',
|
||||
repository_id: isSet(object.repository_id)
|
||||
? globalThis.String(object.repository_id)
|
||||
: '',
|
||||
repository_owner_id: isSet(object.repository_owner_id)
|
||||
? globalThis.String(object.repository_owner_id)
|
||||
: '',
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: GitHubActionsMetadata): unknown {
|
||||
const obj: any = {}
|
||||
if (message.actor_id !== undefined) {
|
||||
obj.actor_id = message.actor_id
|
||||
}
|
||||
if (message.repository_id !== undefined) {
|
||||
obj.repository_id = message.repository_id
|
||||
}
|
||||
if (message.repository_owner_id !== undefined) {
|
||||
obj.repository_owner_id = message.repository_owner_id
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GitHubActionsMetadata>, I>>(
|
||||
base?: I,
|
||||
): GitHubActionsMetadata {
|
||||
return GitHubActionsMetadata.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GitHubActionsMetadata>, I>>(
|
||||
object: I,
|
||||
): GitHubActionsMetadata {
|
||||
const message = createBaseGitHubActionsMetadata()
|
||||
message.actor_id = object.actor_id ?? ''
|
||||
message.repository_id = object.repository_id ?? ''
|
||||
message.repository_owner_id = object.repository_owner_id ?? ''
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
function createBaseEnvironmentMetadata(): EnvironmentMetadata {
|
||||
return {
|
||||
platform: '',
|
||||
node_version: '',
|
||||
terminal: '',
|
||||
package_managers: '',
|
||||
runtimes: '',
|
||||
is_running_with_bun: false,
|
||||
is_ci: false,
|
||||
is_claubbit: false,
|
||||
is_github_action: false,
|
||||
is_claude_code_action: false,
|
||||
is_claude_ai_auth: false,
|
||||
version: '',
|
||||
github_event_name: '',
|
||||
github_actions_runner_environment: '',
|
||||
github_actions_runner_os: '',
|
||||
github_action_ref: '',
|
||||
wsl_version: '',
|
||||
github_actions_metadata: undefined,
|
||||
arch: '',
|
||||
is_claude_code_remote: false,
|
||||
remote_environment_type: '',
|
||||
claude_code_container_id: '',
|
||||
claude_code_remote_session_id: '',
|
||||
tags: [],
|
||||
deployment_environment: '',
|
||||
is_conductor: false,
|
||||
version_base: '',
|
||||
coworker_type: '',
|
||||
build_time: '',
|
||||
is_local_agent_mode: false,
|
||||
linux_distro_id: '',
|
||||
linux_distro_version: '',
|
||||
linux_kernel: '',
|
||||
vcs: '',
|
||||
platform_raw: '',
|
||||
}
|
||||
}
|
||||
|
||||
export const EnvironmentMetadata: MessageFns<EnvironmentMetadata> = {
|
||||
fromJSON(object: any): EnvironmentMetadata {
|
||||
return {
|
||||
platform: isSet(object.platform)
|
||||
? globalThis.String(object.platform)
|
||||
: '',
|
||||
node_version: isSet(object.node_version)
|
||||
? globalThis.String(object.node_version)
|
||||
: '',
|
||||
terminal: isSet(object.terminal)
|
||||
? globalThis.String(object.terminal)
|
||||
: '',
|
||||
package_managers: isSet(object.package_managers)
|
||||
? globalThis.String(object.package_managers)
|
||||
: '',
|
||||
runtimes: isSet(object.runtimes)
|
||||
? globalThis.String(object.runtimes)
|
||||
: '',
|
||||
is_running_with_bun: isSet(object.is_running_with_bun)
|
||||
? globalThis.Boolean(object.is_running_with_bun)
|
||||
: false,
|
||||
is_ci: isSet(object.is_ci) ? globalThis.Boolean(object.is_ci) : false,
|
||||
is_claubbit: isSet(object.is_claubbit)
|
||||
? globalThis.Boolean(object.is_claubbit)
|
||||
: false,
|
||||
is_github_action: isSet(object.is_github_action)
|
||||
? globalThis.Boolean(object.is_github_action)
|
||||
: false,
|
||||
is_claude_code_action: isSet(object.is_claude_code_action)
|
||||
? globalThis.Boolean(object.is_claude_code_action)
|
||||
: false,
|
||||
is_claude_ai_auth: isSet(object.is_claude_ai_auth)
|
||||
? globalThis.Boolean(object.is_claude_ai_auth)
|
||||
: false,
|
||||
version: isSet(object.version) ? globalThis.String(object.version) : '',
|
||||
github_event_name: isSet(object.github_event_name)
|
||||
? globalThis.String(object.github_event_name)
|
||||
: '',
|
||||
github_actions_runner_environment: isSet(
|
||||
object.github_actions_runner_environment,
|
||||
)
|
||||
? globalThis.String(object.github_actions_runner_environment)
|
||||
: '',
|
||||
github_actions_runner_os: isSet(object.github_actions_runner_os)
|
||||
? globalThis.String(object.github_actions_runner_os)
|
||||
: '',
|
||||
github_action_ref: isSet(object.github_action_ref)
|
||||
? globalThis.String(object.github_action_ref)
|
||||
: '',
|
||||
wsl_version: isSet(object.wsl_version)
|
||||
? globalThis.String(object.wsl_version)
|
||||
: '',
|
||||
github_actions_metadata: isSet(object.github_actions_metadata)
|
||||
? GitHubActionsMetadata.fromJSON(object.github_actions_metadata)
|
||||
: undefined,
|
||||
arch: isSet(object.arch) ? globalThis.String(object.arch) : '',
|
||||
is_claude_code_remote: isSet(object.is_claude_code_remote)
|
||||
? globalThis.Boolean(object.is_claude_code_remote)
|
||||
: false,
|
||||
remote_environment_type: isSet(object.remote_environment_type)
|
||||
? globalThis.String(object.remote_environment_type)
|
||||
: '',
|
||||
claude_code_container_id: isSet(object.claude_code_container_id)
|
||||
? globalThis.String(object.claude_code_container_id)
|
||||
: '',
|
||||
claude_code_remote_session_id: isSet(object.claude_code_remote_session_id)
|
||||
? globalThis.String(object.claude_code_remote_session_id)
|
||||
: '',
|
||||
tags: globalThis.Array.isArray(object?.tags)
|
||||
? object.tags.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
deployment_environment: isSet(object.deployment_environment)
|
||||
? globalThis.String(object.deployment_environment)
|
||||
: '',
|
||||
is_conductor: isSet(object.is_conductor)
|
||||
? globalThis.Boolean(object.is_conductor)
|
||||
: false,
|
||||
version_base: isSet(object.version_base)
|
||||
? globalThis.String(object.version_base)
|
||||
: '',
|
||||
coworker_type: isSet(object.coworker_type)
|
||||
? globalThis.String(object.coworker_type)
|
||||
: '',
|
||||
build_time: isSet(object.build_time)
|
||||
? globalThis.String(object.build_time)
|
||||
: '',
|
||||
is_local_agent_mode: isSet(object.is_local_agent_mode)
|
||||
? globalThis.Boolean(object.is_local_agent_mode)
|
||||
: false,
|
||||
linux_distro_id: isSet(object.linux_distro_id)
|
||||
? globalThis.String(object.linux_distro_id)
|
||||
: '',
|
||||
linux_distro_version: isSet(object.linux_distro_version)
|
||||
? globalThis.String(object.linux_distro_version)
|
||||
: '',
|
||||
linux_kernel: isSet(object.linux_kernel)
|
||||
? globalThis.String(object.linux_kernel)
|
||||
: '',
|
||||
vcs: isSet(object.vcs) ? globalThis.String(object.vcs) : '',
|
||||
platform_raw: isSet(object.platform_raw)
|
||||
? globalThis.String(object.platform_raw)
|
||||
: '',
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: EnvironmentMetadata): unknown {
|
||||
const obj: any = {}
|
||||
if (message.platform !== undefined) {
|
||||
obj.platform = message.platform
|
||||
}
|
||||
if (message.node_version !== undefined) {
|
||||
obj.node_version = message.node_version
|
||||
}
|
||||
if (message.terminal !== undefined) {
|
||||
obj.terminal = message.terminal
|
||||
}
|
||||
if (message.package_managers !== undefined) {
|
||||
obj.package_managers = message.package_managers
|
||||
}
|
||||
if (message.runtimes !== undefined) {
|
||||
obj.runtimes = message.runtimes
|
||||
}
|
||||
if (message.is_running_with_bun !== undefined) {
|
||||
obj.is_running_with_bun = message.is_running_with_bun
|
||||
}
|
||||
if (message.is_ci !== undefined) {
|
||||
obj.is_ci = message.is_ci
|
||||
}
|
||||
if (message.is_claubbit !== undefined) {
|
||||
obj.is_claubbit = message.is_claubbit
|
||||
}
|
||||
if (message.is_github_action !== undefined) {
|
||||
obj.is_github_action = message.is_github_action
|
||||
}
|
||||
if (message.is_claude_code_action !== undefined) {
|
||||
obj.is_claude_code_action = message.is_claude_code_action
|
||||
}
|
||||
if (message.is_claude_ai_auth !== undefined) {
|
||||
obj.is_claude_ai_auth = message.is_claude_ai_auth
|
||||
}
|
||||
if (message.version !== undefined) {
|
||||
obj.version = message.version
|
||||
}
|
||||
if (message.github_event_name !== undefined) {
|
||||
obj.github_event_name = message.github_event_name
|
||||
}
|
||||
if (message.github_actions_runner_environment !== undefined) {
|
||||
obj.github_actions_runner_environment =
|
||||
message.github_actions_runner_environment
|
||||
}
|
||||
if (message.github_actions_runner_os !== undefined) {
|
||||
obj.github_actions_runner_os = message.github_actions_runner_os
|
||||
}
|
||||
if (message.github_action_ref !== undefined) {
|
||||
obj.github_action_ref = message.github_action_ref
|
||||
}
|
||||
if (message.wsl_version !== undefined) {
|
||||
obj.wsl_version = message.wsl_version
|
||||
}
|
||||
if (message.github_actions_metadata !== undefined) {
|
||||
obj.github_actions_metadata = GitHubActionsMetadata.toJSON(
|
||||
message.github_actions_metadata,
|
||||
)
|
||||
}
|
||||
if (message.arch !== undefined) {
|
||||
obj.arch = message.arch
|
||||
}
|
||||
if (message.is_claude_code_remote !== undefined) {
|
||||
obj.is_claude_code_remote = message.is_claude_code_remote
|
||||
}
|
||||
if (message.remote_environment_type !== undefined) {
|
||||
obj.remote_environment_type = message.remote_environment_type
|
||||
}
|
||||
if (message.claude_code_container_id !== undefined) {
|
||||
obj.claude_code_container_id = message.claude_code_container_id
|
||||
}
|
||||
if (message.claude_code_remote_session_id !== undefined) {
|
||||
obj.claude_code_remote_session_id = message.claude_code_remote_session_id
|
||||
}
|
||||
if (message.tags?.length) {
|
||||
obj.tags = message.tags
|
||||
}
|
||||
if (message.deployment_environment !== undefined) {
|
||||
obj.deployment_environment = message.deployment_environment
|
||||
}
|
||||
if (message.is_conductor !== undefined) {
|
||||
obj.is_conductor = message.is_conductor
|
||||
}
|
||||
if (message.version_base !== undefined) {
|
||||
obj.version_base = message.version_base
|
||||
}
|
||||
if (message.coworker_type !== undefined) {
|
||||
obj.coworker_type = message.coworker_type
|
||||
}
|
||||
if (message.build_time !== undefined) {
|
||||
obj.build_time = message.build_time
|
||||
}
|
||||
if (message.is_local_agent_mode !== undefined) {
|
||||
obj.is_local_agent_mode = message.is_local_agent_mode
|
||||
}
|
||||
if (message.linux_distro_id !== undefined) {
|
||||
obj.linux_distro_id = message.linux_distro_id
|
||||
}
|
||||
if (message.linux_distro_version !== undefined) {
|
||||
obj.linux_distro_version = message.linux_distro_version
|
||||
}
|
||||
if (message.linux_kernel !== undefined) {
|
||||
obj.linux_kernel = message.linux_kernel
|
||||
}
|
||||
if (message.vcs !== undefined) {
|
||||
obj.vcs = message.vcs
|
||||
}
|
||||
if (message.platform_raw !== undefined) {
|
||||
obj.platform_raw = message.platform_raw
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<EnvironmentMetadata>, I>>(
|
||||
base?: I,
|
||||
): EnvironmentMetadata {
|
||||
return EnvironmentMetadata.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<EnvironmentMetadata>, I>>(
|
||||
object: I,
|
||||
): EnvironmentMetadata {
|
||||
const message = createBaseEnvironmentMetadata()
|
||||
message.platform = object.platform ?? ''
|
||||
message.node_version = object.node_version ?? ''
|
||||
message.terminal = object.terminal ?? ''
|
||||
message.package_managers = object.package_managers ?? ''
|
||||
message.runtimes = object.runtimes ?? ''
|
||||
message.is_running_with_bun = object.is_running_with_bun ?? false
|
||||
message.is_ci = object.is_ci ?? false
|
||||
message.is_claubbit = object.is_claubbit ?? false
|
||||
message.is_github_action = object.is_github_action ?? false
|
||||
message.is_claude_code_action = object.is_claude_code_action ?? false
|
||||
message.is_claude_ai_auth = object.is_claude_ai_auth ?? false
|
||||
message.version = object.version ?? ''
|
||||
message.github_event_name = object.github_event_name ?? ''
|
||||
message.github_actions_runner_environment =
|
||||
object.github_actions_runner_environment ?? ''
|
||||
message.github_actions_runner_os = object.github_actions_runner_os ?? ''
|
||||
message.github_action_ref = object.github_action_ref ?? ''
|
||||
message.wsl_version = object.wsl_version ?? ''
|
||||
message.github_actions_metadata =
|
||||
object.github_actions_metadata !== undefined &&
|
||||
object.github_actions_metadata !== null
|
||||
? GitHubActionsMetadata.fromPartial(object.github_actions_metadata)
|
||||
: undefined
|
||||
message.arch = object.arch ?? ''
|
||||
message.is_claude_code_remote = object.is_claude_code_remote ?? false
|
||||
message.remote_environment_type = object.remote_environment_type ?? ''
|
||||
message.claude_code_container_id = object.claude_code_container_id ?? ''
|
||||
message.claude_code_remote_session_id =
|
||||
object.claude_code_remote_session_id ?? ''
|
||||
message.tags = object.tags?.map(e => e) || []
|
||||
message.deployment_environment = object.deployment_environment ?? ''
|
||||
message.is_conductor = object.is_conductor ?? false
|
||||
message.version_base = object.version_base ?? ''
|
||||
message.coworker_type = object.coworker_type ?? ''
|
||||
message.build_time = object.build_time ?? ''
|
||||
message.is_local_agent_mode = object.is_local_agent_mode ?? false
|
||||
message.linux_distro_id = object.linux_distro_id ?? ''
|
||||
message.linux_distro_version = object.linux_distro_version ?? ''
|
||||
message.linux_kernel = object.linux_kernel ?? ''
|
||||
message.vcs = object.vcs ?? ''
|
||||
message.platform_raw = object.platform_raw ?? ''
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
function createBaseSlackContext(): SlackContext {
|
||||
return {
|
||||
slack_team_id: '',
|
||||
is_enterprise_install: false,
|
||||
trigger: '',
|
||||
creation_method: '',
|
||||
}
|
||||
}
|
||||
|
||||
export const SlackContext: MessageFns<SlackContext> = {
|
||||
fromJSON(object: any): SlackContext {
|
||||
return {
|
||||
slack_team_id: isSet(object.slack_team_id)
|
||||
? globalThis.String(object.slack_team_id)
|
||||
: '',
|
||||
is_enterprise_install: isSet(object.is_enterprise_install)
|
||||
? globalThis.Boolean(object.is_enterprise_install)
|
||||
: false,
|
||||
trigger: isSet(object.trigger) ? globalThis.String(object.trigger) : '',
|
||||
creation_method: isSet(object.creation_method)
|
||||
? globalThis.String(object.creation_method)
|
||||
: '',
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: SlackContext): unknown {
|
||||
const obj: any = {}
|
||||
if (message.slack_team_id !== undefined) {
|
||||
obj.slack_team_id = message.slack_team_id
|
||||
}
|
||||
if (message.is_enterprise_install !== undefined) {
|
||||
obj.is_enterprise_install = message.is_enterprise_install
|
||||
}
|
||||
if (message.trigger !== undefined) {
|
||||
obj.trigger = message.trigger
|
||||
}
|
||||
if (message.creation_method !== undefined) {
|
||||
obj.creation_method = message.creation_method
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<SlackContext>, I>>(
|
||||
base?: I,
|
||||
): SlackContext {
|
||||
return SlackContext.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<SlackContext>, I>>(
|
||||
object: I,
|
||||
): SlackContext {
|
||||
const message = createBaseSlackContext()
|
||||
message.slack_team_id = object.slack_team_id ?? ''
|
||||
message.is_enterprise_install = object.is_enterprise_install ?? false
|
||||
message.trigger = object.trigger ?? ''
|
||||
message.creation_method = object.creation_method ?? ''
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
function createBaseClaudeCodeInternalEvent(): ClaudeCodeInternalEvent {
|
||||
return {
|
||||
event_name: '',
|
||||
client_timestamp: undefined,
|
||||
model: '',
|
||||
session_id: '',
|
||||
user_type: '',
|
||||
betas: '',
|
||||
env: undefined,
|
||||
entrypoint: '',
|
||||
agent_sdk_version: '',
|
||||
is_interactive: false,
|
||||
client_type: '',
|
||||
process: '',
|
||||
additional_metadata: '',
|
||||
auth: undefined,
|
||||
server_timestamp: undefined,
|
||||
event_id: '',
|
||||
device_id: '',
|
||||
swe_bench_run_id: '',
|
||||
swe_bench_instance_id: '',
|
||||
swe_bench_task_id: '',
|
||||
email: '',
|
||||
agent_id: '',
|
||||
parent_session_id: '',
|
||||
agent_type: '',
|
||||
slack: undefined,
|
||||
team_name: '',
|
||||
skill_name: '',
|
||||
plugin_name: '',
|
||||
marketplace_name: '',
|
||||
}
|
||||
}
|
||||
|
||||
export const ClaudeCodeInternalEvent: MessageFns<ClaudeCodeInternalEvent> = {
|
||||
fromJSON(object: any): ClaudeCodeInternalEvent {
|
||||
return {
|
||||
event_name: isSet(object.event_name)
|
||||
? globalThis.String(object.event_name)
|
||||
: '',
|
||||
client_timestamp: isSet(object.client_timestamp)
|
||||
? fromJsonTimestamp(object.client_timestamp)
|
||||
: undefined,
|
||||
model: isSet(object.model) ? globalThis.String(object.model) : '',
|
||||
session_id: isSet(object.session_id)
|
||||
? globalThis.String(object.session_id)
|
||||
: '',
|
||||
user_type: isSet(object.user_type)
|
||||
? globalThis.String(object.user_type)
|
||||
: '',
|
||||
betas: isSet(object.betas) ? globalThis.String(object.betas) : '',
|
||||
env: isSet(object.env)
|
||||
? EnvironmentMetadata.fromJSON(object.env)
|
||||
: undefined,
|
||||
entrypoint: isSet(object.entrypoint)
|
||||
? globalThis.String(object.entrypoint)
|
||||
: '',
|
||||
agent_sdk_version: isSet(object.agent_sdk_version)
|
||||
? globalThis.String(object.agent_sdk_version)
|
||||
: '',
|
||||
is_interactive: isSet(object.is_interactive)
|
||||
? globalThis.Boolean(object.is_interactive)
|
||||
: false,
|
||||
client_type: isSet(object.client_type)
|
||||
? globalThis.String(object.client_type)
|
||||
: '',
|
||||
process: isSet(object.process) ? globalThis.String(object.process) : '',
|
||||
additional_metadata: isSet(object.additional_metadata)
|
||||
? globalThis.String(object.additional_metadata)
|
||||
: '',
|
||||
auth: isSet(object.auth)
|
||||
? PublicApiAuth.fromJSON(object.auth)
|
||||
: undefined,
|
||||
server_timestamp: isSet(object.server_timestamp)
|
||||
? fromJsonTimestamp(object.server_timestamp)
|
||||
: undefined,
|
||||
event_id: isSet(object.event_id)
|
||||
? globalThis.String(object.event_id)
|
||||
: '',
|
||||
device_id: isSet(object.device_id)
|
||||
? globalThis.String(object.device_id)
|
||||
: '',
|
||||
swe_bench_run_id: isSet(object.swe_bench_run_id)
|
||||
? globalThis.String(object.swe_bench_run_id)
|
||||
: '',
|
||||
swe_bench_instance_id: isSet(object.swe_bench_instance_id)
|
||||
? globalThis.String(object.swe_bench_instance_id)
|
||||
: '',
|
||||
swe_bench_task_id: isSet(object.swe_bench_task_id)
|
||||
? globalThis.String(object.swe_bench_task_id)
|
||||
: '',
|
||||
email: isSet(object.email) ? globalThis.String(object.email) : '',
|
||||
agent_id: isSet(object.agent_id)
|
||||
? globalThis.String(object.agent_id)
|
||||
: '',
|
||||
parent_session_id: isSet(object.parent_session_id)
|
||||
? globalThis.String(object.parent_session_id)
|
||||
: '',
|
||||
agent_type: isSet(object.agent_type)
|
||||
? globalThis.String(object.agent_type)
|
||||
: '',
|
||||
slack: isSet(object.slack)
|
||||
? SlackContext.fromJSON(object.slack)
|
||||
: undefined,
|
||||
team_name: isSet(object.team_name)
|
||||
? globalThis.String(object.team_name)
|
||||
: '',
|
||||
skill_name: isSet(object.skill_name)
|
||||
? globalThis.String(object.skill_name)
|
||||
: '',
|
||||
plugin_name: isSet(object.plugin_name)
|
||||
? globalThis.String(object.plugin_name)
|
||||
: '',
|
||||
marketplace_name: isSet(object.marketplace_name)
|
||||
? globalThis.String(object.marketplace_name)
|
||||
: '',
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: ClaudeCodeInternalEvent): unknown {
|
||||
const obj: any = {}
|
||||
if (message.event_name !== undefined) {
|
||||
obj.event_name = message.event_name
|
||||
}
|
||||
if (message.client_timestamp !== undefined) {
|
||||
obj.client_timestamp = message.client_timestamp.toISOString()
|
||||
}
|
||||
if (message.model !== undefined) {
|
||||
obj.model = message.model
|
||||
}
|
||||
if (message.session_id !== undefined) {
|
||||
obj.session_id = message.session_id
|
||||
}
|
||||
if (message.user_type !== undefined) {
|
||||
obj.user_type = message.user_type
|
||||
}
|
||||
if (message.betas !== undefined) {
|
||||
obj.betas = message.betas
|
||||
}
|
||||
if (message.env !== undefined) {
|
||||
obj.env = EnvironmentMetadata.toJSON(message.env)
|
||||
}
|
||||
if (message.entrypoint !== undefined) {
|
||||
obj.entrypoint = message.entrypoint
|
||||
}
|
||||
if (message.agent_sdk_version !== undefined) {
|
||||
obj.agent_sdk_version = message.agent_sdk_version
|
||||
}
|
||||
if (message.is_interactive !== undefined) {
|
||||
obj.is_interactive = message.is_interactive
|
||||
}
|
||||
if (message.client_type !== undefined) {
|
||||
obj.client_type = message.client_type
|
||||
}
|
||||
if (message.process !== undefined) {
|
||||
obj.process = message.process
|
||||
}
|
||||
if (message.additional_metadata !== undefined) {
|
||||
obj.additional_metadata = message.additional_metadata
|
||||
}
|
||||
if (message.auth !== undefined) {
|
||||
obj.auth = PublicApiAuth.toJSON(message.auth)
|
||||
}
|
||||
if (message.server_timestamp !== undefined) {
|
||||
obj.server_timestamp = message.server_timestamp.toISOString()
|
||||
}
|
||||
if (message.event_id !== undefined) {
|
||||
obj.event_id = message.event_id
|
||||
}
|
||||
if (message.device_id !== undefined) {
|
||||
obj.device_id = message.device_id
|
||||
}
|
||||
if (message.swe_bench_run_id !== undefined) {
|
||||
obj.swe_bench_run_id = message.swe_bench_run_id
|
||||
}
|
||||
if (message.swe_bench_instance_id !== undefined) {
|
||||
obj.swe_bench_instance_id = message.swe_bench_instance_id
|
||||
}
|
||||
if (message.swe_bench_task_id !== undefined) {
|
||||
obj.swe_bench_task_id = message.swe_bench_task_id
|
||||
}
|
||||
if (message.email !== undefined) {
|
||||
obj.email = message.email
|
||||
}
|
||||
if (message.agent_id !== undefined) {
|
||||
obj.agent_id = message.agent_id
|
||||
}
|
||||
if (message.parent_session_id !== undefined) {
|
||||
obj.parent_session_id = message.parent_session_id
|
||||
}
|
||||
if (message.agent_type !== undefined) {
|
||||
obj.agent_type = message.agent_type
|
||||
}
|
||||
if (message.slack !== undefined) {
|
||||
obj.slack = SlackContext.toJSON(message.slack)
|
||||
}
|
||||
if (message.team_name !== undefined) {
|
||||
obj.team_name = message.team_name
|
||||
}
|
||||
if (message.skill_name !== undefined) {
|
||||
obj.skill_name = message.skill_name
|
||||
}
|
||||
if (message.plugin_name !== undefined) {
|
||||
obj.plugin_name = message.plugin_name
|
||||
}
|
||||
if (message.marketplace_name !== undefined) {
|
||||
obj.marketplace_name = message.marketplace_name
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<ClaudeCodeInternalEvent>, I>>(
|
||||
base?: I,
|
||||
): ClaudeCodeInternalEvent {
|
||||
return ClaudeCodeInternalEvent.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<ClaudeCodeInternalEvent>, I>>(
|
||||
object: I,
|
||||
): ClaudeCodeInternalEvent {
|
||||
const message = createBaseClaudeCodeInternalEvent()
|
||||
message.event_name = object.event_name ?? ''
|
||||
message.client_timestamp = object.client_timestamp ?? undefined
|
||||
message.model = object.model ?? ''
|
||||
message.session_id = object.session_id ?? ''
|
||||
message.user_type = object.user_type ?? ''
|
||||
message.betas = object.betas ?? ''
|
||||
message.env =
|
||||
object.env !== undefined && object.env !== null
|
||||
? EnvironmentMetadata.fromPartial(object.env)
|
||||
: undefined
|
||||
message.entrypoint = object.entrypoint ?? ''
|
||||
message.agent_sdk_version = object.agent_sdk_version ?? ''
|
||||
message.is_interactive = object.is_interactive ?? false
|
||||
message.client_type = object.client_type ?? ''
|
||||
message.process = object.process ?? ''
|
||||
message.additional_metadata = object.additional_metadata ?? ''
|
||||
message.auth =
|
||||
object.auth !== undefined && object.auth !== null
|
||||
? PublicApiAuth.fromPartial(object.auth)
|
||||
: undefined
|
||||
message.server_timestamp = object.server_timestamp ?? undefined
|
||||
message.event_id = object.event_id ?? ''
|
||||
message.device_id = object.device_id ?? ''
|
||||
message.swe_bench_run_id = object.swe_bench_run_id ?? ''
|
||||
message.swe_bench_instance_id = object.swe_bench_instance_id ?? ''
|
||||
message.swe_bench_task_id = object.swe_bench_task_id ?? ''
|
||||
message.email = object.email ?? ''
|
||||
message.agent_id = object.agent_id ?? ''
|
||||
message.parent_session_id = object.parent_session_id ?? ''
|
||||
message.agent_type = object.agent_type ?? ''
|
||||
message.slack =
|
||||
object.slack !== undefined && object.slack !== null
|
||||
? SlackContext.fromPartial(object.slack)
|
||||
: undefined
|
||||
message.team_name = object.team_name ?? ''
|
||||
message.skill_name = object.skill_name ?? ''
|
||||
message.plugin_name = object.plugin_name ?? ''
|
||||
message.marketplace_name = object.marketplace_name ?? ''
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
|
||||
type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never
|
||||
type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never
|
||||
}
|
||||
|
||||
function fromTimestamp(t: Timestamp): Date {
|
||||
let millis = (t.seconds || 0) * 1_000
|
||||
millis += (t.nanos || 0) / 1_000_000
|
||||
return new globalThis.Date(millis)
|
||||
}
|
||||
|
||||
function fromJsonTimestamp(o: any): Date {
|
||||
if (o instanceof globalThis.Date) {
|
||||
return o
|
||||
} else if (typeof o === 'string') {
|
||||
return new globalThis.Date(o)
|
||||
} else {
|
||||
return fromTimestamp(Timestamp.fromJSON(o))
|
||||
}
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined
|
||||
}
|
||||
|
||||
interface MessageFns<T> {
|
||||
fromJSON(object: any): T
|
||||
toJSON(message: T): unknown
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: events_mono/common/v1/auth.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
/** PublicApiAuth contains authentication context automatically injected by the API */
|
||||
export interface PublicApiAuth {
|
||||
account_id?: number | undefined
|
||||
organization_uuid?: string | undefined
|
||||
account_uuid?: string | undefined
|
||||
}
|
||||
|
||||
function createBasePublicApiAuth(): PublicApiAuth {
|
||||
return { account_id: 0, organization_uuid: '', account_uuid: '' }
|
||||
}
|
||||
|
||||
export const PublicApiAuth: MessageFns<PublicApiAuth> = {
|
||||
fromJSON(object: any): PublicApiAuth {
|
||||
return {
|
||||
account_id: isSet(object.account_id)
|
||||
? globalThis.Number(object.account_id)
|
||||
: 0,
|
||||
organization_uuid: isSet(object.organization_uuid)
|
||||
? globalThis.String(object.organization_uuid)
|
||||
: '',
|
||||
account_uuid: isSet(object.account_uuid)
|
||||
? globalThis.String(object.account_uuid)
|
||||
: '',
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: PublicApiAuth): unknown {
|
||||
const obj: any = {}
|
||||
if (message.account_id !== undefined) {
|
||||
obj.account_id = Math.round(message.account_id)
|
||||
}
|
||||
if (message.organization_uuid !== undefined) {
|
||||
obj.organization_uuid = message.organization_uuid
|
||||
}
|
||||
if (message.account_uuid !== undefined) {
|
||||
obj.account_uuid = message.account_uuid
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<PublicApiAuth>, I>>(
|
||||
base?: I,
|
||||
): PublicApiAuth {
|
||||
return PublicApiAuth.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<PublicApiAuth>, I>>(
|
||||
object: I,
|
||||
): PublicApiAuth {
|
||||
const message = createBasePublicApiAuth()
|
||||
message.account_id = object.account_id ?? 0
|
||||
message.organization_uuid = object.organization_uuid ?? ''
|
||||
message.account_uuid = object.account_uuid ?? ''
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
|
||||
type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never
|
||||
type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined
|
||||
}
|
||||
|
||||
interface MessageFns<T> {
|
||||
fromJSON(object: any): T
|
||||
toJSON(message: T): unknown
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: events_mono/growthbook/v1/growthbook_experiment_event.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { Timestamp } from '../../../google/protobuf/timestamp.js'
|
||||
import { PublicApiAuth } from '../../common/v1/auth.js'
|
||||
|
||||
/**
|
||||
* GrowthBook experiment assignment event
|
||||
* This event tracks when a user is exposed to an experiment variant
|
||||
* See: https://docs.growthbook.io/guide/bigquery
|
||||
*/
|
||||
export interface GrowthbookExperimentEvent {
|
||||
/** Unique event identifier (for deduplication) */
|
||||
event_id?: string | undefined
|
||||
/** When user was exposed to experiment (maps to GrowthBook's timestamp column) */
|
||||
timestamp?: Date | undefined
|
||||
/** Experiment tracking key (maps to GrowthBook's experiment_id column) */
|
||||
experiment_id?: string | undefined
|
||||
/** Variation index: 0=control, 1+=variants (maps to GrowthBook's variation_id column) */
|
||||
variation_id?: number | undefined
|
||||
/** Environment where assignment occurred */
|
||||
environment?: string | undefined
|
||||
/** User attributes at time of assignment */
|
||||
user_attributes?: string | undefined
|
||||
/** Experiment metadata */
|
||||
experiment_metadata?: string | undefined
|
||||
/** Device identifier for the client */
|
||||
device_id?: string | undefined
|
||||
/** Authentication context automatically injected by the API */
|
||||
auth?: PublicApiAuth | undefined
|
||||
/** Session identifier for tracking user sessions */
|
||||
session_id?: string | undefined
|
||||
/** Anonymous identifier for unauthenticated users */
|
||||
anonymous_id?: string | undefined
|
||||
/** Event metadata variables (automatically populated by internal-tools-common event_logging library) */
|
||||
event_metadata_vars?: string | undefined
|
||||
}
|
||||
|
||||
function createBaseGrowthbookExperimentEvent(): GrowthbookExperimentEvent {
|
||||
return {
|
||||
event_id: '',
|
||||
timestamp: undefined,
|
||||
experiment_id: '',
|
||||
variation_id: 0,
|
||||
environment: '',
|
||||
user_attributes: '',
|
||||
experiment_metadata: '',
|
||||
device_id: '',
|
||||
auth: undefined,
|
||||
session_id: '',
|
||||
anonymous_id: '',
|
||||
event_metadata_vars: '',
|
||||
}
|
||||
}
|
||||
|
||||
export const GrowthbookExperimentEvent: MessageFns<GrowthbookExperimentEvent> =
|
||||
{
|
||||
fromJSON(object: any): GrowthbookExperimentEvent {
|
||||
return {
|
||||
event_id: isSet(object.event_id)
|
||||
? globalThis.String(object.event_id)
|
||||
: '',
|
||||
timestamp: isSet(object.timestamp)
|
||||
? fromJsonTimestamp(object.timestamp)
|
||||
: undefined,
|
||||
experiment_id: isSet(object.experiment_id)
|
||||
? globalThis.String(object.experiment_id)
|
||||
: '',
|
||||
variation_id: isSet(object.variation_id)
|
||||
? globalThis.Number(object.variation_id)
|
||||
: 0,
|
||||
environment: isSet(object.environment)
|
||||
? globalThis.String(object.environment)
|
||||
: '',
|
||||
user_attributes: isSet(object.user_attributes)
|
||||
? globalThis.String(object.user_attributes)
|
||||
: '',
|
||||
experiment_metadata: isSet(object.experiment_metadata)
|
||||
? globalThis.String(object.experiment_metadata)
|
||||
: '',
|
||||
device_id: isSet(object.device_id)
|
||||
? globalThis.String(object.device_id)
|
||||
: '',
|
||||
auth: isSet(object.auth)
|
||||
? PublicApiAuth.fromJSON(object.auth)
|
||||
: undefined,
|
||||
session_id: isSet(object.session_id)
|
||||
? globalThis.String(object.session_id)
|
||||
: '',
|
||||
anonymous_id: isSet(object.anonymous_id)
|
||||
? globalThis.String(object.anonymous_id)
|
||||
: '',
|
||||
event_metadata_vars: isSet(object.event_metadata_vars)
|
||||
? globalThis.String(object.event_metadata_vars)
|
||||
: '',
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: GrowthbookExperimentEvent): unknown {
|
||||
const obj: any = {}
|
||||
if (message.event_id !== undefined) {
|
||||
obj.event_id = message.event_id
|
||||
}
|
||||
if (message.timestamp !== undefined) {
|
||||
obj.timestamp = message.timestamp.toISOString()
|
||||
}
|
||||
if (message.experiment_id !== undefined) {
|
||||
obj.experiment_id = message.experiment_id
|
||||
}
|
||||
if (message.variation_id !== undefined) {
|
||||
obj.variation_id = Math.round(message.variation_id)
|
||||
}
|
||||
if (message.environment !== undefined) {
|
||||
obj.environment = message.environment
|
||||
}
|
||||
if (message.user_attributes !== undefined) {
|
||||
obj.user_attributes = message.user_attributes
|
||||
}
|
||||
if (message.experiment_metadata !== undefined) {
|
||||
obj.experiment_metadata = message.experiment_metadata
|
||||
}
|
||||
if (message.device_id !== undefined) {
|
||||
obj.device_id = message.device_id
|
||||
}
|
||||
if (message.auth !== undefined) {
|
||||
obj.auth = PublicApiAuth.toJSON(message.auth)
|
||||
}
|
||||
if (message.session_id !== undefined) {
|
||||
obj.session_id = message.session_id
|
||||
}
|
||||
if (message.anonymous_id !== undefined) {
|
||||
obj.anonymous_id = message.anonymous_id
|
||||
}
|
||||
if (message.event_metadata_vars !== undefined) {
|
||||
obj.event_metadata_vars = message.event_metadata_vars
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GrowthbookExperimentEvent>, I>>(
|
||||
base?: I,
|
||||
): GrowthbookExperimentEvent {
|
||||
return GrowthbookExperimentEvent.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GrowthbookExperimentEvent>, I>>(
|
||||
object: I,
|
||||
): GrowthbookExperimentEvent {
|
||||
const message = createBaseGrowthbookExperimentEvent()
|
||||
message.event_id = object.event_id ?? ''
|
||||
message.timestamp = object.timestamp ?? undefined
|
||||
message.experiment_id = object.experiment_id ?? ''
|
||||
message.variation_id = object.variation_id ?? 0
|
||||
message.environment = object.environment ?? ''
|
||||
message.user_attributes = object.user_attributes ?? ''
|
||||
message.experiment_metadata = object.experiment_metadata ?? ''
|
||||
message.device_id = object.device_id ?? ''
|
||||
message.auth =
|
||||
object.auth !== undefined && object.auth !== null
|
||||
? PublicApiAuth.fromPartial(object.auth)
|
||||
: undefined
|
||||
message.session_id = object.session_id ?? ''
|
||||
message.anonymous_id = object.anonymous_id ?? ''
|
||||
message.event_metadata_vars = object.event_metadata_vars ?? ''
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
|
||||
type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never
|
||||
type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never
|
||||
}
|
||||
|
||||
function fromTimestamp(t: Timestamp): Date {
|
||||
let millis = (t.seconds || 0) * 1_000
|
||||
millis += (t.nanos || 0) / 1_000_000
|
||||
return new globalThis.Date(millis)
|
||||
}
|
||||
|
||||
function fromJsonTimestamp(o: any): Date {
|
||||
if (o instanceof globalThis.Date) {
|
||||
return o
|
||||
} else if (typeof o === 'string') {
|
||||
return new globalThis.Date(o)
|
||||
} else {
|
||||
return fromTimestamp(Timestamp.fromJSON(o))
|
||||
}
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined
|
||||
}
|
||||
|
||||
interface MessageFns<T> {
|
||||
fromJSON(object: any): T
|
||||
toJSON(message: T): unknown
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/protobuf/timestamp.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* A Timestamp represents a point in time independent of any time zone or local
|
||||
* calendar, encoded as a count of seconds and fractions of seconds at
|
||||
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
* Gregorian calendar backwards to year one.
|
||||
*
|
||||
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
* second table is needed for interpretation, using a [24-hour linear
|
||||
* smear](https://developers.google.com/time/smear).
|
||||
*
|
||||
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
* restricting to that range, we ensure that we can convert to and from [RFC
|
||||
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* Example 1: Compute Timestamp from POSIX `time()`.
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(time(NULL));
|
||||
* timestamp.set_nanos(0);
|
||||
*
|
||||
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
*
|
||||
* struct timeval tv;
|
||||
* gettimeofday(&tv, NULL);
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(tv.tv_sec);
|
||||
* timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
*
|
||||
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
*
|
||||
* FILETIME ft;
|
||||
* GetSystemTimeAsFileTime(&ft);
|
||||
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
*
|
||||
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
*
|
||||
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
*
|
||||
* long millis = System.currentTimeMillis();
|
||||
*
|
||||
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
*
|
||||
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
*
|
||||
* Instant now = Instant.now();
|
||||
*
|
||||
* Timestamp timestamp =
|
||||
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
* .setNanos(now.getNano()).build();
|
||||
*
|
||||
* Example 6: Compute Timestamp from current time in Python.
|
||||
*
|
||||
* timestamp = Timestamp()
|
||||
* timestamp.GetCurrentTime()
|
||||
*
|
||||
* # JSON Mapping
|
||||
*
|
||||
* In JSON format, the Timestamp type is encoded as a string in the
|
||||
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
* where {year} is always expressed using four digits while {month}, {day},
|
||||
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
* able to accept both UTC and other timezones (as indicated by an offset).
|
||||
*
|
||||
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
* 01:30 UTC on January 15, 2017.
|
||||
*
|
||||
* In JavaScript, one can convert a Date object to this format using the
|
||||
* standard
|
||||
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
* method. In Python, a standard `datetime.datetime` object can be converted
|
||||
* to this format using
|
||||
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
||||
* ) to obtain a formatter capable of generating timestamps in this format.
|
||||
*/
|
||||
export interface Timestamp {
|
||||
/**
|
||||
* Represents seconds of UTC time since Unix epoch
|
||||
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
* 9999-12-31T23:59:59Z inclusive.
|
||||
*/
|
||||
seconds?: number | undefined
|
||||
/**
|
||||
* Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
* second values with fractions must still have non-negative nanos values
|
||||
* that count forward in time. Must be from 0 to 999,999,999
|
||||
* inclusive.
|
||||
*/
|
||||
nanos?: number | undefined
|
||||
}
|
||||
|
||||
function createBaseTimestamp(): Timestamp {
|
||||
return { seconds: 0, nanos: 0 }
|
||||
}
|
||||
|
||||
export const Timestamp: MessageFns<Timestamp> = {
|
||||
fromJSON(object: any): Timestamp {
|
||||
return {
|
||||
seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
||||
nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
|
||||
}
|
||||
},
|
||||
|
||||
toJSON(message: Timestamp): unknown {
|
||||
const obj: any = {}
|
||||
if (message.seconds !== undefined) {
|
||||
obj.seconds = Math.round(message.seconds)
|
||||
}
|
||||
if (message.nanos !== undefined) {
|
||||
obj.nanos = Math.round(message.nanos)
|
||||
}
|
||||
return obj
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
|
||||
return Timestamp.fromPartial(base ?? ({} as any))
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(
|
||||
object: I,
|
||||
): Timestamp {
|
||||
const message = createBaseTimestamp()
|
||||
message.seconds = object.seconds ?? 0
|
||||
message.nanos = object.nanos ?? 0
|
||||
return message
|
||||
},
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined
|
||||
|
||||
type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never
|
||||
type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined
|
||||
}
|
||||
|
||||
interface MessageFns<T> {
|
||||
fromJSON(object: any): T
|
||||
toJSON(message: T): unknown
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T
|
||||
}
|
||||
Reference in New Issue
Block a user