@warmhub/sdk-ts 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ERGCQLFH.js → chunk-E32PSLWS.js} +557 -30
- package/dist/chunk-E32PSLWS.js.map +1 -0
- package/dist/index.d.ts +257 -15
- package/dist/index.js +1 -1
- package/dist/react.js +2 -2
- package/package.json +26 -2
- package/dist/chunk-ERGCQLFH.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -81,10 +81,12 @@ type CommitApplyResult = {
|
|
|
81
81
|
message?: string;
|
|
82
82
|
operationCount: number;
|
|
83
83
|
operations: Array<{
|
|
84
|
+
opIndex?: number;
|
|
84
85
|
name: string;
|
|
85
86
|
operation: 'add' | 'revise' | 'retract' | 'noop';
|
|
86
87
|
version: number;
|
|
87
88
|
dataHash: string;
|
|
89
|
+
status?: 'applied' | 'noop';
|
|
88
90
|
warnings?: {
|
|
89
91
|
undeclaredFields: Array<string>;
|
|
90
92
|
undeclaredFieldsTruncated?: true;
|
|
@@ -214,6 +216,7 @@ type StreamAppendInput$1 = {
|
|
|
214
216
|
componentId?: string;
|
|
215
217
|
workspaceName?: never;
|
|
216
218
|
committer?: string;
|
|
219
|
+
message?: string;
|
|
217
220
|
allocatedTokens?: Array<{
|
|
218
221
|
tokenNumber: number;
|
|
219
222
|
}>;
|
|
@@ -281,6 +284,7 @@ type StreamAppendResult$1 = {
|
|
|
281
284
|
tokenNumber: number;
|
|
282
285
|
}>;
|
|
283
286
|
results: Array<{
|
|
287
|
+
opIndex?: number;
|
|
284
288
|
name: string;
|
|
285
289
|
operation?: 'add' | 'revise' | 'retract' | 'noop';
|
|
286
290
|
version?: number;
|
|
@@ -290,12 +294,15 @@ type StreamAppendResult$1 = {
|
|
|
290
294
|
code: string;
|
|
291
295
|
message: string;
|
|
292
296
|
};
|
|
297
|
+
resolvedName?: string;
|
|
298
|
+
retryable?: boolean;
|
|
293
299
|
warnings?: {
|
|
294
300
|
undeclaredFields: Array<string>;
|
|
295
301
|
undeclaredFieldsTruncated?: true;
|
|
296
302
|
totalUndeclared?: number;
|
|
297
303
|
};
|
|
298
304
|
}>;
|
|
305
|
+
createdByEmail?: string;
|
|
299
306
|
appendTotalMs?: number;
|
|
300
307
|
appendResolveRepoMs?: number;
|
|
301
308
|
appendTokenResolveMs?: number;
|
|
@@ -418,6 +425,7 @@ type RepoDescribeResult$1 = {
|
|
|
418
425
|
repo: {
|
|
419
426
|
orgName: string;
|
|
420
427
|
name: string;
|
|
428
|
+
displayName: string;
|
|
421
429
|
description?: string;
|
|
422
430
|
visibility: 'public' | 'private';
|
|
423
431
|
archivedAt?: number;
|
|
@@ -452,6 +460,7 @@ type RepoListResult = {
|
|
|
452
460
|
items: Array<{
|
|
453
461
|
orgName: string;
|
|
454
462
|
name: string;
|
|
463
|
+
displayName: string;
|
|
455
464
|
description?: string;
|
|
456
465
|
visibility: 'public' | 'private';
|
|
457
466
|
archivedAt?: number;
|
|
@@ -572,7 +581,7 @@ type WireScopeEntry$1 = {
|
|
|
572
581
|
* Add operation accepted by `client.commit.apply`. Use this shape to create new
|
|
573
582
|
* shapes, things, assertions, or collections in a single commit.
|
|
574
583
|
*
|
|
575
|
-
* @see https://docs.warmhub.ai/
|
|
584
|
+
* @see https://docs.warmhub.ai/writes/operations/#add-operations
|
|
576
585
|
*/
|
|
577
586
|
interface AddOperation {
|
|
578
587
|
/**
|
|
@@ -622,7 +631,7 @@ interface AddOperation {
|
|
|
622
631
|
* field is declared `never` at the type level, so passing `active: false` is
|
|
623
632
|
* a compile error. Use a {@link RetractOperation} to mark an entity inactive.
|
|
624
633
|
*
|
|
625
|
-
* @see https://docs.warmhub.ai/
|
|
634
|
+
* @see https://docs.warmhub.ai/writes/operations/#revise-operations
|
|
626
635
|
*/
|
|
627
636
|
interface ReviseOperation {
|
|
628
637
|
/**
|
|
@@ -656,7 +665,7 @@ interface ReviseOperation {
|
|
|
656
665
|
* Retract operation accepted by `client.commit.apply`. Marks the target as
|
|
657
666
|
* retracted in a new version; prior versions remain queryable by history.
|
|
658
667
|
*
|
|
659
|
-
* @see https://docs.warmhub.ai/
|
|
668
|
+
* @see https://docs.warmhub.ai/writes/operations/#retract-operations
|
|
660
669
|
*/
|
|
661
670
|
interface RetractOperation {
|
|
662
671
|
/**
|
|
@@ -705,18 +714,20 @@ interface RetractOperation {
|
|
|
705
714
|
* await client.commit.apply("acme", "world", "seed", ops);
|
|
706
715
|
* ```
|
|
707
716
|
*
|
|
708
|
-
* @see https://docs.warmhub.ai/sdk/
|
|
717
|
+
* @see https://docs.warmhub.ai/sdk/write-methods/#typing-operation-arrays
|
|
709
718
|
*/
|
|
710
719
|
type Operation = AddOperation | ReviseOperation | RetractOperation;
|
|
711
720
|
|
|
712
721
|
/**
|
|
713
722
|
* Default number of operations the SDK sends per stream append chunk.
|
|
714
|
-
*
|
|
723
|
+
*
|
|
724
|
+
* @internal
|
|
715
725
|
*/
|
|
716
726
|
declare const DEFAULT_STREAM_CHUNK_SIZE = 1000;
|
|
717
727
|
/**
|
|
718
728
|
* Maximum number of operations accepted by one stream append chunk.
|
|
719
|
-
*
|
|
729
|
+
*
|
|
730
|
+
* @internal
|
|
720
731
|
*/
|
|
721
732
|
declare const MAX_STREAM_APPEND_OPERATION_COUNT = 10000;
|
|
722
733
|
interface OperationStreamClient {
|
|
@@ -726,18 +737,29 @@ interface OperationStreamClient {
|
|
|
726
737
|
}
|
|
727
738
|
type SubmittedStreamResult = {
|
|
728
739
|
committer?: string;
|
|
740
|
+
createdByEmail?: string;
|
|
729
741
|
message: string | undefined;
|
|
730
742
|
operationCount: number;
|
|
743
|
+
partial?: boolean;
|
|
744
|
+
statusCounts?: {
|
|
745
|
+
applied: number;
|
|
746
|
+
noop: number;
|
|
747
|
+
error: number;
|
|
748
|
+
};
|
|
731
749
|
operations: Array<{
|
|
750
|
+
opIndex?: number;
|
|
732
751
|
name: string;
|
|
733
752
|
operation: 'add' | 'revise' | 'retract' | 'noop';
|
|
734
753
|
dataHash: string;
|
|
735
754
|
version: number;
|
|
736
|
-
status?: '
|
|
755
|
+
status?: 'applied' | 'noop' | 'error';
|
|
737
756
|
error?: {
|
|
738
757
|
code: string;
|
|
739
758
|
message: string;
|
|
740
759
|
};
|
|
760
|
+
submittedName?: string;
|
|
761
|
+
resolvedName?: string;
|
|
762
|
+
retryable?: boolean;
|
|
741
763
|
/**
|
|
742
764
|
* Non-blocking warnings collected during shape validation — see GH-1418.
|
|
743
765
|
* Aliased to the generated wire shape so this type cannot drift from
|
|
@@ -746,6 +768,10 @@ type SubmittedStreamResult = {
|
|
|
746
768
|
warnings?: NonNullable<StreamAppendResult$1['results'][number]['warnings']>;
|
|
747
769
|
}>;
|
|
748
770
|
};
|
|
771
|
+
/** @internal */
|
|
772
|
+
declare function streamAppendResultStatus(result: StreamAppendResult$1['results'][number]): NonNullable<SubmittedStreamResult['operations'][number]['status']>;
|
|
773
|
+
/** @internal */
|
|
774
|
+
declare function countStreamAppendResultStatuses(results: StreamAppendResult$1['results']): NonNullable<SubmittedStreamResult['statusCounts']>;
|
|
749
775
|
/**
|
|
750
776
|
* Continuation state for caller-managed streamed commit submissions.
|
|
751
777
|
* @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamcontinuationstate/
|
|
@@ -769,6 +795,10 @@ type RetryPolicyOptions = {
|
|
|
769
795
|
baseDelayMs?: number;
|
|
770
796
|
maxDelayMs?: number;
|
|
771
797
|
};
|
|
798
|
+
type StreamFailureCause = {
|
|
799
|
+
code: string;
|
|
800
|
+
message: string;
|
|
801
|
+
};
|
|
772
802
|
/**
|
|
773
803
|
* Error raised when a streamed commit submission fails after an ambiguous or
|
|
774
804
|
* partial append.
|
|
@@ -802,6 +832,19 @@ declare class PartialStreamSubmissionError extends Error {
|
|
|
802
832
|
completedOperations: SubmittedStreamResult['operations'];
|
|
803
833
|
});
|
|
804
834
|
}
|
|
835
|
+
/**
|
|
836
|
+
* Error raised when the stream append path completed deterministically but
|
|
837
|
+
* every submitted operation failed.
|
|
838
|
+
* @see https://docs.warmhub.ai/sdk-reference/classes/allstreamoperationsfailederror/
|
|
839
|
+
*/
|
|
840
|
+
declare class AllStreamOperationsFailedError extends Error {
|
|
841
|
+
readonly code = "STREAM_ALL_OPERATIONS_FAILED";
|
|
842
|
+
readonly result: SubmittedStreamResult;
|
|
843
|
+
readonly operations: SubmittedStreamResult['operations'];
|
|
844
|
+
readonly statusCounts: NonNullable<SubmittedStreamResult['statusCounts']>;
|
|
845
|
+
readonly cause?: StreamFailureCause;
|
|
846
|
+
constructor(result: SubmittedStreamResult);
|
|
847
|
+
}
|
|
805
848
|
/**
|
|
806
849
|
* Submit `operations` to the WarmHub stream-append surface, chunked to
|
|
807
850
|
* stay under MAX_STREAM_APPEND_OPERATION_COUNT.
|
|
@@ -879,6 +922,7 @@ declare class PartialStreamSubmissionError extends Error {
|
|
|
879
922
|
* full idempotency contract.
|
|
880
923
|
*
|
|
881
924
|
* @see https://docs.warmhub.ai/sdk/transient-retry/
|
|
925
|
+
* @internal
|
|
882
926
|
*/
|
|
883
927
|
declare function submitOperationsViaStream(client: OperationStreamClient, args: {
|
|
884
928
|
orgName: string;
|
|
@@ -910,6 +954,61 @@ type CollectionAbout$1 = {
|
|
|
910
954
|
list: string[];
|
|
911
955
|
};
|
|
912
956
|
|
|
957
|
+
/**
|
|
958
|
+
* Canonical request signing for component CLI dispatch.
|
|
959
|
+
*
|
|
960
|
+
* Component workers expose CLI methods over HTTP. The platform dispatcher
|
|
961
|
+
* signs each call with HMAC-SHA256 over a canonical request representation
|
|
962
|
+
* so the worker can authenticate the caller without sharing more than a
|
|
963
|
+
* single secret. The same canonical input works for GET and POST methods:
|
|
964
|
+
* the difference is whether the method args ride in the query string or
|
|
965
|
+
* the body.
|
|
966
|
+
*
|
|
967
|
+
* Canonical signing input:
|
|
968
|
+
* <METHOD>\n<PATH>\n<CANONICAL_QUERY>\n<INSTALL_REPO>\n<SHA256_HEX(BODY)>\n<TIMESTAMP>
|
|
969
|
+
*
|
|
970
|
+
* Where:
|
|
971
|
+
* - METHOD is the uppercased HTTP method ('GET' | 'POST').
|
|
972
|
+
* - PATH is the URL path component (no scheme, host, or query).
|
|
973
|
+
* - CANONICAL_QUERY is `canonicalCliQueryString(query)` — sorted, RFC 3986
|
|
974
|
+
* percent-encoded, omitting undefined / null entries.
|
|
975
|
+
* - INSTALL_REPO is the `<org>/<repo>` slug of the install, transmitted on
|
|
976
|
+
* the wire as the `X-WarmHub-Install-Repo` header.
|
|
977
|
+
* - BODY is the raw request body string ('' for GET).
|
|
978
|
+
* - TIMESTAMP is unix-seconds since epoch (string-formatted).
|
|
979
|
+
*
|
|
980
|
+
* Verifiers should enforce a tolerance window on the timestamp to bound
|
|
981
|
+
* replay attacks (default 300 s); they should also compare signatures in
|
|
982
|
+
* constant time.
|
|
983
|
+
*
|
|
984
|
+
* This module is intentionally low-level: component authors import the
|
|
985
|
+
* higher-level `verifyCliCall(request, secret)` wrapper from
|
|
986
|
+
* `@warmhub/sdk-ts`, which extracts the canonical inputs from a Fetch
|
|
987
|
+
* `Request` and calls `verifyCliRequest` for them.
|
|
988
|
+
*/
|
|
989
|
+
/**
|
|
990
|
+
* Wire header names for component CLI dispatch — the single source of truth
|
|
991
|
+
* shared by the backend dispatcher (which sets them) and `verifyCliCall` (which
|
|
992
|
+
* reads them). The install repo always rides in {@link CLI_INSTALL_REPO_HEADER};
|
|
993
|
+
* the signing scheme adds {@link CLI_SIGNATURE_HEADER} + {@link CLI_TIMESTAMP_HEADER}.
|
|
994
|
+
* @see https://docs.warmhub.ai/sdk-reference/variables/cli_install_repo_header/
|
|
995
|
+
*/
|
|
996
|
+
declare const CLI_INSTALL_REPO_HEADER = "X-WarmHub-Install-Repo";
|
|
997
|
+
/**
|
|
998
|
+
* @see https://docs.warmhub.ai/sdk-reference/variables/cli_signature_header/
|
|
999
|
+
*/
|
|
1000
|
+
declare const CLI_SIGNATURE_HEADER = "X-WarmHub-Signature";
|
|
1001
|
+
/**
|
|
1002
|
+
* @see https://docs.warmhub.ai/sdk-reference/variables/cli_timestamp_header/
|
|
1003
|
+
*/
|
|
1004
|
+
declare const CLI_TIMESTAMP_HEADER = "X-WarmHub-Timestamp";
|
|
1005
|
+
/**
|
|
1006
|
+
* HTTP verbs a component CLI method can declare. No-body verbs (GET, DELETE)
|
|
1007
|
+
* carry args in the query string; body verbs (POST, PUT, PATCH) carry args in
|
|
1008
|
+
* the JSON body.
|
|
1009
|
+
*/
|
|
1010
|
+
type CliHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1011
|
+
|
|
913
1012
|
/**
|
|
914
1013
|
* Hardcoded meta-schema for validating shape definitions.
|
|
915
1014
|
* Shapes are NOT validated against a DB-stored shape — they validate against this constant.
|
|
@@ -991,6 +1090,103 @@ type ShapeValidatorResult = {
|
|
|
991
1090
|
warnings?: UndeclaredFieldsWarning;
|
|
992
1091
|
};
|
|
993
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* Server-side verifier for component CLI dispatch calls.
|
|
1095
|
+
*
|
|
1096
|
+
* Workers that expose CLI methods declared in their component manifest
|
|
1097
|
+
* receive authenticated requests from the WarmHub platform. The platform
|
|
1098
|
+
* supports four CLI auth schemes (selected via the component's
|
|
1099
|
+
* `credentials[]` entry) and this verifier accepts a request authenticated
|
|
1100
|
+
* under whichever schemes the install configured:
|
|
1101
|
+
*
|
|
1102
|
+
* 1. `CLI_SIGNING_SECRET` — HMAC-SHA256 over the canonical request,
|
|
1103
|
+
* transmitted as `X-WarmHub-Signature` + `X-WarmHub-Timestamp`.
|
|
1104
|
+
* 2. `CLI_BEARER_TOKEN` — `Authorization: Bearer <token>`.
|
|
1105
|
+
* 3. `CLI_API_KEY` (+ optional `CLI_API_KEY_HEADER`, default `X-API-Key`)
|
|
1106
|
+
* — custom header carrying the key.
|
|
1107
|
+
* 4. `CLI_BASIC_USERNAME` + `CLI_BASIC_PASSWORD` — `Authorization: Basic …`.
|
|
1108
|
+
*
|
|
1109
|
+
* Multiple schemes can be configured at once; in that case the verifier
|
|
1110
|
+
* requires ALL of them to validate (downgrade-attack defense — an attacker
|
|
1111
|
+
* who learns only one credential can't drop the other from the request).
|
|
1112
|
+
* If none are configured, the call is rejected as misconfigured.
|
|
1113
|
+
*
|
|
1114
|
+
* import { verifyCliCall } from '@warmhub/sdk-ts'
|
|
1115
|
+
*
|
|
1116
|
+
* app.get('/list-reputations', async (c) => {
|
|
1117
|
+
* const { args, installRepo } = await verifyCliCall(c.req.raw, c.env)
|
|
1118
|
+
* return c.json(await listReputations(db, args.scope, args.limit, args.cursor))
|
|
1119
|
+
* })
|
|
1120
|
+
*
|
|
1121
|
+
* Wire format (orthogonal to the auth scheme):
|
|
1122
|
+
* - GET / DELETE: method args ride in the URL query string. Body is empty.
|
|
1123
|
+
* - POST / PUT / PATCH: method args are the JSON body (no envelope wrapper).
|
|
1124
|
+
* - The install repo always rides in `X-WarmHub-Install-Repo`.
|
|
1125
|
+
*
|
|
1126
|
+
* Throws `CliCallVerificationError` on any failure. The error's `reason`
|
|
1127
|
+
* field is one of a small fixed set so callers can map onto HTTP statuses
|
|
1128
|
+
* without string-matching messages.
|
|
1129
|
+
* @see https://docs.warmhub.ai/sdk-reference/type-aliases/clicallverificationfailurereason/
|
|
1130
|
+
*/
|
|
1131
|
+
|
|
1132
|
+
type CliCallVerificationFailureReason = 'missing-signature' | 'missing-timestamp' | 'invalid-timestamp' | 'missing-install-repo' | 'unsupported-method' | 'invalid-signature' | 'invalid-format' | 'expired' | 'invalid-body' | 'no-scheme-configured' | 'invalid-bearer' | 'invalid-api-key' | 'invalid-basic';
|
|
1133
|
+
/**
|
|
1134
|
+
* @see https://docs.warmhub.ai/sdk-reference/classes/clicallverificationerror/
|
|
1135
|
+
*/
|
|
1136
|
+
declare class CliCallVerificationError extends Error {
|
|
1137
|
+
readonly reason: CliCallVerificationFailureReason;
|
|
1138
|
+
constructor(reason: CliCallVerificationFailureReason, message: string);
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* @see https://docs.warmhub.ai/sdk-reference/interfaces/verifiedclicall/
|
|
1142
|
+
*/
|
|
1143
|
+
interface VerifiedCliCall {
|
|
1144
|
+
/** HTTP method the request arrived on. */
|
|
1145
|
+
method: CliHttpMethod;
|
|
1146
|
+
/**
|
|
1147
|
+
* `<org>/<repo>` slug of the install, from the install-repo header.
|
|
1148
|
+
*
|
|
1149
|
+
* Only cryptographically bound under the signing scheme (the HMAC covers the
|
|
1150
|
+
* install repo). Under token schemes (bearer / api-key / basic) it is
|
|
1151
|
+
* caller-asserted — verifying the request does NOT prove the caller is
|
|
1152
|
+
* entitled to this install. When the install repo drives authorization, bind
|
|
1153
|
+
* it (resolve the per-install secret keyed by this value and verify with it)
|
|
1154
|
+
* or require the signing scheme. See docs/dev/component-rules.md → "What each
|
|
1155
|
+
* scheme binds".
|
|
1156
|
+
*/
|
|
1157
|
+
installRepo: string;
|
|
1158
|
+
/** Method args — query params for GET, parsed JSON body for POST/PUT/PATCH. */
|
|
1159
|
+
args: Record<string, string | number | boolean | undefined>;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Secret bundle accepted by `verifyCliCall`. Pass your worker's full env
|
|
1163
|
+
* (e.g. `c.env`) or just the CLI_* subset — the verifier looks only at the
|
|
1164
|
+
* keys it knows.
|
|
1165
|
+
* @see https://docs.warmhub.ai/sdk-reference/type-aliases/clicallsecrets/
|
|
1166
|
+
*/
|
|
1167
|
+
type CliCallSecrets = Partial<{
|
|
1168
|
+
CLI_SIGNING_SECRET: string;
|
|
1169
|
+
CLI_BEARER_TOKEN: string;
|
|
1170
|
+
CLI_API_KEY: string;
|
|
1171
|
+
/** Custom header name for `CLI_API_KEY`. Defaults to `X-API-Key`. */
|
|
1172
|
+
CLI_API_KEY_HEADER: string;
|
|
1173
|
+
CLI_BASIC_USERNAME: string;
|
|
1174
|
+
CLI_BASIC_PASSWORD: string;
|
|
1175
|
+
}> & Record<string, string | undefined>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Verify and parse an inbound component CLI call.
|
|
1178
|
+
*
|
|
1179
|
+
* @param request - The Fetch `Request` as received by the worker.
|
|
1180
|
+
* @param secrets - Credential set values (see `CliCallSecrets`).
|
|
1181
|
+
* @param opts - Optional overrides. `nowUnixSeconds` defaults to the
|
|
1182
|
+
* current wall clock; `toleranceSec` defaults to 300 s.
|
|
1183
|
+
* @see https://docs.warmhub.ai/sdk-reference/functions/verifyclicall/
|
|
1184
|
+
*/
|
|
1185
|
+
declare function verifyCliCall(request: Request, secrets: CliCallSecrets, opts?: {
|
|
1186
|
+
nowUnixSeconds?: number;
|
|
1187
|
+
toleranceSec?: number;
|
|
1188
|
+
}): Promise<VerifiedCliCall>;
|
|
1189
|
+
|
|
994
1190
|
/**
|
|
995
1191
|
* Shape field definitions — the value side of a shape's data.fields
|
|
996
1192
|
* @see https://docs.warmhub.ai/sdk-reference/type-aliases/shapefields/
|
|
@@ -1169,7 +1365,7 @@ type ReviseInput = Omit<ReviseOp, 'operation'> | ReviseOp;
|
|
|
1169
1365
|
* const result = await cb.commit({ client, orgName: "acme", repoName: "world" });
|
|
1170
1366
|
* ```
|
|
1171
1367
|
*
|
|
1172
|
-
* @see https://docs.warmhub.ai/sdk/
|
|
1368
|
+
* @see https://docs.warmhub.ai/sdk/write-methods/
|
|
1173
1369
|
*/
|
|
1174
1370
|
declare class OperationBuilder {
|
|
1175
1371
|
private readonly ops;
|
|
@@ -1257,7 +1453,7 @@ declare class OperationBuilder {
|
|
|
1257
1453
|
/**
|
|
1258
1454
|
* Validate, submit, and seal the builder.
|
|
1259
1455
|
*
|
|
1260
|
-
* A successful call submits operations through the same stream path as `client.commit.apply` and makes the builder single-use. Validation failures throw before any server request is made. Ambiguous multi-chunk failures surface as `PartialStreamSubmissionError
|
|
1456
|
+
* A successful call submits operations through the same stream path as `client.commit.apply` and makes the builder single-use. Validation failures throw before any server request is made. Ambiguous multi-chunk failures surface as `PartialStreamSubmissionError`; deterministic all-failed batches surface as `AllStreamOperationsFailedError` with per-op failure data.
|
|
1261
1457
|
*
|
|
1262
1458
|
* @param params.client WarmHub client or compatible stream client used for submission.
|
|
1263
1459
|
* @param params.message Optional commit message.
|
|
@@ -1703,12 +1899,14 @@ type OrgMemberList = {
|
|
|
1703
1899
|
};
|
|
1704
1900
|
/**
|
|
1705
1901
|
* Repository metadata returned by `client.repo.get`, `create`,
|
|
1706
|
-
* `setDescription`, `setVisibility`, `rename`, `
|
|
1902
|
+
* `setDescription`, `setDisplayName`, `setVisibility`, `rename`, `update`,
|
|
1903
|
+
* `archive`, and `unarchive`.
|
|
1707
1904
|
* @see https://docs.warmhub.ai/sdk-reference/type-aliases/repoinfo/
|
|
1708
1905
|
*/
|
|
1709
1906
|
type RepoInfo = {
|
|
1710
1907
|
orgName: string;
|
|
1711
1908
|
name: string;
|
|
1909
|
+
displayName: string;
|
|
1712
1910
|
description?: string;
|
|
1713
1911
|
visibility: 'public' | 'private';
|
|
1714
1912
|
archivedAt?: number;
|
|
@@ -1736,6 +1934,7 @@ type RepoStatsBatchResult = RepoStatsBatchResult$1;
|
|
|
1736
1934
|
type RepoWithStatsInfo = {
|
|
1737
1935
|
orgName: string;
|
|
1738
1936
|
name: string;
|
|
1937
|
+
displayName: string;
|
|
1739
1938
|
description?: string;
|
|
1740
1939
|
visibility: 'public' | 'private';
|
|
1741
1940
|
archivedAt?: number;
|
|
@@ -2367,6 +2566,16 @@ declare function isConnectionError(error: unknown): boolean;
|
|
|
2367
2566
|
* @see https://docs.warmhub.ai/sdk-reference/functions/connectionerrormessage/
|
|
2368
2567
|
*/
|
|
2369
2568
|
declare function connectionErrorMessage(url: string): string;
|
|
2569
|
+
/**
|
|
2570
|
+
* Returns true when `version` is strictly older than `minimum`. Both
|
|
2571
|
+
* arguments must parse as semver-shaped strings (major.minor.patch with
|
|
2572
|
+
* optional prerelease and build metadata); non-parseable inputs return
|
|
2573
|
+
* false (fail-open) so a malformed `minSupportedSdk` from a future
|
|
2574
|
+
* backend cannot brick existing clients.
|
|
2575
|
+
*
|
|
2576
|
+
* @internal
|
|
2577
|
+
*/
|
|
2578
|
+
declare function sdkVersionIsBelowMinimum(version: string, minimum: string): boolean;
|
|
2370
2579
|
/**
|
|
2371
2580
|
* Primary TypeScript client for the WarmHub API.
|
|
2372
2581
|
*
|
|
@@ -2390,6 +2599,7 @@ declare class WarmHubClient {
|
|
|
2390
2599
|
protected readonly functionLogMode: FunctionLogMode;
|
|
2391
2600
|
protected readonly getToken?: () => Promise<string | undefined>;
|
|
2392
2601
|
private readonly trpc;
|
|
2602
|
+
private compatibilityCheck?;
|
|
2393
2603
|
/**
|
|
2394
2604
|
* Authentication helpers for browser sign-in flows, session checks, and token diagnostics.
|
|
2395
2605
|
* @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#auth
|
|
@@ -2451,6 +2661,20 @@ declare class WarmHubClient {
|
|
|
2451
2661
|
* Return backend API version, minimum supported SDK version, and feature flags.
|
|
2452
2662
|
*/
|
|
2453
2663
|
capabilities: () => Promise<Capabilities>;
|
|
2664
|
+
/**
|
|
2665
|
+
* Verify the installed SDK is at or above the backend's advertised
|
|
2666
|
+
* minimum supported version, throwing a `WarmHubError` with a clear
|
|
2667
|
+
* "upgrade to >=X" message when it is not.
|
|
2668
|
+
*
|
|
2669
|
+
* Call this once at startup (e.g. immediately after constructing the
|
|
2670
|
+
* client) to fail fast on SDK version skew, rather than discovering a
|
|
2671
|
+
* removed route deep in the commit pipeline as an opaque error.
|
|
2672
|
+
* The result is cached on the client instance — repeated calls reuse
|
|
2673
|
+
* the first network round-trip and re-throw the same error if too old.
|
|
2674
|
+
*
|
|
2675
|
+
* @see https://github.com/warmhub/warmhub-app/issues/3081
|
|
2676
|
+
*/
|
|
2677
|
+
assertCompatible: () => Promise<void>;
|
|
2454
2678
|
};
|
|
2455
2679
|
/**
|
|
2456
2680
|
* Installed component inspection for packages that add shapes, subscriptions, credentials, and seed data to a repository.
|
|
@@ -2515,7 +2739,7 @@ declare class WarmHubClient {
|
|
|
2515
2739
|
/**
|
|
2516
2740
|
* High-level write surface for submitting WarmHub operations through the commit pipeline.
|
|
2517
2741
|
*
|
|
2518
|
-
* @see https://docs.warmhub.ai/sdk/
|
|
2742
|
+
* @see https://docs.warmhub.ai/sdk/write-methods/
|
|
2519
2743
|
*/
|
|
2520
2744
|
readonly commit: {
|
|
2521
2745
|
/**
|
|
@@ -2523,7 +2747,7 @@ declare class WarmHubClient {
|
|
|
2523
2747
|
*
|
|
2524
2748
|
* This is the primary write path for SDK callers. It streams operations to the backend, preserves server-side per-operation results, supports chunking for large submissions, and can attribute writes to a committer wref or installed component.
|
|
2525
2749
|
*
|
|
2526
|
-
* Simple first-chunk transport failures are retried by default.
|
|
2750
|
+
* Simple first-chunk transport failures are retried by default. Ambiguous failures surface as `PartialStreamSubmissionError`, including the case where an ambiguous attempt is followed by an all-failed retry; inspect `error.cause` for the underlying `AllStreamOperationsFailedError` or backend error. Deterministic all-failed submissions without prior ambiguity throw `AllStreamOperationsFailedError` directly so callers can inspect per-operation failure rows. Validation, auth, conflict, rate-limit, and other definite backend failures surface as `WarmHubError`. See [Transient Retry](/sdk/transient-retry/) for the full retry and partial-submission rules.
|
|
2527
2751
|
*
|
|
2528
2752
|
* Writing to an archived organization or repository fails with an `ARCHIVED` error before any operations are applied.
|
|
2529
2753
|
*
|
|
@@ -2670,7 +2894,7 @@ declare class WarmHubClient {
|
|
|
2670
2894
|
*
|
|
2671
2895
|
* The returned `total` is the sum of active shapes, things, and assertions. Use this when billing, quota checks, health reports, or per-shape breakdowns need single-repo stats.
|
|
2672
2896
|
*
|
|
2673
|
-
* The per-shape breakdown counts active things
|
|
2897
|
+
* The per-shape breakdown counts active things and assertions by shape.
|
|
2674
2898
|
*/
|
|
2675
2899
|
getStats: (orgName: string, repoName: string) => Promise<RepoStatsView>;
|
|
2676
2900
|
/**
|
|
@@ -2704,13 +2928,20 @@ declare class WarmHubClient {
|
|
|
2704
2928
|
*
|
|
2705
2929
|
* @param visibility `public` or `private`; defaults to `private`.
|
|
2706
2930
|
*/
|
|
2707
|
-
create: (orgName: string, repoName: string, description?: string, visibility?: RepoVisibility) => Promise<RepoInfo>;
|
|
2931
|
+
create: (orgName: string, repoName: string, description?: string, visibility?: RepoVisibility, displayName?: string) => Promise<RepoInfo>;
|
|
2708
2932
|
/**
|
|
2709
2933
|
* Set or clear a repository description.
|
|
2710
2934
|
*
|
|
2711
2935
|
* Descriptions are trimmed; empty strings clear the stored value.
|
|
2712
2936
|
*/
|
|
2713
2937
|
setDescription: (orgName: string, repoName: string, description?: string) => Promise<RepoInfo>;
|
|
2938
|
+
/**
|
|
2939
|
+
* Set a repository display name.
|
|
2940
|
+
*
|
|
2941
|
+
* `displayName` is required and non-empty (trimmed); slug fallback is a
|
|
2942
|
+
* creation-time behavior only and there is no clear-to-slug flow.
|
|
2943
|
+
*/
|
|
2944
|
+
setDisplayName: (orgName: string, repoName: string, displayName: string) => Promise<RepoInfo>;
|
|
2714
2945
|
/**
|
|
2715
2946
|
* Set a repository's visibility to `public` or `private`.
|
|
2716
2947
|
*/
|
|
@@ -2721,6 +2952,17 @@ declare class WarmHubClient {
|
|
|
2721
2952
|
* The new name must be unused in the organization and follow the same path-segment rules as repository creation.
|
|
2722
2953
|
*/
|
|
2723
2954
|
rename: (orgName: string, repoName: string, newName: string) => Promise<RepoInfo>;
|
|
2955
|
+
/**
|
|
2956
|
+
* Atomic combined update of a repository's display name and/or slug.
|
|
2957
|
+
*
|
|
2958
|
+
* Both writes run in a single backend transaction so a slug conflict cannot leave a partial display-name change behind. Pass at least one of `displayName` or `newName`. `displayName` is rejected when empty — slug fallback is a creation-time behavior only.
|
|
2959
|
+
*/
|
|
2960
|
+
update: (input: {
|
|
2961
|
+
orgName: string;
|
|
2962
|
+
repoName: string;
|
|
2963
|
+
displayName?: string;
|
|
2964
|
+
newName?: string;
|
|
2965
|
+
}) => Promise<RepoInfo>;
|
|
2724
2966
|
/**
|
|
2725
2967
|
* Archive a repository, blocking new writes.
|
|
2726
2968
|
*/
|
|
@@ -3394,4 +3636,4 @@ declare class WarmHubClient {
|
|
|
3394
3636
|
private watchRepoQuery;
|
|
3395
3637
|
}
|
|
3396
3638
|
|
|
3397
|
-
export { type AboutOptions, type AboutResult, type AccessTokenProvider, type ActionAttemptInfo, type ActionLeaseAcquire, type ActionLeaseOp, type ActionListNotificationsOptions, type ActionListRunsOptions, type ActionLiveFeed, type ActionLiveFeedOptions, type ActionNotificationInfo, type ActionRunInfo, type AddOp, type AddOperation, type Assertion, CONTENT_FIELD_LIMIT_ERROR, type CollectionAbout, type CollectionTag, type ComponentInfo, type ComponentInstallSystemResult, type ComponentList, type ComponentListOptions, type ComponentView, type CoreErrorKind, type CountOptions, type CountResult, type CredentialAuditEntry, type CredentialDeleteResult, type CredentialGrantResult, type CredentialInfo, type CredentialKeyMutationResult, type CredentialRevokeResult, type CredentialUngrantResult, type CurrentUserInfo, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, type ErrorKind, type FilterOptions, type FilterResult, type FunctionLogMode, type HeadResult, type HistoryResult, type IndexedFieldEntry, type IndexedFieldsReport, type LiveHandle, type LiveRepoEvent, type LiveSubscriptionLogOptions, type LiveThingHeadOptions, type LiveThingHistoryOptions, type LiveWatchResult, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT, type Operation, OperationBuilder, type OperationBuilderClient, type OperationBuilderOp, type OperationBuilderOptions, type OperationSubmitResult, type OrgInfo, type OrgList, type OrgListMembersOptions, type OrgListOptions, type OrgMemberInfo, type OrgMemberList, type OrgRef, type OrgRole, type Page, type PageRequest, PartialStreamSubmissionError, type PingResult, type RefLink, type RefsOptions, type RefsResult, type RenameResult, type RepoConfigureStatsView, type RepoDescribeResult, type RepoInfo, type RepoList, type RepoListOptions, type RepoListPageOptions, type RepoListPageResult, type RepoLocator, type RepoRef, type RepoShapeInstanceCountsView, type RepoSort, type RepoStatsBatchResult, type RepoStatsView, type RepoWithStatsInfo, type RequestEvent, type ResolveWrefResult, type RetractOp, type RetractOperation, type RetryPolicyOptions, type ReviseOp, type ReviseOperation, SDK_VERSION, type SearchOptions, type SearchResult, type Shape, type ShapeChange, type ShapeCreateOptions, type ShapeFields, type ShapeGetOptions, type ShapeHistory, type ShapeHistoryOptions, type ShapeList, type ShapeListOptions, type ShapeRef, type ShapeRemove, type ShapeReviseOptions, type ShapeValidatorResult, type StreamAppendInput, type StreamAppendResult, type StreamContinuationState, type SubscriptionBindCredentialsResult, type SubscriptionCompatCreateInput, type SubscriptionCompatUpdateInput, type SubscriptionInfo, type SubscriptionList, type SubscriptionUnbindCredentialsResult, type SynthesizedRepoContent, type ThingDetail, type ThingGet, type ThingGetManyResult, type ThingGetOptions, type ThingGraphOptions, type ThingGraphResult, type ThingGraphValue, type ThingHead, type ThingHeadOptions, type ThingHeadRequest, type ThingHistory, type ThingHistoryOptions, type ThingItem, type TokenInfo, type TokenResult, type UndeclaredFieldsWarning, type ValidationDiagnostic, type ValidationResult, WarmHubClient, type WarmHubClientOptions, WarmHubError, type WherePredicate, type WhoamiInfo, type WhoamiScopeEntry, type WireScopeEntry, connectionErrorMessage, contentFieldLimitError, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, submitOperationsViaStream, toWarmHubError, validateAgainstShape };
|
|
3639
|
+
export { type AboutOptions, type AboutResult, type AccessTokenProvider, type ActionAttemptInfo, type ActionLeaseAcquire, type ActionLeaseOp, type ActionListNotificationsOptions, type ActionListRunsOptions, type ActionLiveFeed, type ActionLiveFeedOptions, type ActionNotificationInfo, type ActionRunInfo, type AddOp, type AddOperation, AllStreamOperationsFailedError, type Assertion, CLI_INSTALL_REPO_HEADER, CLI_SIGNATURE_HEADER, CLI_TIMESTAMP_HEADER, CONTENT_FIELD_LIMIT_ERROR, type CliCallSecrets, CliCallVerificationError, type CliCallVerificationFailureReason, type CollectionAbout, type CollectionTag, type ComponentInfo, type ComponentInstallSystemResult, type ComponentList, type ComponentListOptions, type ComponentView, type CoreErrorKind, type CountOptions, type CountResult, type CredentialAuditEntry, type CredentialDeleteResult, type CredentialGrantResult, type CredentialInfo, type CredentialKeyMutationResult, type CredentialRevokeResult, type CredentialUngrantResult, type CurrentUserInfo, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, type ErrorKind, type FilterOptions, type FilterResult, type FunctionLogMode, type HeadResult, type HistoryResult, type IndexedFieldEntry, type IndexedFieldsReport, type LiveHandle, type LiveRepoEvent, type LiveSubscriptionLogOptions, type LiveThingHeadOptions, type LiveThingHistoryOptions, type LiveWatchResult, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT, type Operation, OperationBuilder, type OperationBuilderClient, type OperationBuilderOp, type OperationBuilderOptions, type OperationSubmitResult, type OrgInfo, type OrgList, type OrgListMembersOptions, type OrgListOptions, type OrgMemberInfo, type OrgMemberList, type OrgRef, type OrgRole, type Page, type PageRequest, PartialStreamSubmissionError, type PingResult, type RefLink, type RefsOptions, type RefsResult, type RenameResult, type RepoConfigureStatsView, type RepoDescribeResult, type RepoInfo, type RepoList, type RepoListOptions, type RepoListPageOptions, type RepoListPageResult, type RepoLocator, type RepoRef, type RepoShapeInstanceCountsView, type RepoSort, type RepoStatsBatchResult, type RepoStatsView, type RepoWithStatsInfo, type RequestEvent, type ResolveWrefResult, type RetractOp, type RetractOperation, type RetryPolicyOptions, type ReviseOp, type ReviseOperation, SDK_VERSION, type SearchOptions, type SearchResult, type Shape, type ShapeChange, type ShapeCreateOptions, type ShapeFields, type ShapeGetOptions, type ShapeHistory, type ShapeHistoryOptions, type ShapeList, type ShapeListOptions, type ShapeRef, type ShapeRemove, type ShapeReviseOptions, type ShapeValidatorResult, type StreamAppendInput, type StreamAppendResult, type StreamContinuationState, type SubscriptionBindCredentialsResult, type SubscriptionCompatCreateInput, type SubscriptionCompatUpdateInput, type SubscriptionInfo, type SubscriptionList, type SubscriptionUnbindCredentialsResult, type SynthesizedRepoContent, type ThingDetail, type ThingGet, type ThingGetManyResult, type ThingGetOptions, type ThingGraphOptions, type ThingGraphResult, type ThingGraphValue, type ThingHead, type ThingHeadOptions, type ThingHeadRequest, type ThingHistory, type ThingHistoryOptions, type ThingItem, type TokenInfo, type TokenResult, type UndeclaredFieldsWarning, type ValidationDiagnostic, type ValidationResult, type VerifiedCliCall, WarmHubClient, type WarmHubClientOptions, WarmHubError, type WherePredicate, type WhoamiInfo, type WhoamiScopeEntry, type WireScopeEntry, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONTENT_FIELD_LIMIT_ERROR, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT, OperationBuilder, PartialStreamSubmissionError, SDK_VERSION, WarmHubClient, WarmHubError, connectionErrorMessage, contentFieldLimitError, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, submitOperationsViaStream, toWarmHubError, validateAgainstShape } from './chunk-
|
|
1
|
+
export { AllStreamOperationsFailedError, CLI_INSTALL_REPO_HEADER, CLI_SIGNATURE_HEADER, CLI_TIMESTAMP_HEADER, CONTENT_FIELD_LIMIT_ERROR, CliCallVerificationError, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT, OperationBuilder, PartialStreamSubmissionError, SDK_VERSION, WarmHubClient, WarmHubError, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall } from './chunk-E32PSLWS.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WarmHubClient } from './chunk-
|
|
2
|
-
export { DEFAULT_API_URL, SDK_VERSION, WarmHubClient, WarmHubError, toWarmHubError } from './chunk-
|
|
1
|
+
import { WarmHubClient } from './chunk-E32PSLWS.js';
|
|
2
|
+
export { DEFAULT_API_URL, SDK_VERSION, WarmHubClient, WarmHubError, toWarmHubError } from './chunk-E32PSLWS.js';
|
|
3
3
|
import { createContext, useMemo, useState, useEffect, useContext } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warmhub/sdk-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
6
|
+
"description": "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"warmhub",
|
|
9
|
+
"sdk",
|
|
10
|
+
"typescript",
|
|
11
|
+
"ai",
|
|
12
|
+
"agents",
|
|
13
|
+
"mcp",
|
|
14
|
+
"knowledge",
|
|
15
|
+
"knowledge-graph",
|
|
16
|
+
"assertions",
|
|
17
|
+
"trust",
|
|
18
|
+
"trpc"
|
|
19
|
+
],
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "WarmHub",
|
|
22
|
+
"url": "https://warmhub.ai"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://docs.warmhub.ai/get-started/quickstart/#connect-via-sdk",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"email": "support@warmhub.com"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22"
|
|
30
|
+
},
|
|
7
31
|
"main": "./dist/index.js",
|
|
8
32
|
"types": "./dist/index.d.ts",
|
|
9
33
|
"sideEffects": false,
|