@snapshot-labs/snapshot.js 0.3.62 → 0.3.65
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 +12 -0
- package/dist/schemas/index.d.ts +12 -0
- package/dist/snapshot.cjs.js +27 -1
- package/dist/snapshot.esm.js +27 -1
- package/dist/snapshot.min.js +2 -2
- package/package.json +1 -1
- package/src/schemas/proposal.json +2 -9
- package/src/schemas/space.json +12 -0
- package/src/utils.ts +17 -0
package/dist/index.d.ts
CHANGED
|
@@ -215,6 +215,18 @@ declare const _default: {
|
|
|
215
215
|
enum: string[];
|
|
216
216
|
};
|
|
217
217
|
};
|
|
218
|
+
parent: {
|
|
219
|
+
type: string;
|
|
220
|
+
title: string;
|
|
221
|
+
};
|
|
222
|
+
children: {
|
|
223
|
+
type: string;
|
|
224
|
+
maxItems: number;
|
|
225
|
+
title: string;
|
|
226
|
+
items: {
|
|
227
|
+
type: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
218
230
|
};
|
|
219
231
|
required: string[];
|
|
220
232
|
additionalProperties: boolean;
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -210,6 +210,18 @@ declare const _default: {
|
|
|
210
210
|
enum: string[];
|
|
211
211
|
};
|
|
212
212
|
};
|
|
213
|
+
parent: {
|
|
214
|
+
type: string;
|
|
215
|
+
title: string;
|
|
216
|
+
};
|
|
217
|
+
children: {
|
|
218
|
+
type: string;
|
|
219
|
+
maxItems: number;
|
|
220
|
+
title: string;
|
|
221
|
+
items: {
|
|
222
|
+
type: string;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
213
225
|
};
|
|
214
226
|
required: string[];
|
|
215
227
|
additionalProperties: boolean;
|
package/dist/snapshot.cjs.js
CHANGED
|
@@ -816,6 +816,18 @@ var definitions = {
|
|
|
816
816
|
"collector"
|
|
817
817
|
]
|
|
818
818
|
}
|
|
819
|
+
},
|
|
820
|
+
parent: {
|
|
821
|
+
type: "string",
|
|
822
|
+
title: "parent"
|
|
823
|
+
},
|
|
824
|
+
children: {
|
|
825
|
+
type: "array",
|
|
826
|
+
maxItems: 8,
|
|
827
|
+
title: "children",
|
|
828
|
+
items: {
|
|
829
|
+
type: "string"
|
|
830
|
+
}
|
|
819
831
|
}
|
|
820
832
|
},
|
|
821
833
|
required: [
|
|
@@ -854,7 +866,7 @@ var definitions$1 = {
|
|
|
854
866
|
},
|
|
855
867
|
discussion: {
|
|
856
868
|
type: "string",
|
|
857
|
-
format: "
|
|
869
|
+
format: "customUrl",
|
|
858
870
|
title: "discussion",
|
|
859
871
|
maxLength: 256
|
|
860
872
|
},
|
|
@@ -2868,6 +2880,20 @@ function validateSchema(schema, data) {
|
|
|
2868
2880
|
var ajv = new Ajv__default['default']({ allErrors: true, allowUnionTypes: true, $data: true });
|
|
2869
2881
|
// @ts-ignore
|
|
2870
2882
|
addFormats__default['default'](ajv);
|
|
2883
|
+
// Custom URL format to allow empty string values
|
|
2884
|
+
// https://github.com/snapshot-labs/snapshot.js/pull/541/files
|
|
2885
|
+
ajv.addFormat('customUrl', {
|
|
2886
|
+
type: 'string',
|
|
2887
|
+
validate: function (str) {
|
|
2888
|
+
if (!str.length)
|
|
2889
|
+
return true;
|
|
2890
|
+
return (str.startsWith('http://') ||
|
|
2891
|
+
str.startsWith('https://') ||
|
|
2892
|
+
str.startsWith('ipfs://') ||
|
|
2893
|
+
str.startsWith('ipns://') ||
|
|
2894
|
+
str.startsWith('snapshot://'));
|
|
2895
|
+
}
|
|
2896
|
+
});
|
|
2871
2897
|
var validate = ajv.compile(schema);
|
|
2872
2898
|
var valid = validate(data);
|
|
2873
2899
|
return valid ? valid : validate.errors;
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -807,6 +807,18 @@ var definitions = {
|
|
|
807
807
|
"collector"
|
|
808
808
|
]
|
|
809
809
|
}
|
|
810
|
+
},
|
|
811
|
+
parent: {
|
|
812
|
+
type: "string",
|
|
813
|
+
title: "parent"
|
|
814
|
+
},
|
|
815
|
+
children: {
|
|
816
|
+
type: "array",
|
|
817
|
+
maxItems: 8,
|
|
818
|
+
title: "children",
|
|
819
|
+
items: {
|
|
820
|
+
type: "string"
|
|
821
|
+
}
|
|
810
822
|
}
|
|
811
823
|
},
|
|
812
824
|
required: [
|
|
@@ -845,7 +857,7 @@ var definitions$1 = {
|
|
|
845
857
|
},
|
|
846
858
|
discussion: {
|
|
847
859
|
type: "string",
|
|
848
|
-
format: "
|
|
860
|
+
format: "customUrl",
|
|
849
861
|
title: "discussion",
|
|
850
862
|
maxLength: 256
|
|
851
863
|
},
|
|
@@ -2859,6 +2871,20 @@ function validateSchema(schema, data) {
|
|
|
2859
2871
|
var ajv = new Ajv({ allErrors: true, allowUnionTypes: true, $data: true });
|
|
2860
2872
|
// @ts-ignore
|
|
2861
2873
|
addFormats(ajv);
|
|
2874
|
+
// Custom URL format to allow empty string values
|
|
2875
|
+
// https://github.com/snapshot-labs/snapshot.js/pull/541/files
|
|
2876
|
+
ajv.addFormat('customUrl', {
|
|
2877
|
+
type: 'string',
|
|
2878
|
+
validate: function (str) {
|
|
2879
|
+
if (!str.length)
|
|
2880
|
+
return true;
|
|
2881
|
+
return (str.startsWith('http://') ||
|
|
2882
|
+
str.startsWith('https://') ||
|
|
2883
|
+
str.startsWith('ipfs://') ||
|
|
2884
|
+
str.startsWith('ipns://') ||
|
|
2885
|
+
str.startsWith('snapshot://'));
|
|
2886
|
+
}
|
|
2887
|
+
});
|
|
2862
2888
|
var validate = ajv.compile(schema);
|
|
2863
2889
|
var valid = validate(data);
|
|
2864
2890
|
return valid ? valid : validate.errors;
|