@prosopo/datasets 0.1.8

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.
Files changed (51) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.js +24 -0
  3. package/LICENSE +201 -0
  4. package/README.md +25 -0
  5. package/captchas.json +184 -0
  6. package/dist/js/captcha/captcha.d.ts +65 -0
  7. package/dist/js/captcha/captcha.d.ts.map +1 -0
  8. package/dist/js/captcha/captcha.js +194 -0
  9. package/dist/js/captcha/captcha.js.map +1 -0
  10. package/dist/js/captcha/dataset.d.ts +6 -0
  11. package/dist/js/captcha/dataset.d.ts.map +1 -0
  12. package/dist/js/captcha/dataset.js +46 -0
  13. package/dist/js/captcha/dataset.js.map +1 -0
  14. package/dist/js/captcha/index.d.ts +5 -0
  15. package/dist/js/captcha/index.d.ts.map +1 -0
  16. package/dist/js/captcha/index.js +23 -0
  17. package/dist/js/captcha/index.js.map +1 -0
  18. package/dist/js/captcha/merkle.d.ts +19 -0
  19. package/dist/js/captcha/merkle.d.ts.map +1 -0
  20. package/dist/js/captcha/merkle.js +119 -0
  21. package/dist/js/captcha/merkle.js.map +1 -0
  22. package/dist/js/captcha/util.d.ts +3 -0
  23. package/dist/js/captcha/util.d.ts.map +1 -0
  24. package/dist/js/captcha/util.js +26 -0
  25. package/dist/js/captcha/util.js.map +1 -0
  26. package/dist/js/index.d.ts +3 -0
  27. package/dist/js/index.d.ts.map +1 -0
  28. package/dist/js/index.js +21 -0
  29. package/dist/js/index.js.map +1 -0
  30. package/dist/js/types/assets.d.ts +8 -0
  31. package/dist/js/types/assets.d.ts.map +1 -0
  32. package/dist/js/types/assets.js +18 -0
  33. package/dist/js/types/assets.js.map +1 -0
  34. package/dist/js/types/captcha.d.ts +285 -0
  35. package/dist/js/types/captcha.d.ts.map +1 -0
  36. package/dist/js/types/captcha.js +67 -0
  37. package/dist/js/types/captcha.js.map +1 -0
  38. package/dist/js/types/dataset.d.ts +312 -0
  39. package/dist/js/types/dataset.d.ts.map +1 -0
  40. package/dist/js/types/dataset.js +28 -0
  41. package/dist/js/types/dataset.js.map +1 -0
  42. package/dist/js/types/index.d.ts +5 -0
  43. package/dist/js/types/index.d.ts.map +1 -0
  44. package/dist/js/types/index.js +8 -0
  45. package/dist/js/types/index.js.map +1 -0
  46. package/dist/js/types/merkle.d.ts +16 -0
  47. package/dist/js/types/merkle.d.ts.map +1 -0
  48. package/dist/js/types/merkle.js +24 -0
  49. package/dist/js/types/merkle.js.map +1 -0
  50. package/package.json +67 -0
  51. package/tsconfig.json +12 -0
@@ -0,0 +1,285 @@
1
+ import { z } from 'zod';
2
+ import { AccountId, Hash } from '@polkadot/types/interfaces';
3
+ import { u32, u64 } from '@polkadot/types';
4
+ export declare enum CaptchaTypes {
5
+ SelectAll = "SelectAll"
6
+ }
7
+ export declare enum CaptchaItemTypes {
8
+ Text = "text",
9
+ Image = "image"
10
+ }
11
+ export declare enum CaptchaStates {
12
+ Solved = "solved",
13
+ Unsolved = "unsolved"
14
+ }
15
+ export declare type RawSolution = number;
16
+ export declare type HashedSolution = string;
17
+ export declare type Item = z.infer<typeof CaptchaItemSchema>;
18
+ declare type CaptchaWithoutIdBase = {
19
+ salt: string;
20
+ items: Item[];
21
+ target: string;
22
+ solved?: boolean;
23
+ };
24
+ export interface CaptchaWithoutId extends CaptchaWithoutIdBase {
25
+ solution?: HashedSolution[];
26
+ }
27
+ export interface CaptchaWithoutIdRaw extends CaptchaWithoutIdBase {
28
+ solution?: RawSolution[];
29
+ }
30
+ export declare type CaptchaSolutionToUpdate = {
31
+ captchaId: string;
32
+ captchaContentId: string;
33
+ salt: string;
34
+ solution: HashedSolution[];
35
+ };
36
+ export interface Captcha extends CaptchaWithoutId {
37
+ captchaId: string;
38
+ captchaContentId: string;
39
+ assetURI?: string;
40
+ datasetId?: string;
41
+ datasetContentId?: string;
42
+ }
43
+ export declare enum CaptchaStatus {
44
+ Pending = "Pending",
45
+ Approved = "Approved",
46
+ Disapproved = "Disapproved"
47
+ }
48
+ export interface CaptchaSolutionCommitment {
49
+ account: AccountId;
50
+ captchaDatasetId: Hash;
51
+ status: CaptchaStatus;
52
+ contract: AccountId;
53
+ provider: AccountId;
54
+ completed_at: u64;
55
+ }
56
+ export interface CaptchaSolution {
57
+ captchaId: string;
58
+ captchaContentId: string;
59
+ salt: string;
60
+ solution: HashedSolution[];
61
+ }
62
+ export declare type CaptchaConfig = {
63
+ solved: {
64
+ count: number;
65
+ };
66
+ unsolved: {
67
+ count: number;
68
+ };
69
+ };
70
+ export declare type CaptchaSolutionConfig = {
71
+ requiredNumberOfSolutions: number;
72
+ solutionWinningPercentage: number;
73
+ captchaFilePath: string;
74
+ captchaBlockRecency: number;
75
+ };
76
+ export declare type LastCorrectCaptcha = {
77
+ before_ms: u32;
78
+ dapp_id: AccountId;
79
+ };
80
+ export declare const CaptchaSchema: z.ZodObject<{
81
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
82
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
83
+ salt: z.ZodString;
84
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
85
+ timeLimit: z.ZodOptional<z.ZodNumber>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ captchaId?: string | undefined;
88
+ captchaContentId?: string | undefined;
89
+ solution?: number[] | undefined;
90
+ timeLimit?: number | undefined;
91
+ salt: string;
92
+ }, {
93
+ captchaId?: string | undefined;
94
+ captchaContentId?: string | undefined;
95
+ solution?: number[] | undefined;
96
+ timeLimit?: number | undefined;
97
+ salt: string;
98
+ }>;
99
+ export declare const CaptchaItemSchema: z.ZodObject<{
100
+ hash: z.ZodOptional<z.ZodString>;
101
+ data: z.ZodString;
102
+ type: z.ZodNativeEnum<typeof CaptchaItemTypes>;
103
+ }, "strip", z.ZodTypeAny, {
104
+ hash?: string | undefined;
105
+ data: string;
106
+ type: CaptchaItemTypes;
107
+ }, {
108
+ hash?: string | undefined;
109
+ data: string;
110
+ type: CaptchaItemTypes;
111
+ }>;
112
+ export declare const SelectAllCaptchaSchemaRaw: z.ZodObject<z.extendShape<{
113
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
114
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
115
+ salt: z.ZodString;
116
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
117
+ timeLimit: z.ZodOptional<z.ZodNumber>;
118
+ }, {
119
+ items: z.ZodArray<z.ZodObject<{
120
+ hash: z.ZodOptional<z.ZodString>;
121
+ data: z.ZodString;
122
+ type: z.ZodNativeEnum<typeof CaptchaItemTypes>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ hash?: string | undefined;
125
+ data: string;
126
+ type: CaptchaItemTypes;
127
+ }, {
128
+ hash?: string | undefined;
129
+ data: string;
130
+ type: CaptchaItemTypes;
131
+ }>, "many">;
132
+ target: z.ZodString;
133
+ }>, "strip", z.ZodTypeAny, {
134
+ captchaId?: string | undefined;
135
+ captchaContentId?: string | undefined;
136
+ solution?: number[] | undefined;
137
+ timeLimit?: number | undefined;
138
+ salt: string;
139
+ items: {
140
+ hash?: string | undefined;
141
+ data: string;
142
+ type: CaptchaItemTypes;
143
+ }[];
144
+ target: string;
145
+ }, {
146
+ captchaId?: string | undefined;
147
+ captchaContentId?: string | undefined;
148
+ solution?: number[] | undefined;
149
+ timeLimit?: number | undefined;
150
+ salt: string;
151
+ items: {
152
+ hash?: string | undefined;
153
+ data: string;
154
+ type: CaptchaItemTypes;
155
+ }[];
156
+ target: string;
157
+ }>;
158
+ export declare const SelectAllCaptchaSchema: z.ZodObject<z.extendShape<z.extendShape<{
159
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
160
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
161
+ salt: z.ZodString;
162
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
163
+ timeLimit: z.ZodOptional<z.ZodNumber>;
164
+ }, {
165
+ items: z.ZodArray<z.ZodObject<{
166
+ hash: z.ZodOptional<z.ZodString>;
167
+ data: z.ZodString;
168
+ type: z.ZodNativeEnum<typeof CaptchaItemTypes>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ hash?: string | undefined;
171
+ data: string;
172
+ type: CaptchaItemTypes;
173
+ }, {
174
+ hash?: string | undefined;
175
+ data: string;
176
+ type: CaptchaItemTypes;
177
+ }>, "many">;
178
+ target: z.ZodString;
179
+ }>, {
180
+ solution: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
181
+ }>, "strip", z.ZodTypeAny, {
182
+ captchaId?: string | undefined;
183
+ captchaContentId?: string | undefined;
184
+ solution?: string[] | undefined;
185
+ timeLimit?: number | undefined;
186
+ salt: string;
187
+ items: {
188
+ hash?: string | undefined;
189
+ data: string;
190
+ type: CaptchaItemTypes;
191
+ }[];
192
+ target: string;
193
+ }, {
194
+ captchaId?: string | undefined;
195
+ captchaContentId?: string | undefined;
196
+ solution?: string[] | undefined;
197
+ timeLimit?: number | undefined;
198
+ salt: string;
199
+ items: {
200
+ hash?: string | undefined;
201
+ data: string;
202
+ type: CaptchaItemTypes;
203
+ }[];
204
+ target: string;
205
+ }>;
206
+ export declare const CaptchasSchema: z.ZodArray<z.ZodObject<z.extendShape<{
207
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
208
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
209
+ salt: z.ZodString;
210
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
211
+ timeLimit: z.ZodOptional<z.ZodNumber>;
212
+ }, {
213
+ items: z.ZodArray<z.ZodObject<{
214
+ hash: z.ZodOptional<z.ZodString>;
215
+ data: z.ZodString;
216
+ type: z.ZodNativeEnum<typeof CaptchaItemTypes>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ hash?: string | undefined;
219
+ data: string;
220
+ type: CaptchaItemTypes;
221
+ }, {
222
+ hash?: string | undefined;
223
+ data: string;
224
+ type: CaptchaItemTypes;
225
+ }>, "many">;
226
+ target: z.ZodString;
227
+ }>, "strip", z.ZodTypeAny, {
228
+ captchaId?: string | undefined;
229
+ captchaContentId?: string | undefined;
230
+ solution?: number[] | undefined;
231
+ timeLimit?: number | undefined;
232
+ salt: string;
233
+ items: {
234
+ hash?: string | undefined;
235
+ data: string;
236
+ type: CaptchaItemTypes;
237
+ }[];
238
+ target: string;
239
+ }, {
240
+ captchaId?: string | undefined;
241
+ captchaContentId?: string | undefined;
242
+ solution?: number[] | undefined;
243
+ timeLimit?: number | undefined;
244
+ salt: string;
245
+ items: {
246
+ hash?: string | undefined;
247
+ data: string;
248
+ type: CaptchaItemTypes;
249
+ }[];
250
+ target: string;
251
+ }>, "many">;
252
+ export declare const CaptchaSolution: z.ZodObject<{
253
+ captchaId: z.ZodString;
254
+ captchaContentId: z.ZodString;
255
+ solution: z.ZodArray<z.ZodString, "many">;
256
+ salt: z.ZodString;
257
+ }, "strip", z.ZodTypeAny, {
258
+ captchaId: string;
259
+ captchaContentId: string;
260
+ salt: string;
261
+ solution: string[];
262
+ }, {
263
+ captchaId: string;
264
+ captchaContentId: string;
265
+ salt: string;
266
+ solution: string[];
267
+ }>;
268
+ export declare const CaptchaSolutionSchema: z.ZodArray<z.ZodObject<{
269
+ captchaId: z.ZodString;
270
+ captchaContentId: z.ZodString;
271
+ solution: z.ZodArray<z.ZodString, "many">;
272
+ salt: z.ZodString;
273
+ }, "strip", z.ZodTypeAny, {
274
+ captchaId: string;
275
+ captchaContentId: string;
276
+ salt: string;
277
+ solution: string[];
278
+ }, {
279
+ captchaId: string;
280
+ captchaContentId: string;
281
+ salt: string;
282
+ solution: string[];
283
+ }>, "many">;
284
+ export {};
285
+ //# sourceMappingURL=captcha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../../src/js/types/captcha.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CA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;;;;;;;;;;;WAAqC,CAAA;AAEhE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAK1B,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;WAA2B,CAAA"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaptchaSolutionSchema = exports.CaptchaSolution = exports.CaptchasSchema = exports.SelectAllCaptchaSchema = exports.SelectAllCaptchaSchemaRaw = exports.CaptchaItemSchema = exports.CaptchaSchema = exports.CaptchaStatus = exports.CaptchaStates = exports.CaptchaItemTypes = exports.CaptchaTypes = void 0;
4
+ // Copyright (C) 2021-2022 Prosopo (UK) Ltd.
5
+ // This file is part of provider <https://github.com/prosopo/provider>.
6
+ //
7
+ // provider is free software: you can redistribute it and/or modify
8
+ // it under the terms of the GNU General Public License as published by
9
+ // the Free Software Foundation, either version 3 of the License, or
10
+ // (at your option) any later version.
11
+ //
12
+ // provider is distributed in the hope that it will be useful,
13
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ // GNU General Public License for more details.
16
+ //
17
+ // You should have received a copy of the GNU General Public License
18
+ // along with provider. If not, see <http://www.gnu.org/licenses/>.
19
+ const zod_1 = require("zod");
20
+ var CaptchaTypes;
21
+ (function (CaptchaTypes) {
22
+ CaptchaTypes["SelectAll"] = "SelectAll";
23
+ })(CaptchaTypes = exports.CaptchaTypes || (exports.CaptchaTypes = {}));
24
+ var CaptchaItemTypes;
25
+ (function (CaptchaItemTypes) {
26
+ CaptchaItemTypes["Text"] = "text";
27
+ CaptchaItemTypes["Image"] = "image";
28
+ })(CaptchaItemTypes = exports.CaptchaItemTypes || (exports.CaptchaItemTypes = {}));
29
+ var CaptchaStates;
30
+ (function (CaptchaStates) {
31
+ CaptchaStates["Solved"] = "solved";
32
+ CaptchaStates["Unsolved"] = "unsolved";
33
+ })(CaptchaStates = exports.CaptchaStates || (exports.CaptchaStates = {}));
34
+ var CaptchaStatus;
35
+ (function (CaptchaStatus) {
36
+ CaptchaStatus["Pending"] = "Pending";
37
+ CaptchaStatus["Approved"] = "Approved";
38
+ CaptchaStatus["Disapproved"] = "Disapproved";
39
+ })(CaptchaStatus = exports.CaptchaStatus || (exports.CaptchaStatus = {}));
40
+ exports.CaptchaSchema = zod_1.z.object({
41
+ captchaId: zod_1.z.union([zod_1.z.string(), zod_1.z.undefined()]),
42
+ captchaContentId: zod_1.z.union([zod_1.z.string(), zod_1.z.undefined()]),
43
+ salt: zod_1.z.string(),
44
+ solution: zod_1.z.number().array().optional(),
45
+ timeLimit: zod_1.z.number().optional()
46
+ });
47
+ exports.CaptchaItemSchema = zod_1.z.object({
48
+ hash: zod_1.z.string().optional(),
49
+ data: zod_1.z.string(),
50
+ type: zod_1.z.nativeEnum(CaptchaItemTypes)
51
+ });
52
+ exports.SelectAllCaptchaSchemaRaw = exports.CaptchaSchema.extend({
53
+ items: zod_1.z.array(exports.CaptchaItemSchema),
54
+ target: zod_1.z.string()
55
+ });
56
+ exports.SelectAllCaptchaSchema = exports.SelectAllCaptchaSchemaRaw.extend({
57
+ solution: zod_1.z.string().array().optional(),
58
+ });
59
+ exports.CaptchasSchema = zod_1.z.array(exports.SelectAllCaptchaSchemaRaw);
60
+ exports.CaptchaSolution = zod_1.z.object({
61
+ captchaId: zod_1.z.string(),
62
+ captchaContentId: zod_1.z.string(),
63
+ solution: zod_1.z.string().array(),
64
+ salt: zod_1.z.string(),
65
+ });
66
+ exports.CaptchaSolutionSchema = zod_1.z.array(exports.CaptchaSolution);
67
+ //# sourceMappingURL=captcha.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captcha.js","sourceRoot":"","sources":["../../../src/js/types/captcha.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,uEAAuE;AACvE,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,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,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC;CACvC,CAAC,CAAA;AAEW,QAAA,yBAAyB,GAAG,qBAAa,CAAC,MAAM,CAAC;IAC1D,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,yBAAiB,CAAC;IACjC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAA;AAEW,QAAA,sBAAsB,GAAG,iCAAyB,CAAC,MAAM,CAAC;IACnE,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAA;AAEW,QAAA,cAAc,GAAG,OAAC,CAAC,KAAK,CAAC,iCAAyB,CAAC,CAAA;AAEnD,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC5B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IAC5B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAA;AAEW,QAAA,qBAAqB,GAAG,OAAC,CAAC,KAAK,CAAC,uBAAe,CAAC,CAAA"}
@@ -0,0 +1,312 @@
1
+ import { HexString } from "@polkadot/util/types";
2
+ import { Captcha, CaptchaTypes, CaptchaWithoutId, CaptchaWithoutIdRaw } from "./captcha";
3
+ import { z } from "zod";
4
+ declare type DatasetBase = {
5
+ datasetId?: HexString | string | null;
6
+ datasetContentId?: HexString | string | null;
7
+ format: CaptchaTypes;
8
+ contentTree?: string[][];
9
+ solutionTree?: string[][];
10
+ };
11
+ export interface Dataset extends DatasetBase {
12
+ captchas: CaptchaWithoutId[] | Captcha[];
13
+ }
14
+ export interface DatasetRaw extends DatasetBase {
15
+ captchas: CaptchaWithoutIdRaw[];
16
+ }
17
+ export declare type DatasetWithIds = {
18
+ datasetId: HexString | string;
19
+ datasetContentId: HexString | string | null;
20
+ captchas: Captcha[];
21
+ format: CaptchaTypes;
22
+ contentTree?: string[][];
23
+ solutionTree?: string[][];
24
+ };
25
+ export interface DatasetWithIdsAndTree extends DatasetWithIds {
26
+ contentTree: string[][];
27
+ }
28
+ export declare const DatasetSchema: z.ZodObject<{
29
+ datasetId: z.ZodOptional<z.ZodString>;
30
+ datasetContentId: z.ZodOptional<z.ZodString>;
31
+ captchas: z.ZodArray<z.ZodObject<z.extendShape<{
32
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
33
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
34
+ salt: z.ZodString;
35
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
36
+ timeLimit: z.ZodOptional<z.ZodNumber>;
37
+ }, {
38
+ items: z.ZodArray<z.ZodObject<{
39
+ hash: z.ZodOptional<z.ZodString>;
40
+ data: z.ZodString;
41
+ type: z.ZodNativeEnum<typeof import("./captcha").CaptchaItemTypes>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ hash?: string | undefined;
44
+ data: string;
45
+ type: import("./captcha").CaptchaItemTypes;
46
+ }, {
47
+ hash?: string | undefined;
48
+ data: string;
49
+ type: import("./captcha").CaptchaItemTypes;
50
+ }>, "many">;
51
+ target: z.ZodString;
52
+ }>, "strip", z.ZodTypeAny, {
53
+ captchaId?: string | undefined;
54
+ captchaContentId?: string | undefined;
55
+ solution?: number[] | undefined;
56
+ timeLimit?: number | undefined;
57
+ salt: string;
58
+ items: {
59
+ hash?: string | undefined;
60
+ data: string;
61
+ type: import("./captcha").CaptchaItemTypes;
62
+ }[];
63
+ target: string;
64
+ }, {
65
+ captchaId?: string | undefined;
66
+ captchaContentId?: string | undefined;
67
+ solution?: number[] | undefined;
68
+ timeLimit?: number | undefined;
69
+ salt: string;
70
+ items: {
71
+ hash?: string | undefined;
72
+ data: string;
73
+ type: import("./captcha").CaptchaItemTypes;
74
+ }[];
75
+ target: string;
76
+ }>, "many">;
77
+ format: z.ZodNativeEnum<typeof CaptchaTypes>;
78
+ solutionTree: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
79
+ contentTree: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
80
+ timeLimit: z.ZodOptional<z.ZodNumber>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ timeLimit?: number | undefined;
83
+ datasetId?: string | undefined;
84
+ datasetContentId?: string | undefined;
85
+ solutionTree?: string[][] | undefined;
86
+ contentTree?: string[][] | undefined;
87
+ captchas: {
88
+ captchaId?: string | undefined;
89
+ captchaContentId?: string | undefined;
90
+ solution?: number[] | undefined;
91
+ timeLimit?: number | undefined;
92
+ salt: string;
93
+ items: {
94
+ hash?: string | undefined;
95
+ data: string;
96
+ type: import("./captcha").CaptchaItemTypes;
97
+ }[];
98
+ target: string;
99
+ }[];
100
+ format: CaptchaTypes.SelectAll;
101
+ }, {
102
+ timeLimit?: number | undefined;
103
+ datasetId?: string | undefined;
104
+ datasetContentId?: string | undefined;
105
+ solutionTree?: string[][] | undefined;
106
+ contentTree?: string[][] | undefined;
107
+ captchas: {
108
+ captchaId?: string | undefined;
109
+ captchaContentId?: string | undefined;
110
+ solution?: number[] | undefined;
111
+ timeLimit?: number | undefined;
112
+ salt: string;
113
+ items: {
114
+ hash?: string | undefined;
115
+ data: string;
116
+ type: import("./captcha").CaptchaItemTypes;
117
+ }[];
118
+ target: string;
119
+ }[];
120
+ format: CaptchaTypes.SelectAll;
121
+ }>;
122
+ export declare const DatasetWithIdsSchema: z.ZodObject<{
123
+ datasetId: z.ZodString;
124
+ datasetContentId: z.ZodOptional<z.ZodString>;
125
+ captchas: z.ZodArray<z.ZodObject<z.extendShape<z.extendShape<{
126
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
127
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
128
+ salt: z.ZodString;
129
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
130
+ timeLimit: z.ZodOptional<z.ZodNumber>;
131
+ }, {
132
+ items: z.ZodArray<z.ZodObject<{
133
+ hash: z.ZodOptional<z.ZodString>;
134
+ data: z.ZodString;
135
+ type: z.ZodNativeEnum<typeof import("./captcha").CaptchaItemTypes>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ hash?: string | undefined;
138
+ data: string;
139
+ type: import("./captcha").CaptchaItemTypes;
140
+ }, {
141
+ hash?: string | undefined;
142
+ data: string;
143
+ type: import("./captcha").CaptchaItemTypes;
144
+ }>, "many">;
145
+ target: z.ZodString;
146
+ }>, {
147
+ solution: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
148
+ }>, "strip", z.ZodTypeAny, {
149
+ captchaId?: string | undefined;
150
+ captchaContentId?: string | undefined;
151
+ solution?: string[] | undefined;
152
+ timeLimit?: number | undefined;
153
+ salt: string;
154
+ items: {
155
+ hash?: string | undefined;
156
+ data: string;
157
+ type: import("./captcha").CaptchaItemTypes;
158
+ }[];
159
+ target: string;
160
+ }, {
161
+ captchaId?: string | undefined;
162
+ captchaContentId?: string | undefined;
163
+ solution?: string[] | undefined;
164
+ timeLimit?: number | undefined;
165
+ salt: string;
166
+ items: {
167
+ hash?: string | undefined;
168
+ data: string;
169
+ type: import("./captcha").CaptchaItemTypes;
170
+ }[];
171
+ target: string;
172
+ }>, "many">;
173
+ format: z.ZodNativeEnum<typeof CaptchaTypes>;
174
+ solutionTree: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
175
+ contentTree: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ datasetContentId?: string | undefined;
178
+ solutionTree?: string[][] | undefined;
179
+ contentTree?: string[][] | undefined;
180
+ datasetId: string;
181
+ captchas: {
182
+ captchaId?: string | undefined;
183
+ captchaContentId?: string | undefined;
184
+ solution?: string[] | undefined;
185
+ timeLimit?: number | undefined;
186
+ salt: string;
187
+ items: {
188
+ hash?: string | undefined;
189
+ data: string;
190
+ type: import("./captcha").CaptchaItemTypes;
191
+ }[];
192
+ target: string;
193
+ }[];
194
+ format: CaptchaTypes.SelectAll;
195
+ }, {
196
+ datasetContentId?: string | undefined;
197
+ solutionTree?: string[][] | undefined;
198
+ contentTree?: string[][] | undefined;
199
+ datasetId: string;
200
+ captchas: {
201
+ captchaId?: string | undefined;
202
+ captchaContentId?: string | undefined;
203
+ solution?: string[] | undefined;
204
+ timeLimit?: number | undefined;
205
+ salt: string;
206
+ items: {
207
+ hash?: string | undefined;
208
+ data: string;
209
+ type: import("./captcha").CaptchaItemTypes;
210
+ }[];
211
+ target: string;
212
+ }[];
213
+ format: CaptchaTypes.SelectAll;
214
+ }>;
215
+ export declare const DatasetWithIdsAndTreeSchema: z.ZodObject<z.extendShape<{
216
+ datasetId: z.ZodString;
217
+ datasetContentId: z.ZodOptional<z.ZodString>;
218
+ captchas: z.ZodArray<z.ZodObject<z.extendShape<z.extendShape<{
219
+ captchaId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
220
+ captchaContentId: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
221
+ salt: z.ZodString;
222
+ solution: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
223
+ timeLimit: z.ZodOptional<z.ZodNumber>;
224
+ }, {
225
+ items: z.ZodArray<z.ZodObject<{
226
+ hash: z.ZodOptional<z.ZodString>;
227
+ data: z.ZodString;
228
+ type: z.ZodNativeEnum<typeof import("./captcha").CaptchaItemTypes>;
229
+ }, "strip", z.ZodTypeAny, {
230
+ hash?: string | undefined;
231
+ data: string;
232
+ type: import("./captcha").CaptchaItemTypes;
233
+ }, {
234
+ hash?: string | undefined;
235
+ data: string;
236
+ type: import("./captcha").CaptchaItemTypes;
237
+ }>, "many">;
238
+ target: z.ZodString;
239
+ }>, {
240
+ solution: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
241
+ }>, "strip", z.ZodTypeAny, {
242
+ captchaId?: string | undefined;
243
+ captchaContentId?: string | undefined;
244
+ solution?: string[] | undefined;
245
+ timeLimit?: number | undefined;
246
+ salt: string;
247
+ items: {
248
+ hash?: string | undefined;
249
+ data: string;
250
+ type: import("./captcha").CaptchaItemTypes;
251
+ }[];
252
+ target: string;
253
+ }, {
254
+ captchaId?: string | undefined;
255
+ captchaContentId?: string | undefined;
256
+ solution?: string[] | undefined;
257
+ timeLimit?: number | undefined;
258
+ salt: string;
259
+ items: {
260
+ hash?: string | undefined;
261
+ data: string;
262
+ type: import("./captcha").CaptchaItemTypes;
263
+ }[];
264
+ target: string;
265
+ }>, "many">;
266
+ format: z.ZodNativeEnum<typeof CaptchaTypes>;
267
+ solutionTree: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
268
+ contentTree: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
269
+ }, {
270
+ solutionTree: z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">;
271
+ contentTree: z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">;
272
+ }>, "strip", z.ZodTypeAny, {
273
+ datasetContentId?: string | undefined;
274
+ datasetId: string;
275
+ captchas: {
276
+ captchaId?: string | undefined;
277
+ captchaContentId?: string | undefined;
278
+ solution?: string[] | undefined;
279
+ timeLimit?: number | undefined;
280
+ salt: string;
281
+ items: {
282
+ hash?: string | undefined;
283
+ data: string;
284
+ type: import("./captcha").CaptchaItemTypes;
285
+ }[];
286
+ target: string;
287
+ }[];
288
+ format: CaptchaTypes.SelectAll;
289
+ solutionTree: string[][];
290
+ contentTree: string[][];
291
+ }, {
292
+ datasetContentId?: string | undefined;
293
+ datasetId: string;
294
+ captchas: {
295
+ captchaId?: string | undefined;
296
+ captchaContentId?: string | undefined;
297
+ solution?: string[] | undefined;
298
+ timeLimit?: number | undefined;
299
+ salt: string;
300
+ items: {
301
+ hash?: string | undefined;
302
+ data: string;
303
+ type: import("./captcha").CaptchaItemTypes;
304
+ }[];
305
+ target: string;
306
+ }[];
307
+ format: CaptchaTypes.SelectAll;
308
+ solutionTree: string[][];
309
+ contentTree: string[][];
310
+ }>;
311
+ export {};
312
+ //# sourceMappingURL=dataset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset.d.ts","sourceRoot":"","sources":["../../../src/js/types/dataset.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACH,OAAO,EAEP,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EAEtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,aAAK,WAAW,GAAG;IACf,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7C,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,OAAQ,SAAQ,WAAW;IACxC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,OAAO,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC3C,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACnC;AAED,oBAAY,cAAc,GAAG;IACzB,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B,gBAAgB,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EA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