@madewithremy/admin 0.1.53 → 0.1.54
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/CHANGELOG.md +12 -0
- package/README.md +21 -0
- package/dist/index.d.ts +156 -19
- package/dist/index.js +142 -60
- package/dist/index.js.map +1 -1
- package/dist/prod.js +78 -9
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ What changed in `@madewithremy/admin`, newest first, each version under its own
|
|
|
4
4
|
|
|
5
5
|
Versions before 0.1.44 aren't recorded here.
|
|
6
6
|
|
|
7
|
+
## 0.1.54
|
|
8
|
+
|
|
9
|
+
### New
|
|
10
|
+
|
|
11
|
+
- Inside an app's own method, `createAdminClient()` with no key runs as the method's own run, on its own app: no workspace key in the app's secrets. The method declares what it may do with `"adminPermissions"` on its `mindstudio.json` entry (`analytics.view`, `usage.view`, `voice.manage` and the rest, listed on `createAdminClient` and at the end of `remy-admin --help`). A call it doesn't declare fails with `admin_permission_required:<name>` (403), `users.manage` from a dev or preview run with `admin_permission_live_only:users.manage`, and another app with `app_credential_wrong_app`. `@mindstudio-ai/agent` is an optional peer, the app's own copy, which the client reads the run from.
|
|
12
|
+
- `remy-admin usage summary [--start] [--end] [--by method|model|step]` (`admin.usage.summary`): what the app costs to run over a window, in dollars, builds left out.
|
|
13
|
+
|
|
14
|
+
### Changed behavior
|
|
15
|
+
|
|
16
|
+
- A client resolves its credential on each call: a key passed in, then the running method's own run, then `MINDSTUDIO_API_KEY`. Bound operations all return promises, and `client.context` is null when neither the options nor the environment name a key. Code that read `client.context` should allow for null.
|
|
17
|
+
- An app that bought numbers from a method with a workspace key kept as a secret can drop the key: declare `"adminPermissions": ["voice.manage"]` on the method and call `createAdminClient()` with no options.
|
|
18
|
+
|
|
7
19
|
## 0.1.53
|
|
8
20
|
|
|
9
21
|
### Changed behavior
|
package/README.md
CHANGED
|
@@ -58,6 +58,27 @@ try {
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### Inside an app's own method
|
|
62
|
+
|
|
63
|
+
A Remy app's method can manage its own app with no key. Declare what it may do as `adminPermissions` on the method's entry in `mindstudio.json` (the list is on `createAdminClient`), then create the client with no options:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{ "id": "admin-dashboard", "path": "dist/methods/src/adminDashboard.ts", "export": "adminDashboard", "adminPermissions": ["analytics.view", "usage.view"] }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { createAdminClient } from '@madewithremy/admin';
|
|
71
|
+
const admin = createAdminClient();
|
|
72
|
+
|
|
73
|
+
export async function adminDashboard() {
|
|
74
|
+
const live = await admin.analytics.live();
|
|
75
|
+
const spend = await admin.usage.summary({ startTime, endTime, groupBy: 'method' });
|
|
76
|
+
return { live, spend };
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Each call runs as the method's own run (its hook token, from `@mindstudio-ai/agent`'s request context), on the method's own app, so a client made at module scope follows every execution. A call the method doesn't declare an admin permission for fails with `admin_permission_required:<name>`; another app is `app_credential_wrong_app`, and needs a key. A key passed in always wins, and outside a method the client falls back to the environment, as above.
|
|
81
|
+
|
|
61
82
|
Every response is fully typed (the shapes are hand-transcribed from the platform API). Failures throw `AdminApiError` (method/path/status/body) or `AdminTimeoutError`. Long-running composites take an `onProgress` callback (`releases.waitForCommit`, `dataSources.addDocument` / `waitForIngest`, `files.put`). The SSE/NDJSON streaming paths (`methods invoke --stream`, `jewels export --file`) are CLI-only.
|
|
62
83
|
|
|
63
84
|
## Development
|
package/dist/index.d.ts
CHANGED
|
@@ -5873,7 +5873,7 @@ declare function ls$1(ctx: AdminContext, params: FilesLsParams): Promise<FilesLs
|
|
|
5873
5873
|
* @example
|
|
5874
5874
|
* const { stores, totalObjects } = await admin.files.summary();
|
|
5875
5875
|
*/
|
|
5876
|
-
declare function summary(ctx: AdminContext): Promise<FilesListResult>;
|
|
5876
|
+
declare function summary$1(ctx: AdminContext): Promise<FilesListResult>;
|
|
5877
5877
|
/**
|
|
5878
5878
|
* Delete one object from a store.
|
|
5879
5879
|
*
|
|
@@ -5893,9 +5893,8 @@ declare const files_put: typeof put;
|
|
|
5893
5893
|
declare const files_remove: typeof remove;
|
|
5894
5894
|
declare const files_sign: typeof sign;
|
|
5895
5895
|
declare const files_stat: typeof stat;
|
|
5896
|
-
declare const files_summary: typeof summary;
|
|
5897
5896
|
declare namespace files {
|
|
5898
|
-
export { files_fetchBytes as fetchBytes, ls$1 as ls, files_put as put, files_remove as remove, files_sign as sign, files_stat as stat,
|
|
5897
|
+
export { files_fetchBytes as fetchBytes, ls$1 as ls, files_put as put, files_remove as remove, files_sign as sign, files_stat as stat, summary$1 as summary };
|
|
5899
5898
|
export type { files_FileAccess as FileAccess, files_FileRef as FileRef, files_FilesLsParams as FilesLsParams, files_FilesPutParams as FilesPutParams };
|
|
5900
5899
|
}
|
|
5901
5900
|
|
|
@@ -8530,6 +8529,82 @@ declare namespace settings {
|
|
|
8530
8529
|
};
|
|
8531
8530
|
}
|
|
8532
8531
|
|
|
8532
|
+
/**
|
|
8533
|
+
* Response types for an app's runtime cost.
|
|
8534
|
+
*
|
|
8535
|
+
* Transcribed from the api (apps/api/src/):
|
|
8536
|
+
* roles/http/routes/Apps/manage/usage.ts — the route and its shape
|
|
8537
|
+
*/
|
|
8538
|
+
/** How the spend is broken down. */
|
|
8539
|
+
type UsageGroupBy = 'method' | 'model' | 'step';
|
|
8540
|
+
/** One row of the breakdown. */
|
|
8541
|
+
interface UsageGroup {
|
|
8542
|
+
/** The method's id, the model's id, or the step type. */
|
|
8543
|
+
key: string;
|
|
8544
|
+
/** What it cost over the window, in dollars. */
|
|
8545
|
+
costDollars: number;
|
|
8546
|
+
requests: number;
|
|
8547
|
+
/** Failed requests; absent for a model row. */
|
|
8548
|
+
errors?: number;
|
|
8549
|
+
/** For a model row, its type (`text`, `image`, …). */
|
|
8550
|
+
modelType?: string;
|
|
8551
|
+
}
|
|
8552
|
+
interface UsageSummaryResult {
|
|
8553
|
+
groupBy: UsageGroupBy;
|
|
8554
|
+
startTime: string;
|
|
8555
|
+
endTime: string;
|
|
8556
|
+
/** The window's total, in dollars. */
|
|
8557
|
+
totalCostDollars: number;
|
|
8558
|
+
/** Most expensive first. */
|
|
8559
|
+
groups: UsageGroup[];
|
|
8560
|
+
}
|
|
8561
|
+
|
|
8562
|
+
/**
|
|
8563
|
+
* Usage operations: what the app costs to run.
|
|
8564
|
+
*
|
|
8565
|
+
* Ops are pure: (ctx, params) → typed result, throwing AdminApiError /
|
|
8566
|
+
* AdminTimeoutError. No printing, no process coupling — the CLI skin in
|
|
8567
|
+
* commands/usage.ts and the importable client both call these.
|
|
8568
|
+
*/
|
|
8569
|
+
|
|
8570
|
+
interface UsageSummaryParams {
|
|
8571
|
+
/** Window start, ISO 8601. */
|
|
8572
|
+
startTime: string;
|
|
8573
|
+
/** Window end, ISO 8601, after `startTime`. */
|
|
8574
|
+
endTime: string;
|
|
8575
|
+
/**
|
|
8576
|
+
* The breakdown (default `method`): `method` is the spend each method
|
|
8577
|
+
* drove, `model` the models' share, `step` the whole spend by action,
|
|
8578
|
+
* models and everything else.
|
|
8579
|
+
*/
|
|
8580
|
+
groupBy?: UsageGroupBy;
|
|
8581
|
+
}
|
|
8582
|
+
/**
|
|
8583
|
+
* The app's runtime spend over a window, broken down one way, in dollars.
|
|
8584
|
+
* Builds (Remy's own work on the app) aren't counted.
|
|
8585
|
+
*
|
|
8586
|
+
* In a method, needs the `usage.view` admin permission.
|
|
8587
|
+
*
|
|
8588
|
+
* @throws AdminApiError `invalid_window` (400) — a date that doesn't parse, or
|
|
8589
|
+
* an end not after the start; `invalid_group_by` (400);
|
|
8590
|
+
* `admin_permission_required:usage.view` (403) — a method that doesn't
|
|
8591
|
+
* declare it.
|
|
8592
|
+
* @example
|
|
8593
|
+
* const { totalCostDollars, groups } = await admin.usage.summary({
|
|
8594
|
+
* startTime: '2026-10-01T00:00:00Z',
|
|
8595
|
+
* endTime: '2026-11-01T00:00:00Z',
|
|
8596
|
+
* groupBy: 'method',
|
|
8597
|
+
* });
|
|
8598
|
+
*/
|
|
8599
|
+
declare function summary(ctx: AdminContext, params: UsageSummaryParams): Promise<UsageSummaryResult>;
|
|
8600
|
+
|
|
8601
|
+
type usage_UsageSummaryParams = UsageSummaryParams;
|
|
8602
|
+
declare const usage_summary: typeof summary;
|
|
8603
|
+
declare namespace usage {
|
|
8604
|
+
export { usage_summary as summary };
|
|
8605
|
+
export type { usage_UsageSummaryParams as UsageSummaryParams };
|
|
8606
|
+
}
|
|
8607
|
+
|
|
8533
8608
|
/**
|
|
8534
8609
|
* Response types for the v2 app users endpoints.
|
|
8535
8610
|
*
|
|
@@ -8911,9 +8986,11 @@ interface NumbersBuyParams {
|
|
|
8911
8986
|
*
|
|
8912
8987
|
* The number is an inbound line to the app's voice agent and a caller ID for
|
|
8913
8988
|
* `voice.call()`. An app can hold several, one per tenant say, up to its
|
|
8914
|
-
* workspace's limit (10 unless support raised it), and app
|
|
8915
|
-
* release them with this client
|
|
8916
|
-
*
|
|
8989
|
+
* workspace's limit (10 unless support raised it), and the app's own methods
|
|
8990
|
+
* can buy and release them with this client by declaring the `voice.manage`
|
|
8991
|
+
* admin permission. A
|
|
8992
|
+
* `pending` status usually activates within seconds; poll `numbersList` to
|
|
8993
|
+
* confirm.
|
|
8917
8994
|
*
|
|
8918
8995
|
* @throws AdminApiError `invalid_phone_number` (400) — not a valid +1 E.164
|
|
8919
8996
|
* US number; `phone_number_limit_reached` (422) — the workspace holds as
|
|
@@ -9043,30 +9120,46 @@ declare namespace voice {
|
|
|
9043
9120
|
}
|
|
9044
9121
|
|
|
9045
9122
|
interface AdminClientOptions {
|
|
9046
|
-
/**
|
|
9123
|
+
/**
|
|
9124
|
+
* Org-scoped `sk_` API key. Inside an app's method, leave it out: the
|
|
9125
|
+
* method's own run is the credential, holding the `adminPermissions` its
|
|
9126
|
+
* `mindstudio.json` entry declares. Elsewhere it falls back to
|
|
9127
|
+
* MINDSTUDIO_API_KEY.
|
|
9128
|
+
*/
|
|
9047
9129
|
apiKey?: string;
|
|
9048
9130
|
/**
|
|
9049
|
-
* The app to manage.
|
|
9050
|
-
*
|
|
9131
|
+
* The app to manage. Inside a method, the method's own app. Elsewhere it
|
|
9132
|
+
* falls back to the workspace's mindstudio.json — pass explicitly anywhere
|
|
9133
|
+
* that file doesn't exist.
|
|
9051
9134
|
*/
|
|
9052
9135
|
appId?: string;
|
|
9053
|
-
/**
|
|
9136
|
+
/**
|
|
9137
|
+
* API origin. Inside a method, the api the run calls back on. Elsewhere it
|
|
9138
|
+
* falls back to MINDSTUDIO_BASE_URL, then the production default.
|
|
9139
|
+
*/
|
|
9054
9140
|
baseUrl?: string;
|
|
9055
9141
|
}
|
|
9056
|
-
/**
|
|
9142
|
+
/** The context one call runs with. */
|
|
9143
|
+
type ContextSource = () => Promise<AdminContext>;
|
|
9144
|
+
/** An ops module with the AdminContext applied to every function. */
|
|
9057
9145
|
type BoundOps<T> = {
|
|
9058
|
-
[K in keyof T as T[K] extends (ctx: AdminContext, ...args: never[]) => unknown ? K : never]: T[K] extends (ctx: AdminContext, ...args: infer A) => infer R ? (...args: A) => R : never;
|
|
9146
|
+
[K in keyof T as T[K] extends (ctx: AdminContext, ...args: never[]) => unknown ? K : never]: T[K] extends (ctx: AdminContext, ...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> : never;
|
|
9059
9147
|
};
|
|
9060
|
-
declare function buildClient(
|
|
9061
|
-
/**
|
|
9062
|
-
|
|
9148
|
+
declare function buildClient(source: ContextSource, context: AdminContext | null): {
|
|
9149
|
+
/**
|
|
9150
|
+
* The context the client uses outside a running method: its options, or
|
|
9151
|
+
* the environment. Null when neither names a key, as in a method, where
|
|
9152
|
+
* each call takes the run's own.
|
|
9153
|
+
*/
|
|
9154
|
+
context: Readonly<AdminContext> | null;
|
|
9063
9155
|
/**
|
|
9064
9156
|
* A sibling client for another app, sharing credentials.
|
|
9065
9157
|
*
|
|
9066
9158
|
* The app we came from becomes the origin, so a write through the returned
|
|
9067
9159
|
* client records which app acted — the same rule the CLI's `--app` follows.
|
|
9068
9160
|
* Chaining `forApp` twice keeps the FIRST app as the origin, since that is
|
|
9069
|
-
* the one whose workspace this code is running in.
|
|
9161
|
+
* the one whose workspace this code is running in. A method's own
|
|
9162
|
+
* credential acts on its own app only, so from a method this needs a key.
|
|
9070
9163
|
*/
|
|
9071
9164
|
forApp(appId: string): /*elided*/ any;
|
|
9072
9165
|
agent: BoundOps<typeof agent>;
|
|
@@ -9115,6 +9208,7 @@ declare function buildClient(ctx: AdminContext): {
|
|
|
9115
9208
|
requests: BoundOps<typeof requests>;
|
|
9116
9209
|
secrets: BoundOps<typeof secrets>;
|
|
9117
9210
|
settings: BoundOps<typeof settings>;
|
|
9211
|
+
usage: BoundOps<typeof usage>;
|
|
9118
9212
|
users: BoundOps<typeof users>;
|
|
9119
9213
|
voice: BoundOps<typeof voice>;
|
|
9120
9214
|
};
|
|
@@ -9122,10 +9216,53 @@ type AdminClient = ReturnType<typeof buildClient>;
|
|
|
9122
9216
|
/**
|
|
9123
9217
|
* Create a client bound to one app.
|
|
9124
9218
|
*
|
|
9219
|
+
* Inside an app's method, with no options, it acts on the method's own app as
|
|
9220
|
+
* the method's own run: no key in the app's secrets. Each operation needs the
|
|
9221
|
+
* admin permission the method declares in `mindstudio.json`
|
|
9222
|
+
* (`"adminPermissions": ["analytics.view"]`), and an undeclared one fails with
|
|
9223
|
+
* `admin_permission_required:<name>`.
|
|
9224
|
+
*
|
|
9225
|
+
* The admin permissions, by the client namespaces they open (`.manage`
|
|
9226
|
+
* includes its `.view`):
|
|
9227
|
+
*
|
|
9228
|
+
* | Admin permission | Opens |
|
|
9229
|
+
* |---|---|
|
|
9230
|
+
* | `analytics.view` | `analytics` |
|
|
9231
|
+
* | `usage.view` | `usage` |
|
|
9232
|
+
* | `requests.view` | `requests`, `crashes` |
|
|
9233
|
+
* | `agent.view` / `tasks.view` | `agent` / `tasks` |
|
|
9234
|
+
* | `voice.view` / `voice.manage` | `voice` reads: call log, transcripts, settings, numbers list / buying, releasing and naming numbers, settings writes |
|
|
9235
|
+
* | `users.view` / `users.manage` | `users` reads / roles and app-user API keys, live runs only (`admin_permission_live_only:users.manage` from dev or a preview) |
|
|
9236
|
+
* | `settings.manage` | `settings` |
|
|
9237
|
+
* | `email.view` / `email.manage` | `email` reads: log, batches, status, inbox, domains list / suppressions and the sending and receiving domains |
|
|
9238
|
+
* | `domains.manage` | `domains`' custom domains and subdomain (not buying domains, which is the workspace's) |
|
|
9239
|
+
* | `issues.view` / `issues.manage` | `issues` on this app, reads / writes as the app |
|
|
9240
|
+
* | `datasources.manage` | `dataSources` and its jobs, connectors, evals, mappers and readers |
|
|
9241
|
+
* | `cron.view` / `cron.manage` | `cron` overview / run now |
|
|
9242
|
+
* | `releases.view` | `releases`, `diagnostics`' release reads |
|
|
9243
|
+
*
|
|
9244
|
+
* The rules:
|
|
9245
|
+
* - Only the method's own app: `forApp()` and another `appId` get
|
|
9246
|
+
* `app_credential_wrong_app`. Another app or the workspace needs a key.
|
|
9247
|
+
* - Not in a jewel's shadow run or a data source's mapper or reader run
|
|
9248
|
+
* (`admin_permission_unavailable`).
|
|
9249
|
+
* - Publishing the declaration is the consent, and any visitor who can call
|
|
9250
|
+
* the method can make it use what it holds, so gate the method accordingly.
|
|
9251
|
+
* - Never an admin permission: secrets (a method has its own in
|
|
9252
|
+
* `process.env`) and builder operations (deploys, data lifts, previews,
|
|
9253
|
+
* infra, jewel training). What `@mindstudio-ai/agent` already does needs
|
|
9254
|
+
* none.
|
|
9255
|
+
*
|
|
9125
9256
|
* ```ts
|
|
9126
9257
|
* import { createAdminClient } from '@madewithremy/admin';
|
|
9127
|
-
*
|
|
9128
|
-
*
|
|
9258
|
+
*
|
|
9259
|
+
* // In a method declaring "adminPermissions": ["analytics.view"]
|
|
9260
|
+
* const admin = createAdminClient();
|
|
9261
|
+
* const live = await admin.analytics.live();
|
|
9262
|
+
*
|
|
9263
|
+
* // Anywhere else, with a workspace API key
|
|
9264
|
+
* const other = createAdminClient({ apiKey: 'sk_…', appId: 'app_…' });
|
|
9265
|
+
* const { releases } = await other.releases.list({ limit: 5 });
|
|
9129
9266
|
* ```
|
|
9130
9267
|
*/
|
|
9131
9268
|
declare function createAdminClient(options?: AdminClientOptions): AdminClient;
|
|
@@ -9162,4 +9299,4 @@ declare class AdminTimeoutError extends Error {
|
|
|
9162
9299
|
declare const admin: AdminClient;
|
|
9163
9300
|
|
|
9164
9301
|
export { AdminApiError, AdminTimeoutError, admin, createAdminClient, admin as default };
|
|
9165
|
-
export type { AdminClient, AdminClientOptions, AdminContext, AgentThreadDetail, AgentThreadListItem, AgentThreadsGetResult, AgentThreadsListResult, AgentToolCall, AgentTranscriptMessage, AgentTurnError, AnalyticsAiHostRow, AnalyticsAiSourcesResult, AnalyticsAiVendorRow, AnalyticsBatchResult, AnalyticsCrawlersOverviewResult, AnalyticsCrawlersRecentResult, AnalyticsCrawlersRecentRow, AnalyticsCrawlersResult, AnalyticsCrawlersTimeseriesBucket, AnalyticsCrawlersTimeseriesResult, AnalyticsLiveResult, AnalyticsMapPoint, AnalyticsMapResult, AnalyticsMetric, AnalyticsQueryResult, AnalyticsQueryResultRow, AnalyticsSourceRow, AnalyticsSourcesResult, AppCronJobStatus, AppCronJobStatusReason, AppCronRunState, AppEmailSuppression, AppSecretRow, AppsListPage, AppsListResult, BoughtDomain, CrashGroup, CrashOccurrenceRow, CrashesGetResult, CrashesListResult, CrashesOccurrencesResult, CrashesStatsBucket, CrashesStatsResult, CronJobDecorated, CronOverviewResult, CronRunResult, CronRunSummary, DashboardLiveRelease, DashboardReleaseMethod, DashboardResult, DataLiftFromDevResult, DataLiftFromLiveResult, DataSourceConnector, DataSourceConnectorCredentials, DataSourceConnectorDeletions, DataSourceConnectorGetResult, DataSourceConnectorPolicy, DataSourceConnectorResult, DataSourceInspectReport, DataSourceInspectResult, DataSourceJob, DataSourceJobGetResult, DataSourceJobManifestTokenResult, DataSourceJobPlan, DataSourceJobResult, DataSourceJobSource, DataSourceJobState, DataSourceJobsListResult, DataSourceMapDeployResult, DataSourceMapTestDocument, DataSourceMapTestOutcome, DataSourceMapTestResult, DataSourceMapper, DataSourceObjectSelection, DataSourceQuarantineResult, DataSourceQuarantinedObject, DataSourceReader, DataSourceReaderDeliveries, DataSourceReaderRetryResult, DataSourceReaderStatusResult, DataSourceReaderTestDocument, DataSourceReaderTestResult, DataSourceRemapResult, DataSourceRereadResult, DataSourceSyncResult, DataSourcesBuildProgress, DataSourcesChunkingConfig, DataSourcesChunkingStrategy, DataSourcesConfigResult, DataSourcesConfigUpdateResult, DataSourcesCountResult, DataSourcesCreateResult, DataSourcesDeleteResult, DataSourcesDictionaryPushResult, DataSourcesDictionaryReport, DataSourcesDictionaryStatus, DataSourcesDocument, DataSourcesDocumentConfirmResult, DataSourcesDocumentDeleteManyResult, DataSourcesDocumentDeleteResult, DataSourcesDocumentSelector, DataSourcesDocumentStatus, DataSourcesDocumentsResult, DataSourcesDropResult, DataSourcesEntitiesResult, DataSourcesHydrateResult, DataSourcesHydration, DataSourcesIndex, DataSourcesIngestConfig, DataSourcesIngestUpdate, DataSourcesLinkResult, DataSourcesListEntry, DataSourcesListResult, DataSourcesMigration, DataSourcesMoveResult, DataSourcesPassage, DataSourcesPassagesResult, DataSourcesPlacement, DataSourcesPromoteResult, DataSourcesRelink, DataSourcesRetrievalConfig, DataSourcesRetrievalUpdate, DataSourcesRevectorizeResult, DataSourcesSampleResult, DataSourcesSearchCitation, DataSourcesSearchResult, DataSourcesSearchResultItem, DataSourcesUploadTokenResult, DatasetFile, DbHistoryResult, DbQueryResult, DiagnosticsAuditEnvironment, DiagnosticsDashboardResult, DiagnosticsFinding, DiagnosticsLighthouseScores, DiagnosticsPayload, DiagnosticsReleaseResult, DiagnosticsRuntimeFindings, DomainsCheckResult, DomainsCustomAddResult, DomainsCustomCheckResult, DomainsCustomHostnameUiStatus, DomainsCustomHostnameView, DomainsCustomListResult, DomainsCustomRemoveResult, DomainsCustomRetryResult, DomainsDnsInstructions, DomainsGetResult, DomainsSetResult, EmailBatchLifecycle, EmailBatchResult, EmailBatchSummary, EmailBatchesResult, EmailDomainBase, EmailEffectiveSender, EmailInboxResult, EmailListResult, EmailMessageKind, EmailMessageResult, EmailMessageStatus, EmailSenderTier, EmailSendingStatusResult, EmailStatsResult, EmailSummary, EmailSuppressResult, EmailSuppressionsResult, EmailUnsuppressResult, EvalAggregates, EvalCompareResult, EvalExpectation, EvalQueriesAddResult, EvalQueriesListResult, EvalQuery, EvalQueryResult, EvalQueryStyle, EvalRetrieval, EvalRun, EvalRunResult, EvalRunState, EvalRunsListResult, EvalSet, EvalSetGetResult, EvalSetResult, EvalSetState, EvalSetsListResult, EventChannelActivity, EventsChannelsListResult, EventsPublishResult, EventsTailFrame, FilesDeleteResult, FilesFileMeta, FilesListEntry, FilesListResult, FilesLsResult, FilesScanBadge, FilesScanFlagged, FilesScanStore, FilesStatResult, FilesStoreSummaryEntry, FilesUploadUrlResult, FilesUrlResult, FrontendErrorType, InboundDnsInstructions, InboundEmailDomainAddResult, InboundEmailDomainCheckResult, InboundEmailDomainDeleteResult, InboundEmailDomainUiStatus, InboundEmailDomainVerifyResult, InboundEmailDomainView, InboundEmailDomainsListResult, InboxEmailPreview, IssueAuthorKind, IssueCommentRow, IssueEventType, IssueRow, IssueStatus, IssuesCommentResult, IssuesCreateResult, IssuesDeleteResult, IssuesGetResult, IssuesListResult, IssuesUpdateResult, JewelPairRow, JewelPairSummaryRow, JewelVerdict, JewelsDatasetSummary, JewelsDryrunResult, JewelsExportResult, JewelsGradeResult, JewelsGrading, JewelsOverviewResult, JewelsPairResult, JewelsPairsResult, JewelsQueueResult, JewelsResolveResult, JewelsRunResult, JewelsRunsResult, JewelsTimeseriesBucket, JewelsTimeseriesResult, JewelsTrainResult, LiftedDatabase, MethodsInvokeResult, OperationProgress, OutboundDnsInstructions, OutboundDnsRecord, OutboundEmailDomainAddResult, OutboundEmailDomainCheckResult, OutboundEmailDomainDeleteResult, OutboundEmailDomainUiStatus, OutboundEmailDomainVerifyResult, OutboundEmailDomainView, OutboundEmailDomainsListResult, PlatformSuppression, PrerenderGetResult, PrerenderInvalidateResult, PrerenderPage, PrerenderPagesResult, PrerenderViewResult, PreviewShareLink, PreviewShareListResult, PreviewShareResult, PreviewShareRevokeResult, RegisteredDomainConnection, RegisteredDomainOffer, RegisteredDomainQuote, RegisteredDomainRecordType, RegisteredDomainRecords, RegisteredDomainStatus, RegisteredDomainView, RegisteredDomainZoneRecord, RegisteredDomainsBuyResult, RegisteredDomainsContactResult, RegisteredDomainsContactSetResult, RegisteredDomainsListResult, RegisteredDomainsQuoteResult, RegisteredDomainsRecordDeleteResult, RegisteredDomainsRecordResult, RegisteredDomainsSearchResult, RegisteredDomainsZoneResult, RegistrantContact, ReleaseFailureFields, ReleaseFragment, ReleasesByCommitResult, ReleasesGetResult, ReleasesListResult, RequestsGetResult, RequestsListResult, RequestsListRow, RequestsStatsMethodBucket, RequestsStatsMethodResult, RequestsStatsSummaryBucket, RequestsStatsSummaryResult, SecretsDeleteResult, SecretsGetResult, SecretsListResult, SecretsSetResult, SettingsResult, SuppressionSource, TaskTraceOutcome, TaskTraceSummary, TaskTranscriptMessage, TaskTurnError, TasksGetResult, TasksListResult, TrainingLogEntry, TrainingRunRow, TrainingRunStatus, UserAuthProvider, UserListItem, UserRecord, UsersCreateApiKeyResult, UsersListResult, UsersRevokeApiKeyResult, UsersSetRoleResult, V2AppSettings, V2BuildLogEntry, V2BuildStats, V2CommitInfo, V2EmailMessage, V2ReleaseStatus, VoiceAvailableNumber, VoiceNumbersBuyResult, VoiceNumbersListResult, VoiceNumbersReleaseResult, VoiceNumbersSearchResult, VoiceNumbersSetNameResult, VoicePhoneNumberStatus, VoicePhoneNumberView, VoiceResolvedPolicy, VoiceSessionChannel, VoiceSessionCost, VoiceSessionCostLine, VoiceSessionDetail, VoiceSessionGetResult, VoiceSessionListItem, VoiceSessionSip, VoiceSessionSpeechEntry, VoiceSessionStatus, VoiceSessionToolEntry, VoiceSessionTranscriptEntry, VoiceSessionsListResult, VoiceSettingsCeilings, VoiceSettingsGetResult, VoiceSettingsOverrides, VoiceSettingsSetResult, WorkspaceApp, WorkspaceRegistrantContact };
|
|
9302
|
+
export type { AdminClient, AdminClientOptions, AdminContext, AgentThreadDetail, AgentThreadListItem, AgentThreadsGetResult, AgentThreadsListResult, AgentToolCall, AgentTranscriptMessage, AgentTurnError, AnalyticsAiHostRow, AnalyticsAiSourcesResult, AnalyticsAiVendorRow, AnalyticsBatchResult, AnalyticsCrawlersOverviewResult, AnalyticsCrawlersRecentResult, AnalyticsCrawlersRecentRow, AnalyticsCrawlersResult, AnalyticsCrawlersTimeseriesBucket, AnalyticsCrawlersTimeseriesResult, AnalyticsLiveResult, AnalyticsMapPoint, AnalyticsMapResult, AnalyticsMetric, AnalyticsQueryResult, AnalyticsQueryResultRow, AnalyticsSourceRow, AnalyticsSourcesResult, AppCronJobStatus, AppCronJobStatusReason, AppCronRunState, AppEmailSuppression, AppSecretRow, AppsListPage, AppsListResult, BoughtDomain, CrashGroup, CrashOccurrenceRow, CrashesGetResult, CrashesListResult, CrashesOccurrencesResult, CrashesStatsBucket, CrashesStatsResult, CronJobDecorated, CronOverviewResult, CronRunResult, CronRunSummary, DashboardLiveRelease, DashboardReleaseMethod, DashboardResult, DataLiftFromDevResult, DataLiftFromLiveResult, DataSourceConnector, DataSourceConnectorCredentials, DataSourceConnectorDeletions, DataSourceConnectorGetResult, DataSourceConnectorPolicy, DataSourceConnectorResult, DataSourceInspectReport, DataSourceInspectResult, DataSourceJob, DataSourceJobGetResult, DataSourceJobManifestTokenResult, DataSourceJobPlan, DataSourceJobResult, DataSourceJobSource, DataSourceJobState, DataSourceJobsListResult, DataSourceMapDeployResult, DataSourceMapTestDocument, DataSourceMapTestOutcome, DataSourceMapTestResult, DataSourceMapper, DataSourceObjectSelection, DataSourceQuarantineResult, DataSourceQuarantinedObject, DataSourceReader, DataSourceReaderDeliveries, DataSourceReaderRetryResult, DataSourceReaderStatusResult, DataSourceReaderTestDocument, DataSourceReaderTestResult, DataSourceRemapResult, DataSourceRereadResult, DataSourceSyncResult, DataSourcesBuildProgress, DataSourcesChunkingConfig, DataSourcesChunkingStrategy, DataSourcesConfigResult, DataSourcesConfigUpdateResult, DataSourcesCountResult, DataSourcesCreateResult, DataSourcesDeleteResult, DataSourcesDictionaryPushResult, DataSourcesDictionaryReport, DataSourcesDictionaryStatus, DataSourcesDocument, DataSourcesDocumentConfirmResult, DataSourcesDocumentDeleteManyResult, DataSourcesDocumentDeleteResult, DataSourcesDocumentSelector, DataSourcesDocumentStatus, DataSourcesDocumentsResult, DataSourcesDropResult, DataSourcesEntitiesResult, DataSourcesHydrateResult, DataSourcesHydration, DataSourcesIndex, DataSourcesIngestConfig, DataSourcesIngestUpdate, DataSourcesLinkResult, DataSourcesListEntry, DataSourcesListResult, DataSourcesMigration, DataSourcesMoveResult, DataSourcesPassage, DataSourcesPassagesResult, DataSourcesPlacement, DataSourcesPromoteResult, DataSourcesRelink, DataSourcesRetrievalConfig, DataSourcesRetrievalUpdate, DataSourcesRevectorizeResult, DataSourcesSampleResult, DataSourcesSearchCitation, DataSourcesSearchResult, DataSourcesSearchResultItem, DataSourcesUploadTokenResult, DatasetFile, DbHistoryResult, DbQueryResult, DiagnosticsAuditEnvironment, DiagnosticsDashboardResult, DiagnosticsFinding, DiagnosticsLighthouseScores, DiagnosticsPayload, DiagnosticsReleaseResult, DiagnosticsRuntimeFindings, DomainsCheckResult, DomainsCustomAddResult, DomainsCustomCheckResult, DomainsCustomHostnameUiStatus, DomainsCustomHostnameView, DomainsCustomListResult, DomainsCustomRemoveResult, DomainsCustomRetryResult, DomainsDnsInstructions, DomainsGetResult, DomainsSetResult, EmailBatchLifecycle, EmailBatchResult, EmailBatchSummary, EmailBatchesResult, EmailDomainBase, EmailEffectiveSender, EmailInboxResult, EmailListResult, EmailMessageKind, EmailMessageResult, EmailMessageStatus, EmailSenderTier, EmailSendingStatusResult, EmailStatsResult, EmailSummary, EmailSuppressResult, EmailSuppressionsResult, EmailUnsuppressResult, EvalAggregates, EvalCompareResult, EvalExpectation, EvalQueriesAddResult, EvalQueriesListResult, EvalQuery, EvalQueryResult, EvalQueryStyle, EvalRetrieval, EvalRun, EvalRunResult, EvalRunState, EvalRunsListResult, EvalSet, EvalSetGetResult, EvalSetResult, EvalSetState, EvalSetsListResult, EventChannelActivity, EventsChannelsListResult, EventsPublishResult, EventsTailFrame, FilesDeleteResult, FilesFileMeta, FilesListEntry, FilesListResult, FilesLsResult, FilesScanBadge, FilesScanFlagged, FilesScanStore, FilesStatResult, FilesStoreSummaryEntry, FilesUploadUrlResult, FilesUrlResult, FrontendErrorType, InboundDnsInstructions, InboundEmailDomainAddResult, InboundEmailDomainCheckResult, InboundEmailDomainDeleteResult, InboundEmailDomainUiStatus, InboundEmailDomainVerifyResult, InboundEmailDomainView, InboundEmailDomainsListResult, InboxEmailPreview, IssueAuthorKind, IssueCommentRow, IssueEventType, IssueRow, IssueStatus, IssuesCommentResult, IssuesCreateResult, IssuesDeleteResult, IssuesGetResult, IssuesListResult, IssuesUpdateResult, JewelPairRow, JewelPairSummaryRow, JewelVerdict, JewelsDatasetSummary, JewelsDryrunResult, JewelsExportResult, JewelsGradeResult, JewelsGrading, JewelsOverviewResult, JewelsPairResult, JewelsPairsResult, JewelsQueueResult, JewelsResolveResult, JewelsRunResult, JewelsRunsResult, JewelsTimeseriesBucket, JewelsTimeseriesResult, JewelsTrainResult, LiftedDatabase, MethodsInvokeResult, OperationProgress, OutboundDnsInstructions, OutboundDnsRecord, OutboundEmailDomainAddResult, OutboundEmailDomainCheckResult, OutboundEmailDomainDeleteResult, OutboundEmailDomainUiStatus, OutboundEmailDomainVerifyResult, OutboundEmailDomainView, OutboundEmailDomainsListResult, PlatformSuppression, PrerenderGetResult, PrerenderInvalidateResult, PrerenderPage, PrerenderPagesResult, PrerenderViewResult, PreviewShareLink, PreviewShareListResult, PreviewShareResult, PreviewShareRevokeResult, RegisteredDomainConnection, RegisteredDomainOffer, RegisteredDomainQuote, RegisteredDomainRecordType, RegisteredDomainRecords, RegisteredDomainStatus, RegisteredDomainView, RegisteredDomainZoneRecord, RegisteredDomainsBuyResult, RegisteredDomainsContactResult, RegisteredDomainsContactSetResult, RegisteredDomainsListResult, RegisteredDomainsQuoteResult, RegisteredDomainsRecordDeleteResult, RegisteredDomainsRecordResult, RegisteredDomainsSearchResult, RegisteredDomainsZoneResult, RegistrantContact, ReleaseFailureFields, ReleaseFragment, ReleasesByCommitResult, ReleasesGetResult, ReleasesListResult, RequestsGetResult, RequestsListResult, RequestsListRow, RequestsStatsMethodBucket, RequestsStatsMethodResult, RequestsStatsSummaryBucket, RequestsStatsSummaryResult, SecretsDeleteResult, SecretsGetResult, SecretsListResult, SecretsSetResult, SettingsResult, SuppressionSource, TaskTraceOutcome, TaskTraceSummary, TaskTranscriptMessage, TaskTurnError, TasksGetResult, TasksListResult, TrainingLogEntry, TrainingRunRow, TrainingRunStatus, UsageGroup, UsageGroupBy, UsageSummaryResult, UserAuthProvider, UserListItem, UserRecord, UsersCreateApiKeyResult, UsersListResult, UsersRevokeApiKeyResult, UsersSetRoleResult, V2AppSettings, V2BuildLogEntry, V2BuildStats, V2CommitInfo, V2EmailMessage, V2ReleaseStatus, VoiceAvailableNumber, VoiceNumbersBuyResult, VoiceNumbersListResult, VoiceNumbersReleaseResult, VoiceNumbersSearchResult, VoiceNumbersSetNameResult, VoicePhoneNumberStatus, VoicePhoneNumberView, VoiceResolvedPolicy, VoiceSessionChannel, VoiceSessionCost, VoiceSessionCostLine, VoiceSessionDetail, VoiceSessionGetResult, VoiceSessionListItem, VoiceSessionSip, VoiceSessionSpeechEntry, VoiceSessionStatus, VoiceSessionToolEntry, VoiceSessionTranscriptEntry, VoiceSessionsListResult, VoiceSettingsCeilings, VoiceSettingsGetResult, VoiceSettingsOverrides, VoiceSettingsSetResult, WorkspaceApp, WorkspaceRegistrantContact };
|
package/dist/index.js
CHANGED
|
@@ -59,13 +59,6 @@ function loadWorkspaceAppId(workspaceDir = WORKSPACE_DIR) {
|
|
|
59
59
|
return result.value.appId;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
// src/ops/agent.ts
|
|
63
|
-
var agent_exports = {};
|
|
64
|
-
__export(agent_exports, {
|
|
65
|
-
threadsGet: () => threadsGet,
|
|
66
|
-
threadsList: () => threadsList
|
|
67
|
-
});
|
|
68
|
-
|
|
69
62
|
// src/errors.ts
|
|
70
63
|
var AdminApiError = class extends Error {
|
|
71
64
|
constructor(method, path3, status2, body) {
|
|
@@ -180,7 +173,51 @@ async function tryCall(ctx, method, apiPath) {
|
|
|
180
173
|
return { ok: res.ok, status: res.status, body: await readBody(res) };
|
|
181
174
|
}
|
|
182
175
|
|
|
176
|
+
// src/runningMethod.ts
|
|
177
|
+
var AGENT_SDK = "@mindstudio-ai/agent";
|
|
178
|
+
var agentSdk;
|
|
179
|
+
var loadAgentSdk = () => agentSdk ??= import(AGENT_SDK).then(
|
|
180
|
+
(mod) => mod,
|
|
181
|
+
() => null
|
|
182
|
+
);
|
|
183
|
+
var appIds = /* @__PURE__ */ new Map();
|
|
184
|
+
var MAX_REMEMBERED = 500;
|
|
185
|
+
function appIdOf(token, baseUrl) {
|
|
186
|
+
let known = appIds.get(token);
|
|
187
|
+
if (!known) {
|
|
188
|
+
known = call(
|
|
189
|
+
{ apiKey: token, appId: "", baseUrl },
|
|
190
|
+
"GET",
|
|
191
|
+
"/_internal/v2/execution/identity"
|
|
192
|
+
).then((identity) => identity.appId);
|
|
193
|
+
known.catch(() => appIds.delete(token));
|
|
194
|
+
if (appIds.size >= MAX_REMEMBERED) {
|
|
195
|
+
appIds.delete(appIds.keys().next().value);
|
|
196
|
+
}
|
|
197
|
+
appIds.set(token, known);
|
|
198
|
+
}
|
|
199
|
+
return known;
|
|
200
|
+
}
|
|
201
|
+
async function runningMethodContext(options) {
|
|
202
|
+
const sdk = await loadAgentSdk();
|
|
203
|
+
const run3 = sdk?.getRequestContext?.();
|
|
204
|
+
if (!run3?.callbackToken) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const baseUrl = (options.baseUrl ?? run3.remoteHostname ?? process.env["MINDSTUDIO_BASE_URL"] ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
208
|
+
return {
|
|
209
|
+
apiKey: run3.callbackToken,
|
|
210
|
+
appId: options.appId ?? await appIdOf(run3.callbackToken, baseUrl),
|
|
211
|
+
baseUrl
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
183
215
|
// src/ops/agent.ts
|
|
216
|
+
var agent_exports = {};
|
|
217
|
+
__export(agent_exports, {
|
|
218
|
+
threadsGet: () => threadsGet,
|
|
219
|
+
threadsList: () => threadsList
|
|
220
|
+
});
|
|
184
221
|
function threadsList(ctx, params = {}) {
|
|
185
222
|
return call(
|
|
186
223
|
ctx,
|
|
@@ -1743,7 +1780,7 @@ async function primaryUrl(ctx) {
|
|
|
1743
1780
|
return dashboard.primaryUrl;
|
|
1744
1781
|
}
|
|
1745
1782
|
function summarizeRelease(release) {
|
|
1746
|
-
const
|
|
1783
|
+
const summary3 = {
|
|
1747
1784
|
releaseId: release.id,
|
|
1748
1785
|
commitSha: release.commitSha,
|
|
1749
1786
|
branch: release.branch ?? null,
|
|
@@ -1755,16 +1792,16 @@ function summarizeRelease(release) {
|
|
|
1755
1792
|
};
|
|
1756
1793
|
const readers = (release.dataSources ?? []).filter((d) => d.reader);
|
|
1757
1794
|
if (readers.length > 0 && release.status === "live") {
|
|
1758
|
-
|
|
1795
|
+
summary3.readers = readers.map((d) => ({
|
|
1759
1796
|
slug: d.slug,
|
|
1760
1797
|
unread: d.readerUnread ?? 0
|
|
1761
1798
|
}));
|
|
1762
1799
|
}
|
|
1763
1800
|
if (release.status !== "failed") {
|
|
1764
|
-
return
|
|
1801
|
+
return summary3;
|
|
1765
1802
|
}
|
|
1766
1803
|
return {
|
|
1767
|
-
...
|
|
1804
|
+
...summary3,
|
|
1768
1805
|
error: release.failureReason ?? "Build failed (no error entry in the build log)",
|
|
1769
1806
|
...release.failureKind ? { failureKind: release.failureKind } : {},
|
|
1770
1807
|
...release.failurePhase ? { failurePhase: release.failurePhase } : {}
|
|
@@ -3028,6 +3065,19 @@ function updateSettings(ctx, partial) {
|
|
|
3028
3065
|
).then((res) => res.settings ?? {});
|
|
3029
3066
|
}
|
|
3030
3067
|
|
|
3068
|
+
// src/ops/usage.ts
|
|
3069
|
+
var usage_exports = {};
|
|
3070
|
+
__export(usage_exports, {
|
|
3071
|
+
summary: () => summary2
|
|
3072
|
+
});
|
|
3073
|
+
function summary2(ctx, params) {
|
|
3074
|
+
return call(
|
|
3075
|
+
ctx,
|
|
3076
|
+
"GET",
|
|
3077
|
+
`/_internal/v2/apps/${ctx.appId}/usage/summary${qs(params)}`
|
|
3078
|
+
);
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3031
3081
|
// src/ops/users.ts
|
|
3032
3082
|
var users_exports = {};
|
|
3033
3083
|
__export(users_exports, {
|
|
@@ -3183,11 +3233,11 @@ function settingsSet(ctx, params) {
|
|
|
3183
3233
|
}
|
|
3184
3234
|
|
|
3185
3235
|
// src/client.ts
|
|
3186
|
-
function bindOps(ops,
|
|
3236
|
+
function bindOps(ops, source) {
|
|
3187
3237
|
const bound = {};
|
|
3188
3238
|
for (const [name, value] of Object.entries(ops)) {
|
|
3189
3239
|
if (typeof value === "function") {
|
|
3190
|
-
bound[name] = (...args) => value(
|
|
3240
|
+
bound[name] = async (...args) => value(await source(), ...args);
|
|
3191
3241
|
}
|
|
3192
3242
|
}
|
|
3193
3243
|
return bound;
|
|
@@ -3207,71 +3257,103 @@ function resolveOptions(options) {
|
|
|
3207
3257
|
baseUrl: options.baseUrl ?? process.env["MINDSTUDIO_BASE_URL"] ?? DEFAULT_BASE_URL
|
|
3208
3258
|
};
|
|
3209
3259
|
}
|
|
3210
|
-
function
|
|
3260
|
+
function retarget(ctx, appId) {
|
|
3261
|
+
return {
|
|
3262
|
+
...ctx,
|
|
3263
|
+
appId,
|
|
3264
|
+
originAppId: appId === ctx.appId ? ctx.originAppId : ctx.originAppId ?? ctx.appId
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
function buildClient(source, context) {
|
|
3211
3268
|
return {
|
|
3212
|
-
/**
|
|
3213
|
-
|
|
3269
|
+
/**
|
|
3270
|
+
* The context the client uses outside a running method: its options, or
|
|
3271
|
+
* the environment. Null when neither names a key, as in a method, where
|
|
3272
|
+
* each call takes the run's own.
|
|
3273
|
+
*/
|
|
3274
|
+
context,
|
|
3214
3275
|
/**
|
|
3215
3276
|
* A sibling client for another app, sharing credentials.
|
|
3216
3277
|
*
|
|
3217
3278
|
* The app we came from becomes the origin, so a write through the returned
|
|
3218
3279
|
* client records which app acted — the same rule the CLI's `--app` follows.
|
|
3219
3280
|
* Chaining `forApp` twice keeps the FIRST app as the origin, since that is
|
|
3220
|
-
* the one whose workspace this code is running in.
|
|
3281
|
+
* the one whose workspace this code is running in. A method's own
|
|
3282
|
+
* credential acts on its own app only, so from a method this needs a key.
|
|
3221
3283
|
*/
|
|
3222
3284
|
forApp(appId) {
|
|
3223
|
-
return buildClient(
|
|
3224
|
-
|
|
3225
|
-
appId
|
|
3226
|
-
|
|
3227
|
-
});
|
|
3285
|
+
return buildClient(
|
|
3286
|
+
async () => retarget(await source(), appId),
|
|
3287
|
+
context && retarget(context, appId)
|
|
3288
|
+
);
|
|
3228
3289
|
},
|
|
3229
|
-
agent: bindOps(agent_exports,
|
|
3230
|
-
tasks: bindOps(tasks_exports,
|
|
3231
|
-
analytics: bindOps(analytics_exports,
|
|
3232
|
-
apps: bindOps(apps_exports,
|
|
3233
|
-
events: bindOps(events_exports,
|
|
3234
|
-
crashes: bindOps(crashes_exports,
|
|
3235
|
-
cron: bindOps(cron_exports,
|
|
3236
|
-
feedback: bindOps(feedback_exports,
|
|
3237
|
-
data: bindOps(data_exports,
|
|
3238
|
-
dataSources: bindOps(dataSources_exports,
|
|
3239
|
-
dataSourceJobs: bindOps(dataSourceJobs_exports,
|
|
3240
|
-
dataSourceConnectors: bindOps(dataSourceConnectors_exports,
|
|
3241
|
-
dataSourceEvals: bindOps(dataSourceEvals_exports,
|
|
3242
|
-
dataSourceMappers: bindOps(dataSourceMappers_exports,
|
|
3243
|
-
db: bindOps(db_exports,
|
|
3244
|
-
diagnostics: bindOps(diagnostics_exports,
|
|
3245
|
-
domains: bindOps(domains_exports,
|
|
3290
|
+
agent: bindOps(agent_exports, source),
|
|
3291
|
+
tasks: bindOps(tasks_exports, source),
|
|
3292
|
+
analytics: bindOps(analytics_exports, source),
|
|
3293
|
+
apps: bindOps(apps_exports, source),
|
|
3294
|
+
events: bindOps(events_exports, source),
|
|
3295
|
+
crashes: bindOps(crashes_exports, source),
|
|
3296
|
+
cron: bindOps(cron_exports, source),
|
|
3297
|
+
feedback: bindOps(feedback_exports, source),
|
|
3298
|
+
data: bindOps(data_exports, source),
|
|
3299
|
+
dataSources: bindOps(dataSources_exports, source),
|
|
3300
|
+
dataSourceJobs: bindOps(dataSourceJobs_exports, source),
|
|
3301
|
+
dataSourceConnectors: bindOps(dataSourceConnectors_exports, source),
|
|
3302
|
+
dataSourceEvals: bindOps(dataSourceEvals_exports, source),
|
|
3303
|
+
dataSourceMappers: bindOps(dataSourceMappers_exports, source),
|
|
3304
|
+
db: bindOps(db_exports, source),
|
|
3305
|
+
diagnostics: bindOps(diagnostics_exports, source),
|
|
3306
|
+
domains: bindOps(domains_exports, source),
|
|
3246
3307
|
email: {
|
|
3247
|
-
...bindOps(email_exports,
|
|
3308
|
+
...bindOps(email_exports, source),
|
|
3248
3309
|
// Hand-bound: these are generic over the direction ('sending' |
|
|
3249
3310
|
// 'inbound') and bindOps' mapped type would erase the generic,
|
|
3250
3311
|
// collapsing every result to the cross-direction union.
|
|
3251
|
-
listDomains: (direction) => listDomains(
|
|
3252
|
-
checkDomain: (direction, domain) => checkDomain(
|
|
3253
|
-
addDomain: (direction, domain) => addDomain(
|
|
3254
|
-
verifyDomain: (direction, domain) => verifyDomain(
|
|
3255
|
-
removeDomain: (direction, domain) => removeDomain(
|
|
3312
|
+
listDomains: async (direction) => listDomains(await source(), direction),
|
|
3313
|
+
checkDomain: async (direction, domain) => checkDomain(await source(), direction, domain),
|
|
3314
|
+
addDomain: async (direction, domain) => addDomain(await source(), direction, domain),
|
|
3315
|
+
verifyDomain: async (direction, domain) => verifyDomain(await source(), direction, domain),
|
|
3316
|
+
removeDomain: async (direction, domain) => removeDomain(await source(), direction, domain)
|
|
3256
3317
|
},
|
|
3257
|
-
files: bindOps(files_exports,
|
|
3258
|
-
infra: bindOps(infra_exports,
|
|
3259
|
-
issues: bindOps(issues_exports,
|
|
3260
|
-
jewels: bindOps(jewels_exports,
|
|
3261
|
-
methods: bindOps(methods_exports,
|
|
3262
|
-
prerender: bindOps(prerender_exports,
|
|
3263
|
-
previews: bindOps(previews_exports,
|
|
3264
|
-
qaRecordings: bindOps(qaRecordings_exports,
|
|
3265
|
-
releases: bindOps(releases_exports,
|
|
3266
|
-
requests: bindOps(requests_exports,
|
|
3267
|
-
secrets: bindOps(secrets_exports,
|
|
3268
|
-
settings: bindOps(settings_exports,
|
|
3269
|
-
|
|
3270
|
-
|
|
3318
|
+
files: bindOps(files_exports, source),
|
|
3319
|
+
infra: bindOps(infra_exports, source),
|
|
3320
|
+
issues: bindOps(issues_exports, source),
|
|
3321
|
+
jewels: bindOps(jewels_exports, source),
|
|
3322
|
+
methods: bindOps(methods_exports, source),
|
|
3323
|
+
prerender: bindOps(prerender_exports, source),
|
|
3324
|
+
previews: bindOps(previews_exports, source),
|
|
3325
|
+
qaRecordings: bindOps(qaRecordings_exports, source),
|
|
3326
|
+
releases: bindOps(releases_exports, source),
|
|
3327
|
+
requests: bindOps(requests_exports, source),
|
|
3328
|
+
secrets: bindOps(secrets_exports, source),
|
|
3329
|
+
settings: bindOps(settings_exports, source),
|
|
3330
|
+
usage: bindOps(usage_exports, source),
|
|
3331
|
+
users: bindOps(users_exports, source),
|
|
3332
|
+
voice: bindOps(voice_exports, source)
|
|
3271
3333
|
};
|
|
3272
3334
|
}
|
|
3273
3335
|
function createAdminClient(options = {}) {
|
|
3274
|
-
|
|
3336
|
+
if (options.apiKey) {
|
|
3337
|
+
const context2 = resolveOptions(options);
|
|
3338
|
+
return buildClient(async () => context2, context2);
|
|
3339
|
+
}
|
|
3340
|
+
let context = null;
|
|
3341
|
+
let unresolved = null;
|
|
3342
|
+
try {
|
|
3343
|
+
context = resolveOptions(options);
|
|
3344
|
+
} catch (err) {
|
|
3345
|
+
unresolved = err;
|
|
3346
|
+
}
|
|
3347
|
+
return buildClient(async () => {
|
|
3348
|
+
const running = await runningMethodContext(options);
|
|
3349
|
+
if (running) {
|
|
3350
|
+
return running;
|
|
3351
|
+
}
|
|
3352
|
+
if (!context) {
|
|
3353
|
+
throw unresolved;
|
|
3354
|
+
}
|
|
3355
|
+
return context;
|
|
3356
|
+
}, context);
|
|
3275
3357
|
}
|
|
3276
3358
|
|
|
3277
3359
|
// src/index.ts
|