@elmohq/sdk 0.0.0-stage → 0.1.1
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.md +21 -0
- package/README.md +326 -2
- package/dist/calls/index.d.mts +288 -0
- package/dist/calls/index.d.mts.map +1 -0
- package/dist/calls/index.mjs +390 -0
- package/dist/calls/index.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1031 -0
- package/dist/index.mjs.map +1 -0
- package/dist/request-options-B9S9d24M.d.mts +1549 -0
- package/dist/request-options-B9S9d24M.d.mts.map +1 -0
- package/dist/tools-7Hs5J2xb.d.mts +1945 -0
- package/dist/tools-7Hs5J2xb.d.mts.map +1 -0
- package/dist/tools-B1lVtYAr.mjs +2459 -0
- package/dist/tools-B1lVtYAr.mjs.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +68 -4
- package/src/calls/brands-analytics-get.ts +33 -0
- package/src/calls/brands-citations-domains-list.ts +36 -0
- package/src/calls/brands-citations-urls-list.ts +32 -0
- package/src/calls/brands-create.ts +19 -0
- package/src/calls/brands-get.ts +19 -0
- package/src/calls/brands-list.ts +18 -0
- package/src/calls/brands-opportunities-get.ts +42 -0
- package/src/calls/brands-prompt-performance-list.ts +39 -0
- package/src/calls/brands-query-fanout-get.ts +30 -0
- package/src/calls/brands-tags-list.ts +28 -0
- package/src/calls/brands-update.ts +20 -0
- package/src/calls/competitors-create.ts +23 -0
- package/src/calls/competitors-delete.ts +19 -0
- package/src/calls/competitors-get.ts +19 -0
- package/src/calls/competitors-list.ts +23 -0
- package/src/calls/competitors-update.ts +24 -0
- package/src/calls/index.ts +33 -0
- package/src/calls/me-get.ts +18 -0
- package/src/calls/models-list.ts +20 -0
- package/src/calls/organizations-billing-get.ts +37 -0
- package/src/calls/organizations-get.ts +24 -0
- package/src/calls/organizations-list.ts +27 -0
- package/src/calls/prompts-create.ts +27 -0
- package/src/calls/prompts-delete.ts +28 -0
- package/src/calls/prompts-get.ts +23 -0
- package/src/calls/prompts-list.ts +28 -0
- package/src/calls/prompts-runs-get.ts +27 -0
- package/src/calls/prompts-runs-list.ts +30 -0
- package/src/calls/prompts-snapshot-get.ts +28 -0
- package/src/calls/prompts-update.ts +29 -0
- package/src/calls/reports-create.ts +31 -0
- package/src/calls/reports-get.ts +27 -0
- package/src/calls/reports-list.ts +28 -0
- package/src/calls/tools-analyze.ts +26 -0
- package/src/client.ts +649 -0
- package/src/index.ts +21 -0
- package/src/internal/binding/rest/binding.ts +127 -0
- package/src/internal/binding/rest/errors.ts +107 -0
- package/src/internal/binding/rest/path.ts +9 -0
- package/src/internal/binding/rest/url.ts +97 -0
- package/src/internal/codec/json.ts +66 -0
- package/src/internal/codec/registry.ts +55 -0
- package/src/internal/core/backoff.ts +170 -0
- package/src/internal/core/body.ts +54 -0
- package/src/internal/core/browser.ts +11 -0
- package/src/internal/core/call-promise.ts +145 -0
- package/src/internal/core/callable.ts +11 -0
- package/src/internal/core/client.ts +89 -0
- package/src/internal/core/config.ts +84 -0
- package/src/internal/core/credentials.ts +40 -0
- package/src/internal/core/dispatch.ts +225 -0
- package/src/internal/core/env.ts +68 -0
- package/src/internal/core/errors.ts +431 -0
- package/src/internal/core/features.ts +60 -0
- package/src/internal/core/lazy-promise.ts +39 -0
- package/src/internal/core/metadata.ts +79 -0
- package/src/internal/core/page.ts +402 -0
- package/src/internal/core/params.ts +98 -0
- package/src/internal/core/protocol.ts +17 -0
- package/src/internal/core/read-reply.ts +7 -0
- package/src/internal/core/text.ts +7 -0
- package/src/internal/core/types.ts +554 -0
- package/src/internal/feature/auth.ts +201 -0
- package/src/internal/feature/interceptors.ts +36 -0
- package/src/internal/feature/logger.ts +222 -0
- package/src/internal/feature/retry.ts +168 -0
- package/src/internal/feature/rules.ts +54 -0
- package/src/internal/feature/timeout.ts +146 -0
- package/src/internal/feature/validate.ts +82 -0
- package/src/internal/transport/fetch.ts +82 -0
- package/src/resources/analytics.ts +364 -0
- package/src/resources/brands.ts +288 -0
- package/src/resources/competitors.ts +213 -0
- package/src/resources/identity.ts +49 -0
- package/src/resources/models.ts +32 -0
- package/src/resources/opportunities.ts +81 -0
- package/src/resources/organizations.ts +182 -0
- package/src/resources/prompts.ts +293 -0
- package/src/resources/reports.ts +212 -0
- package/src/resources/runs.ts +124 -0
- package/src/resources/shared/auth.ts +13 -0
- package/src/resources/shared/request-options.ts +26 -0
- package/src/resources/shared/resource.ts +23 -0
- package/src/resources/shared/rule.ts +25 -0
- package/src/resources/snapshots.ts +54 -0
- package/src/resources/tags.ts +46 -0
- package/src/resources/tools.ts +69 -0
- package/src/types/analytics.ts +497 -0
- package/src/types/brands.ts +228 -0
- package/src/types/competitors.ts +196 -0
- package/src/types/identity.ts +55 -0
- package/src/types/index.ts +163 -0
- package/src/types/models.ts +40 -0
- package/src/types/opportunities.ts +84 -0
- package/src/types/organizations.ts +157 -0
- package/src/types/prompts.ts +231 -0
- package/src/types/reports.ts +266 -0
- package/src/types/runs.ts +131 -0
- package/src/types/shared/brand-id-path.ts +2 -0
- package/src/types/shared/conflict-error.ts +7 -0
- package/src/types/shared/error.ts +29 -0
- package/src/types/shared/limit.ts +8 -0
- package/src/types/shared/mention-entry.ts +21 -0
- package/src/types/shared/model-filter.ts +15 -0
- package/src/types/shared/not-found-error.ts +4 -0
- package/src/types/shared/page.ts +7 -0
- package/src/types/shared/pagination.ts +7 -0
- package/src/types/shared/validation-error.ts +4 -0
- package/src/types/snapshots.ts +88 -0
- package/src/types/tags.ts +47 -0
- package/src/types/tools.ts +78 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A bare
|
|
3
|
+
* `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a local
|
|
4
|
+
* calendar day there.
|
|
5
|
+
*/
|
|
6
|
+
export type WindowStart = Date;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
10
|
+
* exactly `end` is outside it.
|
|
11
|
+
*/
|
|
12
|
+
export type WindowEnd = Date;
|
|
13
|
+
|
|
14
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
15
|
+
export type ModelFilter = string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ForbiddenError,
|
|
3
|
+
InternalServerError,
|
|
4
|
+
RateLimitError,
|
|
5
|
+
UnauthorizedError,
|
|
6
|
+
} from './shared/error';
|
|
7
|
+
import type { MentionsSummary } from './shared/mention-entry';
|
|
8
|
+
import type { NotFoundError } from './shared/not-found-error';
|
|
9
|
+
import type { ValidationError } from './shared/validation-error';
|
|
10
|
+
|
|
11
|
+
export type CitedURLEntry = {
|
|
12
|
+
/** Number of times this URL was cited */
|
|
13
|
+
count: number;
|
|
14
|
+
/** Page title if available */
|
|
15
|
+
title: string | null;
|
|
16
|
+
/** The cited URL */
|
|
17
|
+
url: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type PromptSnapshot = {
|
|
21
|
+
/** Brand identifier this prompt belongs to */
|
|
22
|
+
brandId: string;
|
|
23
|
+
citations: {
|
|
24
|
+
/** Number of citations to brand-owned domains */
|
|
25
|
+
brandCitationsTotal: number;
|
|
26
|
+
/** Total number of citations across all runs */
|
|
27
|
+
citationsTotal: number;
|
|
28
|
+
/** Top-K cited URLs ranked by frequency */
|
|
29
|
+
citedUrlsTopK: Array<CitedURLEntry>;
|
|
30
|
+
/** Number of citations to competitor-owned domains */
|
|
31
|
+
competitorCitationsTotal: number;
|
|
32
|
+
};
|
|
33
|
+
/** End of the queried date range (YYYY-MM-DD) */
|
|
34
|
+
endDate: string;
|
|
35
|
+
mentions: MentionsSummary;
|
|
36
|
+
/** Unique identifier for the prompt */
|
|
37
|
+
promptId: string;
|
|
38
|
+
/** The prompt text */
|
|
39
|
+
promptValue: string;
|
|
40
|
+
/** Start of the queried date range (YYYY-MM-DD) */
|
|
41
|
+
startDate: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type GetPromptSnapshotErrors = {
|
|
45
|
+
/** Invalid request data */
|
|
46
|
+
400: ValidationError;
|
|
47
|
+
/** Authentication required */
|
|
48
|
+
401: UnauthorizedError;
|
|
49
|
+
/**
|
|
50
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
51
|
+
* read-only (demo) mode.
|
|
52
|
+
*/
|
|
53
|
+
403: ForbiddenError;
|
|
54
|
+
/** Resource not found */
|
|
55
|
+
404: NotFoundError;
|
|
56
|
+
/** Per-key rate limit exceeded. */
|
|
57
|
+
429: RateLimitError;
|
|
58
|
+
/** Internal server error */
|
|
59
|
+
500: InternalServerError;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type GetPromptSnapshotResponses = {
|
|
63
|
+
/** Prompt snapshot with mention and citation analytics */
|
|
64
|
+
200: PromptSnapshot;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type GetPromptSnapshotParams = {
|
|
68
|
+
/** Start of date range (YYYY-MM-DD) */
|
|
69
|
+
startDate: string;
|
|
70
|
+
/** End of date range (YYYY-MM-DD) */
|
|
71
|
+
endDate: string;
|
|
72
|
+
/**
|
|
73
|
+
* Number of top competitor entities to return in mentionsTopK
|
|
74
|
+
*
|
|
75
|
+
* @default 5
|
|
76
|
+
* @minimum 1
|
|
77
|
+
* @maximum 50
|
|
78
|
+
*/
|
|
79
|
+
kMentions?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Number of top cited URLs to return in citedUrlsTopK
|
|
82
|
+
*
|
|
83
|
+
* @default 10
|
|
84
|
+
* @minimum 1
|
|
85
|
+
* @maximum 50
|
|
86
|
+
*/
|
|
87
|
+
kCitations?: number;
|
|
88
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ForbiddenError,
|
|
3
|
+
InternalServerError,
|
|
4
|
+
RateLimitError,
|
|
5
|
+
UnauthorizedError,
|
|
6
|
+
} from './shared/error';
|
|
7
|
+
import type { NotFoundError } from './shared/not-found-error';
|
|
8
|
+
|
|
9
|
+
export type Tag = {
|
|
10
|
+
/** The tag, normalized to lower case. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Prompts in this brand carrying the tag. */
|
|
13
|
+
promptCount: number;
|
|
14
|
+
/**
|
|
15
|
+
* True for `branded` and `unbranded`, which Elmo computes from the prompt text. A system tag
|
|
16
|
+
* always appears here; applying it to a prompt as a user tag overrides the computed
|
|
17
|
+
* classification rather than creating a new tag.
|
|
18
|
+
*/
|
|
19
|
+
system: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type TagList = {
|
|
23
|
+
brandId: string;
|
|
24
|
+
/** System tags first, then user tags alphabetically — the order the dashboard's filter shows. */
|
|
25
|
+
data: Array<Tag>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ListBrandTagsErrors = {
|
|
29
|
+
/** Authentication required */
|
|
30
|
+
401: UnauthorizedError;
|
|
31
|
+
/**
|
|
32
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
33
|
+
* read-only (demo) mode.
|
|
34
|
+
*/
|
|
35
|
+
403: ForbiddenError;
|
|
36
|
+
/** Resource not found */
|
|
37
|
+
404: NotFoundError;
|
|
38
|
+
/** Per-key rate limit exceeded. */
|
|
39
|
+
429: RateLimitError;
|
|
40
|
+
/** Internal server error */
|
|
41
|
+
500: InternalServerError;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type ListBrandTagsResponses = {
|
|
45
|
+
/** List a brand's tags */
|
|
46
|
+
200: TagList;
|
|
47
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ConflictError, PaymentRequiredError } from './shared/conflict-error';
|
|
2
|
+
import type {
|
|
3
|
+
ForbiddenError,
|
|
4
|
+
InternalServerError,
|
|
5
|
+
RateLimitError,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
} from './shared/error';
|
|
8
|
+
import type { ValidationError } from './shared/validation-error';
|
|
9
|
+
|
|
10
|
+
export type OnboardingSuggestion = {
|
|
11
|
+
additionalDomains: Array<string>;
|
|
12
|
+
aliases: Array<string>;
|
|
13
|
+
brandName: string;
|
|
14
|
+
competitors: Array<{
|
|
15
|
+
aliases: Array<string>;
|
|
16
|
+
domains: Array<string>;
|
|
17
|
+
name: string;
|
|
18
|
+
}>;
|
|
19
|
+
suggestedPrompts: Array<{
|
|
20
|
+
prompt: string;
|
|
21
|
+
tags: Array<string>;
|
|
22
|
+
}>;
|
|
23
|
+
/** Cleaned hostname */
|
|
24
|
+
website: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type AnalyzeBrandErrors = {
|
|
28
|
+
/** Invalid request data */
|
|
29
|
+
400: ValidationError;
|
|
30
|
+
/** Authentication required */
|
|
31
|
+
401: UnauthorizedError;
|
|
32
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
33
|
+
402: PaymentRequiredError;
|
|
34
|
+
/**
|
|
35
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
36
|
+
* read-only (demo) mode.
|
|
37
|
+
*/
|
|
38
|
+
403: ForbiddenError;
|
|
39
|
+
/** Resource already exists */
|
|
40
|
+
409: ConflictError;
|
|
41
|
+
/** Per-key rate limit exceeded. */
|
|
42
|
+
429: RateLimitError;
|
|
43
|
+
/** Internal server error */
|
|
44
|
+
500: InternalServerError;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type AnalyzeBrandResponses = {
|
|
48
|
+
/** Brand analysis suggestion */
|
|
49
|
+
200: OnboardingSuggestion;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type AnalyzeBrandParams = {
|
|
53
|
+
/**
|
|
54
|
+
* Brand's website — a hostname or a full URL. A URL with a path (e.g. https://www.nike.com/golf)
|
|
55
|
+
* is analyzed as given; the returned website is always its domain.
|
|
56
|
+
*
|
|
57
|
+
* @minLength 1
|
|
58
|
+
*/
|
|
59
|
+
website: string;
|
|
60
|
+
/** Optional brand name hint. If omitted, inferred from the domain. */
|
|
61
|
+
brandName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Maximum number of competitor suggestions. 0 disables competitor generation entirely.
|
|
64
|
+
*
|
|
65
|
+
* @default 20
|
|
66
|
+
* @minimum 0
|
|
67
|
+
* @maximum 100
|
|
68
|
+
*/
|
|
69
|
+
maxCompetitors?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Maximum number of suggested prompts. 0 disables prompt generation entirely.
|
|
72
|
+
*
|
|
73
|
+
* @default 30
|
|
74
|
+
* @minimum 0
|
|
75
|
+
* @maximum 100
|
|
76
|
+
*/
|
|
77
|
+
maxPrompts?: number;
|
|
78
|
+
};
|