@dyne/interfacer-client 0.3.5 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +128 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -1
- package/dist/index.d.ts +83 -1
- package/dist/index.js +127 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -52,6 +52,8 @@ interface InterfacerConfig {
|
|
|
52
52
|
};
|
|
53
53
|
/** Open Source Hardware analysis endpoint */
|
|
54
54
|
oshUrl?: string;
|
|
55
|
+
/** Feedback service base URL (reviews & comments) */
|
|
56
|
+
feedbackUrl?: string;
|
|
55
57
|
/** Location services */
|
|
56
58
|
location?: {
|
|
57
59
|
autocomplete: string;
|
|
@@ -527,6 +529,84 @@ declare class DppClient {
|
|
|
527
529
|
getFileUrl(fileId: string): string;
|
|
528
530
|
}
|
|
529
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Feedback client — reviews & comments via interfacer-feedback-service REST API.
|
|
534
|
+
*
|
|
535
|
+
* Auth: DID-signed headers (did-sign + did-pk), same pattern as DppClient.
|
|
536
|
+
* Ported from interfacer-gui lib/feedback.ts
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
interface Review {
|
|
540
|
+
id: string;
|
|
541
|
+
project_ulid: string;
|
|
542
|
+
user_ulid: string;
|
|
543
|
+
rating: number;
|
|
544
|
+
content?: string | null;
|
|
545
|
+
created_at: string;
|
|
546
|
+
updated_at: string;
|
|
547
|
+
}
|
|
548
|
+
interface ReviewSummary {
|
|
549
|
+
average_rating: number;
|
|
550
|
+
total_reviews: number;
|
|
551
|
+
rating_distribution: Record<number, number>;
|
|
552
|
+
}
|
|
553
|
+
interface Comment {
|
|
554
|
+
id: string;
|
|
555
|
+
project_ulid: string;
|
|
556
|
+
user_ulid: string;
|
|
557
|
+
parent_id?: string | null;
|
|
558
|
+
content: string;
|
|
559
|
+
attachments?: string | null;
|
|
560
|
+
status: string;
|
|
561
|
+
created_at: string;
|
|
562
|
+
updated_at: string;
|
|
563
|
+
}
|
|
564
|
+
interface GetReviewsParams {
|
|
565
|
+
limit?: number;
|
|
566
|
+
cursor?: number;
|
|
567
|
+
}
|
|
568
|
+
interface GetCommentsParams {
|
|
569
|
+
limit?: number;
|
|
570
|
+
cursor?: number;
|
|
571
|
+
parent_id?: string;
|
|
572
|
+
}
|
|
573
|
+
declare class FeedbackClient {
|
|
574
|
+
private config;
|
|
575
|
+
private store;
|
|
576
|
+
private baseUrl;
|
|
577
|
+
constructor(config: InterfacerConfig, store: KeyStorage);
|
|
578
|
+
private get url();
|
|
579
|
+
private get userId();
|
|
580
|
+
private signedHeaders;
|
|
581
|
+
private request;
|
|
582
|
+
/** Create or update a review (1-5 stars + optional text). Auth required. */
|
|
583
|
+
createReview(projectUlid: string, rating: number, content?: string): Promise<Review>;
|
|
584
|
+
/** Fetch paginated reviews for a project. Public. */
|
|
585
|
+
getReviews(projectUlid: string, params?: GetReviewsParams): Promise<{
|
|
586
|
+
reviews: Review[];
|
|
587
|
+
}>;
|
|
588
|
+
/** Fetch aggregated review stats for a project. Public. */
|
|
589
|
+
getReviewSummary(projectUlid: string): Promise<ReviewSummary>;
|
|
590
|
+
/** Fetch the current user's review for a project, or null. */
|
|
591
|
+
getUserReview(projectUlid: string): Promise<{
|
|
592
|
+
review: Review | null;
|
|
593
|
+
}>;
|
|
594
|
+
/** Delete a review by ID. Only the author can delete. Auth required. */
|
|
595
|
+
deleteReview(reviewId: string): Promise<{
|
|
596
|
+
status: string;
|
|
597
|
+
}>;
|
|
598
|
+
/** Post a comment (optionally as a reply to parent_id). Auth required. */
|
|
599
|
+
createComment(projectUlid: string, content: string, parentId?: string, attachments?: string): Promise<Comment>;
|
|
600
|
+
/** Fetch paginated comments for a project. Public. */
|
|
601
|
+
getComments(projectUlid: string, params?: GetCommentsParams): Promise<{
|
|
602
|
+
comments: Comment[];
|
|
603
|
+
}>;
|
|
604
|
+
/** Soft-delete a comment. Only the author can delete. Auth required. */
|
|
605
|
+
deleteComment(commentId: string): Promise<{
|
|
606
|
+
status: string;
|
|
607
|
+
}>;
|
|
608
|
+
}
|
|
609
|
+
|
|
530
610
|
/**
|
|
531
611
|
* File hashing and preparation for Zenflows and DPP uploads.
|
|
532
612
|
*
|
|
@@ -977,6 +1057,7 @@ declare class InterfacerClient {
|
|
|
977
1057
|
private _resources?;
|
|
978
1058
|
private _files?;
|
|
979
1059
|
private _dpp?;
|
|
1060
|
+
private _feedback?;
|
|
980
1061
|
private _inbox?;
|
|
981
1062
|
private _wallet?;
|
|
982
1063
|
private _social?;
|
|
@@ -988,6 +1069,7 @@ declare class InterfacerClient {
|
|
|
988
1069
|
get resources(): ResourceClient;
|
|
989
1070
|
get files(): FileClient;
|
|
990
1071
|
get dpp(): DppClient;
|
|
1072
|
+
get feedback(): FeedbackClient;
|
|
991
1073
|
get inbox(): InboxClient;
|
|
992
1074
|
get wallet(): WalletClient;
|
|
993
1075
|
get social(): SocialClient;
|
|
@@ -1158,4 +1240,4 @@ declare function signDidRequest(body: string, store: KeyStorage): Promise<{
|
|
|
1158
1240
|
*/
|
|
1159
1241
|
declare function signFileUpload(checksumHex: string, store: KeyStorage): Promise<string>;
|
|
1160
1242
|
|
|
1161
|
-
export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Contributor, type CreateProjectParams, type DerivedEndpoints, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FileClient, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, deriveEndpointsFromProxy, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
|
|
1243
|
+
export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Comment, type Contributor, type CreateProjectParams, type DerivedEndpoints, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FeedbackClient, FileClient, type GetCommentsParams, type GetReviewsParams, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, type Review, type ReviewSummary, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, deriveEndpointsFromProxy, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ interface InterfacerConfig {
|
|
|
52
52
|
};
|
|
53
53
|
/** Open Source Hardware analysis endpoint */
|
|
54
54
|
oshUrl?: string;
|
|
55
|
+
/** Feedback service base URL (reviews & comments) */
|
|
56
|
+
feedbackUrl?: string;
|
|
55
57
|
/** Location services */
|
|
56
58
|
location?: {
|
|
57
59
|
autocomplete: string;
|
|
@@ -527,6 +529,84 @@ declare class DppClient {
|
|
|
527
529
|
getFileUrl(fileId: string): string;
|
|
528
530
|
}
|
|
529
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Feedback client — reviews & comments via interfacer-feedback-service REST API.
|
|
534
|
+
*
|
|
535
|
+
* Auth: DID-signed headers (did-sign + did-pk), same pattern as DppClient.
|
|
536
|
+
* Ported from interfacer-gui lib/feedback.ts
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
interface Review {
|
|
540
|
+
id: string;
|
|
541
|
+
project_ulid: string;
|
|
542
|
+
user_ulid: string;
|
|
543
|
+
rating: number;
|
|
544
|
+
content?: string | null;
|
|
545
|
+
created_at: string;
|
|
546
|
+
updated_at: string;
|
|
547
|
+
}
|
|
548
|
+
interface ReviewSummary {
|
|
549
|
+
average_rating: number;
|
|
550
|
+
total_reviews: number;
|
|
551
|
+
rating_distribution: Record<number, number>;
|
|
552
|
+
}
|
|
553
|
+
interface Comment {
|
|
554
|
+
id: string;
|
|
555
|
+
project_ulid: string;
|
|
556
|
+
user_ulid: string;
|
|
557
|
+
parent_id?: string | null;
|
|
558
|
+
content: string;
|
|
559
|
+
attachments?: string | null;
|
|
560
|
+
status: string;
|
|
561
|
+
created_at: string;
|
|
562
|
+
updated_at: string;
|
|
563
|
+
}
|
|
564
|
+
interface GetReviewsParams {
|
|
565
|
+
limit?: number;
|
|
566
|
+
cursor?: number;
|
|
567
|
+
}
|
|
568
|
+
interface GetCommentsParams {
|
|
569
|
+
limit?: number;
|
|
570
|
+
cursor?: number;
|
|
571
|
+
parent_id?: string;
|
|
572
|
+
}
|
|
573
|
+
declare class FeedbackClient {
|
|
574
|
+
private config;
|
|
575
|
+
private store;
|
|
576
|
+
private baseUrl;
|
|
577
|
+
constructor(config: InterfacerConfig, store: KeyStorage);
|
|
578
|
+
private get url();
|
|
579
|
+
private get userId();
|
|
580
|
+
private signedHeaders;
|
|
581
|
+
private request;
|
|
582
|
+
/** Create or update a review (1-5 stars + optional text). Auth required. */
|
|
583
|
+
createReview(projectUlid: string, rating: number, content?: string): Promise<Review>;
|
|
584
|
+
/** Fetch paginated reviews for a project. Public. */
|
|
585
|
+
getReviews(projectUlid: string, params?: GetReviewsParams): Promise<{
|
|
586
|
+
reviews: Review[];
|
|
587
|
+
}>;
|
|
588
|
+
/** Fetch aggregated review stats for a project. Public. */
|
|
589
|
+
getReviewSummary(projectUlid: string): Promise<ReviewSummary>;
|
|
590
|
+
/** Fetch the current user's review for a project, or null. */
|
|
591
|
+
getUserReview(projectUlid: string): Promise<{
|
|
592
|
+
review: Review | null;
|
|
593
|
+
}>;
|
|
594
|
+
/** Delete a review by ID. Only the author can delete. Auth required. */
|
|
595
|
+
deleteReview(reviewId: string): Promise<{
|
|
596
|
+
status: string;
|
|
597
|
+
}>;
|
|
598
|
+
/** Post a comment (optionally as a reply to parent_id). Auth required. */
|
|
599
|
+
createComment(projectUlid: string, content: string, parentId?: string, attachments?: string): Promise<Comment>;
|
|
600
|
+
/** Fetch paginated comments for a project. Public. */
|
|
601
|
+
getComments(projectUlid: string, params?: GetCommentsParams): Promise<{
|
|
602
|
+
comments: Comment[];
|
|
603
|
+
}>;
|
|
604
|
+
/** Soft-delete a comment. Only the author can delete. Auth required. */
|
|
605
|
+
deleteComment(commentId: string): Promise<{
|
|
606
|
+
status: string;
|
|
607
|
+
}>;
|
|
608
|
+
}
|
|
609
|
+
|
|
530
610
|
/**
|
|
531
611
|
* File hashing and preparation for Zenflows and DPP uploads.
|
|
532
612
|
*
|
|
@@ -977,6 +1057,7 @@ declare class InterfacerClient {
|
|
|
977
1057
|
private _resources?;
|
|
978
1058
|
private _files?;
|
|
979
1059
|
private _dpp?;
|
|
1060
|
+
private _feedback?;
|
|
980
1061
|
private _inbox?;
|
|
981
1062
|
private _wallet?;
|
|
982
1063
|
private _social?;
|
|
@@ -988,6 +1069,7 @@ declare class InterfacerClient {
|
|
|
988
1069
|
get resources(): ResourceClient;
|
|
989
1070
|
get files(): FileClient;
|
|
990
1071
|
get dpp(): DppClient;
|
|
1072
|
+
get feedback(): FeedbackClient;
|
|
991
1073
|
get inbox(): InboxClient;
|
|
992
1074
|
get wallet(): WalletClient;
|
|
993
1075
|
get social(): SocialClient;
|
|
@@ -1158,4 +1240,4 @@ declare function signDidRequest(body: string, store: KeyStorage): Promise<{
|
|
|
1158
1240
|
*/
|
|
1159
1241
|
declare function signFileUpload(checksumHex: string, store: KeyStorage): Promise<string>;
|
|
1160
1242
|
|
|
1161
|
-
export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Contributor, type CreateProjectParams, type DerivedEndpoints, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FileClient, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, deriveEndpointsFromProxy, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
|
|
1243
|
+
export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Comment, type Contributor, type CreateProjectParams, type DerivedEndpoints, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FeedbackClient, FileClient, type GetCommentsParams, type GetReviewsParams, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, type Review, type ReviewSummary, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, deriveEndpointsFromProxy, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
|
package/dist/index.js
CHANGED
|
@@ -379,12 +379,10 @@ var FETCH_RESOURCES = gql`
|
|
|
379
379
|
node {
|
|
380
380
|
conformsTo { id name }
|
|
381
381
|
currentLocation { id name mappableAddress lat long }
|
|
382
|
-
id name classifiedAs note metadata
|
|
382
|
+
id name classifiedAs note metadata
|
|
383
383
|
images { hash name mimeType }
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
accountingQuantity { hasUnit { id label symbol } hasNumericalValue }
|
|
387
|
-
onhandQuantity { hasUnit { id label symbol } hasNumericalValue }
|
|
384
|
+
license
|
|
385
|
+
primaryAccountable { id name images { mimeType } }
|
|
388
386
|
}
|
|
389
387
|
}
|
|
390
388
|
}
|
|
@@ -1090,6 +1088,125 @@ var DppClient = class {
|
|
|
1090
1088
|
}
|
|
1091
1089
|
};
|
|
1092
1090
|
|
|
1091
|
+
// src/feedback/FeedbackClient.ts
|
|
1092
|
+
init_sign();
|
|
1093
|
+
var FeedbackClient = class {
|
|
1094
|
+
constructor(config, store) {
|
|
1095
|
+
this.config = config;
|
|
1096
|
+
this.store = store;
|
|
1097
|
+
this.baseUrl = config.feedbackUrl || "";
|
|
1098
|
+
}
|
|
1099
|
+
config;
|
|
1100
|
+
store;
|
|
1101
|
+
baseUrl;
|
|
1102
|
+
get url() {
|
|
1103
|
+
if (!this.baseUrl) throw new Error("feedbackUrl not configured");
|
|
1104
|
+
return this.baseUrl;
|
|
1105
|
+
}
|
|
1106
|
+
get userId() {
|
|
1107
|
+
return this.store.getItem("authId") ?? void 0;
|
|
1108
|
+
}
|
|
1109
|
+
// ─── DID Signing ───────────────────────────────────────────────────
|
|
1110
|
+
async signedHeaders(body) {
|
|
1111
|
+
const headers = {};
|
|
1112
|
+
const uid = this.userId;
|
|
1113
|
+
if (uid) headers["x-user-id"] = uid;
|
|
1114
|
+
if (body) {
|
|
1115
|
+
const did = await signDidRequest(body, this.store);
|
|
1116
|
+
Object.assign(headers, did);
|
|
1117
|
+
headers["Content-Type"] = "application/json";
|
|
1118
|
+
}
|
|
1119
|
+
return headers;
|
|
1120
|
+
}
|
|
1121
|
+
async request(method, path, body) {
|
|
1122
|
+
const json = body != null ? JSON.stringify(body) : void 0;
|
|
1123
|
+
const headers = await this.signedHeaders(json ?? void 0);
|
|
1124
|
+
const res = await fetch(`${this.url}${path}`, { method, headers, body: json });
|
|
1125
|
+
if (!res.ok) {
|
|
1126
|
+
let errMsg = res.statusText;
|
|
1127
|
+
try {
|
|
1128
|
+
const err = await res.json();
|
|
1129
|
+
errMsg = err.error || errMsg;
|
|
1130
|
+
} catch {
|
|
1131
|
+
}
|
|
1132
|
+
throw new Error(`Feedback ${method} ${path} failed: ${errMsg}`);
|
|
1133
|
+
}
|
|
1134
|
+
if (res.status === 204) return void 0;
|
|
1135
|
+
return res.json();
|
|
1136
|
+
}
|
|
1137
|
+
// ─── Reviews ───────────────────────────────────────────────────────
|
|
1138
|
+
/** Create or update a review (1-5 stars + optional text). Auth required. */
|
|
1139
|
+
async createReview(projectUlid, rating, content) {
|
|
1140
|
+
return this.request(
|
|
1141
|
+
"POST",
|
|
1142
|
+
`/api/v1/projects/${encodeURIComponent(projectUlid)}/reviews`,
|
|
1143
|
+
{ rating, content: content || null }
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
/** Fetch paginated reviews for a project. Public. */
|
|
1147
|
+
async getReviews(projectUlid, params) {
|
|
1148
|
+
const qs = new URLSearchParams();
|
|
1149
|
+
if (params?.limit != null) qs.set("limit", String(params.limit));
|
|
1150
|
+
if (params?.cursor != null) qs.set("cursor", String(params.cursor));
|
|
1151
|
+
const query = qs.toString();
|
|
1152
|
+
const path = `/api/v1/projects/${encodeURIComponent(projectUlid)}/reviews${query ? `?${query}` : ""}`;
|
|
1153
|
+
return this.request("GET", path);
|
|
1154
|
+
}
|
|
1155
|
+
/** Fetch aggregated review stats for a project. Public. */
|
|
1156
|
+
async getReviewSummary(projectUlid) {
|
|
1157
|
+
return this.request(
|
|
1158
|
+
"GET",
|
|
1159
|
+
`/api/v1/projects/${encodeURIComponent(projectUlid)}/reviews/summary`
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
/** Fetch the current user's review for a project, or null. */
|
|
1163
|
+
async getUserReview(projectUlid) {
|
|
1164
|
+
return this.request(
|
|
1165
|
+
"GET",
|
|
1166
|
+
`/api/v1/projects/${encodeURIComponent(projectUlid)}/reviews/mine`
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
/** Delete a review by ID. Only the author can delete. Auth required. */
|
|
1170
|
+
async deleteReview(reviewId) {
|
|
1171
|
+
return this.request(
|
|
1172
|
+
"DELETE",
|
|
1173
|
+
`/api/v1/reviews/${encodeURIComponent(reviewId)}`,
|
|
1174
|
+
{}
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
// ─── Comments ──────────────────────────────────────────────────────
|
|
1178
|
+
/** Post a comment (optionally as a reply to parent_id). Auth required. */
|
|
1179
|
+
async createComment(projectUlid, content, parentId, attachments) {
|
|
1180
|
+
return this.request(
|
|
1181
|
+
"POST",
|
|
1182
|
+
`/api/v1/projects/${encodeURIComponent(projectUlid)}/comments`,
|
|
1183
|
+
{
|
|
1184
|
+
content,
|
|
1185
|
+
parent_id: parentId || null,
|
|
1186
|
+
attachments: attachments || null
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
/** Fetch paginated comments for a project. Public. */
|
|
1191
|
+
async getComments(projectUlid, params) {
|
|
1192
|
+
const qs = new URLSearchParams();
|
|
1193
|
+
if (params?.limit != null) qs.set("limit", String(params.limit));
|
|
1194
|
+
if (params?.cursor != null) qs.set("cursor", String(params.cursor));
|
|
1195
|
+
if (params?.parent_id) qs.set("parent_id", params.parent_id);
|
|
1196
|
+
const query = qs.toString();
|
|
1197
|
+
const path = `/api/v1/projects/${encodeURIComponent(projectUlid)}/comments${query ? `?${query}` : ""}`;
|
|
1198
|
+
return this.request("GET", path);
|
|
1199
|
+
}
|
|
1200
|
+
/** Soft-delete a comment. Only the author can delete. Auth required. */
|
|
1201
|
+
async deleteComment(commentId) {
|
|
1202
|
+
return this.request(
|
|
1203
|
+
"DELETE",
|
|
1204
|
+
`/api/v1/comments/${encodeURIComponent(commentId)}`,
|
|
1205
|
+
{}
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1093
1210
|
// src/files/FileClient.ts
|
|
1094
1211
|
init_hashing();
|
|
1095
1212
|
var FileClient = class {
|
|
@@ -2144,6 +2261,7 @@ var InterfacerClient = class {
|
|
|
2144
2261
|
_resources;
|
|
2145
2262
|
_files;
|
|
2146
2263
|
_dpp;
|
|
2264
|
+
_feedback;
|
|
2147
2265
|
_inbox;
|
|
2148
2266
|
_wallet;
|
|
2149
2267
|
_social;
|
|
@@ -2169,6 +2287,9 @@ var InterfacerClient = class {
|
|
|
2169
2287
|
get dpp() {
|
|
2170
2288
|
return this._dpp ??= new DppClient(this.config, this.store);
|
|
2171
2289
|
}
|
|
2290
|
+
get feedback() {
|
|
2291
|
+
return this._feedback ??= new FeedbackClient(this.config, this.store);
|
|
2292
|
+
}
|
|
2172
2293
|
get inbox() {
|
|
2173
2294
|
return this._inbox ??= new InboxClient(this.config, this.store);
|
|
2174
2295
|
}
|
|
@@ -2265,6 +2386,7 @@ export {
|
|
|
2265
2386
|
CO2_THRESHOLDS_KG,
|
|
2266
2387
|
DppClient,
|
|
2267
2388
|
ENERGY_THRESHOLDS_KWH,
|
|
2389
|
+
FeedbackClient,
|
|
2268
2390
|
FileClient,
|
|
2269
2391
|
GraphQLClient,
|
|
2270
2392
|
ImportClient,
|