mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
138 lines
7.4 KiB
TypeScript
Generated
138 lines
7.4 KiB
TypeScript
Generated
/**
|
|
* Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
|
|
* To modify these schemas, update the Django serializers or views, then run:
|
|
* insightscli build:openapi
|
|
* Questions or issues? #team-devex on Slack
|
|
*
|
|
* Insights API - generated
|
|
* OpenAPI spec version: 1.0.0
|
|
*/
|
|
import * as zod from 'zod'
|
|
|
|
/**
|
|
* Only for setting properties on the person. "properties" from the request data will be updated via a "$set" event.
|
|
* This means that only the properties listed will be updated, but other properties won't be removed nor updated.
|
|
* If you would like to remove a property use the `delete_property` endpoint.
|
|
*/
|
|
export const PersonsUpdateBody = /* @__PURE__ */ zod.object({
|
|
properties: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('Key-value map of person properties set via $set and $set_once operations.'),
|
|
})
|
|
|
|
/**
|
|
* This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the [capture API](https://hanzo.ai/docs/api/capture), the `$set` and `$unset` [properties](https://hanzo.ai/docs/product-analytics/user-properties), or one of our SDKs.
|
|
*/
|
|
export const PersonsPartialUpdateBody = /* @__PURE__ */ zod.object({
|
|
properties: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('Key-value map of person properties set via $set and $set_once operations.'),
|
|
})
|
|
|
|
/**
|
|
* This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the [capture API](https://hanzo.ai/docs/api/capture), the `$set` and `$unset` [properties](https://hanzo.ai/docs/product-analytics/user-properties), or one of our SDKs.
|
|
*/
|
|
|
|
export const personsDeletePropertyCreateBodyUnsetTwoMax = 1000
|
|
|
|
export const PersonsDeletePropertyCreateBody = /* @__PURE__ */ zod.object({
|
|
$unset: zod
|
|
.union([
|
|
zod.string().min(1),
|
|
zod.array(zod.string().min(1)).min(1).max(personsDeletePropertyCreateBodyUnsetTwoMax),
|
|
])
|
|
.describe('A property key, or a list of property keys, to remove from this person.'),
|
|
})
|
|
|
|
/**
|
|
* Split distinct_ids off a merged person. Two mutually exclusive modes:
|
|
*
|
|
* - **`distinct_ids_to_split`** (recommended for surgical edits): moves only the listed distinct_ids off this person onto new single-id persons. The original person keeps every other distinct_id and its properties.
|
|
* - **`main_distinct_id`**: keeps only the specified distinct_id on this person; moves every *other* distinct_id off onto its own new person. If omitted, the first distinct_id is kept.
|
|
*
|
|
* The original person always retains its properties. To clear individual properties afterward, use the `delete_property` endpoint.
|
|
*
|
|
* The split runs asynchronously: a 201 response means the task was enqueued. Newly-created split-off persons get a deterministic UUID derived from `(team_id, distinct_id)`, so they can be located client-side without polling. If you need to delete a split-off person after this call, prefer looking it up by that deterministic UUID rather than by distinct_id, since the latter still resolves to the original merged person until the async task completes.
|
|
*/
|
|
export const PersonsSplitCreateBody = /* @__PURE__ */ zod.object({
|
|
main_distinct_id: zod
|
|
.string()
|
|
.nullish()
|
|
.describe(
|
|
'The distinct_id to \*\*keep\*\* on this person; every \*other\* distinct_id is moved to its own new single-id person. If omitted, the first distinct_id on the person is kept. The original person always retains its properties; to clear individual properties afterward, use the delete_property endpoint. To surgically \*remove\* one or more distinct_ids while leaving the merge intact, use `distinct_ids_to_split` instead — these parameters are inverses of each other and cannot be combined.'
|
|
),
|
|
distinct_ids_to_split: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe(
|
|
'List of distinct_ids to \*\*move off\*\* this person onto new single-id persons. The original person keeps every other distinct_id and its properties. New persons are created with deterministic UUIDs derived from `(team_id, distinct_id)`. Cannot be combined with `main_distinct_id`.'
|
|
),
|
|
})
|
|
|
|
/**
|
|
* This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the [capture API](https://hanzo.ai/docs/api/capture), the `$set` and `$unset` [properties](https://hanzo.ai/docs/product-analytics/user-properties), or one of our SDKs.
|
|
*/
|
|
export const PersonsUpdatePropertyCreateBody = /* @__PURE__ */ zod.object({
|
|
key: zod.string().describe('The property key to set.'),
|
|
value: zod.unknown().describe('The property value. Can be a string, number, boolean, or object.'),
|
|
})
|
|
|
|
/**
|
|
* This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the [capture API](https://hanzo.ai/docs/api/capture), the `$set` and `$unset` [properties](https://hanzo.ai/docs/product-analytics/user-properties), or one of our SDKs.
|
|
*/
|
|
export const PersonsBatchByDistinctIdsCreateBody = /* @__PURE__ */ zod.object({
|
|
properties: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('Key-value map of person properties set via $set and $set_once operations.'),
|
|
})
|
|
|
|
/**
|
|
* This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the [capture API](https://hanzo.ai/docs/api/capture), the `$set` and `$unset` [properties](https://hanzo.ai/docs/product-analytics/user-properties), or one of our SDKs.
|
|
*/
|
|
export const PersonsBatchByUuidsCreateBody = /* @__PURE__ */ zod.object({
|
|
properties: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('Key-value map of person properties set via $set and $set_once operations.'),
|
|
})
|
|
|
|
/**
|
|
* This endpoint allows you to bulk delete persons, either by the Insights person IDs or by distinct IDs. You can pass in a maximum of 1000 IDs per call. Only events captured before the request will be deleted.
|
|
*/
|
|
export const personsBulkDeleteCreateBodyDeleteEventsDefault = false
|
|
export const personsBulkDeleteCreateBodyDeleteRecordingsDefault = false
|
|
export const personsBulkDeleteCreateBodyKeepPersonDefault = false
|
|
|
|
export const PersonsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({
|
|
ids: zod.array(zod.string()).optional().describe('A list of Insights person UUIDs to delete (max 1000).'),
|
|
distinct_ids: zod
|
|
.array(zod.string())
|
|
.optional()
|
|
.describe('A list of distinct IDs whose associated persons will be deleted (max 1000).'),
|
|
delete_events: zod
|
|
.boolean()
|
|
.default(personsBulkDeleteCreateBodyDeleteEventsDefault)
|
|
.describe('If true, queue deletion of all events associated with these persons.'),
|
|
delete_recordings: zod
|
|
.boolean()
|
|
.default(personsBulkDeleteCreateBodyDeleteRecordingsDefault)
|
|
.describe('If true, queue deletion of all recordings associated with these persons.'),
|
|
keep_person: zod
|
|
.boolean()
|
|
.default(personsBulkDeleteCreateBodyKeepPersonDefault)
|
|
.describe('If true, keep the person records but delete their events and recordings.'),
|
|
})
|
|
|
|
/**
|
|
* Reset a distinct_id for a deleted person. This allows the distinct_id to be used again.
|
|
*/
|
|
export const PersonsResetPersonDistinctIdCreateBody = /* @__PURE__ */ zod.object({
|
|
properties: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('Key-value map of person properties set via $set and $set_once operations.'),
|
|
})
|