shred-api-client 2.9.7 → 2.9.9
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.d.ts +66 -2
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1940,6 +1940,22 @@ declare const FeedbackSchema: z.ZodObject<{
|
|
|
1940
1940
|
}[];
|
|
1941
1941
|
comment?: string | undefined;
|
|
1942
1942
|
}>;
|
|
1943
|
+
declare const RatingSchema: z.ZodObject<{
|
|
1944
|
+
score: z.ZodNumber;
|
|
1945
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
1946
|
+
timestamp: z.ZodNumber;
|
|
1947
|
+
deliveryIndex: z.ZodNumber;
|
|
1948
|
+
}, "strip", z.ZodTypeAny, {
|
|
1949
|
+
timestamp: number;
|
|
1950
|
+
score: number;
|
|
1951
|
+
deliveryIndex: number;
|
|
1952
|
+
comment?: string | undefined;
|
|
1953
|
+
}, {
|
|
1954
|
+
timestamp: number;
|
|
1955
|
+
score: number;
|
|
1956
|
+
deliveryIndex: number;
|
|
1957
|
+
comment?: string | undefined;
|
|
1958
|
+
}>;
|
|
1943
1959
|
declare const ProjectSchema: z.ZodObject<{
|
|
1944
1960
|
id: z.ZodString;
|
|
1945
1961
|
title: z.ZodString;
|
|
@@ -2058,6 +2074,22 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
2058
2074
|
type: InteractionType;
|
|
2059
2075
|
timestamp: number;
|
|
2060
2076
|
}>, "many">>;
|
|
2077
|
+
ratings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2078
|
+
score: z.ZodNumber;
|
|
2079
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
2080
|
+
timestamp: z.ZodNumber;
|
|
2081
|
+
deliveryIndex: z.ZodNumber;
|
|
2082
|
+
}, "strip", z.ZodTypeAny, {
|
|
2083
|
+
timestamp: number;
|
|
2084
|
+
score: number;
|
|
2085
|
+
deliveryIndex: number;
|
|
2086
|
+
comment?: string | undefined;
|
|
2087
|
+
}, {
|
|
2088
|
+
timestamp: number;
|
|
2089
|
+
score: number;
|
|
2090
|
+
deliveryIndex: number;
|
|
2091
|
+
comment?: string | undefined;
|
|
2092
|
+
}>, "many">>;
|
|
2061
2093
|
submitTimestamp: z.ZodNumber;
|
|
2062
2094
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
2063
2095
|
status: z.ZodNativeEnum<typeof Status$1>;
|
|
@@ -2112,6 +2144,12 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
2112
2144
|
type: InteractionType;
|
|
2113
2145
|
timestamp: number;
|
|
2114
2146
|
}[] | undefined;
|
|
2147
|
+
ratings?: {
|
|
2148
|
+
timestamp: number;
|
|
2149
|
+
score: number;
|
|
2150
|
+
deliveryIndex: number;
|
|
2151
|
+
comment?: string | undefined;
|
|
2152
|
+
}[] | undefined;
|
|
2115
2153
|
}, {
|
|
2116
2154
|
id: string;
|
|
2117
2155
|
userId: string;
|
|
@@ -2163,6 +2201,12 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
2163
2201
|
type: InteractionType;
|
|
2164
2202
|
timestamp: number;
|
|
2165
2203
|
}[] | undefined;
|
|
2204
|
+
ratings?: {
|
|
2205
|
+
timestamp: number;
|
|
2206
|
+
score: number;
|
|
2207
|
+
deliveryIndex: number;
|
|
2208
|
+
comment?: string | undefined;
|
|
2209
|
+
}[] | undefined;
|
|
2166
2210
|
}>;
|
|
2167
2211
|
type ProjectCreation = Pick<Project, "title" | "instructions" | "captionStyle" | "assets">;
|
|
2168
2212
|
type SendToApproval = {
|
|
@@ -2179,6 +2223,8 @@ type Project = z.infer<typeof ProjectSchema>;
|
|
|
2179
2223
|
type TimelineItem = z.infer<typeof TimelineItemSchema>;
|
|
2180
2224
|
type Interaction = z.infer<typeof InteractionSchema>;
|
|
2181
2225
|
type Feedback = z.infer<typeof FeedbackSchema>;
|
|
2226
|
+
type Rating = z.infer<typeof RatingSchema>;
|
|
2227
|
+
type RatingInput = Pick<Rating, "score" | "comment">;
|
|
2182
2228
|
|
|
2183
2229
|
interface IAPI$7 {
|
|
2184
2230
|
reorder: (context: Context, projectId: string, position: number) => Promise<boolean>;
|
|
@@ -2200,6 +2246,7 @@ interface IAPI$7 {
|
|
|
2200
2246
|
getNext: (context: Context, userId: string) => Promise<Project | null>;
|
|
2201
2247
|
getUserHistory: (context: Context, userId: string) => Promise<APIResponse<Project>>;
|
|
2202
2248
|
interact: (context: Context, projectId: string, type: InteractionType) => Promise<boolean>;
|
|
2249
|
+
rate: (context: Context, projectId: string, data: RatingInput) => Promise<boolean>;
|
|
2203
2250
|
getPoolSize(context: Context): Promise<number>;
|
|
2204
2251
|
permissions: {
|
|
2205
2252
|
isEligibleForFreeProject(context: Context): Promise<boolean>;
|
|
@@ -2294,6 +2341,10 @@ declare const Endpoints$6: {
|
|
|
2294
2341
|
uri: string;
|
|
2295
2342
|
method: string;
|
|
2296
2343
|
};
|
|
2344
|
+
Rate: {
|
|
2345
|
+
uri: string;
|
|
2346
|
+
method: string;
|
|
2347
|
+
};
|
|
2297
2348
|
};
|
|
2298
2349
|
|
|
2299
2350
|
type StatusConfigType = {
|
|
@@ -2339,6 +2390,9 @@ type index$8_InteractionType = InteractionType;
|
|
|
2339
2390
|
declare const index$8_InteractionType: typeof InteractionType;
|
|
2340
2391
|
type index$8_ProjectCreation = ProjectCreation;
|
|
2341
2392
|
declare const index$8_ProjectSchema: typeof ProjectSchema;
|
|
2393
|
+
type index$8_Rating = Rating;
|
|
2394
|
+
type index$8_RatingInput = RatingInput;
|
|
2395
|
+
declare const index$8_RatingSchema: typeof RatingSchema;
|
|
2342
2396
|
type index$8_SendToApproval = SendToApproval;
|
|
2343
2397
|
declare const index$8_StatusConfig: typeof StatusConfig;
|
|
2344
2398
|
type index$8_StatusConfigType = StatusConfigType;
|
|
@@ -2347,7 +2401,7 @@ declare const index$8_Styles: typeof Styles;
|
|
|
2347
2401
|
type index$8_TimelineItem = TimelineItem;
|
|
2348
2402
|
declare const index$8_TimelineItemSchema: typeof TimelineItemSchema;
|
|
2349
2403
|
declare namespace index$8 {
|
|
2350
|
-
export { type index$8_Approve as Approve, index$8_CaptionStyle as CaptionStyle, Endpoints$6 as Endpoints, type Project as Entity, type index$8_Feedback as Feedback, index$8_FeedbackSchema as FeedbackSchema, type IAPI$7 as IAPI, type index$8_Interaction as Interaction, index$8_InteractionSchema as InteractionSchema, index$8_InteractionType as InteractionType, type index$8_ProjectCreation as ProjectCreation, index$8_ProjectSchema as ProjectSchema, type index$8_SendToApproval as SendToApproval, Status$1 as Status, index$8_StatusConfig as StatusConfig, type index$8_StatusConfigType as StatusConfigType, type index$8_Style as Style, index$8_Styles as Styles, type index$8_TimelineItem as TimelineItem, index$8_TimelineItemSchema as TimelineItemSchema };
|
|
2404
|
+
export { type index$8_Approve as Approve, index$8_CaptionStyle as CaptionStyle, Endpoints$6 as Endpoints, type Project as Entity, type index$8_Feedback as Feedback, index$8_FeedbackSchema as FeedbackSchema, type IAPI$7 as IAPI, type index$8_Interaction as Interaction, index$8_InteractionSchema as InteractionSchema, index$8_InteractionType as InteractionType, type index$8_ProjectCreation as ProjectCreation, index$8_ProjectSchema as ProjectSchema, type index$8_Rating as Rating, type index$8_RatingInput as RatingInput, index$8_RatingSchema as RatingSchema, type index$8_SendToApproval as SendToApproval, Status$1 as Status, index$8_StatusConfig as StatusConfig, type index$8_StatusConfigType as StatusConfigType, type index$8_Style as Style, index$8_Styles as Styles, type index$8_TimelineItem as TimelineItem, index$8_TimelineItemSchema as TimelineItemSchema };
|
|
2351
2405
|
}
|
|
2352
2406
|
|
|
2353
2407
|
declare const DailyMilestoneSchema: z.ZodObject<{
|
|
@@ -3248,6 +3302,7 @@ declare const SpecialOfferSchema: z.ZodObject<{
|
|
|
3248
3302
|
description: z.ZodString;
|
|
3249
3303
|
ctaLabel: z.ZodString;
|
|
3250
3304
|
enabled: z.ZodBoolean;
|
|
3305
|
+
tenantIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3251
3306
|
}, "strip", z.ZodTypeAny, {
|
|
3252
3307
|
id: string;
|
|
3253
3308
|
title: string;
|
|
@@ -3258,6 +3313,7 @@ declare const SpecialOfferSchema: z.ZodObject<{
|
|
|
3258
3313
|
couponId: string;
|
|
3259
3314
|
ctaLabel: string;
|
|
3260
3315
|
enabled: boolean;
|
|
3316
|
+
tenantIds?: string[] | undefined;
|
|
3261
3317
|
}, {
|
|
3262
3318
|
id: string;
|
|
3263
3319
|
title: string;
|
|
@@ -3268,6 +3324,7 @@ declare const SpecialOfferSchema: z.ZodObject<{
|
|
|
3268
3324
|
couponId: string;
|
|
3269
3325
|
ctaLabel: string;
|
|
3270
3326
|
enabled: boolean;
|
|
3327
|
+
tenantIds?: string[] | undefined;
|
|
3271
3328
|
}>;
|
|
3272
3329
|
declare const UserOfferDetailsSchema: z.ZodObject<{
|
|
3273
3330
|
offerId: z.ZodString;
|
|
@@ -3296,6 +3353,7 @@ declare const CreateSpecialOfferSchema: z.ZodObject<{
|
|
|
3296
3353
|
title: z.ZodString;
|
|
3297
3354
|
description: z.ZodString;
|
|
3298
3355
|
ctaLabel: z.ZodString;
|
|
3356
|
+
tenantIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3299
3357
|
}, "strip", z.ZodTypeAny, {
|
|
3300
3358
|
title: string;
|
|
3301
3359
|
description: string;
|
|
@@ -3303,6 +3361,7 @@ declare const CreateSpecialOfferSchema: z.ZodObject<{
|
|
|
3303
3361
|
planId: string;
|
|
3304
3362
|
couponId: string;
|
|
3305
3363
|
ctaLabel: string;
|
|
3364
|
+
tenantIds?: string[] | undefined;
|
|
3306
3365
|
freeProjectsAllowed?: number | undefined;
|
|
3307
3366
|
}, {
|
|
3308
3367
|
title: string;
|
|
@@ -3311,6 +3370,7 @@ declare const CreateSpecialOfferSchema: z.ZodObject<{
|
|
|
3311
3370
|
planId: string;
|
|
3312
3371
|
couponId: string;
|
|
3313
3372
|
ctaLabel: string;
|
|
3373
|
+
tenantIds?: string[] | undefined;
|
|
3314
3374
|
freeProjectsAllowed?: number | undefined;
|
|
3315
3375
|
}>;
|
|
3316
3376
|
declare const UpdateSpecialOfferSchema: z.ZodObject<{
|
|
@@ -3321,9 +3381,11 @@ declare const UpdateSpecialOfferSchema: z.ZodObject<{
|
|
|
3321
3381
|
title: z.ZodOptional<z.ZodString>;
|
|
3322
3382
|
description: z.ZodOptional<z.ZodString>;
|
|
3323
3383
|
ctaLabel: z.ZodOptional<z.ZodString>;
|
|
3384
|
+
tenantIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3324
3385
|
}, "strip", z.ZodTypeAny, {
|
|
3325
3386
|
title?: string | undefined;
|
|
3326
3387
|
description?: string | undefined;
|
|
3388
|
+
tenantIds?: string[] | undefined;
|
|
3327
3389
|
freeProjectsAllowed?: number | undefined;
|
|
3328
3390
|
windowHours?: number | undefined;
|
|
3329
3391
|
planId?: string | undefined;
|
|
@@ -3332,6 +3394,7 @@ declare const UpdateSpecialOfferSchema: z.ZodObject<{
|
|
|
3332
3394
|
}, {
|
|
3333
3395
|
title?: string | undefined;
|
|
3334
3396
|
description?: string | undefined;
|
|
3397
|
+
tenantIds?: string[] | undefined;
|
|
3335
3398
|
freeProjectsAllowed?: number | undefined;
|
|
3336
3399
|
windowHours?: number | undefined;
|
|
3337
3400
|
planId?: string | undefined;
|
|
@@ -3345,7 +3408,7 @@ type Update = z.infer<typeof UpdateSpecialOfferSchema>;
|
|
|
3345
3408
|
|
|
3346
3409
|
interface IAPI$1 {
|
|
3347
3410
|
list: (ctx: Context) => Promise<SpecialOffer[]>;
|
|
3348
|
-
getActive: (ctx: Context) => Promise<SpecialOffer
|
|
3411
|
+
getActive: (ctx: Context) => Promise<SpecialOffer[]>;
|
|
3349
3412
|
create: (ctx: Context, data: Create) => Promise<SpecialOffer>;
|
|
3350
3413
|
update: (ctx: Context, id: string, data: Update) => Promise<void>;
|
|
3351
3414
|
enable: (ctx: Context, id: string) => Promise<void>;
|
|
@@ -3428,6 +3491,7 @@ declare const Actions: {
|
|
|
3428
3491
|
readonly PROJECT_REORDER: "project.reorder";
|
|
3429
3492
|
readonly PROJECT_REQUEST_REVIEW: "project.request_review";
|
|
3430
3493
|
readonly PROJECT_RECORD_INTERACTION: "project.record_interaction";
|
|
3494
|
+
readonly PROJECT_RATE: "project.rate";
|
|
3431
3495
|
readonly PROJECT_CHECK_FREE_QUOTA: "project.check_free_quota";
|
|
3432
3496
|
readonly EDITOR_LIST: "editor.list";
|
|
3433
3497
|
readonly EDITOR_GET: "editor.get";
|
package/dist/index.js
CHANGED
|
@@ -5055,6 +5055,7 @@ __export(project_exports, {
|
|
|
5055
5055
|
InteractionSchema: () => InteractionSchema,
|
|
5056
5056
|
InteractionType: () => InteractionType,
|
|
5057
5057
|
ProjectSchema: () => ProjectSchema,
|
|
5058
|
+
RatingSchema: () => RatingSchema,
|
|
5058
5059
|
Status: () => Status2,
|
|
5059
5060
|
StatusConfig: () => StatusConfig,
|
|
5060
5061
|
Styles: () => Styles,
|
|
@@ -5140,6 +5141,12 @@ var FeedbackSchema = external_exports.object({
|
|
|
5140
5141
|
),
|
|
5141
5142
|
comment: external_exports.string().optional()
|
|
5142
5143
|
});
|
|
5144
|
+
var RatingSchema = external_exports.object({
|
|
5145
|
+
score: external_exports.number().int().min(1).max(5),
|
|
5146
|
+
comment: external_exports.string().max(500).optional(),
|
|
5147
|
+
timestamp: external_exports.number(),
|
|
5148
|
+
deliveryIndex: external_exports.number().int().min(0)
|
|
5149
|
+
});
|
|
5143
5150
|
var ProjectSchema = external_exports.object({
|
|
5144
5151
|
id: external_exports.string(),
|
|
5145
5152
|
title: external_exports.string(),
|
|
@@ -5158,6 +5165,7 @@ var ProjectSchema = external_exports.object({
|
|
|
5158
5165
|
isFree: external_exports.boolean().optional(),
|
|
5159
5166
|
timeline: external_exports.array(TimelineItemSchema),
|
|
5160
5167
|
interactions: external_exports.array(InteractionSchema).optional(),
|
|
5168
|
+
ratings: external_exports.array(RatingSchema).optional(),
|
|
5161
5169
|
submitTimestamp: external_exports.number(),
|
|
5162
5170
|
tenantId: external_exports.string().optional(),
|
|
5163
5171
|
status: external_exports.nativeEnum(Status2)
|
|
@@ -5192,7 +5200,8 @@ var Endpoints3 = {
|
|
|
5192
5200
|
Assign: { uri: "/projects/:projectId/assign/", method: "POST" },
|
|
5193
5201
|
GetUserHistory: { uri: "/projects/user/:userId/history/", method: "GET" },
|
|
5194
5202
|
GetPoolSize: { uri: "/projects/pool/size/", method: "GET" },
|
|
5195
|
-
Interact: { uri: "/projects/:projectId/interactions/", method: "POST" }
|
|
5203
|
+
Interact: { uri: "/projects/:projectId/interactions/", method: "POST" },
|
|
5204
|
+
Rate: { uri: "/projects/:projectId/rating/", method: "POST" }
|
|
5196
5205
|
};
|
|
5197
5206
|
|
|
5198
5207
|
// src/model/project/StatusConfig.ts
|
|
@@ -5618,6 +5627,18 @@ var ProjectAPI = class {
|
|
|
5618
5627
|
);
|
|
5619
5628
|
return data.success;
|
|
5620
5629
|
}
|
|
5630
|
+
async rate(ctx, projectId, data) {
|
|
5631
|
+
const endpointData = Endpoints3.Rate;
|
|
5632
|
+
const endpoint = endpointData.uri.replace(":projectId", projectId);
|
|
5633
|
+
const result = await this.clientHTTP.makeRequest(
|
|
5634
|
+
this.env,
|
|
5635
|
+
endpoint,
|
|
5636
|
+
endpointData.method,
|
|
5637
|
+
data,
|
|
5638
|
+
ctx
|
|
5639
|
+
);
|
|
5640
|
+
return result.success;
|
|
5641
|
+
}
|
|
5621
5642
|
async start(context) {
|
|
5622
5643
|
const endpointData = Endpoints3.StartEdition;
|
|
5623
5644
|
const data = await this.clientHTTP.makeRequest(
|
|
@@ -5949,7 +5970,8 @@ var SpecialOfferSchema = external_exports.object({
|
|
|
5949
5970
|
title: external_exports.string(),
|
|
5950
5971
|
description: external_exports.string(),
|
|
5951
5972
|
ctaLabel: external_exports.string(),
|
|
5952
|
-
enabled: external_exports.boolean()
|
|
5973
|
+
enabled: external_exports.boolean(),
|
|
5974
|
+
tenantIds: external_exports.array(external_exports.string()).optional()
|
|
5953
5975
|
});
|
|
5954
5976
|
var UserOfferDetailsSchema = external_exports.object({
|
|
5955
5977
|
offerId: external_exports.string(),
|
|
@@ -5965,7 +5987,8 @@ var CreateSpecialOfferSchema = external_exports.object({
|
|
|
5965
5987
|
couponId: external_exports.string().min(1),
|
|
5966
5988
|
title: external_exports.string().min(1),
|
|
5967
5989
|
description: external_exports.string().min(1),
|
|
5968
|
-
ctaLabel: external_exports.string().min(1)
|
|
5990
|
+
ctaLabel: external_exports.string().min(1),
|
|
5991
|
+
tenantIds: external_exports.array(external_exports.string().min(1)).optional()
|
|
5969
5992
|
});
|
|
5970
5993
|
var UpdateSpecialOfferSchema = external_exports.object({
|
|
5971
5994
|
freeProjectsAllowed: external_exports.number().int().positive().optional(),
|
|
@@ -5974,7 +5997,8 @@ var UpdateSpecialOfferSchema = external_exports.object({
|
|
|
5974
5997
|
couponId: external_exports.string().min(1).optional(),
|
|
5975
5998
|
title: external_exports.string().min(1).optional(),
|
|
5976
5999
|
description: external_exports.string().min(1).optional(),
|
|
5977
|
-
ctaLabel: external_exports.string().min(1).optional()
|
|
6000
|
+
ctaLabel: external_exports.string().min(1).optional(),
|
|
6001
|
+
tenantIds: external_exports.array(external_exports.string().min(1)).optional()
|
|
5978
6002
|
});
|
|
5979
6003
|
|
|
5980
6004
|
// src/api/SpecialOffer.api.ts
|
|
@@ -5989,7 +6013,7 @@ var SpecialOfferAPI = class {
|
|
|
5989
6013
|
}
|
|
5990
6014
|
async getActive(ctx) {
|
|
5991
6015
|
const { uri, method } = Endpoints8.GetActive;
|
|
5992
|
-
return this.clientHTTP.makeRequest(this.env, uri, method, null, ctx,
|
|
6016
|
+
return this.clientHTTP.makeRequest(this.env, uri, method, null, ctx, external_exports.array(SpecialOfferSchema));
|
|
5993
6017
|
}
|
|
5994
6018
|
async create(ctx, data) {
|
|
5995
6019
|
const { uri, method } = Endpoints8.Create;
|
|
@@ -6056,6 +6080,7 @@ var Actions = {
|
|
|
6056
6080
|
PROJECT_REORDER: "project.reorder",
|
|
6057
6081
|
PROJECT_REQUEST_REVIEW: "project.request_review",
|
|
6058
6082
|
PROJECT_RECORD_INTERACTION: "project.record_interaction",
|
|
6083
|
+
PROJECT_RATE: "project.rate",
|
|
6059
6084
|
PROJECT_CHECK_FREE_QUOTA: "project.check_free_quota",
|
|
6060
6085
|
// — Editors —
|
|
6061
6086
|
EDITOR_LIST: "editor.list",
|
|
@@ -6143,6 +6168,7 @@ var ActionCatalog = {
|
|
|
6143
6168
|
[Actions.PROJECT_REORDER]: { label: "Reorder your own projects", group: "Projects" },
|
|
6144
6169
|
[Actions.PROJECT_REQUEST_REVIEW]: { label: "Request a review on your own project", group: "Projects" },
|
|
6145
6170
|
[Actions.PROJECT_RECORD_INTERACTION]: { label: "Record an interaction on your own project", group: "Projects" },
|
|
6171
|
+
[Actions.PROJECT_RATE]: { label: "Rate a delivered video on your own project", group: "Projects" },
|
|
6146
6172
|
[Actions.PROJECT_CHECK_FREE_QUOTA]: { label: "Check your own free-project quota", group: "Projects" },
|
|
6147
6173
|
// Editors (staff)
|
|
6148
6174
|
[Actions.EDITOR_LIST]: { label: "List all editors", group: "Editors" },
|