@cowprotocol/app-data
Advanced tools
Comparing version 0.0.1-RC.0 to 0.0.1-RC.1
@@ -1,4 +0,11 @@ | ||
export * as v0_1_0 from './v0.1.0'; | ||
export * as v0_2_0 from './v0.2.0'; | ||
export * as v0_3_0 from './v0.3.0'; | ||
export * as v0_4_0 from './v0.4.0'; | ||
import * as v0_1_0 from './v0.1.0'; | ||
import * as v0_2_0 from './v0.2.0'; | ||
import * as v0_3_0 from './v0.3.0'; | ||
import * as v0_4_0 from './v0.4.0'; | ||
export * as latest from './v0.4.0'; | ||
export declare const LATEST_APP_DATA_VERSION = "0.4.0"; | ||
export declare const LATEST_QUOTE_METADATA_VERSION = "0.2.0"; | ||
export declare const LATEST_REFERRER_METADATA_VERSION = "0.1.0"; | ||
export declare type LatestAppDataDocVersion = v0_4_0.AppDataRootSchema; | ||
export declare type AnyAppDataDocVersion = v0_4_0.AppDataRootSchema | v0_3_0.AppDataRootSchema | v0_2_0.AppDataRootSchema | v0_1_0.AppDataRootSchema; | ||
export { v0_4_0, v0_3_0, v0_2_0, v0_1_0 }; |
export * from './generatedTypes'; | ||
export * from './utils'; |
@@ -1,2 +0,2 @@ | ||
var _={__proto__:null},o={__proto__:null},l={__proto__:null},r={__proto__:null};export{_ as v0_1_0,o as v0_2_0,l as v0_3_0,r as v0_4_0}; | ||
var n={__proto__:null},r={__proto__:null},t={__proto__:null},o={__proto__:null};const e="0.4.0",_="0.2.0",u="0.1.0";function i(){return i=Object.assign?Object.assign.bind():function(n){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},i.apply(this,arguments)}function l(n){return i({},n,{version:"0.2.0"})}function s(n){return i({},n,{version:"0.1.0"})}function a(n){return i({},n,{version:"0.4.0"})}export{e as LATEST_APP_DATA_VERSION,_ as LATEST_QUOTE_METADATA_VERSION,u as LATEST_REFERRER_METADATA_VERSION,a as createAppDataDoc,l as createQuoteMetadata,s as createReferrerMetadata,o as latest,n as v0_1_0,r as v0_2_0,t as v0_3_0,o as v0_4_0}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
var _={__proto__:null},o={__proto__:null},l={__proto__:null},r={__proto__:null};export{_ as v0_1_0,o as v0_2_0,l as v0_3_0,r as v0_4_0}; | ||
var n={__proto__:null},r={__proto__:null},t={__proto__:null},o={__proto__:null},e="0.4.0",_="0.2.0",u="0.1.0";function i(){return i=Object.assign?Object.assign.bind():function(n){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},i.apply(this,arguments)}function l(n){return i({},n,{version:"0.2.0"})}function a(n){return i({},n,{version:"0.1.0"})}function s(n){return i({},n,{version:"0.4.0"})}export{e as LATEST_APP_DATA_VERSION,_ as LATEST_QUOTE_METADATA_VERSION,u as LATEST_REFERRER_METADATA_VERSION,s as createAppDataDoc,l as createQuoteMetadata,a as createReferrerMetadata,o as latest,n as v0_1_0,r as v0_2_0,t as v0_3_0,o as v0_4_0}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(_,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((_||self).appData={})}(this,function(_){_.v0_1_0={__proto__:null},_.v0_2_0={__proto__:null},_.v0_3_0={__proto__:null},_.v0_4_0={__proto__:null}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).appData={})}(this,function(e){var t={__proto__:null},n="0.4.0",o="0.2.0",r="0.1.0";function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_.apply(this,arguments)}e.LATEST_APP_DATA_VERSION=n,e.LATEST_QUOTE_METADATA_VERSION=o,e.LATEST_REFERRER_METADATA_VERSION=r,e.createAppDataDoc=function(e){return _({},e,{version:n})},e.createQuoteMetadata=function(e){return _({},e,{version:o})},e.createReferrerMetadata=function(e){return _({},e,{version:r})},e.latest=t,e.v0_1_0={__proto__:null},e.v0_2_0={__proto__:null},e.v0_3_0={__proto__:null},e.v0_4_0=t}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@cowprotocol/app-data", | ||
"version": "0.0.1-RC.0", | ||
"version": "0.0.1-RC.1", | ||
"description": "CowProtocol AppData schema definitions", | ||
@@ -35,5 +35,7 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/semver-sort": "^0.0.1", | ||
"json-schema-ref-parser": "^9.0.9", | ||
"json-schema-to-typescript": "^10.1.5", | ||
"microbundle": "^0.15.0", | ||
"semver-sort": "^1.0.0", | ||
"ts-node": "^10.8.2", | ||
@@ -40,0 +42,0 @@ "typescript": "^4.7.4" |
@@ -11,2 +11,4 @@ # @cowprotocol/app-data | ||
### Schemas | ||
Schemas are exposed as json files, where the version is the file name: | ||
@@ -21,9 +23,12 @@ | ||
### Type definitions | ||
There are also type definitions | ||
```js | ||
import { v0_4_0 } from '@cowprotocol/app-data' | ||
import {v0_4_0} from '@cowprotocol/app-data' | ||
// Note: this example is | ||
function createAppDataV0_4_0( | ||
appCode: v0_4_0.AppCode, | ||
appCode: v0_4_0.AppCode, | ||
metadata: v0_4_0.Metadata | ||
@@ -39,6 +44,32 @@ ): v0_4_0.AppDataRootSchema { | ||
### Constants | ||
The latest version names are exposed as constants | ||
```js | ||
import { | ||
LATEST_APP_DATA_VERSION, | ||
LATEST_QUOTE_METADATA_VERSION, | ||
LATEST_REFERRER_METADATA_VERSION | ||
} from '@cowprotocol/app-data' | ||
``` | ||
### Utils | ||
There are util functions to handle the creation of valid schema docs for the latest version | ||
```js | ||
import { | ||
createAppDataDoc, createReferrerMetadata, createQuoteMetadata | ||
} from '@cowprotocol/app-data' | ||
const referrer = createReferrerMetadata({address: '0x...'}) | ||
const quote = createQuoteMetadata({slippageBips: '100'}) | ||
const appDataDoc = createAppDataDoc({appCode: 'myApp', metadata: {referrer, quote}}) | ||
``` | ||
## TODO: | ||
- [ ] Add tests for: | ||
- [ ] Consuming only the schema | ||
- [ ] Importing the type definitions | ||
- [ ] Consuming only the schema | ||
- [ ] Importing the type definitions |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29679
22
224
73
7