@hypercerts-org/sdk-core 0.10.0-beta.4 → 0.10.0-beta.6
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 +226 -0
- package/README.md +309 -45
- package/dist/index.cjs +2749 -347
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1961 -182
- package/dist/index.mjs +3769 -1397
- package/dist/index.mjs.map +1 -1
- package/dist/lexicons.cjs +446 -34
- package/dist/lexicons.cjs.map +1 -1
- package/dist/lexicons.d.ts +248 -8
- package/dist/lexicons.mjs +422 -11
- package/dist/lexicons.mjs.map +1 -1
- package/dist/testing.d.ts +56 -9
- package/dist/types.cjs +89 -9
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +438 -97
- package/dist/types.mjs +89 -9
- package/dist/types.mjs.map +1 -1
- package/package.json +4 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OAuthSession, NodeSavedSession, NodeSavedState } from '@atproto/oauth-client-node';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { EventEmitter } from 'eventemitter3';
|
|
4
|
-
import {
|
|
4
|
+
import { OverrideProperties, SetOptional } from 'type-fest';
|
|
5
|
+
import { ComAtprotoRepoStrongRef, AppCertifiedLocation, OrgHypercertsClaimActivity, OrgHypercertsClaimCollection, OrgHypercertsClaimRights, OrgHypercertsClaimContributionDetails, OrgHypercertsClaimContributorInformation, OrgHypercertsClaimMeasurement, OrgHypercertsClaimEvaluation, OrgHypercertsHelperWorkScopeTag, OrgHypercertsClaimEvidence, OrgHypercertsDefs } from '@hypercerts-org/lexicon';
|
|
5
6
|
export { BlobRef, JsonBlobRef } from '@atproto/lexicon';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -738,22 +739,28 @@ interface LoggerInterface {
|
|
|
738
739
|
* Zod schema for OAuth configuration validation.
|
|
739
740
|
*
|
|
740
741
|
* @remarks
|
|
741
|
-
* All URLs must be valid and use HTTPS in production.
|
|
742
|
-
*
|
|
742
|
+
* All URLs must be valid and use HTTPS in production. For local development,
|
|
743
|
+
* HTTP loopback URLs (localhost, 127.0.0.1, [::1]) are allowed.
|
|
744
|
+
* The `jwkPrivate` field should contain the private key in JWK (JSON Web Key) format as a string.
|
|
743
745
|
*/
|
|
744
746
|
declare const OAuthConfigSchema: z.ZodObject<{
|
|
745
747
|
/**
|
|
746
748
|
* URL to the OAuth client metadata JSON document.
|
|
747
749
|
* This document describes your application to the authorization server.
|
|
748
750
|
*
|
|
751
|
+
* For local development, you can use `http://localhost/` as a loopback client.
|
|
752
|
+
*
|
|
749
753
|
* @see https://atproto.com/specs/oauth#client-metadata
|
|
750
754
|
*/
|
|
751
|
-
clientId: z.ZodString
|
|
755
|
+
clientId: z.ZodEffects<z.ZodString, string, string>;
|
|
752
756
|
/**
|
|
753
757
|
* URL where users are redirected after authentication.
|
|
754
758
|
* Must match one of the redirect URIs in your client metadata.
|
|
759
|
+
*
|
|
760
|
+
* For local development, you can use HTTP loopback URLs like
|
|
761
|
+
* `http://127.0.0.1:3000/callback` or `http://localhost:3000/callback`.
|
|
755
762
|
*/
|
|
756
|
-
redirectUri: z.ZodString
|
|
763
|
+
redirectUri: z.ZodEffects<z.ZodString, string, string>;
|
|
757
764
|
/**
|
|
758
765
|
* OAuth scopes to request, space-separated.
|
|
759
766
|
*
|
|
@@ -787,8 +794,11 @@ declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
787
794
|
/**
|
|
788
795
|
* URL to your public JWKS (JSON Web Key Set) endpoint.
|
|
789
796
|
* Used by the authorization server to verify your client's signatures.
|
|
797
|
+
*
|
|
798
|
+
* For local development, you can serve JWKS from a loopback URL like
|
|
799
|
+
* `http://127.0.0.1:3000/.well-known/jwks.json`.
|
|
790
800
|
*/
|
|
791
|
-
jwksUri: z.ZodString
|
|
801
|
+
jwksUri: z.ZodEffects<z.ZodString, string, string>;
|
|
792
802
|
/**
|
|
793
803
|
* Private JWK (JSON Web Key) as a JSON string.
|
|
794
804
|
* Used for signing DPoP proofs and client assertions.
|
|
@@ -798,40 +808,78 @@ declare const OAuthConfigSchema: z.ZodObject<{
|
|
|
798
808
|
* Typically loaded from environment variables or a secrets manager.
|
|
799
809
|
*/
|
|
800
810
|
jwkPrivate: z.ZodString;
|
|
811
|
+
/**
|
|
812
|
+
* Enable development mode features (optional).
|
|
813
|
+
*
|
|
814
|
+
* When true, suppresses warnings about using HTTP loopback URLs.
|
|
815
|
+
* Should be set to true for local development to reduce console noise.
|
|
816
|
+
*
|
|
817
|
+
* @default false
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```typescript
|
|
821
|
+
* oauth: {
|
|
822
|
+
* clientId: "http://localhost/",
|
|
823
|
+
* redirectUri: "http://127.0.0.1:3000/callback",
|
|
824
|
+
* // ... other config
|
|
825
|
+
* developmentMode: true, // Suppress loopback warnings
|
|
826
|
+
* }
|
|
827
|
+
* ```
|
|
828
|
+
*/
|
|
829
|
+
developmentMode: z.ZodOptional<z.ZodBoolean>;
|
|
801
830
|
}, "strip", z.ZodTypeAny, {
|
|
802
831
|
clientId: string;
|
|
803
832
|
redirectUri: string;
|
|
804
833
|
scope: string;
|
|
805
834
|
jwksUri: string;
|
|
806
835
|
jwkPrivate: string;
|
|
836
|
+
developmentMode?: boolean | undefined;
|
|
807
837
|
}, {
|
|
808
838
|
clientId: string;
|
|
809
839
|
redirectUri: string;
|
|
810
840
|
scope: string;
|
|
811
841
|
jwksUri: string;
|
|
812
842
|
jwkPrivate: string;
|
|
843
|
+
developmentMode?: boolean | undefined;
|
|
813
844
|
}>;
|
|
814
845
|
/**
|
|
815
846
|
* Zod schema for server URL configuration.
|
|
816
847
|
*
|
|
817
848
|
* @remarks
|
|
818
849
|
* At least one server (PDS or SDS) should be configured for the SDK to be useful.
|
|
850
|
+
* For local development, HTTP loopback URLs are allowed.
|
|
819
851
|
*/
|
|
820
852
|
declare const ServerConfigSchema: z.ZodObject<{
|
|
821
853
|
/**
|
|
822
854
|
* Personal Data Server URL - the user's own AT Protocol server.
|
|
823
855
|
* This is the primary server for user data operations.
|
|
824
856
|
*
|
|
825
|
-
* @example
|
|
857
|
+
* @example Production
|
|
858
|
+
* ```typescript
|
|
859
|
+
* pds: "https://bsky.social"
|
|
860
|
+
* ```
|
|
861
|
+
*
|
|
862
|
+
* @example Local development
|
|
863
|
+
* ```typescript
|
|
864
|
+
* pds: "http://localhost:2583"
|
|
865
|
+
* ```
|
|
826
866
|
*/
|
|
827
|
-
pds: z.ZodOptional<z.ZodString
|
|
867
|
+
pds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
828
868
|
/**
|
|
829
869
|
* Shared Data Server URL - for collaborative data storage.
|
|
830
870
|
* Required for collaborator and organization operations.
|
|
831
871
|
*
|
|
832
|
-
* @example
|
|
872
|
+
* @example Production
|
|
873
|
+
* ```typescript
|
|
874
|
+
* sds: "https://sds.hypercerts.org"
|
|
875
|
+
* ```
|
|
876
|
+
*
|
|
877
|
+
* @example Local development
|
|
878
|
+
* ```typescript
|
|
879
|
+
* sds: "http://127.0.0.1:2584"
|
|
880
|
+
* ```
|
|
833
881
|
*/
|
|
834
|
-
sds: z.ZodOptional<z.ZodString
|
|
882
|
+
sds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
835
883
|
}, "strip", z.ZodTypeAny, {
|
|
836
884
|
pds?: string | undefined;
|
|
837
885
|
sds?: string | undefined;
|
|
@@ -877,14 +925,19 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
877
925
|
* URL to the OAuth client metadata JSON document.
|
|
878
926
|
* This document describes your application to the authorization server.
|
|
879
927
|
*
|
|
928
|
+
* For local development, you can use `http://localhost/` as a loopback client.
|
|
929
|
+
*
|
|
880
930
|
* @see https://atproto.com/specs/oauth#client-metadata
|
|
881
931
|
*/
|
|
882
|
-
clientId: z.ZodString
|
|
932
|
+
clientId: z.ZodEffects<z.ZodString, string, string>;
|
|
883
933
|
/**
|
|
884
934
|
* URL where users are redirected after authentication.
|
|
885
935
|
* Must match one of the redirect URIs in your client metadata.
|
|
936
|
+
*
|
|
937
|
+
* For local development, you can use HTTP loopback URLs like
|
|
938
|
+
* `http://127.0.0.1:3000/callback` or `http://localhost:3000/callback`.
|
|
886
939
|
*/
|
|
887
|
-
redirectUri: z.ZodString
|
|
940
|
+
redirectUri: z.ZodEffects<z.ZodString, string, string>;
|
|
888
941
|
/**
|
|
889
942
|
* OAuth scopes to request, space-separated.
|
|
890
943
|
*
|
|
@@ -918,8 +971,11 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
918
971
|
/**
|
|
919
972
|
* URL to your public JWKS (JSON Web Key Set) endpoint.
|
|
920
973
|
* Used by the authorization server to verify your client's signatures.
|
|
974
|
+
*
|
|
975
|
+
* For local development, you can serve JWKS from a loopback URL like
|
|
976
|
+
* `http://127.0.0.1:3000/.well-known/jwks.json`.
|
|
921
977
|
*/
|
|
922
|
-
jwksUri: z.ZodString
|
|
978
|
+
jwksUri: z.ZodEffects<z.ZodString, string, string>;
|
|
923
979
|
/**
|
|
924
980
|
* Private JWK (JSON Web Key) as a JSON string.
|
|
925
981
|
* Used for signing DPoP proofs and client assertions.
|
|
@@ -929,34 +985,71 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
929
985
|
* Typically loaded from environment variables or a secrets manager.
|
|
930
986
|
*/
|
|
931
987
|
jwkPrivate: z.ZodString;
|
|
988
|
+
/**
|
|
989
|
+
* Enable development mode features (optional).
|
|
990
|
+
*
|
|
991
|
+
* When true, suppresses warnings about using HTTP loopback URLs.
|
|
992
|
+
* Should be set to true for local development to reduce console noise.
|
|
993
|
+
*
|
|
994
|
+
* @default false
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```typescript
|
|
998
|
+
* oauth: {
|
|
999
|
+
* clientId: "http://localhost/",
|
|
1000
|
+
* redirectUri: "http://127.0.0.1:3000/callback",
|
|
1001
|
+
* // ... other config
|
|
1002
|
+
* developmentMode: true, // Suppress loopback warnings
|
|
1003
|
+
* }
|
|
1004
|
+
* ```
|
|
1005
|
+
*/
|
|
1006
|
+
developmentMode: z.ZodOptional<z.ZodBoolean>;
|
|
932
1007
|
}, "strip", z.ZodTypeAny, {
|
|
933
1008
|
clientId: string;
|
|
934
1009
|
redirectUri: string;
|
|
935
1010
|
scope: string;
|
|
936
1011
|
jwksUri: string;
|
|
937
1012
|
jwkPrivate: string;
|
|
1013
|
+
developmentMode?: boolean | undefined;
|
|
938
1014
|
}, {
|
|
939
1015
|
clientId: string;
|
|
940
1016
|
redirectUri: string;
|
|
941
1017
|
scope: string;
|
|
942
1018
|
jwksUri: string;
|
|
943
1019
|
jwkPrivate: string;
|
|
1020
|
+
developmentMode?: boolean | undefined;
|
|
944
1021
|
}>;
|
|
945
1022
|
servers: z.ZodOptional<z.ZodObject<{
|
|
946
1023
|
/**
|
|
947
1024
|
* Personal Data Server URL - the user's own AT Protocol server.
|
|
948
1025
|
* This is the primary server for user data operations.
|
|
949
1026
|
*
|
|
950
|
-
* @example
|
|
1027
|
+
* @example Production
|
|
1028
|
+
* ```typescript
|
|
1029
|
+
* pds: "https://bsky.social"
|
|
1030
|
+
* ```
|
|
1031
|
+
*
|
|
1032
|
+
* @example Local development
|
|
1033
|
+
* ```typescript
|
|
1034
|
+
* pds: "http://localhost:2583"
|
|
1035
|
+
* ```
|
|
951
1036
|
*/
|
|
952
|
-
pds: z.ZodOptional<z.ZodString
|
|
1037
|
+
pds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
953
1038
|
/**
|
|
954
1039
|
* Shared Data Server URL - for collaborative data storage.
|
|
955
1040
|
* Required for collaborator and organization operations.
|
|
956
1041
|
*
|
|
957
|
-
* @example
|
|
1042
|
+
* @example Production
|
|
1043
|
+
* ```typescript
|
|
1044
|
+
* sds: "https://sds.hypercerts.org"
|
|
1045
|
+
* ```
|
|
1046
|
+
*
|
|
1047
|
+
* @example Local development
|
|
1048
|
+
* ```typescript
|
|
1049
|
+
* sds: "http://127.0.0.1:2584"
|
|
1050
|
+
* ```
|
|
958
1051
|
*/
|
|
959
|
-
sds: z.ZodOptional<z.ZodString
|
|
1052
|
+
sds: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
960
1053
|
}, "strip", z.ZodTypeAny, {
|
|
961
1054
|
pds?: string | undefined;
|
|
962
1055
|
sds?: string | undefined;
|
|
@@ -989,6 +1082,7 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
989
1082
|
scope: string;
|
|
990
1083
|
jwksUri: string;
|
|
991
1084
|
jwkPrivate: string;
|
|
1085
|
+
developmentMode?: boolean | undefined;
|
|
992
1086
|
};
|
|
993
1087
|
servers?: {
|
|
994
1088
|
pds?: string | undefined;
|
|
@@ -1005,6 +1099,7 @@ declare const ATProtoSDKConfigSchema: z.ZodObject<{
|
|
|
1005
1099
|
scope: string;
|
|
1006
1100
|
jwksUri: string;
|
|
1007
1101
|
jwkPrivate: string;
|
|
1102
|
+
developmentMode?: boolean | undefined;
|
|
1008
1103
|
};
|
|
1009
1104
|
servers?: {
|
|
1010
1105
|
pds?: string | undefined;
|
|
@@ -1240,45 +1335,137 @@ interface ProgressStep {
|
|
|
1240
1335
|
* @packageDocumentation
|
|
1241
1336
|
*/
|
|
1242
1337
|
|
|
1338
|
+
type StrongRef = ComAtprotoRepoStrongRef.Main;
|
|
1243
1339
|
type HypercertClaim = OrgHypercertsClaimActivity.Main;
|
|
1244
1340
|
type HypercertRights = OrgHypercertsClaimRights.Main;
|
|
1245
|
-
type
|
|
1341
|
+
type HypercertContributionDetails = OrgHypercertsClaimContributionDetails.Main;
|
|
1342
|
+
type HypercertContributorInformation = OrgHypercertsClaimContributorInformation.Main;
|
|
1343
|
+
/** Contributor entry in an activity - can be inline or reference external records */
|
|
1344
|
+
type HypercertContributor = OrgHypercertsClaimActivity.Contributor;
|
|
1246
1345
|
type HypercertMeasurement = OrgHypercertsClaimMeasurement.Main;
|
|
1247
1346
|
type HypercertEvaluation = OrgHypercertsClaimEvaluation.Main;
|
|
1248
1347
|
type HypercertEvidence = OrgHypercertsClaimEvidence.Main;
|
|
1249
1348
|
type HypercertCollection = OrgHypercertsClaimCollection.Main;
|
|
1250
|
-
|
|
1349
|
+
/** Collection item with optional weight */
|
|
1350
|
+
type HypercertCollectionItem = OrgHypercertsClaimCollection.Item;
|
|
1351
|
+
/** Work scope tag for creating reusable scope atoms */
|
|
1352
|
+
type HypercertWorkScopeTag = OrgHypercertsHelperWorkScopeTag.Main;
|
|
1251
1353
|
type HypercertLocation = AppCertifiedLocation.Main;
|
|
1252
1354
|
/**
|
|
1253
1355
|
* Image input for SDK operations.
|
|
1254
1356
|
*
|
|
1255
|
-
*
|
|
1256
|
-
* - A URI reference (for external images)
|
|
1257
|
-
* - A Blob to be uploaded
|
|
1357
|
+
* Accepts either:
|
|
1358
|
+
* - A string URI reference (for external images)
|
|
1359
|
+
* - A Blob to be uploaded (will be converted to SmallImage or LargeImage)
|
|
1258
1360
|
*
|
|
1259
|
-
* The SDK will convert these to the appropriate lexicon types
|
|
1260
|
-
* - OrgHypercertsDefs.Uri
|
|
1261
|
-
* - OrgHypercertsDefs.SmallImage
|
|
1262
|
-
* - OrgHypercertsDefs.LargeImage
|
|
1361
|
+
* The SDK will convert these inputs to the appropriate lexicon types.
|
|
1263
1362
|
*/
|
|
1264
|
-
type HypercertImage =
|
|
1265
|
-
type: "uri";
|
|
1266
|
-
uri: string;
|
|
1267
|
-
} | {
|
|
1268
|
-
type: "blob";
|
|
1269
|
-
blob: Blob;
|
|
1270
|
-
};
|
|
1363
|
+
type HypercertImage = string | Blob;
|
|
1271
1364
|
/**
|
|
1272
1365
|
* Lexicon-defined image types (union of Uri and image blob types).
|
|
1273
|
-
*
|
|
1366
|
+
*
|
|
1367
|
+
* Used when working with stored records. Can be:
|
|
1368
|
+
* - OrgHypercertsDefs.Uri - External image reference
|
|
1369
|
+
* - OrgHypercertsDefs.SmallImage - Uploaded blob for avatars/thumbnails
|
|
1370
|
+
* - OrgHypercertsDefs.LargeImage - Uploaded blob for banners/covers
|
|
1274
1371
|
*/
|
|
1275
1372
|
type HypercertImageRecord = OrgHypercertsDefs.Uri | OrgHypercertsDefs.SmallImage | OrgHypercertsDefs.LargeImage;
|
|
1276
|
-
/** Hypercert with
|
|
1277
|
-
|
|
1373
|
+
/** Hypercert with resolved metadata */
|
|
1374
|
+
type HypercertWithMetadata = HypercertClaim & {
|
|
1375
|
+
resolvedRights?: HypercertRights;
|
|
1376
|
+
resolvedLocation?: HypercertLocation;
|
|
1377
|
+
};
|
|
1378
|
+
/** Project type alias (collection with type="project") */
|
|
1379
|
+
type HypercertProject = HypercertCollection & {
|
|
1380
|
+
type: "project";
|
|
1381
|
+
};
|
|
1382
|
+
/** Project with resolved metadata */
|
|
1383
|
+
type HypercertProjectWithMetadata = HypercertCollection & {
|
|
1384
|
+
resolvedLocation?: HypercertLocation;
|
|
1385
|
+
resolvedActivities?: HypercertClaim[];
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
type CollectionItemInput = SetOptional<OrgHypercertsClaimCollection.Item, "$type">;
|
|
1389
|
+
/**
|
|
1390
|
+
* Parameters for specifying a location in collection/project operations.
|
|
1391
|
+
* Supports three ways to specify location:
|
|
1392
|
+
*
|
|
1393
|
+
* 1. **StrongRef** - Direct reference with uri and cid (no record creation)
|
|
1394
|
+
* 2. **AT-URI string** - Reference to existing location record
|
|
1395
|
+
* 3. **Location object** - Full location data (lpVersion, srs, locationType, location, etc.)
|
|
1396
|
+
* with optional `$type` and `createdAt` fields
|
|
1397
|
+
* where-as location field can be a Blob (e.g., GeoJSON) that will be uploaded
|
|
1398
|
+
*
|
|
1399
|
+
* @example Using a StrongRef (no record creation)
|
|
1400
|
+
* ```typescript
|
|
1401
|
+
* const location: AttachLocationParams = { uri: "at://did:plc:test/app.certified.location/abc", cid: "bafyrei..." };
|
|
1402
|
+
* ```
|
|
1403
|
+
*
|
|
1404
|
+
* @example Using an AT-URI (fetches existing record)
|
|
1405
|
+
* ```typescript
|
|
1406
|
+
* const location: AttachLocationParams = "at://did:plc:test/app.certified.location/xyz";
|
|
1407
|
+
* ```
|
|
1408
|
+
*
|
|
1409
|
+
* @example Using a location object
|
|
1410
|
+
* ```typescript
|
|
1411
|
+
* const location: AttachLocationParams = {
|
|
1412
|
+
* lpVersion: "1.0.0",
|
|
1413
|
+
* srs: "EPSG:4326",
|
|
1414
|
+
* locationType: "coordinate-decimal",
|
|
1415
|
+
* location: "https://locationuri.com",
|
|
1416
|
+
* name: "San Francisco",
|
|
1417
|
+
* };
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
type CreateLocationParams = OverrideProperties<SetOptional<HypercertLocation, "$type" | "createdAt">, {
|
|
1421
|
+
location: string | Blob | HypercertLocation["location"];
|
|
1422
|
+
}>;
|
|
1423
|
+
type LocationParams = StrongRef | string | CreateLocationParams;
|
|
1424
|
+
/**
|
|
1425
|
+
* SDK input parameters for creating a collection.
|
|
1426
|
+
* Derived from lexicon type with $type and createdAt removed.
|
|
1427
|
+
* avatar/banner accept HypercertImage (string URI or Blob) for user convenience.
|
|
1428
|
+
* Location can be provided inline or via attachLocationToCollection().
|
|
1429
|
+
*/
|
|
1430
|
+
type CreateCollectionParams = OverrideProperties<SetOptional<OrgHypercertsClaimCollection.Main, "$type" | "createdAt">, {
|
|
1431
|
+
avatar?: HypercertImage;
|
|
1432
|
+
banner?: HypercertImage;
|
|
1433
|
+
items: CollectionItemInput[];
|
|
1434
|
+
/**
|
|
1435
|
+
* Optional location to attach to the collection.
|
|
1436
|
+
* Can be:
|
|
1437
|
+
* - StrongRef to reference existing location (uri + cid)
|
|
1438
|
+
* - string (AT-URI) to reference existing location (CID will be fetched)
|
|
1439
|
+
* - Location object to create a new location record
|
|
1440
|
+
*/
|
|
1441
|
+
location?: LocationParams;
|
|
1442
|
+
}>;
|
|
1443
|
+
/**
|
|
1444
|
+
* SDK input parameters for updating a collection.
|
|
1445
|
+
* All fields are optional.
|
|
1446
|
+
* avatar/banner accept HypercertImage (string URI or Blob), or null to remove.
|
|
1447
|
+
* Location can be updated inline or removed with null.
|
|
1448
|
+
*/
|
|
1449
|
+
type UpdateCollectionParams = Omit<Partial<CreateCollectionParams>, "avatar" | "banner" | "location"> & {
|
|
1450
|
+
avatar?: HypercertImage | null;
|
|
1451
|
+
banner?: HypercertImage | null;
|
|
1452
|
+
location?: LocationParams | null;
|
|
1453
|
+
};
|
|
1454
|
+
type CreateCollectionResult = {
|
|
1278
1455
|
uri: string;
|
|
1279
1456
|
cid: string;
|
|
1280
|
-
record:
|
|
1281
|
-
}
|
|
1457
|
+
record: HypercertCollection;
|
|
1458
|
+
};
|
|
1459
|
+
/**
|
|
1460
|
+
* SDK input parameters for creating a project.
|
|
1461
|
+
* Projects are collections with type="project" (set automatically).
|
|
1462
|
+
*/
|
|
1463
|
+
type CreateProjectParams = CreateCollectionParams;
|
|
1464
|
+
/**
|
|
1465
|
+
* SDK input parameters for updating a project.
|
|
1466
|
+
*/
|
|
1467
|
+
type UpdateProjectParams = UpdateCollectionParams;
|
|
1468
|
+
type CreateProjectResult = CreateCollectionResult;
|
|
1282
1469
|
|
|
1283
1470
|
/**
|
|
1284
1471
|
* Parameters for creating a new hypercert.
|
|
@@ -1360,14 +1547,12 @@ interface CreateHypercertParams {
|
|
|
1360
1547
|
description: string;
|
|
1361
1548
|
/**
|
|
1362
1549
|
* Scope of work or impact area.
|
|
1363
|
-
* Logical scope of the work using label-based conditions.
|
|
1550
|
+
* Logical scope of the work using label-based conditions.
|
|
1364
1551
|
*
|
|
1365
|
-
* @example
|
|
1552
|
+
* @example WorkScopeAll with atom references
|
|
1366
1553
|
*/
|
|
1367
|
-
workScope?: {
|
|
1368
|
-
|
|
1369
|
-
withinAnyOf?: string[];
|
|
1370
|
-
withinNoneOf?: string[];
|
|
1554
|
+
workScope?: OrgHypercertsDefs.WorkScopeAll | OrgHypercertsDefs.WorkScopeAny | OrgHypercertsDefs.WorkScopeNot | OrgHypercertsDefs.WorkScopeAtom | {
|
|
1555
|
+
$type: string;
|
|
1371
1556
|
};
|
|
1372
1557
|
/**
|
|
1373
1558
|
* Start date of the work period.
|
|
@@ -1419,34 +1604,7 @@ interface CreateHypercertParams {
|
|
|
1419
1604
|
/**
|
|
1420
1605
|
* Optional geographic location of the impact.
|
|
1421
1606
|
*/
|
|
1422
|
-
location?:
|
|
1423
|
-
/**
|
|
1424
|
-
* Location value/address.
|
|
1425
|
-
*
|
|
1426
|
-
* @example "San Francisco, CA, USA"
|
|
1427
|
-
*/
|
|
1428
|
-
value: string;
|
|
1429
|
-
/**
|
|
1430
|
-
* Human-readable location name.
|
|
1431
|
-
*
|
|
1432
|
-
* @example "SF Bay Area"
|
|
1433
|
-
*/
|
|
1434
|
-
name?: string;
|
|
1435
|
-
/**
|
|
1436
|
-
* Description of the location scope.
|
|
1437
|
-
*/
|
|
1438
|
-
description?: string;
|
|
1439
|
-
/**
|
|
1440
|
-
* Spatial Reference System identifier (required if location is provided).
|
|
1441
|
-
*
|
|
1442
|
-
* @example "EPSG:4326" for WGS84
|
|
1443
|
-
*/
|
|
1444
|
-
srs: string;
|
|
1445
|
-
/**
|
|
1446
|
-
* GeoJSON file as a Blob for precise boundaries.
|
|
1447
|
-
*/
|
|
1448
|
-
geojson?: Blob;
|
|
1449
|
-
};
|
|
1607
|
+
location?: LocationParams;
|
|
1450
1608
|
/**
|
|
1451
1609
|
* Optional list of contributions to the impact.
|
|
1452
1610
|
*
|
|
@@ -1471,7 +1629,7 @@ interface CreateHypercertParams {
|
|
|
1471
1629
|
/**
|
|
1472
1630
|
* Optional evidence supporting the impact claim.
|
|
1473
1631
|
*/
|
|
1474
|
-
evidence?:
|
|
1632
|
+
evidence?: Array<Omit<CreateHypercertEvidenceParams, "subjectUri">>;
|
|
1475
1633
|
/**
|
|
1476
1634
|
* Optional callback for progress updates during creation.
|
|
1477
1635
|
*
|
|
@@ -1496,6 +1654,45 @@ interface CreateOrganizationParams {
|
|
|
1496
1654
|
*/
|
|
1497
1655
|
description?: string;
|
|
1498
1656
|
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Input params for creating Hypercert evidence.
|
|
1659
|
+
*
|
|
1660
|
+
* Based on `org.hypercerts.claim.evidence` but:
|
|
1661
|
+
* - removes: $type, createdAt, subject, content
|
|
1662
|
+
* - adds: subjectUri, content (string | Blob)
|
|
1663
|
+
*/
|
|
1664
|
+
interface CreateHypercertEvidenceParams {
|
|
1665
|
+
/**
|
|
1666
|
+
* URI for the subject this evidence is attached to.
|
|
1667
|
+
*/
|
|
1668
|
+
subjectUri: string;
|
|
1669
|
+
/**
|
|
1670
|
+
* Evidence content.
|
|
1671
|
+
* - string: should be a URI.
|
|
1672
|
+
* - Blob: binary payload (e.g. image/pdf)
|
|
1673
|
+
*/
|
|
1674
|
+
content: string | Blob;
|
|
1675
|
+
/**
|
|
1676
|
+
* Title to describe the nature of the evidence.
|
|
1677
|
+
*/
|
|
1678
|
+
title: string;
|
|
1679
|
+
/**
|
|
1680
|
+
* Short description explaining what this evidence shows.
|
|
1681
|
+
*/
|
|
1682
|
+
shortDescription?: string;
|
|
1683
|
+
/**
|
|
1684
|
+
* Longer description describing the evidence in more detail.
|
|
1685
|
+
*/
|
|
1686
|
+
description?: string;
|
|
1687
|
+
/**
|
|
1688
|
+
* How this evidence relates to the subject.
|
|
1689
|
+
*/
|
|
1690
|
+
relationType?: "supports" | "challenges" | "clarifies" | (string & {});
|
|
1691
|
+
/**
|
|
1692
|
+
* Any additional custom fields supported by the record.
|
|
1693
|
+
*/
|
|
1694
|
+
[k: string]: unknown;
|
|
1695
|
+
}
|
|
1499
1696
|
/**
|
|
1500
1697
|
* Result of creating a hypercert.
|
|
1501
1698
|
*
|
|
@@ -1526,6 +1723,10 @@ interface CreateHypercertResult {
|
|
|
1526
1723
|
* AT-URIs of contribution records, if contributions were provided.
|
|
1527
1724
|
*/
|
|
1528
1725
|
contributionUris?: string[];
|
|
1726
|
+
/**
|
|
1727
|
+
* AT-URIs of evidence records, if evidence was provided.
|
|
1728
|
+
*/
|
|
1729
|
+
evidenceUris?: string[];
|
|
1529
1730
|
}
|
|
1530
1731
|
/**
|
|
1531
1732
|
* Low-level record operations for AT Protocol CRUD.
|
|
@@ -1840,6 +2041,67 @@ interface HypercertEvents {
|
|
|
1840
2041
|
uri: string;
|
|
1841
2042
|
cid: string;
|
|
1842
2043
|
};
|
|
2044
|
+
/**
|
|
2045
|
+
* Emitted when a collection is updated.
|
|
2046
|
+
*/
|
|
2047
|
+
collectionUpdated: {
|
|
2048
|
+
uri: string;
|
|
2049
|
+
cid: string;
|
|
2050
|
+
};
|
|
2051
|
+
/**
|
|
2052
|
+
* Emitted when a collection is deleted.
|
|
2053
|
+
*/
|
|
2054
|
+
collectionDeleted: {
|
|
2055
|
+
uri: string;
|
|
2056
|
+
};
|
|
2057
|
+
/**
|
|
2058
|
+
* Emitted when a location is attached to a collection.
|
|
2059
|
+
*/
|
|
2060
|
+
locationAttachedToCollection: {
|
|
2061
|
+
uri: string;
|
|
2062
|
+
cid: string;
|
|
2063
|
+
collectionUri: string;
|
|
2064
|
+
};
|
|
2065
|
+
/**
|
|
2066
|
+
* Emitted when a location is removed from a collection.
|
|
2067
|
+
*/
|
|
2068
|
+
locationRemovedFromCollection: {
|
|
2069
|
+
collectionUri: string;
|
|
2070
|
+
};
|
|
2071
|
+
/**
|
|
2072
|
+
* Emitted when a project is created.
|
|
2073
|
+
*/
|
|
2074
|
+
projectCreated: {
|
|
2075
|
+
uri: string;
|
|
2076
|
+
cid: string;
|
|
2077
|
+
};
|
|
2078
|
+
/**
|
|
2079
|
+
* Emitted when a project is updated.
|
|
2080
|
+
*/
|
|
2081
|
+
projectUpdated: {
|
|
2082
|
+
uri: string;
|
|
2083
|
+
cid: string;
|
|
2084
|
+
};
|
|
2085
|
+
/**
|
|
2086
|
+
* Emitted when a project is deleted.
|
|
2087
|
+
*/
|
|
2088
|
+
projectDeleted: {
|
|
2089
|
+
uri: string;
|
|
2090
|
+
};
|
|
2091
|
+
/**
|
|
2092
|
+
* Emitted when a location is attached to a project.
|
|
2093
|
+
*/
|
|
2094
|
+
locationAttachedToProject: {
|
|
2095
|
+
uri: string;
|
|
2096
|
+
cid: string;
|
|
2097
|
+
projectUri: string;
|
|
2098
|
+
};
|
|
2099
|
+
/**
|
|
2100
|
+
* Emitted when a location is removed from a project.
|
|
2101
|
+
*/
|
|
2102
|
+
locationRemovedFromProject: {
|
|
2103
|
+
projectUri: string;
|
|
2104
|
+
};
|
|
1843
2105
|
}
|
|
1844
2106
|
/**
|
|
1845
2107
|
* High-level hypercert operations.
|
|
@@ -1895,7 +2157,7 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
1895
2157
|
*/
|
|
1896
2158
|
update(params: {
|
|
1897
2159
|
uri: string;
|
|
1898
|
-
updates: Partial<
|
|
2160
|
+
updates: Partial<CreateHypercertParams>;
|
|
1899
2161
|
image?: Blob | null;
|
|
1900
2162
|
}): Promise<UpdateResult>;
|
|
1901
2163
|
/**
|
|
@@ -1941,21 +2203,14 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
1941
2203
|
* @param location.geojson - Optional GeoJSON blob for precise boundaries
|
|
1942
2204
|
* @returns Promise resolving to location record result
|
|
1943
2205
|
*/
|
|
1944
|
-
attachLocation(uri: string, location:
|
|
1945
|
-
value: string;
|
|
1946
|
-
name?: string;
|
|
1947
|
-
description?: string;
|
|
1948
|
-
srs: string;
|
|
1949
|
-
geojson?: Blob;
|
|
1950
|
-
}): Promise<CreateResult>;
|
|
2206
|
+
attachLocation(uri: string, location: LocationParams): Promise<CreateResult>;
|
|
1951
2207
|
/**
|
|
1952
2208
|
* Adds evidence to an existing hypercert.
|
|
1953
2209
|
*
|
|
1954
|
-
* @param
|
|
1955
|
-
* @param evidence - Array of evidence items to add
|
|
2210
|
+
* @param evidence - Evidence item to add
|
|
1956
2211
|
* @returns Promise resolving to update result
|
|
1957
2212
|
*/
|
|
1958
|
-
addEvidence(
|
|
2213
|
+
addEvidence(evidence: CreateHypercertEvidenceParams): Promise<UpdateResult>;
|
|
1959
2214
|
/**
|
|
1960
2215
|
* Creates a contribution record.
|
|
1961
2216
|
*
|
|
@@ -1997,18 +2252,9 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
1997
2252
|
* Creates a collection of hypercerts.
|
|
1998
2253
|
*
|
|
1999
2254
|
* @param params - Collection parameters
|
|
2000
|
-
* @returns Promise resolving to collection record result
|
|
2001
|
-
*/
|
|
2002
|
-
createCollection(params:
|
|
2003
|
-
title: string;
|
|
2004
|
-
claims: Array<{
|
|
2005
|
-
uri: string;
|
|
2006
|
-
cid: string;
|
|
2007
|
-
weight: string;
|
|
2008
|
-
}>;
|
|
2009
|
-
shortDescription?: string;
|
|
2010
|
-
coverPhoto?: Blob;
|
|
2011
|
-
}): Promise<CreateResult>;
|
|
2255
|
+
* @returns Promise resolving to collection record result with optional location URI
|
|
2256
|
+
*/
|
|
2257
|
+
createCollection(params: CreateCollectionParams): Promise<CreateCollectionResult>;
|
|
2012
2258
|
/**
|
|
2013
2259
|
* Gets a collection by URI.
|
|
2014
2260
|
*
|
|
@@ -2031,6 +2277,101 @@ interface HypercertOperations extends EventEmitter<HypercertEvents> {
|
|
|
2031
2277
|
cid: string;
|
|
2032
2278
|
record: HypercertCollection;
|
|
2033
2279
|
}>>;
|
|
2280
|
+
/**
|
|
2281
|
+
* Updates a collection.
|
|
2282
|
+
*
|
|
2283
|
+
* @param uri - AT-URI of the collection
|
|
2284
|
+
* @param updates - Fields to update
|
|
2285
|
+
* @returns Promise resolving to update result
|
|
2286
|
+
*/
|
|
2287
|
+
updateCollection(uri: string, updates: UpdateCollectionParams): Promise<UpdateResult>;
|
|
2288
|
+
/**
|
|
2289
|
+
* Deletes a collection.
|
|
2290
|
+
*
|
|
2291
|
+
* @param uri - AT-URI of the collection
|
|
2292
|
+
* @returns Promise resolving when deleted
|
|
2293
|
+
*/
|
|
2294
|
+
deleteCollection(uri: string): Promise<void>;
|
|
2295
|
+
/**
|
|
2296
|
+
* Attaches a location to a collection.
|
|
2297
|
+
*
|
|
2298
|
+
* @param uri - AT-URI of the collection
|
|
2299
|
+
* @param location - Location data
|
|
2300
|
+
* @returns Promise resolving to location record result
|
|
2301
|
+
*/
|
|
2302
|
+
attachLocationToCollection(uri: string, location: LocationParams): Promise<CreateResult>;
|
|
2303
|
+
/**
|
|
2304
|
+
* Removes a location from a collection.
|
|
2305
|
+
*
|
|
2306
|
+
* @param uri - AT-URI of the collection
|
|
2307
|
+
* @returns Promise resolving when location is removed
|
|
2308
|
+
*/
|
|
2309
|
+
removeLocationFromCollection(uri: string): Promise<void>;
|
|
2310
|
+
/**
|
|
2311
|
+
* Creates a project.
|
|
2312
|
+
*
|
|
2313
|
+
* A project is a collection with type='project' and optional location sidecar.
|
|
2314
|
+
*
|
|
2315
|
+
* @param params - Project parameters
|
|
2316
|
+
* @returns Promise resolving to project record result with optional location URI
|
|
2317
|
+
*/
|
|
2318
|
+
createProject(params: CreateProjectParams): Promise<CreateProjectResult>;
|
|
2319
|
+
/**
|
|
2320
|
+
* Gets a project by URI.
|
|
2321
|
+
*
|
|
2322
|
+
* Projects are collections with type='project'.
|
|
2323
|
+
*
|
|
2324
|
+
* @param uri - AT-URI of the project
|
|
2325
|
+
* @returns Promise resolving to project data (as collection)
|
|
2326
|
+
*/
|
|
2327
|
+
getProject(uri: string): Promise<{
|
|
2328
|
+
uri: string;
|
|
2329
|
+
cid: string;
|
|
2330
|
+
record: HypercertCollection;
|
|
2331
|
+
}>;
|
|
2332
|
+
/**
|
|
2333
|
+
* Lists projects with pagination.
|
|
2334
|
+
*
|
|
2335
|
+
* Projects are collections with type='project'.
|
|
2336
|
+
*
|
|
2337
|
+
* @param params - Optional pagination parameters
|
|
2338
|
+
* @returns Promise resolving to paginated list
|
|
2339
|
+
*/
|
|
2340
|
+
listProjects(params?: ListParams): Promise<PaginatedList<{
|
|
2341
|
+
uri: string;
|
|
2342
|
+
cid: string;
|
|
2343
|
+
record: HypercertCollection;
|
|
2344
|
+
}>>;
|
|
2345
|
+
/**
|
|
2346
|
+
* Updates a project.
|
|
2347
|
+
*
|
|
2348
|
+
* @param uri - AT-URI of the project
|
|
2349
|
+
* @param updates - Fields to update
|
|
2350
|
+
* @returns Promise resolving to update result
|
|
2351
|
+
*/
|
|
2352
|
+
updateProject(uri: string, updates: UpdateProjectParams): Promise<UpdateResult>;
|
|
2353
|
+
/**
|
|
2354
|
+
* Deletes a project.
|
|
2355
|
+
*
|
|
2356
|
+
* @param uri - AT-URI of the project
|
|
2357
|
+
* @returns Promise resolving when deleted
|
|
2358
|
+
*/
|
|
2359
|
+
deleteProject(uri: string): Promise<void>;
|
|
2360
|
+
/**
|
|
2361
|
+
* Attaches a location to a project.
|
|
2362
|
+
*
|
|
2363
|
+
* @param uri - AT-URI of the project
|
|
2364
|
+
* @param location - Location data
|
|
2365
|
+
* @returns Promise resolving to location record result
|
|
2366
|
+
*/
|
|
2367
|
+
attachLocationToProject(uri: string, location: LocationParams): Promise<CreateResult>;
|
|
2368
|
+
/**
|
|
2369
|
+
* Removes a location from a project.
|
|
2370
|
+
*
|
|
2371
|
+
* @param uri - AT-URI of the project
|
|
2372
|
+
* @returns Promise resolving when location is removed
|
|
2373
|
+
*/
|
|
2374
|
+
removeLocationFromProject(uri: string): Promise<void>;
|
|
2034
2375
|
}
|
|
2035
2376
|
/**
|
|
2036
2377
|
* Collaborator operations for SDS access control.
|
|
@@ -2250,4 +2591,4 @@ interface AuthorizeOptions {
|
|
|
2250
2591
|
}
|
|
2251
2592
|
|
|
2252
2593
|
export { ATProtoSDKConfigSchema, CollaboratorPermissionsSchema, CollaboratorSchema, OAuthConfigSchema, OrganizationSchema, ServerConfigSchema, TimeoutConfigSchema };
|
|
2253
|
-
export type { ATProtoSDKConfig, AuthorizeOptions, BlobOperations, CacheInterface, Collaborator, CollaboratorOperations, CollaboratorPermissions, CreateHypercertParams, CreateHypercertResult, CreateResult, DID, HypercertClaim, HypercertCollection,
|
|
2594
|
+
export type { ATProtoSDKConfig, AuthorizeOptions, BlobOperations, CacheInterface, Collaborator, CollaboratorOperations, CollaboratorPermissions, CreateHypercertParams, CreateHypercertResult, CreateProjectParams, CreateResult, DID, HypercertClaim, HypercertCollection, HypercertCollectionItem, HypercertContributionDetails, HypercertContributor, HypercertContributorInformation, HypercertEvaluation, HypercertEvents, HypercertEvidence, HypercertImage, HypercertImageRecord, HypercertLocation, HypercertMeasurement, HypercertOperations, HypercertProject, HypercertProjectWithMetadata, HypercertRights, HypercertWithMetadata, HypercertWorkScopeTag, ListParams, LoggerInterface, Organization, OrganizationInfo, OrganizationOperations, PaginatedList, ProfileOperations, ProgressStep, RecordOperations, RepositoryAccessGrant, RepositoryOptions, RepositoryRole, Session, SessionStore, StateStore, UpdateProjectParams, UpdateResult };
|