@voidhash/api-spec 0.0.1-alpha.1-canary.2.1.223955
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/LICENSE.md +21 -0
- package/README.md +43 -0
- package/package.json +37 -0
- package/src/api.ts +420 -0
- package/src/auth.ts +102 -0
- package/src/changeset.ts +204 -0
- package/src/errors/admin.ts +11 -0
- package/src/errors/analytics.ts +29 -0
- package/src/errors/api-key.ts +20 -0
- package/src/errors/billing.ts +29 -0
- package/src/errors/changeset.ts +11 -0
- package/src/errors/common.ts +30 -0
- package/src/errors/customer.ts +37 -0
- package/src/errors/index.ts +18 -0
- package/src/errors/organization.ts +20 -0
- package/src/errors/payment-provider.ts +74 -0
- package/src/errors/paywall-location.ts +11 -0
- package/src/errors/paywall.ts +38 -0
- package/src/errors/perk.ts +33 -0
- package/src/errors/product-perk.ts +20 -0
- package/src/errors/product.ts +33 -0
- package/src/errors/project.ts +24 -0
- package/src/errors/sdk.ts +42 -0
- package/src/errors/user.ts +11 -0
- package/src/errors/webhook.ts +38 -0
- package/src/index.ts +5 -0
- package/src/middlewares.ts +32 -0
- package/src/schema.ts +535 -0
package/src/changeset.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Paywall Location Changes
|
|
5
|
+
// ============================================================================
|
|
6
|
+
|
|
7
|
+
export const PaywallLocationCreateChangeSchema = Schema.Struct({
|
|
8
|
+
changeType: Schema.Literal("create-paywall-location"),
|
|
9
|
+
key: Schema.String,
|
|
10
|
+
payload: Schema.Struct({
|
|
11
|
+
description: Schema.optional(Schema.NullOr(Schema.String)),
|
|
12
|
+
name: Schema.String,
|
|
13
|
+
slug: Schema.String,
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const PaywallLocationUpdateChangeSchema = Schema.Struct({
|
|
18
|
+
changeType: Schema.Literal("update-paywall-location"),
|
|
19
|
+
key: Schema.String,
|
|
20
|
+
payload: Schema.Struct({
|
|
21
|
+
description: Schema.optional(Schema.NullOr(Schema.String)),
|
|
22
|
+
name: Schema.String,
|
|
23
|
+
slug: Schema.String,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const PaywallLocationArchiveChangeSchema = Schema.Struct({
|
|
28
|
+
changeType: Schema.Literal("archive-paywall-location"),
|
|
29
|
+
key: Schema.String,
|
|
30
|
+
payload: Schema.Struct({
|
|
31
|
+
slug: Schema.String,
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Perk Changes
|
|
37
|
+
// ============================================================================
|
|
38
|
+
|
|
39
|
+
export const PerkCreateChangeSchema = Schema.Struct({
|
|
40
|
+
changeType: Schema.Literal("create-perk"),
|
|
41
|
+
key: Schema.String,
|
|
42
|
+
payload: Schema.Struct({
|
|
43
|
+
name: Schema.String,
|
|
44
|
+
slug: Schema.String,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const PerkUpdateChangeSchema = Schema.Struct({
|
|
49
|
+
changeType: Schema.Literal("update-perk"),
|
|
50
|
+
key: Schema.String,
|
|
51
|
+
payload: Schema.Struct({
|
|
52
|
+
name: Schema.String,
|
|
53
|
+
slug: Schema.String,
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const PerkDeleteChangeSchema = Schema.Struct({
|
|
58
|
+
changeType: Schema.Literal("delete-perk"),
|
|
59
|
+
key: Schema.String,
|
|
60
|
+
payload: Schema.Struct({
|
|
61
|
+
slug: Schema.String,
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Product Changes
|
|
67
|
+
// ============================================================================
|
|
68
|
+
|
|
69
|
+
export const ProductCreateChangeSchema = Schema.Struct({
|
|
70
|
+
changeType: Schema.Literal("create-product"),
|
|
71
|
+
key: Schema.String,
|
|
72
|
+
payload: Schema.Struct({
|
|
73
|
+
name: Schema.String,
|
|
74
|
+
slug: Schema.String,
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const ProductUpdateChangeSchema = Schema.Struct({
|
|
79
|
+
changeType: Schema.Literal("update-product"),
|
|
80
|
+
key: Schema.String,
|
|
81
|
+
payload: Schema.Struct({
|
|
82
|
+
name: Schema.String,
|
|
83
|
+
slug: Schema.String,
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const ProductDeleteChangeSchema = Schema.Struct({
|
|
88
|
+
changeType: Schema.Literal("delete-product"),
|
|
89
|
+
key: Schema.String,
|
|
90
|
+
payload: Schema.Struct({
|
|
91
|
+
slug: Schema.String,
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// Product Perk Changes
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
export const ProductPerkCreateChangeSchema = Schema.Struct({
|
|
100
|
+
changeType: Schema.Literal("create-product-perk"),
|
|
101
|
+
key: Schema.String,
|
|
102
|
+
payload: Schema.Struct({
|
|
103
|
+
perkSlug: Schema.String,
|
|
104
|
+
productSlug: Schema.String,
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export const ProductPerkDeleteChangeSchema = Schema.Struct({
|
|
109
|
+
changeType: Schema.Literal("delete-product-perk"),
|
|
110
|
+
key: Schema.String,
|
|
111
|
+
payload: Schema.Struct({
|
|
112
|
+
perkSlug: Schema.String,
|
|
113
|
+
productSlug: Schema.String,
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// ============================================================================
|
|
118
|
+
// Payment Provider Product Changes
|
|
119
|
+
// ============================================================================
|
|
120
|
+
|
|
121
|
+
export const PaymentProviderProductCreateChangeSchema = Schema.Struct({
|
|
122
|
+
changeType: Schema.Literal("create-payment-provider-product"),
|
|
123
|
+
key: Schema.String,
|
|
124
|
+
payload: Schema.Struct({
|
|
125
|
+
configuration: Schema.Record({ key: Schema.String, value: Schema.Unknown }),
|
|
126
|
+
productSlug: Schema.String,
|
|
127
|
+
providerId: Schema.String,
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const PaymentProviderProductUpdateChangeSchema = Schema.Struct({
|
|
132
|
+
changeType: Schema.Literal("update-payment-provider-product"),
|
|
133
|
+
key: Schema.String,
|
|
134
|
+
payload: Schema.Struct({
|
|
135
|
+
configuration: Schema.Record({ key: Schema.String, value: Schema.Unknown }),
|
|
136
|
+
productSlug: Schema.String,
|
|
137
|
+
providerId: Schema.String,
|
|
138
|
+
}),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export const PaymentProviderProductDeleteChangeSchema = Schema.Struct({
|
|
142
|
+
changeType: Schema.Literal("delete-payment-provider-product"),
|
|
143
|
+
key: Schema.String,
|
|
144
|
+
payload: Schema.Struct({
|
|
145
|
+
productSlug: Schema.String,
|
|
146
|
+
providerId: Schema.String,
|
|
147
|
+
}),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// ============================================================================
|
|
151
|
+
// Combined Schemas
|
|
152
|
+
// ============================================================================
|
|
153
|
+
|
|
154
|
+
export const ChangeSchema = Schema.Union(
|
|
155
|
+
PaywallLocationCreateChangeSchema,
|
|
156
|
+
PaywallLocationUpdateChangeSchema,
|
|
157
|
+
PaywallLocationArchiveChangeSchema,
|
|
158
|
+
PerkCreateChangeSchema,
|
|
159
|
+
PerkUpdateChangeSchema,
|
|
160
|
+
PerkDeleteChangeSchema,
|
|
161
|
+
ProductCreateChangeSchema,
|
|
162
|
+
ProductUpdateChangeSchema,
|
|
163
|
+
ProductDeleteChangeSchema,
|
|
164
|
+
ProductPerkCreateChangeSchema,
|
|
165
|
+
ProductPerkDeleteChangeSchema,
|
|
166
|
+
PaymentProviderProductCreateChangeSchema,
|
|
167
|
+
PaymentProviderProductUpdateChangeSchema,
|
|
168
|
+
PaymentProviderProductDeleteChangeSchema
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
export const ChangesetSchema = Schema.Struct({
|
|
172
|
+
changes: Schema.Array(ChangeSchema),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// ============================================================================
|
|
176
|
+
// Utility Functions
|
|
177
|
+
// ============================================================================
|
|
178
|
+
|
|
179
|
+
export function sortChangeset(changeset: typeof ChangesetSchema.Type) {
|
|
180
|
+
const sortedChangeTypesByPriority: (typeof ChangeSchema.Type.changeType)[] = [
|
|
181
|
+
"create-paywall-location",
|
|
182
|
+
"create-perk",
|
|
183
|
+
"create-product",
|
|
184
|
+
"update-paywall-location",
|
|
185
|
+
"update-perk",
|
|
186
|
+
"update-product",
|
|
187
|
+
"create-product-perk",
|
|
188
|
+
"create-payment-provider-product",
|
|
189
|
+
"update-payment-provider-product",
|
|
190
|
+
"archive-paywall-location",
|
|
191
|
+
"delete-product-perk",
|
|
192
|
+
"delete-payment-provider-product",
|
|
193
|
+
"delete-product",
|
|
194
|
+
"delete-perk",
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
const sortedChangeset = [...changeset.changes].sort(
|
|
198
|
+
(a, b) =>
|
|
199
|
+
sortedChangeTypesByPriority.indexOf(a.changeType) -
|
|
200
|
+
sortedChangeTypesByPriority.indexOf(b.changeType)
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
return sortedChangeset;
|
|
204
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic admin service error */
|
|
5
|
+
export class AdminServiceError extends Schema.TaggedError<AdminServiceError>()(
|
|
6
|
+
"AdminServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic analytics service error */
|
|
5
|
+
export class AnalyticsServiceError extends Schema.TaggedError<AnalyticsServiceError>()(
|
|
6
|
+
"AnalyticsServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Invalid time range error */
|
|
14
|
+
export class InvalidTimeRangeError extends Schema.TaggedError<InvalidTimeRangeError>()(
|
|
15
|
+
"InvalidTimeRangeError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/** Invalid metric error */
|
|
23
|
+
export class InvalidMetricError extends Schema.TaggedError<InvalidMetricError>()(
|
|
24
|
+
"InvalidMetricError",
|
|
25
|
+
{
|
|
26
|
+
message: Schema.String,
|
|
27
|
+
},
|
|
28
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
29
|
+
) {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic API key service error */
|
|
5
|
+
export class ApiKeyServiceError extends Schema.TaggedError<ApiKeyServiceError>()(
|
|
6
|
+
"ApiKeyServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** API key not found */
|
|
14
|
+
export class ApiKeyNotFoundError extends Schema.TaggedError<ApiKeyNotFoundError>()(
|
|
15
|
+
"ApiKeyNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic billing service error */
|
|
5
|
+
export class BillingServiceError extends Schema.TaggedError<BillingServiceError>()(
|
|
6
|
+
"BillingServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Organization billing not found */
|
|
14
|
+
export class OrganizationBillingNotFoundError extends Schema.TaggedError<OrganizationBillingNotFoundError>()(
|
|
15
|
+
"OrganizationBillingNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/** Invalid billing tier error */
|
|
23
|
+
export class InvalidBillingTierError extends Schema.TaggedError<InvalidBillingTierError>()(
|
|
24
|
+
"InvalidBillingTierError",
|
|
25
|
+
{
|
|
26
|
+
message: Schema.String,
|
|
27
|
+
},
|
|
28
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
29
|
+
) {}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic changeset deployment service error */
|
|
5
|
+
export class ChangesetDeploymentServiceError extends Schema.TaggedError<ChangesetDeploymentServiceError>()(
|
|
6
|
+
"ChangesetDeploymentServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.Unknown,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Action is forbidden due to insufficient permissions */
|
|
5
|
+
export class ActionForbiddenError extends Schema.TaggedError<ActionForbiddenError>()(
|
|
6
|
+
"ActionForbiddenError",
|
|
7
|
+
{
|
|
8
|
+
message: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 403 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Authentication failed */
|
|
14
|
+
export class AuthenticationError extends Schema.TaggedError<AuthenticationError>()(
|
|
15
|
+
"AuthenticationError",
|
|
16
|
+
{
|
|
17
|
+
cause: Schema.String,
|
|
18
|
+
message: Schema.String,
|
|
19
|
+
},
|
|
20
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
/** User is not authenticated */
|
|
24
|
+
export class NotAuthenticatedError extends Schema.TaggedError<NotAuthenticatedError>()(
|
|
25
|
+
"NotAuthenticatedError",
|
|
26
|
+
{
|
|
27
|
+
message: Schema.String,
|
|
28
|
+
},
|
|
29
|
+
HttpApiSchema.annotations({ status: 401 })
|
|
30
|
+
) {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic customer service error */
|
|
5
|
+
export class CustomerServiceError extends Schema.TaggedError<CustomerServiceError>()(
|
|
6
|
+
"CustomerServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Customer not found */
|
|
14
|
+
export class CustomerNotFoundError extends Schema.TaggedError<CustomerNotFoundError>()(
|
|
15
|
+
"CustomerNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
id: Schema.NonEmptyString,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {
|
|
21
|
+
toString(): string {
|
|
22
|
+
return `The following customer not found: ${this.id}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Anonymous ID is invalid */
|
|
27
|
+
export class CustomerInvalidAnonymousIdError extends Schema.TaggedError<CustomerInvalidAnonymousIdError>()(
|
|
28
|
+
"CustomerInvalidAnonymousIdError",
|
|
29
|
+
{
|
|
30
|
+
id: Schema.NonEmptyString,
|
|
31
|
+
},
|
|
32
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
33
|
+
) {
|
|
34
|
+
toString(): string {
|
|
35
|
+
return `The following anonymous ID is invalid: ${this.id}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./admin";
|
|
2
|
+
export * from "./analytics";
|
|
3
|
+
export * from "./api-key";
|
|
4
|
+
export * from "./billing";
|
|
5
|
+
export * from "./changeset";
|
|
6
|
+
export * from "./common";
|
|
7
|
+
export * from "./customer";
|
|
8
|
+
export * from "./organization";
|
|
9
|
+
export * from "./payment-provider";
|
|
10
|
+
export * from "./paywall";
|
|
11
|
+
export * from "./paywall-location";
|
|
12
|
+
export * from "./perk";
|
|
13
|
+
export * from "./product";
|
|
14
|
+
export * from "./product-perk";
|
|
15
|
+
export * from "./project";
|
|
16
|
+
export * from "./sdk";
|
|
17
|
+
export * from "./user";
|
|
18
|
+
export * from "./webhook";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic organization service error */
|
|
5
|
+
export class OrganizationServiceError extends Schema.TaggedError<OrganizationServiceError>()(
|
|
6
|
+
"OrganizationServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Organization not found */
|
|
14
|
+
export class OrganizationNotFoundError extends Schema.TaggedError<OrganizationNotFoundError>()(
|
|
15
|
+
"OrganizationNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic payment provider configuration service error */
|
|
5
|
+
export class PaymentProviderConfigurationServiceError extends Schema.TaggedError<PaymentProviderConfigurationServiceError>()(
|
|
6
|
+
"PaymentProviderConfigurationServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Payment provider configuration not found */
|
|
14
|
+
export class PaymentProviderConfigurationNotFoundError extends Schema.TaggedError<PaymentProviderConfigurationNotFoundError>()(
|
|
15
|
+
"PaymentProviderConfigurationNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/** Payment provider configuration validation error */
|
|
23
|
+
export class PaymentProviderConfigurationValidationError extends Schema.TaggedError<PaymentProviderConfigurationValidationError>()(
|
|
24
|
+
"PaymentProviderConfigurationValidationError",
|
|
25
|
+
{
|
|
26
|
+
cause: Schema.String,
|
|
27
|
+
},
|
|
28
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
29
|
+
) {}
|
|
30
|
+
|
|
31
|
+
/** Payment provider configuration key unavailable */
|
|
32
|
+
export class PaymentProviderConfigurationKeyUnavailableError extends Schema.TaggedError<PaymentProviderConfigurationKeyUnavailableError>()(
|
|
33
|
+
"PaymentProviderConfigurationKeyUnavailableError",
|
|
34
|
+
{
|
|
35
|
+
message: Schema.String,
|
|
36
|
+
},
|
|
37
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
38
|
+
) {}
|
|
39
|
+
|
|
40
|
+
/** Payment provider already exists */
|
|
41
|
+
export class PaymentProviderAlreadyExistsError extends Schema.TaggedError<PaymentProviderAlreadyExistsError>()(
|
|
42
|
+
"PaymentProviderAlreadyExistsError",
|
|
43
|
+
{
|
|
44
|
+
message: Schema.String,
|
|
45
|
+
},
|
|
46
|
+
HttpApiSchema.annotations({ status: 409 })
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
/** Generic payment provider product service error */
|
|
50
|
+
export class PaymentProviderProductServiceError extends Schema.TaggedError<PaymentProviderProductServiceError>()(
|
|
51
|
+
"PaymentProviderProductServiceError",
|
|
52
|
+
{
|
|
53
|
+
cause: Schema.String,
|
|
54
|
+
},
|
|
55
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
56
|
+
) {}
|
|
57
|
+
|
|
58
|
+
/** Payment provider product validation error */
|
|
59
|
+
export class PaymentProviderProductValidationError extends Schema.TaggedError<PaymentProviderProductValidationError>()(
|
|
60
|
+
"PaymentProviderProductValidationError",
|
|
61
|
+
{
|
|
62
|
+
message: Schema.String,
|
|
63
|
+
},
|
|
64
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
65
|
+
) {}
|
|
66
|
+
|
|
67
|
+
/** Payment provider product not found */
|
|
68
|
+
export class PaymentProviderProductNotFoundError extends Schema.TaggedError<PaymentProviderProductNotFoundError>()(
|
|
69
|
+
"PaymentProviderProductNotFoundError",
|
|
70
|
+
{
|
|
71
|
+
message: Schema.String,
|
|
72
|
+
},
|
|
73
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
74
|
+
) {}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic paywall location service error */
|
|
5
|
+
export class PaywallLocationServiceError extends Schema.TaggedError<PaywallLocationServiceError>()(
|
|
6
|
+
"PaywallLocationServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic paywall service error */
|
|
5
|
+
export class PaywallServiceError extends Schema.TaggedError<PaywallServiceError>()(
|
|
6
|
+
"PaywallServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Paywall not found */
|
|
14
|
+
export class PaywallNotFoundError extends Schema.TaggedError<PaywallNotFoundError>()(
|
|
15
|
+
"PaywallNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/** Paywall slug already exists */
|
|
23
|
+
export class PaywallSlugAlreadyExistsError extends Schema.TaggedError<PaywallSlugAlreadyExistsError>()(
|
|
24
|
+
"PaywallSlugAlreadyExistsError",
|
|
25
|
+
{
|
|
26
|
+
slug: Schema.String,
|
|
27
|
+
},
|
|
28
|
+
HttpApiSchema.annotations({ status: 409 })
|
|
29
|
+
) {}
|
|
30
|
+
|
|
31
|
+
/** Paywall publish error */
|
|
32
|
+
export class PaywallPublishError extends Schema.TaggedError<PaywallPublishError>()(
|
|
33
|
+
"PaywallPublishError",
|
|
34
|
+
{
|
|
35
|
+
message: Schema.String,
|
|
36
|
+
},
|
|
37
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
38
|
+
) {}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic perk service error */
|
|
5
|
+
export class PerkServiceError extends Schema.TaggedError<PerkServiceError>()(
|
|
6
|
+
"PerkServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Perk not found */
|
|
14
|
+
export class PerkNotFoundError extends Schema.TaggedError<PerkNotFoundError>()(
|
|
15
|
+
"PerkNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/** Perk slug already exists */
|
|
23
|
+
export class PerkSlugAlreadyExistsError extends Schema.TaggedError<PerkSlugAlreadyExistsError>()(
|
|
24
|
+
"PerkSlugAlreadyExistsError",
|
|
25
|
+
{
|
|
26
|
+
slug: Schema.String,
|
|
27
|
+
},
|
|
28
|
+
HttpApiSchema.annotations({ status: 409 })
|
|
29
|
+
) {
|
|
30
|
+
toString(): string {
|
|
31
|
+
return `The following perk slug already exists: ${this.slug}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic product perk service error */
|
|
5
|
+
export class ProductPerkServiceError extends Schema.TaggedError<ProductPerkServiceError>()(
|
|
6
|
+
"ProductPerkServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Product perk validation error */
|
|
14
|
+
export class ProductPerkValidationError extends Schema.TaggedError<ProductPerkValidationError>()(
|
|
15
|
+
"ProductPerkValidationError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 400 })
|
|
20
|
+
) {}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic product service error */
|
|
5
|
+
export class ProductServiceError extends Schema.TaggedError<ProductServiceError>()(
|
|
6
|
+
"ProductServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Product not found */
|
|
14
|
+
export class ProductNotFoundError extends Schema.TaggedError<ProductNotFoundError>()(
|
|
15
|
+
"ProductNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
message: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
/** Product slug already exists */
|
|
23
|
+
export class ProductSlugAlreadyExistsError extends Schema.TaggedError<ProductSlugAlreadyExistsError>()(
|
|
24
|
+
"ProductSlugAlreadyExistsError",
|
|
25
|
+
{
|
|
26
|
+
slug: Schema.String,
|
|
27
|
+
},
|
|
28
|
+
HttpApiSchema.annotations({ status: 409 })
|
|
29
|
+
) {
|
|
30
|
+
toString(): string {
|
|
31
|
+
return `The following product slug already exists: ${this.slug}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpApiSchema } from "@effect/platform";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
/** Generic project service error */
|
|
5
|
+
export class ProjectServiceError extends Schema.TaggedError<ProjectServiceError>()(
|
|
6
|
+
"ProjectServiceError",
|
|
7
|
+
{
|
|
8
|
+
cause: Schema.String,
|
|
9
|
+
},
|
|
10
|
+
HttpApiSchema.annotations({ status: 500 })
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
/** Project not found */
|
|
14
|
+
export class ProjectNotFoundError extends Schema.TaggedError<ProjectNotFoundError>()(
|
|
15
|
+
"ProjectNotFoundError",
|
|
16
|
+
{
|
|
17
|
+
projectId: Schema.String,
|
|
18
|
+
},
|
|
19
|
+
HttpApiSchema.annotations({ status: 404 })
|
|
20
|
+
) {
|
|
21
|
+
toString(): string {
|
|
22
|
+
return `The following project not found: ${this.projectId}`;
|
|
23
|
+
}
|
|
24
|
+
}
|